summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp18
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h3
3 files changed, 19 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 0eed1c9..492c97b 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -208,33 +208,33 @@ enum OHingeStatus {
*/
struct default_button {
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
/**
* A singleton which gives informations about device specefic option
* like the Hardware used, LEDs, the Base Distribution and
* hardware key mappings.
*
- * @short A small class for device specefic options
+ * @short A small class for device specific options
* @see QObject
* @author Robert Griebl
* @version 1.0
*/
class ODevice : public QObject
{
Q_OBJECT
private:
/* disable copy */
ODevice ( const ODevice & );
protected:
ODevice();
virtual void init(const QString&);
virtual void initButtons();
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index a75f566..8a7e252 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -144,32 +144,33 @@ struct z_button z_buttons_6000 [] = {
{ Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
"devicebuttons/z_hinge3",
"QPE/VMemo", "toggleRecord()",
"sound", "raise()" },
};
// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
// class up into individual classes. We would need three classes
//
// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
void Zaurus::init(const QString& cpu_info)
{
+ qDebug( "Zaurus::init()" );
// Set the time to wait until the system is really suspended
// the delta between apm --suspend and sleeping
setAPMTimeOut( 15000 );
// generic distribution code already scanned /etc/issue at that point -
// embedix releases contain "Embedix <version> | Linux for Embedded Devices"
if ( d->m_sysverstr.contains( "embedix", false ) )
{
d->m_vendorstr = "Sharp";
d->m_vendor = Vendor_Sharp;
d->m_systemstr = "Zaurus";
d->m_system = System_Zaurus;
m_embedix = true;
}
else
{
@@ -246,83 +247,84 @@ void Zaurus::init(const QString& cpu_info)
break;
default:
m_backlightdev = "/sys/class/backlight/corgi-bl/";
}
// set initial rotation
switch( d->m_model )
{
case Model_Zaurus_SL6000: // fallthrough
case Model_Zaurus_SLA300:
d->m_rotation = Rot0;
break;
case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000: // fallthrough
case Model_Zaurus_SLC7x0:
+ initHingeSensor();
d->m_rotation = rotation();
d->m_direction = direction();
break;
case Model_Zaurus_SLB600: // fallthrough
case Model_Zaurus_SL5000: // fallthrough
case Model_Zaurus_SL5500: // fallthrough
default:
d->m_rotation = Rot270;
}
// set default qte driver
switch( d->m_model )
{
case Model_Zaurus_SLC7x0:
d->m_qteDriver = "W100";
break;
default:
d->m_qteDriver = "Transformed";
}
m_leds[0] = Led_Off;
if ( m_embedix )
qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
else
qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
}
void Zaurus::initButtons()
{
+ qDebug( "Zaurus::initButtons()" );
if ( d->m_buttons )
return;
d->m_buttons = new QValueList <ODeviceButton>;
struct z_button * pz_buttons;
int buttoncount;
switch ( d->m_model )
{
case Model_Zaurus_SL6000:
pz_buttons = z_buttons_6000;
buttoncount = ARRAY_SIZE(z_buttons_6000);
break;
case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000: // fallthrough
case Model_Zaurus_SLC7x0:
if ( isQWS( ) )
- { // setup hinge sensor stuff
+ {
addPreHandler(this);
- initHingeSensor();
}
pz_buttons = z_buttons_c700;
buttoncount = ARRAY_SIZE(z_buttons_c700);
break;
default:
pz_buttons = z_buttons;
buttoncount = ARRAY_SIZE(z_buttons);
break;
}
for ( int i = 0; i < buttoncount; i++ ) {
struct z_button *zb = pz_buttons + i;
ODeviceButton b;
b.setKeycode( zb->code );
b.setUserText( QObject::tr( "Button", zb->utext ));
@@ -588,32 +590,33 @@ Transformation Zaurus::rotation() const
if ( hs == CASE_PORTRAIT ) rot = Rot90;
else if ( hs == CASE_UNKNOWN ) rot = Rot0;
else rot = Rot0;
}
}
break;
case Model_Zaurus_SL6000:
case Model_Zaurus_SLB600:
case Model_Zaurus_SLA300:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
rot = d->m_rotation;
break;
}
+ qDebug( "Zaurus::rotation() - returning '%d'", rot );
return rot;
}
ODirection Zaurus::direction() const
{
ODirection dir;
switch ( d->m_model ) {
case Model_Zaurus_SLC3100: // fallthrough
case Model_Zaurus_SLC3000: // fallthrough
case Model_Zaurus_SLC1000: // fallthrough
case Model_Zaurus_SLC7x0: {
OHingeStatus hs = readHingeSensor();
if ( hs == CASE_PORTRAIT ) dir = CCW;
else if ( hs == CASE_UNKNOWN ) dir = CCW;
else dir = CW;
}
@@ -692,56 +695,65 @@ OHingeStatus Zaurus::readHingeSensor() const
return switch1 ? CASE_CLOSED : CASE_UNKNOWN;
}
else
{
return switch1 ? CASE_PORTRAIT : CASE_LANDSCAPE;
}
}
}
void Zaurus::initHingeSensor()
{
if ( m_embedix ) return;
m_hinge.setName( "/dev/input/event0" );
if ( !m_hinge.open( IO_ReadOnly ) )
{
- qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) );
+ qWarning( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) );
return;
}
QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this );
QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) );
+
+ qDebug( "Zaurus::init() - Hinge Sensor Initialization successfully completed" );
}
void Zaurus::hingeSensorTriggered()
{
qDebug( "Zaurus::hingeSensorTriggered() - got event" );
struct input_event e;
if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 )
{
qDebug( "Zaurus::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value );
if ( e.type != EV_SW ) return;
if ( readHingeSensor() != CASE_UNKNOWN )
{
qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" );
QCopChannel::send( "QPE/Rotation", "rotateDefault()" );
}
}
}
+void Zaurus::systemMessage( const QCString &msg, const QByteArray & )
+{
+ if ( msg == "deviceButtonMappingChanged()" ) {
+ reloadButtonMapping();
+ }
+}
+
/*
* Take code from iPAQ device.
* That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
* I hope that is ok - Alwin
*/
bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
{
int newkeycode = keycode;
if ( !hasHingeSensor() ) return false;
/* map cursor keys depending on the hinge status */
switch ( keycode ) {
// Rotate cursor keys
case Key_Left :
case Key_Right:
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index bf30bc6..8a66f9c 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -84,39 +84,42 @@
#define SHARP_FL_IOCTL_ON 1
#define SHARP_FL_IOCTL_OFF 2
#define SHARP_FL_IOCTL_STEP_CONTRAST 100
#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
#define SHARP_FL_IOCTL_GET_STEP 102
// Vesa Standard
#define FB_BLANK_UNBLANK 0
#define FB_BLANK_POWERDOWN 4
namespace Opie {
namespace Core {
namespace Internal {
class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
{
+ Q_OBJECT
+
protected:
virtual void init(const QString&);
virtual void initButtons();
void initHingeSensor();
protected slots:
void hingeSensorTriggered();
+ void systemMessage( const QCString &msg, const QByteArray & );
public:
virtual bool setDisplayBrightness( int b );
virtual bool setDisplayStatus( bool on );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual void playKeySound();
virtual void playTouchSound();
virtual QValueList <OLed> ledList() const;
virtual QValueList <OLedState> ledStateList ( OLed led ) const;
virtual OLedState ledState( OLed led ) const;
virtual bool setLedState( OLed led, OLedState st );
virtual bool hasHingeSensor() const;