summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
authorsandman <sandman>2002-12-22 23:54:50 (UTC)
committer sandman <sandman>2002-12-22 23:54:50 (UTC)
commit5c7694a7baadec8afe128ad2541e0a8acfc23737 (patch) (unidiff)
treec3dc0189dd9933e43565d85183474adfdc0de7aa /libopie/odevice.cpp
parent3ef4b1549eca77c3d1c3ef710eb6abbd3de336be (diff)
downloadopie-5c7694a7baadec8afe128ad2541e0a8acfc23737.zip
opie-5c7694a7baadec8afe128ad2541e0a8acfc23737.tar.gz
opie-5c7694a7baadec8afe128ad2541e0a8acfc23737.tar.bz2
- added the device button stuff to ODevice
- ODevice is now derived from QObject (don't ask me why I didn't make this from the beginning)
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp246
1 files changed, 230 insertions, 16 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index c947630..f93d1ed 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -24,24 +24,25 @@
24#include <signal.h> 24#include <signal.h>
25#include <sys/time.h> 25#include <sys/time.h>
26#include <linux/soundcard.h> 26#include <linux/soundcard.h>
27#include <math.h> 27#include <math.h>
28 28
29#include <qapplication.h> 29#include <qapplication.h>
30 30
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qpe/sound.h> 33#include <qpe/sound.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/qcopenvelope_qws.h>
36 37
37#include "odevice.h" 38#include "odevice.h"
38 39
39#include <qwindowsystem_qws.h> 40#include <qwindowsystem_qws.h>
40 41
41 42
42// _IO and friends are only defined in kernel headers ... 43// _IO and friends are only defined in kernel headers ...
43 44
44#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 45#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
45 46
46#define OD_IO(type,number) OD_IOC(0,type,number,0) 47#define OD_IO(type,number) OD_IOC(0,type,number,0)
47#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 48#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
@@ -55,50 +56,51 @@ public:
55 bool m_qwsserver; 56 bool m_qwsserver;
56 57
57 QString m_vendorstr; 58 QString m_vendorstr;
58 OVendor m_vendor; 59 OVendor m_vendor;
59 60
60 QString m_modelstr; 61 QString m_modelstr;
61 OModel m_model; 62 OModel m_model;
62 63
63 QString m_systemstr; 64 QString m_systemstr;
64 OSystem m_system; 65 OSystem m_system;
65 66
66 QString m_sysverstr; 67 QString m_sysverstr;
68
69 QValueList <ODeviceButton> m_buttons;
70 uint m_holdtime;
67}; 71};
68 72
69 73
70class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter { 74class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
71protected: 75protected:
72 virtual void init ( ); 76 virtual void init ( );
73 77
74public: 78public:
75 virtual bool setSoftSuspend ( bool soft ); 79 virtual bool setSoftSuspend ( bool soft );
76 80
77 virtual bool setDisplayBrightness ( int b ); 81 virtual bool setDisplayBrightness ( int b );
78 virtual int displayBrightnessResolution ( ) const; 82 virtual int displayBrightnessResolution ( ) const;
79 83
80 virtual void alarmSound ( ); 84 virtual void alarmSound ( );
81 85
82 virtual QValueList <OLed> ledList ( ) const; 86 virtual QValueList <OLed> ledList ( ) const;
83 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 87 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
84 virtual OLedState ledState ( OLed led ) const; 88 virtual OLedState ledState ( OLed led ) const;
85 virtual bool setLedState ( OLed led, OLedState st ); 89 virtual bool setLedState ( OLed led, OLedState st );
86 90
87 virtual bool hasLightSensor ( ) const; 91 virtual bool hasLightSensor ( ) const;
88 virtual int readLightSensor ( ); 92 virtual int readLightSensor ( );
89 virtual int lightSensorResolution ( ) const; 93 virtual int lightSensorResolution ( ) const;
90 94
91 //virtual QValueList <int> keyList ( ) const;
92
93protected: 95protected:
94 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 96 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
95 virtual void timerEvent ( QTimerEvent *te ); 97 virtual void timerEvent ( QTimerEvent *te );
96 98
97 int m_power_timer; 99 int m_power_timer;
98 100
99 OLedState m_leds [2]; 101 OLedState m_leds [2];
100}; 102};
101 103
102class Zaurus : public ODevice { 104class Zaurus : public ODevice {
103protected: 105protected:
104 virtual void init ( ); 106 virtual void init ( );
@@ -109,34 +111,111 @@ public:
109 virtual bool setDisplayBrightness ( int b ); 111 virtual bool setDisplayBrightness ( int b );
110 virtual int displayBrightnessResolution ( ) const; 112 virtual int displayBrightnessResolution ( ) const;
111 113
112 virtual void alarmSound ( ); 114 virtual void alarmSound ( );
113 virtual void keySound ( ); 115 virtual void keySound ( );
114 virtual void touchSound ( ); 116 virtual void touchSound ( );
115 117
116 virtual QValueList <OLed> ledList ( ) const; 118 virtual QValueList <OLed> ledList ( ) const;
117 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 119 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
118 virtual OLedState ledState ( OLed led ) const; 120 virtual OLedState ledState ( OLed led ) const;
119 virtual bool setLedState ( OLed led, OLedState st ); 121 virtual bool setLedState ( OLed led, OLedState st );
120 122
121 //virtual QValueList <int> keyList ( ) const;
122
123protected: 123protected:
124 virtual void buzzer ( int snd ); 124 virtual void buzzer ( int snd );
125 125
126 OLedState m_leds [1]; 126 OLedState m_leds [1];
127}; 127};
128 128
129 129
130struct i_button {
131 uint model;
132 Qt::Key code;
133 char *utext;
134 char *pix;
135 char *fpressedservice;
136 char *fpressedaction;
137 char *fheldservice;
138 char *fheldaction;
139} ipaq_buttons [] = {
140 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
141 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
142 "devicebuttons/ipaq_calendar",
143 "datebook", "nextView()",
144 "today", "raise()" },
145 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
146 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
147 "devicebuttons/ipaq_contact",
148 "addressbook", "raise()",
149 "addressbook", "beamBusinessCard()" },
150 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
151 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
152 "devicebuttons/ipaq_menu",
153 "QPE/TaskBar", "toggleMenu()",
154 "QPE/TaskBar", "toggleStartMenu()" },
155 { Model_iPAQ_H38xx | Model_iPAQ_H39xx,
156 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Mail Button"),
157 "devicebuttons/ipaq_mail",
158 "mail", "raise()",
159 "mail", "newMail()" },
160 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
161 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
162 "devicebuttons/ipaq_home",
163 "QPE/Launcher", "home()",
164 "buttonsettings", "raise()" },
165 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
166 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
167 "devicebuttons/ipaq_record",
168 "QPE/VMemo", "toggleRecord()",
169 "sound", "raise()" },
170};
171
172struct z_button {
173 Qt::Key code;
174 char *utext;
175 char *pix;
176 char *fpressedservice;
177 char *fpressedaction;
178 char *fheldservice;
179 char *fheldaction;
180} z_buttons [] = {
181 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
182 "devicebuttons/z_calendar",
183 "datebook", "nextView()",
184 "today", "raise()" },
185 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
186 "devicebuttons/z_contact",
187 "addressbook", "raise()",
188 "addressbook", "beamBusinessCard()" },
189 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
190 "devicebuttons/z_home",
191 "QPE/Launcher", "home()",
192 "buttonsettings", "raise()" },
193 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
194 "devicebuttons/z_menu",
195 "QPE/TaskBar", "toggleMenu()",
196 "QPE/TaskBar", "toggleStartMenu()" },
197 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
198 "devicebuttons/z_mail",
199 "mail", "raise()",
200 "mail", "newMail()" },
201};
130 202
203static QCString makeChannel ( const char *str )
204{
205 if ( str && !::strchr ( str, '/' ))
206 return QCString ( "QPE/Application/" ) + str;
207 else
208 return str;
209}
131 210
132 211
133 212
134 213
135ODevice *ODevice::inst ( ) 214ODevice *ODevice::inst ( )
136{ 215{
137 static ODevice *dev = 0; 216 static ODevice *dev = 0;
138 217
139 if ( !dev ) { 218 if ( !dev ) {
140 if ( QFile::exists ( "/proc/hal/model" )) 219 if ( QFile::exists ( "/proc/hal/model" ))
141 dev = new iPAQ ( ); 220 dev = new iPAQ ( );
142 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 221 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
@@ -161,28 +240,57 @@ ODevice::ODevice ( )
161{ 240{
162 d = new ODeviceData; 241 d = new ODeviceData;
163 242
164 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 243 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
165 244
166 d-> m_modelstr = "Unknown"; 245 d-> m_modelstr = "Unknown";
167 d-> m_model = Model_Unknown; 246 d-> m_model = Model_Unknown;
168 d-> m_vendorstr = "Unkown"; 247 d-> m_vendorstr = "Unkown";
169 d-> m_vendor = Vendor_Unknown; 248 d-> m_vendor = Vendor_Unknown;
170 d-> m_systemstr = "Unkown"; 249 d-> m_systemstr = "Unkown";
171 d-> m_system = System_Unknown; 250 d-> m_system = System_Unknown;
172 d-> m_sysverstr = "0.0"; 251 d-> m_sysverstr = "0.0";
252
253 d-> m_holdtime = 1000; // 1000ms
254
255 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
256 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
257}
258
259void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
260{
261 if ( msg == "deviceButtonMappingChanged()" ) {
262 reloadButtonMapping ( );
263 }
173} 264}
174 265
175void ODevice::init ( ) 266void ODevice::init ( )
176{ 267{
268 // Simulation uses iPAQ 3660 device buttons
269
270 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
271 i_button *ib = ipaq_buttons + i;
272 ODeviceButton b;
273
274 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
275 b. setKeycode ( ib-> code );
276 b. setUserText ( qApp-> translate ( "Button", ib-> utext ));
277 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
278 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
279 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
280
281 d-> m_buttons. append ( b );
282 }
283 }
284 reloadButtonMapping ( );
177} 285}
178 286
179ODevice::~ODevice ( ) 287ODevice::~ODevice ( )
180{ 288{
181 delete d; 289 delete d;
182} 290}
183 291
184bool ODevice::setSoftSuspend ( bool /*soft*/ ) 292bool ODevice::setSoftSuspend ( bool /*soft*/ )
185{ 293{
186 return false; 294 return false;
187} 295}
188 296
@@ -350,28 +458,107 @@ bool ODevice::hasLightSensor ( ) const
350} 458}
351 459
352int ODevice::readLightSensor ( ) 460int ODevice::readLightSensor ( )
353{ 461{
354 return -1; 462 return -1;
355} 463}
356 464
357int ODevice::lightSensorResolution ( ) const 465int ODevice::lightSensorResolution ( ) const
358{ 466{
359 return 0; 467 return 0;
360} 468}
361 469
362//QValueList <int> ODevice::keyList ( ) const 470const QValueList <ODeviceButton> &ODevice::buttons ( ) const
363//{ 471{
364 //return QValueList <int> ( ); 472 return d-> m_buttons;
365//} 473}
474
475uint ODevice::buttonHoldTime ( ) const
476{
477 return d-> m_holdtime;
478}
479
480const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
481{
482 for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons. begin ( ); it != d-> m_buttons. end ( ); ++it ) {
483 if ( (*it). keycode ( ) == code )
484 return &(*it);
485 }
486 return 0;
487}
488
489void ODevice::reloadButtonMapping ( )
490{
491 Config cfg ( "ButtonSettings" );
492
493 for ( uint i = 0; i < d-> m_buttons. count ( ); i++ ) {
494 ODeviceButton &b = d-> m_buttons [i];
495 QString group = "Button" + QString::number ( i );
496
497 QCString pch, hch;
498 QCString pm, hm;
499 QByteArray pdata, hdata;
500
501 if ( cfg. hasGroup ( group )) {
502 cfg. setGroup ( group );
503 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( );
504 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( );
505 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
506
507 hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( );
508 hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( );
509 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
510 }
511
512 b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
513 b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
514 }
515}
516
517void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
518{
519 if ( button >= (int) d-> m_buttons. count ( ))
520 return;
521
522 ODeviceButton &b = d-> m_buttons [button];
523 b. setPressedAction ( action );
524
525 Config buttonFile ( "ButtonSettings" );
526 buttonFile. setGroup ( "Button" + QString::number ( button ));
527 buttonFile. writeEntry ( "PressedActionChannel", (const char*) b. pressedAction ( ). channel ( ));
528 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( ));
529
530 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( )));
531
532 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
533}
534
535void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
536{
537 if ( button >= (int) d-> m_buttons. count ( ))
538 return;
539
540 ODeviceButton &b = d-> m_buttons [button];
541 b. setHeldAction ( action );
542
543 Config buttonFile ( "ButtonSettings" );
544 buttonFile. setGroup ( "Button" + QString::number ( button ));
545 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( ));
546 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( ));
547
548 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( )));
549
550 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
551}
552
366 553
367 554
368 555
369/************************************************** 556/**************************************************
370 * 557 *
371 * iPAQ 558 * iPAQ
372 * 559 *
373 **************************************************/ 560 **************************************************/
374 561
375void iPAQ::init ( ) 562void iPAQ::init ( )
376{ 563{
377 d-> m_vendorstr = "HP"; 564 d-> m_vendorstr = "HP";
@@ -406,24 +593,44 @@ void iPAQ::init ( )
406 d-> m_system = System_Familiar; 593 d-> m_system = System_Familiar;
407 594
408 QTextStream ts ( &f ); 595 QTextStream ts ( &f );
409 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 596 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
410 597
411 f. close ( ); 598 f. close ( );
412 } 599 }
413 600
414 m_leds [0] = m_leds [1] = Led_Off; 601 m_leds [0] = m_leds [1] = Led_Off;
415 602
416 m_power_timer = 0; 603 m_power_timer = 0;
417 604
605 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
606 i_button *ib = ipaq_buttons + i;
607 ODeviceButton b;
608
609 qDebug ( "%d: %d", i, ib-> model );
610
611 if (( ib-> model & d-> m_model ) == d-> m_model ) {
612 b. setKeycode ( ib-> code );
613 b. setUserText ( qApp-> translate ( "Button", ib-> utext ));
614 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
615 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
616 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
617
618 d-> m_buttons. append ( b );
619
620 qDebug ( "code: %d", ib-> code );
621 }
622 }
623 reloadButtonMapping ( );
624
418 if ( d-> m_qwsserver ) 625 if ( d-> m_qwsserver )
419 QWSServer::setKeyboardFilter ( this ); 626 QWSServer::setKeyboardFilter ( this );
420} 627}
421 628
422//#include <linux/h3600_ts.h> // including kernel headers is evil ... 629//#include <linux/h3600_ts.h> // including kernel headers is evil ...
423 630
424typedef struct { 631typedef struct {
425 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 632 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
426 unsigned char TotalTime; /* Units of 5 seconds */ 633 unsigned char TotalTime; /* Units of 5 seconds */
427 unsigned char OnTime; /* units of 100m/s */ 634 unsigned char OnTime; /* units of 100m/s */
428 unsigned char OffTime; /* units of 100m/s */ 635 unsigned char OffTime; /* units of 100m/s */
429} LED_IN; 636} LED_IN;
@@ -494,31 +701,24 @@ bool iPAQ::setLedState ( OLed l, OLedState st )
494 } 701 }
495 702
496 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { 703 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) {
497 m_leds [0] = st; 704 m_leds [0] = st;
498 return true; 705 return true;
499 } 706 }
500 } 707 }
501 } 708 }
502 return false; 709 return false;
503} 710}
504 711
505 712
506//QValueList <int> iPAQ::keyList ( ) const
507//{
508 //QValueList <int> vl;
509 //vl << HardKey_Datebook << HardKey_Contacts << ( model ( ) == Model_iPAQ_H38xx ? HardKey_Mail : HardKey_Menu ) << HardKey_Home << HardKey_Record << HardKey_Suspend << HardKey_Backlight;
510 //return vl;
511//}
512
513bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 713bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
514{ 714{
515 int newkeycode = keycode; 715 int newkeycode = keycode;
516 716
517 switch ( keycode ) { 717 switch ( keycode ) {
518 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 718 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
519 case HardKey_Menu: { 719 case HardKey_Menu: {
520 if (( d-> m_model == Model_iPAQ_H38xx ) || 720 if (( d-> m_model == Model_iPAQ_H38xx ) ||
521 ( d-> m_model == Model_iPAQ_H39xx )) { 721 ( d-> m_model == Model_iPAQ_H39xx )) {
522 newkeycode = HardKey_Mail; 722 newkeycode = HardKey_Mail;
523 } 723 }
524 break; 724 break;
@@ -745,24 +945,38 @@ void Zaurus::init ( )
745 d-> m_model = Model_Zaurus_SL5000; 945 d-> m_model = Model_Zaurus_SL5000;
746 d-> m_modelstr = "Zaurus SL-5000D"; 946 d-> m_modelstr = "Zaurus SL-5000D";
747 } else if ( model == "SL-5500" ) { 947 } else if ( model == "SL-5500" ) {
748 d-> m_model = Model_Zaurus_SL5500; 948 d-> m_model = Model_Zaurus_SL5500;
749 d-> m_modelstr = "Zaurus SL-5500"; 949 d-> m_modelstr = "Zaurus SL-5500";
750 } 950 }
751 } 951 }
752 else { 952 else {
753 d-> m_model = Model_Zaurus_SL5000; 953 d-> m_model = Model_Zaurus_SL5000;
754 d-> m_modelstr = "Zaurus SL-5000D (unverified)"; 954 d-> m_modelstr = "Zaurus SL-5000D (unverified)";
755 } 955 }
756 956
957 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) {
958 z_button *zb = z_buttons + i;
959 ODeviceButton b;
960
961 b. setKeycode ( zb-> code );
962 b. setUserText ( qApp-> translate ( "Button", zb-> utext ));
963 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
964 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction ));
965 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction ));
966
967 d-> m_buttons. append ( b );
968 }
969 reloadButtonMapping ( );
970
757 m_leds [0] = Led_Off; 971 m_leds [0] = Led_Off;
758} 972}
759 973
760#include <unistd.h> 974#include <unistd.h>
761#include <fcntl.h> 975#include <fcntl.h>
762#include <sys/ioctl.h> 976#include <sys/ioctl.h>
763 977
764//#include <asm/sharp_char.h> // including kernel headers is evil ... 978//#include <asm/sharp_char.h> // including kernel headers is evil ...
765 979
766#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 980#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
767 981
768 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 982 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)