author | harlekin <harlekin> | 2003-04-10 21:19:45 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-04-10 21:19:45 (UTC) |
commit | b44d3aff66e7f520f6e0c08cb201cfe00994dbc5 (patch) (unidiff) | |
tree | 3356fc83d1feb2e577fc26d58f2fd9804523fa40 | |
parent | 6f7b120de8f4b883e709386882f3fe8ed925d0da (diff) | |
download | opie-b44d3aff66e7f520f6e0c08cb201cfe00994dbc5.zip opie-b44d3aff66e7f520f6e0c08cb201cfe00994dbc5.tar.gz opie-b44d3aff66e7f520f6e0c08cb201cfe00994dbc5.tar.bz2 |
openembedded/ipaq name
-rw-r--r-- | libopie/odevice.cpp | 232 |
1 files changed, 124 insertions, 108 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index cea4f35..9b2a954 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -59,3 +59,3 @@ public: | |||
59 | OVendor m_vendor; | 59 | OVendor m_vendor; |
60 | 60 | ||
61 | QString m_modelstr; | 61 | QString m_modelstr; |
@@ -65,3 +65,3 @@ public: | |||
65 | OSystem m_system; | 65 | OSystem m_system; |
66 | 66 | ||
67 | QString m_sysverstr; | 67 | QString m_sysverstr; |
@@ -69,3 +69,3 @@ public: | |||
69 | Transformation m_rotation; | 69 | Transformation m_rotation; |
70 | 70 | ||
71 | QValueList <ODeviceButton> *m_buttons; | 71 | QValueList <ODeviceButton> *m_buttons; |
@@ -76,6 +76,6 @@ public: | |||
76 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { | 76 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { |
77 | protected: | 77 | protected: |
78 | virtual void init ( ); | 78 | virtual void init ( ); |
79 | virtual void initButtons ( ); | 79 | virtual void initButtons ( ); |
80 | 80 | ||
81 | public: | 81 | public: |
@@ -87,3 +87,3 @@ public: | |||
87 | virtual void alarmSound ( ); | 87 | virtual void alarmSound ( ); |
88 | 88 | ||
89 | virtual QValueList <OLed> ledList ( ) const; | 89 | virtual QValueList <OLed> ledList ( ) const; |
@@ -96,3 +96,3 @@ public: | |||
96 | virtual int lightSensorResolution ( ) const; | 96 | virtual int lightSensorResolution ( ) const; |
97 | 97 | ||
98 | protected: | 98 | protected: |
@@ -100,5 +100,5 @@ protected: | |||
100 | virtual void timerEvent ( QTimerEvent *te ); | 100 | virtual void timerEvent ( QTimerEvent *te ); |
101 | 101 | ||
102 | int m_power_timer; | 102 | int m_power_timer; |
103 | 103 | ||
104 | OLedState m_leds [2]; | 104 | OLedState m_leds [2]; |
@@ -111,3 +111,3 @@ protected: | |||
111 | 111 | ||
112 | public: | 112 | public: |
113 | virtual bool setSoftSuspend ( bool soft ); | 113 | virtual bool setSoftSuspend ( bool soft ); |
@@ -119,3 +119,3 @@ public: | |||
119 | virtual void keySound ( ); | 119 | virtual void keySound ( ); |
120 | virtual void touchSound ( ); | 120 | virtual void touchSound ( ); |
121 | 121 | ||
@@ -125,6 +125,6 @@ public: | |||
125 | virtual bool setLedState ( OLed led, OLedState st ); | 125 | virtual bool setLedState ( OLed led, OLedState st ); |
126 | 126 | ||
127 | protected: | 127 | protected: |
128 | virtual void buzzer ( int snd ); | 128 | virtual void buzzer ( int snd ); |
129 | 129 | ||
130 | OLedState m_leds [1]; | 130 | OLedState m_leds [1]; |
@@ -143,14 +143,14 @@ struct i_button { | |||
143 | } ipaq_buttons [] = { | 143 | } ipaq_buttons [] = { |
144 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 144 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
145 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 145 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
146 | "devicebuttons/ipaq_calendar", | 146 | "devicebuttons/ipaq_calendar", |
147 | "datebook", "nextView()", | 147 | "datebook", "nextView()", |
148 | "today", "raise()" }, | 148 | "today", "raise()" }, |
149 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 149 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
150 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 150 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
151 | "devicebuttons/ipaq_contact", | 151 | "devicebuttons/ipaq_contact", |
152 | "addressbook", "raise()", | 152 | "addressbook", "raise()", |
153 | "addressbook", "beamBusinessCard()" }, | 153 | "addressbook", "beamBusinessCard()" }, |
154 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 154 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
155 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 155 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
156 | "devicebuttons/ipaq_menu", | 156 | "devicebuttons/ipaq_menu", |
@@ -159,3 +159,3 @@ struct i_button { | |||
159 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 159 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
160 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 160 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
161 | "devicebuttons/ipaq_mail", | 161 | "devicebuttons/ipaq_mail", |
@@ -164,4 +164,4 @@ struct i_button { | |||
164 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 164 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
165 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 165 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
166 | "devicebuttons/ipaq_home", | 166 | "devicebuttons/ipaq_home", |
167 | "QPE/Launcher", "home()", | 167 | "QPE/Launcher", "home()", |
@@ -169,4 +169,4 @@ struct i_button { | |||
169 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 169 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
170 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 170 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
171 | "devicebuttons/ipaq_record", | 171 | "devicebuttons/ipaq_record", |
172 | "QPE/VMemo", "toggleRecord()", | 172 | "QPE/VMemo", "toggleRecord()", |
@@ -220,3 +220,3 @@ ODevice *ODevice::inst ( ) | |||
220 | static ODevice *dev = 0; | 220 | static ODevice *dev = 0; |
221 | 221 | ||
222 | if ( !dev ) { | 222 | if ( !dev ) { |
@@ -228,3 +228,3 @@ ODevice *ODevice::inst ( ) | |||
228 | dev = new ODevice ( ); | 228 | dev = new ODevice ( ); |
229 | 229 | ||
230 | dev-> init ( ); | 230 | dev-> init ( ); |
@@ -256,3 +256,3 @@ ODevice::ODevice ( ) | |||
256 | d-> m_rotation = Rot0; | 256 | d-> m_rotation = Rot0; |
257 | 257 | ||
258 | d-> m_holdtime = 1000; // 1000ms | 258 | d-> m_holdtime = 1000; // 1000ms |
@@ -265,3 +265,3 @@ void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | |||
265 | reloadButtonMapping ( ); | 265 | reloadButtonMapping ( ); |
266 | } | 266 | } |
267 | } | 267 | } |
@@ -283,6 +283,6 @@ void ODevice::initButtons ( ) | |||
283 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 283 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
284 | i_button *ib = ipaq_buttons + i; | 284 | i_button *ib = ipaq_buttons + i; |
285 | ODeviceButton b; | 285 | ODeviceButton b; |
286 | 286 | ||
287 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 287 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
288 | b. setKeycode ( ib-> code ); | 288 | b. setKeycode ( ib-> code ); |
@@ -296,5 +296,5 @@ void ODevice::initButtons ( ) | |||
296 | reloadButtonMapping ( ); | 296 | reloadButtonMapping ( ); |
297 | 297 | ||
298 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 298 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
299 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 299 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
300 | } | 300 | } |
@@ -325,6 +325,6 @@ bool ODevice::suspend ( ) | |||
325 | bool res = false; | 325 | bool res = false; |
326 | 326 | ||
327 | struct timeval tvs, tvn; | 327 | struct timeval tvs, tvn; |
328 | ::gettimeofday ( &tvs, 0 ); | 328 | ::gettimeofday ( &tvs, 0 ); |
329 | 329 | ||
330 | ::sync ( ); // flush fs caches | 330 | ::sync ( ); // flush fs caches |
@@ -336,9 +336,9 @@ bool ODevice::suspend ( ) | |||
336 | 336 | ||
337 | if ( res ) { | 337 | if ( res ) { |
338 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 338 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
339 | ::usleep ( 200 * 1000 ); | 339 | ::usleep ( 200 * 1000 ); |
340 | ::gettimeofday ( &tvn, 0 ); | 340 | ::gettimeofday ( &tvn, 0 ); |
341 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 341 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
342 | } | 342 | } |
343 | 343 | ||
344 | return res; | 344 | return res; |
@@ -364,3 +364,3 @@ bool ODevice::setDisplayStatus ( bool on ) | |||
364 | int fd; | 364 | int fd; |
365 | 365 | ||
366 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 366 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
@@ -368,3 +368,3 @@ bool ODevice::setDisplayStatus ( bool on ) | |||
368 | ::close ( fd ); | 368 | ::close ( fd ); |
369 | } | 369 | } |
370 | return res; | 370 | return res; |
@@ -517,3 +517,3 @@ void ODevice::reloadButtonMapping ( ) | |||
517 | Config cfg ( "ButtonSettings" ); | 517 | Config cfg ( "ButtonSettings" ); |
518 | 518 | ||
519 | for ( uint i = 0; i < d-> m_buttons-> count ( ); i++ ) { | 519 | for ( uint i = 0; i < d-> m_buttons-> count ( ); i++ ) { |
@@ -525,3 +525,3 @@ void ODevice::reloadButtonMapping ( ) | |||
525 | QByteArray pdata, hdata; | 525 | QByteArray pdata, hdata; |
526 | 526 | ||
527 | if ( cfg. hasGroup ( group )) { | 527 | if ( cfg. hasGroup ( group )) { |
@@ -536,5 +536,5 @@ void ODevice::reloadButtonMapping ( ) | |||
536 | } | 536 | } |
537 | 537 | ||
538 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); | 538 | b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); |
539 | 539 | ||
540 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); | 540 | b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); |
@@ -548,6 +548,6 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | |||
548 | QString mb_chan; | 548 | QString mb_chan; |
549 | 549 | ||
550 | if ( button >= (int) d-> m_buttons-> count ( )) | 550 | if ( button >= (int) d-> m_buttons-> count ( )) |
551 | return; | 551 | return; |
552 | 552 | ||
553 | ODeviceButton &b = ( *d-> m_buttons ) [button]; | 553 | ODeviceButton &b = ( *d-> m_buttons ) [button]; |
@@ -573,3 +573,3 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | |||
573 | return; | 573 | return; |
574 | 574 | ||
575 | ODeviceButton &b = ( *d-> m_buttons ) [button]; | 575 | ODeviceButton &b = ( *d-> m_buttons ) [button]; |
@@ -638,18 +638,34 @@ void iPAQ::init ( ) | |||
638 | f. setName ( "/etc/familiar-version" ); | 638 | f. setName ( "/etc/familiar-version" ); |
639 | if ( f. open ( IO_ReadOnly )) { | 639 | if ( f. open ( IO_ReadOnly )) { |
640 | d-> m_systemstr = "Familiar"; | 640 | d-> m_systemstr = "Familiar"; |
641 | d-> m_system = System_Familiar; | 641 | d-> m_system = System_Familiar; |
642 | 642 | ||
643 | QTextStream ts ( &f ); | 643 | QTextStream ts ( &f ); |
644 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 644 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
645 | 645 | ||
646 | f. close ( ); | 646 | f. close ( ); |
647 | } | 647 | } else { |
648 | f. setName ( "/etc/oz_version" ); | ||
649 | |||
650 | if ( f. open ( IO_ReadOnly )) { | ||
651 | d-> m_systemstr = "OpenEmbedded/iPaq"; | ||
652 | d-> m_system = System_Familiar; | ||
653 | |||
654 | QTextStream ts ( &f ); | ||
655 | ts.setDevice ( &f ); | ||
656 | d-> m_sysverstr = ts. readLine ( ); | ||
657 | f. close ( ); | ||
658 | } | ||
659 | } | ||
660 | |||
661 | |||
662 | |||
663 | |||
648 | 664 | ||
649 | m_leds [0] = m_leds [1] = Led_Off; | 665 | m_leds [0] = m_leds [1] = Led_Off; |
650 | 666 | ||
651 | m_power_timer = 0; | 667 | m_power_timer = 0; |
652 | 668 | ||
653 | if ( d-> m_qwsserver ) | 669 | if ( d-> m_qwsserver ) |
654 | QWSServer::setKeyboardFilter ( this ); | 670 | QWSServer::setKeyboardFilter ( this ); |
655 | } | 671 | } |
@@ -664,6 +680,6 @@ void iPAQ::initButtons ( ) | |||
664 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 680 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
665 | i_button *ib = ipaq_buttons + i; | 681 | i_button *ib = ipaq_buttons + i; |
666 | ODeviceButton b; | 682 | ODeviceButton b; |
667 | 683 | ||
668 | if (( ib-> model & d-> m_model ) == d-> m_model ) { | 684 | if (( ib-> model & d-> m_model ) == d-> m_model ) { |
669 | b. setKeycode ( ib-> code ); | 685 | b. setKeycode ( ib-> code ); |
@@ -673,3 +689,3 @@ void iPAQ::initButtons ( ) | |||
673 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 689 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
674 | 690 | ||
675 | d-> m_buttons-> append ( b ); | 691 | d-> m_buttons-> append ( b ); |
@@ -677,4 +693,4 @@ void iPAQ::initButtons ( ) | |||
677 | } | 693 | } |
678 | reloadButtonMapping ( ); | 694 | reloadButtonMapping ( ); |
679 | 695 | ||
680 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 696 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
@@ -721,3 +737,3 @@ QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | |||
721 | vl << Led_Off; // << Led_On << ??? | 737 | vl << Led_Off; // << Led_On << ??? |
722 | 738 | ||
723 | return vl; | 739 | return vl; |
@@ -726,3 +742,3 @@ QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | |||
726 | OLedState iPAQ::ledState ( OLed l ) const | 742 | OLedState iPAQ::ledState ( OLed l ) const |
727 | { | 743 | { |
728 | switch ( l ) { | 744 | switch ( l ) { |
@@ -737,3 +753,3 @@ OLedState iPAQ::ledState ( OLed l ) const | |||
737 | 753 | ||
738 | bool iPAQ::setLedState ( OLed l, OLedState st ) | 754 | bool iPAQ::setLedState ( OLed l, OLedState st ) |
739 | { | 755 | { |
@@ -775,3 +791,3 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
775 | if (( d-> m_model == Model_iPAQ_H38xx ) || | 791 | if (( d-> m_model == Model_iPAQ_H38xx ) || |
776 | ( d-> m_model == Model_iPAQ_H39xx )) { | 792 | ( d-> m_model == Model_iPAQ_H39xx )) { |
777 | newkeycode = HardKey_Mail; | 793 | newkeycode = HardKey_Mail; |
@@ -780,10 +796,10 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
780 | } | 796 | } |
781 | 797 | ||
782 | // Rotate cursor keys 180� | 798 | // Rotate cursor keys 180� |
783 | case Key_Left : | 799 | case Key_Left : |
784 | case Key_Right: | 800 | case Key_Right: |
785 | case Key_Up : | 801 | case Key_Up : |
786 | case Key_Down : { | 802 | case Key_Down : { |
787 | if (( d-> m_model == Model_iPAQ_H31xx ) || | 803 | if (( d-> m_model == Model_iPAQ_H31xx ) || |
788 | ( d-> m_model == Model_iPAQ_H38xx )) { | 804 | ( d-> m_model == Model_iPAQ_H38xx )) { |
789 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 805 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
@@ -806,7 +822,7 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
806 | } | 822 | } |
807 | newkeycode = Key_unknown; | 823 | newkeycode = Key_unknown; |
808 | break; | 824 | break; |
809 | } | 825 | } |
810 | } | 826 | } |
811 | 827 | ||
812 | if ( newkeycode != keycode ) { | 828 | if ( newkeycode != keycode ) { |
@@ -871,3 +887,3 @@ bool iPAQ::setSoftSuspend ( bool soft ) | |||
871 | int fd; | 887 | int fd; |
872 | 888 | ||
873 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 889 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
@@ -877,3 +893,3 @@ bool iPAQ::setSoftSuspend ( bool soft ) | |||
877 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 893 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
878 | 894 | ||
879 | ::close ( fd ); | 895 | ::close ( fd ); |
@@ -882,3 +898,3 @@ bool iPAQ::setSoftSuspend ( bool soft ) | |||
882 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 898 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
883 | 899 | ||
884 | return res; | 900 | return res; |
@@ -891,3 +907,3 @@ bool iPAQ::setDisplayBrightness ( int bright ) | |||
891 | int fd; | 907 | int fd; |
892 | 908 | ||
893 | if ( bright > 255 ) | 909 | if ( bright > 255 ) |
@@ -915,3 +931,3 @@ int iPAQ::displayBrightnessResolution ( ) const | |||
915 | return 128; // really 256, but >128 could damage the LCD | 931 | return 128; // really 256, but >128 could damage the LCD |
916 | 932 | ||
917 | case Model_iPAQ_H38xx: | 933 | case Model_iPAQ_H38xx: |
@@ -919,6 +935,6 @@ int iPAQ::displayBrightnessResolution ( ) const | |||
919 | return 64; | 935 | return 64; |
920 | 936 | ||
921 | default: | 937 | default: |
922 | return 2; | 938 | return 2; |
923 | } | 939 | } |
924 | } | 940 | } |
@@ -935,15 +951,15 @@ int iPAQ::readLightSensor ( ) | |||
935 | int val = -1; | 951 | int val = -1; |
936 | 952 | ||
937 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 953 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
938 | char buffer [8]; | 954 | char buffer [8]; |
939 | 955 | ||
940 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 956 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
941 | char *endptr; | 957 | char *endptr; |
942 | 958 | ||
943 | buffer [4] = 0; | 959 | buffer [4] = 0; |
944 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 960 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
945 | 961 | ||
946 | if ( *endptr != 0 ) | 962 | if ( *endptr != 0 ) |
947 | val = -1; | 963 | val = -1; |
948 | } | 964 | } |
949 | ::close ( fd ); | 965 | ::close ( fd ); |
@@ -982,3 +998,3 @@ void Zaurus::init ( ) | |||
982 | f. setName ( "/etc/oz_version" ); | 998 | f. setName ( "/etc/oz_version" ); |
983 | if ( f. open ( IO_ReadOnly )) { | 999 | if ( f. open ( IO_ReadOnly )) { |
984 | QTextStream ts ( &f ); | 1000 | QTextStream ts ( &f ); |
@@ -1038,3 +1054,3 @@ void Zaurus::initButtons ( ) | |||
1038 | return; | 1054 | return; |
1039 | 1055 | ||
1040 | d-> m_buttons = new QValueList <ODeviceButton>; | 1056 | d-> m_buttons = new QValueList <ODeviceButton>; |
@@ -1042,5 +1058,5 @@ void Zaurus::initButtons ( ) | |||
1042 | for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { | 1058 | for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { |
1043 | z_button *zb = z_buttons + i; | 1059 | z_button *zb = z_buttons + i; |
1044 | ODeviceButton b; | 1060 | ODeviceButton b; |
1045 | 1061 | ||
1046 | b. setKeycode ( zb-> code ); | 1062 | b. setKeycode ( zb-> code ); |
@@ -1050,8 +1066,8 @@ void Zaurus::initButtons ( ) | |||
1050 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); | 1066 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); |
1051 | 1067 | ||
1052 | d-> m_buttons-> append ( b ); | 1068 | d-> m_buttons-> append ( b ); |
1053 | } | 1069 | } |
1054 | 1070 | ||
1055 | reloadButtonMapping ( ); | 1071 | reloadButtonMapping ( ); |
1056 | 1072 | ||
1057 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1073 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
@@ -1130,3 +1146,3 @@ void Zaurus::buzzer ( int sound ) | |||
1130 | static int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 1146 | static int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
1131 | 1147 | ||
1132 | if ( fd >= 0 ) { | 1148 | if ( fd >= 0 ) { |
@@ -1138,3 +1154,3 @@ void Zaurus::buzzer ( int sound ) | |||
1138 | 1154 | ||
1139 | void Zaurus::alarmSound ( ) | 1155 | void Zaurus::alarmSound ( ) |
1140 | { | 1156 | { |
@@ -1143,3 +1159,3 @@ void Zaurus::alarmSound ( ) | |||
1143 | 1159 | ||
1144 | void Zaurus::touchSound ( ) | 1160 | void Zaurus::touchSound ( ) |
1145 | { | 1161 | { |
@@ -1148,3 +1164,3 @@ void Zaurus::touchSound ( ) | |||
1148 | 1164 | ||
1149 | void Zaurus::keySound ( ) | 1165 | void Zaurus::keySound ( ) |
1150 | { | 1166 | { |
@@ -1164,3 +1180,3 @@ QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | |||
1164 | QValueList <OLedState> vl; | 1180 | QValueList <OLedState> vl; |
1165 | 1181 | ||
1166 | if ( l == Led_Mail ) | 1182 | if ( l == Led_Mail ) |
@@ -1174,3 +1190,3 @@ OLedState Zaurus::ledState ( OLed which ) const | |||
1174 | return m_leds [0]; | 1190 | return m_leds [0]; |
1175 | else | 1191 | else |
1176 | return Led_Off; | 1192 | return Led_Off; |
@@ -1180,3 +1196,3 @@ bool Zaurus::setLedState ( OLed which, OLedState st ) | |||
1180 | { | 1196 | { |
1181 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 1197 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
1182 | 1198 | ||
@@ -1188,3 +1204,3 @@ bool Zaurus::setLedState ( OLed which, OLedState st ) | |||
1188 | bool ok = true; | 1204 | bool ok = true; |
1189 | 1205 | ||
1190 | switch ( st ) { | 1206 | switch ( st ) { |
@@ -1195,3 +1211,3 @@ bool Zaurus::setLedState ( OLed which, OLedState st ) | |||
1195 | } | 1211 | } |
1196 | 1212 | ||
1197 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 1213 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
@@ -1200,3 +1216,3 @@ bool Zaurus::setLedState ( OLed which, OLedState st ) | |||
1200 | } | 1216 | } |
1201 | } | 1217 | } |
1202 | } | 1218 | } |
@@ -1228,3 +1244,3 @@ bool Zaurus::setSoftSuspend ( bool soft ) | |||
1228 | perror ( "APM_IOCGEVTSRC" ); | 1244 | perror ( "APM_IOCGEVTSRC" ); |
1229 | 1245 | ||
1230 | ::close ( fd ); | 1246 | ::close ( fd ); |
@@ -1233,3 +1249,3 @@ bool Zaurus::setSoftSuspend ( bool soft ) | |||
1233 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); | 1249 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); |
1234 | 1250 | ||
1235 | return res; | 1251 | return res; |
@@ -1242,3 +1258,3 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
1242 | int fd; | 1258 | int fd; |
1243 | 1259 | ||
1244 | if ( bright > 255 ) | 1260 | if ( bright > 255 ) |
@@ -1247,3 +1263,3 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
1247 | bright = 0; | 1263 | bright = 0; |
1248 | 1264 | ||
1249 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { | 1265 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { |
@@ -1259,3 +1275,3 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
1259 | 1275 | ||
1260 | int Zaurus::displayBrightnessResolution ( ) const | 1276 | int Zaurus::displayBrightnessResolution ( ) const |
1261 | { | 1277 | { |