summaryrefslogtreecommitdiff
Unidiff
Diffstat (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
@@ -212,25 +212,25 @@ struct default_button {
212 char *pix; 212 char *pix;
213 char *fpressedservice; 213 char *fpressedservice;
214 char *fpressedaction; 214 char *fpressedaction;
215 char *fheldservice; 215 char *fheldservice;
216 char *fheldaction; 216 char *fheldaction;
217}; 217};
218 218
219/** 219/**
220 * A singleton which gives informations about device specefic option 220 * A singleton which gives informations about device specefic option
221 * like the Hardware used, LEDs, the Base Distribution and 221 * like the Hardware used, LEDs, the Base Distribution and
222 * hardware key mappings. 222 * hardware key mappings.
223 * 223 *
224 * @short A small class for device specefic options 224 * @short A small class for device specific options
225 * @see QObject 225 * @see QObject
226 * @author Robert Griebl 226 * @author Robert Griebl
227 * @version 1.0 227 * @version 1.0
228 */ 228 */
229class ODevice : public QObject 229class ODevice : public QObject
230{ 230{
231 Q_OBJECT 231 Q_OBJECT
232 232
233private: 233private:
234 /* disable copy */ 234 /* disable copy */
235 ODevice ( const ODevice & ); 235 ODevice ( const ODevice & );
236 236
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
@@ -148,24 +148,25 @@ struct z_button z_buttons_6000 [] = {
148}; 148};
149 149
150// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 150// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
151// class up into individual classes. We would need three classes 151// class up into individual classes. We would need three classes
152// 152//
153// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 153// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
155// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) 155// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
157 157
158void Zaurus::init(const QString& cpu_info) 158void Zaurus::init(const QString& cpu_info)
159{ 159{
160 qDebug( "Zaurus::init()" );
160 // Set the time to wait until the system is really suspended 161 // Set the time to wait until the system is really suspended
161 // the delta between apm --suspend and sleeping 162 // the delta between apm --suspend and sleeping
162 setAPMTimeOut( 15000 ); 163 setAPMTimeOut( 15000 );
163 164
164 // generic distribution code already scanned /etc/issue at that point - 165 // generic distribution code already scanned /etc/issue at that point -
165 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 166 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
166 if ( d->m_sysverstr.contains( "embedix", false ) ) 167 if ( d->m_sysverstr.contains( "embedix", false ) )
167 { 168 {
168 d->m_vendorstr = "Sharp"; 169 d->m_vendorstr = "Sharp";
169 d->m_vendor = Vendor_Sharp; 170 d->m_vendor = Vendor_Sharp;
170 d->m_systemstr = "Zaurus"; 171 d->m_systemstr = "Zaurus";
171 d->m_system = System_Zaurus; 172 d->m_system = System_Zaurus;
@@ -250,24 +251,25 @@ void Zaurus::init(const QString& cpu_info)
250 251
251 // set initial rotation 252 // set initial rotation
252 switch( d->m_model ) 253 switch( d->m_model )
253 { 254 {
254 case Model_Zaurus_SL6000: // fallthrough 255 case Model_Zaurus_SL6000: // fallthrough
255 case Model_Zaurus_SLA300: 256 case Model_Zaurus_SLA300:
256 d->m_rotation = Rot0; 257 d->m_rotation = Rot0;
257 break; 258 break;
258 case Model_Zaurus_SLC3100: // fallthrough 259 case Model_Zaurus_SLC3100: // fallthrough
259 case Model_Zaurus_SLC3000: // fallthrough 260 case Model_Zaurus_SLC3000: // fallthrough
260 case Model_Zaurus_SLC1000: // fallthrough 261 case Model_Zaurus_SLC1000: // fallthrough
261 case Model_Zaurus_SLC7x0: 262 case Model_Zaurus_SLC7x0:
263 initHingeSensor();
262 d->m_rotation = rotation(); 264 d->m_rotation = rotation();
263 d->m_direction = direction(); 265 d->m_direction = direction();
264 break; 266 break;
265 case Model_Zaurus_SLB600: // fallthrough 267 case Model_Zaurus_SLB600: // fallthrough
266 case Model_Zaurus_SL5000: // fallthrough 268 case Model_Zaurus_SL5000: // fallthrough
267 case Model_Zaurus_SL5500: // fallthrough 269 case Model_Zaurus_SL5500: // fallthrough
268 default: 270 default:
269 d->m_rotation = Rot270; 271 d->m_rotation = Rot270;
270 } 272 }
271 273
272 // set default qte driver 274 // set default qte driver
273 switch( d->m_model ) 275 switch( d->m_model )
@@ -280,45 +282,45 @@ void Zaurus::init(const QString& cpu_info)
280 } 282 }
281 283
282 m_leds[0] = Led_Off; 284 m_leds[0] = Led_Off;
283 285
284 if ( m_embedix ) 286 if ( m_embedix )
285 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); 287 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
286 else 288 else
287 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 289 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
288} 290}
289 291
290void Zaurus::initButtons() 292void Zaurus::initButtons()
291{ 293{
294 qDebug( "Zaurus::initButtons()" );
292 if ( d->m_buttons ) 295 if ( d->m_buttons )
293 return; 296 return;
294 297
295 d->m_buttons = new QValueList <ODeviceButton>; 298 d->m_buttons = new QValueList <ODeviceButton>;
296 299
297 struct z_button * pz_buttons; 300 struct z_button * pz_buttons;
298 int buttoncount; 301 int buttoncount;
299 switch ( d->m_model ) 302 switch ( d->m_model )
300 { 303 {
301 case Model_Zaurus_SL6000: 304 case Model_Zaurus_SL6000:
302 pz_buttons = z_buttons_6000; 305 pz_buttons = z_buttons_6000;
303 buttoncount = ARRAY_SIZE(z_buttons_6000); 306 buttoncount = ARRAY_SIZE(z_buttons_6000);
304 break; 307 break;
305 case Model_Zaurus_SLC3100: // fallthrough 308 case Model_Zaurus_SLC3100: // fallthrough
306 case Model_Zaurus_SLC3000: // fallthrough 309 case Model_Zaurus_SLC3000: // fallthrough
307 case Model_Zaurus_SLC1000: // fallthrough 310 case Model_Zaurus_SLC1000: // fallthrough
308 case Model_Zaurus_SLC7x0: 311 case Model_Zaurus_SLC7x0:
309 if ( isQWS( ) ) 312 if ( isQWS( ) )
310 { // setup hinge sensor stuff 313 {
311 addPreHandler(this); 314 addPreHandler(this);
312 initHingeSensor();
313 } 315 }
314 pz_buttons = z_buttons_c700; 316 pz_buttons = z_buttons_c700;
315 buttoncount = ARRAY_SIZE(z_buttons_c700); 317 buttoncount = ARRAY_SIZE(z_buttons_c700);
316 break; 318 break;
317 default: 319 default:
318 pz_buttons = z_buttons; 320 pz_buttons = z_buttons;
319 buttoncount = ARRAY_SIZE(z_buttons); 321 buttoncount = ARRAY_SIZE(z_buttons);
320 break; 322 break;
321 } 323 }
322 324
323 for ( int i = 0; i < buttoncount; i++ ) { 325 for ( int i = 0; i < buttoncount; i++ ) {
324 struct z_button *zb = pz_buttons + i; 326 struct z_button *zb = pz_buttons + i;
@@ -592,24 +594,25 @@ Transformation Zaurus::rotation() const
592 } 594 }
593 break; 595 break;
594 case Model_Zaurus_SL6000: 596 case Model_Zaurus_SL6000:
595 case Model_Zaurus_SLB600: 597 case Model_Zaurus_SLB600:
596 case Model_Zaurus_SLA300: 598 case Model_Zaurus_SLA300:
597 case Model_Zaurus_SL5500: 599 case Model_Zaurus_SL5500:
598 case Model_Zaurus_SL5000: 600 case Model_Zaurus_SL5000:
599 default: 601 default:
600 rot = d->m_rotation; 602 rot = d->m_rotation;
601 break; 603 break;
602 } 604 }
603 605
606 qDebug( "Zaurus::rotation() - returning '%d'", rot );
604 return rot; 607 return rot;
605} 608}
606ODirection Zaurus::direction() const 609ODirection Zaurus::direction() const
607{ 610{
608 ODirection dir; 611 ODirection dir;
609 612
610 switch ( d->m_model ) { 613 switch ( d->m_model ) {
611 case Model_Zaurus_SLC3100: // fallthrough 614 case Model_Zaurus_SLC3100: // fallthrough
612 case Model_Zaurus_SLC3000: // fallthrough 615 case Model_Zaurus_SLC3000: // fallthrough
613 case Model_Zaurus_SLC1000: // fallthrough 616 case Model_Zaurus_SLC1000: // fallthrough
614 case Model_Zaurus_SLC7x0: { 617 case Model_Zaurus_SLC7x0: {
615 OHingeStatus hs = readHingeSensor(); 618 OHingeStatus hs = readHingeSensor();
@@ -696,48 +699,57 @@ OHingeStatus Zaurus::readHingeSensor() const
696 return switch1 ? CASE_PORTRAIT : CASE_LANDSCAPE; 699 return switch1 ? CASE_PORTRAIT : CASE_LANDSCAPE;
697 } 700 }
698 } 701 }
699} 702}
700 703
701void Zaurus::initHingeSensor() 704void Zaurus::initHingeSensor()
702{ 705{
703 if ( m_embedix ) return; 706 if ( m_embedix ) return;
704 707
705 m_hinge.setName( "/dev/input/event0" ); 708 m_hinge.setName( "/dev/input/event0" );
706 if ( !m_hinge.open( IO_ReadOnly ) ) 709 if ( !m_hinge.open( IO_ReadOnly ) )
707 { 710 {
708 qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); 711 qWarning( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) );
709 return; 712 return;
710 } 713 }
711 714
712 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); 715 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this );
713 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); 716 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) );
717
718 qDebug( "Zaurus::init() - Hinge Sensor Initialization successfully completed" );
714} 719}
715 720
716void Zaurus::hingeSensorTriggered() 721void Zaurus::hingeSensorTriggered()
717{ 722{
718 qDebug( "Zaurus::hingeSensorTriggered() - got event" ); 723 qDebug( "Zaurus::hingeSensorTriggered() - got event" );
719 struct input_event e; 724 struct input_event e;
720 if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 ) 725 if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 )
721 { 726 {
722 qDebug( "Zaurus::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value ); 727 qDebug( "Zaurus::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value );
723 if ( e.type != EV_SW ) return; 728 if ( e.type != EV_SW ) return;
724 if ( readHingeSensor() != CASE_UNKNOWN ) 729 if ( readHingeSensor() != CASE_UNKNOWN )
725 { 730 {
726 qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); 731 qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" );
727 QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); 732 QCopChannel::send( "QPE/Rotation", "rotateDefault()" );
728 } 733 }
729 } 734 }
730} 735}
731 736
737void Zaurus::systemMessage( const QCString &msg, const QByteArray & )
738{
739 if ( msg == "deviceButtonMappingChanged()" ) {
740 reloadButtonMapping();
741 }
742}
743
732/* 744/*
733 * Take code from iPAQ device. 745 * Take code from iPAQ device.
734 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. 746 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
735 * I hope that is ok - Alwin 747 * I hope that is ok - Alwin
736 */ 748 */
737bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 749bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
738{ 750{
739 int newkeycode = keycode; 751 int newkeycode = keycode;
740 752
741 if ( !hasHingeSensor() ) return false; 753 if ( !hasHingeSensor() ) return false;
742 754
743 /* map cursor keys depending on the hinge status */ 755 /* map cursor keys depending on the hinge status */
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
@@ -88,31 +88,34 @@
88#define SHARP_FL_IOCTL_GET_STEP 102 88#define SHARP_FL_IOCTL_GET_STEP 102
89 89
90// Vesa Standard 90// Vesa Standard
91#define FB_BLANK_UNBLANK 0 91#define FB_BLANK_UNBLANK 0
92#define FB_BLANK_POWERDOWN 4 92#define FB_BLANK_POWERDOWN 4
93 93
94namespace Opie { 94namespace Opie {
95namespace Core { 95namespace Core {
96namespace Internal { 96namespace Internal {
97 97
98class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter 98class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
99{ 99{
100 Q_OBJECT
101
100 protected: 102 protected:
101 virtual void init(const QString&); 103 virtual void init(const QString&);
102 virtual void initButtons(); 104 virtual void initButtons();
103 void initHingeSensor(); 105 void initHingeSensor();
104 106
105 protected slots: 107 protected slots:
106 void hingeSensorTriggered(); 108 void hingeSensorTriggered();
109 void systemMessage( const QCString &msg, const QByteArray & );
107 110
108 public: 111 public:
109 virtual bool setDisplayBrightness( int b ); 112 virtual bool setDisplayBrightness( int b );
110 virtual bool setDisplayStatus( bool on ); 113 virtual bool setDisplayStatus( bool on );
111 virtual int displayBrightnessResolution() const; 114 virtual int displayBrightnessResolution() const;
112 115
113 virtual void playAlarmSound(); 116 virtual void playAlarmSound();
114 virtual void playKeySound(); 117 virtual void playKeySound();
115 virtual void playTouchSound(); 118 virtual void playTouchSound();
116 119
117 virtual QValueList <OLed> ledList() const; 120 virtual QValueList <OLed> ledList() const;
118 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 121 virtual QValueList <OLedState> ledStateList ( OLed led ) const;