author | mickeyl <mickeyl> | 2005-06-09 09:14:22 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-09 09:14:22 (UTC) |
commit | 9a4b3a90fdd4ac0288034657d4818e3d10ed0193 (patch) (unidiff) | |
tree | b65dc74dce17f4f709242753152b53767bb1a4fc /libopie2/opiecore | |
parent | 15978c2609cc29d2eb2b21922dd52627015889c1 (diff) | |
download | opie-9a4b3a90fdd4ac0288034657d4818e3d10ed0193.zip opie-9a4b3a90fdd4ac0288034657d4818e3d10ed0193.tar.gz opie-9a4b3a90fdd4ac0288034657d4818e3d10ed0193.tar.bz2 |
add support for the linux 2.6 backlight interface on tosa, poodle, and collie
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 65 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 5 |
2 files changed, 42 insertions, 28 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 1742100..21d2342 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,49 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | |
4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> | ||
5 | =. | 4 | =. |
6 | .=l. | 5 | .=l. |
7 | Â Â Â Â Â Â .>+-= | 6 | .>+-= |
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | 12 | ._= =} : |
14 | Â Â .%`+i> Â Â Â _;_. | 13 | .%`+i> _;_. |
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
21 | ++= Â -. Â Â .` Â Â .: details. | 20 | ++= -. .` .: details. |
22 | : Â Â = Â ...= . :.=- | 21 | : = ...= . :.=- |
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | Â -_. . . Â )=. Â = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
29 | */ | 28 | */ |
30 | 29 | ||
31 | #include "odevice_zaurus.h" | 30 | #include "odevice_zaurus.h" |
32 | 31 | ||
33 | /* QT */ | 32 | /* QT */ |
34 | #include <qapplication.h> | 33 | #include <qapplication.h> |
35 | #include <qfile.h> | 34 | #include <qfile.h> |
36 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
37 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
38 | 37 | ||
39 | /* OPIE */ | 38 | /* OPIE */ |
40 | #include <opie2/oinputsystem.h> | 39 | #include <opie2/oinputsystem.h> |
41 | #include <opie2/oresource.h> | 40 | #include <opie2/oresource.h> |
42 | 41 | ||
43 | #include <qpe/config.h> | 42 | #include <qpe/config.h> |
44 | #include <qpe/sound.h> | 43 | #include <qpe/sound.h> |
45 | #include <qpe/qcopenvelope_qws.h> | 44 | #include <qpe/qcopenvelope_qws.h> |
46 | 45 | ||
47 | /* STD */ | 46 | /* STD */ |
48 | #include <fcntl.h> | 47 | #include <fcntl.h> |
49 | #include <math.h> | 48 | #include <math.h> |
@@ -99,49 +98,49 @@ struct z_button z_buttons_c700 [] = { | |||
99 | "devicebuttons/z_menu", | 98 | "devicebuttons/z_menu", |
100 | "QPE/TaskBar", "toggleMenu()", | 99 | "QPE/TaskBar", "toggleMenu()", |
101 | "QPE/TaskBar", "toggleStartMenu()" }, | 100 | "QPE/TaskBar", "toggleStartMenu()" }, |
102 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 101 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
103 | "devicebuttons/z_mail", | 102 | "devicebuttons/z_mail", |
104 | "opiemail", "raise()", | 103 | "opiemail", "raise()", |
105 | "opiemail", "newMail()" }, | 104 | "opiemail", "newMail()" }, |
106 | 105 | ||
107 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), | 106 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), |
108 | "devicebuttons/z_hinge1", | 107 | "devicebuttons/z_hinge1", |
109 | "QPE/Rotation", "rotateDefault()",0}, | 108 | "QPE/Rotation", "rotateDefault()",0}, |
110 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), | 109 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), |
111 | "devicebuttons/z_hinge2", | 110 | "devicebuttons/z_hinge2", |
112 | "QPE/Rotation", "rotateDefault()",0}, | 111 | "QPE/Rotation", "rotateDefault()",0}, |
113 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), | 112 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), |
114 | "devicebuttons/z_hinge3", | 113 | "devicebuttons/z_hinge3", |
115 | "QPE/Rotation", "rotateDefault()",0}, | 114 | "QPE/Rotation", "rotateDefault()",0}, |
116 | }; | 115 | }; |
117 | 116 | ||
118 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 117 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
119 | // class up into individual classes. We would need three classes | 118 | // class up into individual classes. We would need three classes |
120 | // | 119 | // |
121 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 120 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
122 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 121 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
123 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000) | 122 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) |
124 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) | 123 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) |
125 | 124 | ||
126 | void Zaurus::init(const QString& cpu_info) | 125 | void Zaurus::init(const QString& cpu_info) |
127 | { | 126 | { |
128 | // Set the time to wait until the system is really suspended | 127 | // Set the time to wait until the system is really suspended |
129 | // the delta between apm --suspend and sleeping | 128 | // the delta between apm --suspend and sleeping |
130 | setAPMTimeOut( 15000 ); | 129 | setAPMTimeOut( 15000 ); |
131 | 130 | ||
132 | // generic distribution code already scanned /etc/issue at that point - | 131 | // generic distribution code already scanned /etc/issue at that point - |
133 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 132 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
134 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 133 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
135 | { | 134 | { |
136 | d->m_vendorstr = "Sharp"; | 135 | d->m_vendorstr = "Sharp"; |
137 | d->m_vendor = Vendor_Sharp; | 136 | d->m_vendor = Vendor_Sharp; |
138 | d->m_systemstr = "Zaurus"; | 137 | d->m_systemstr = "Zaurus"; |
139 | d->m_system = System_Zaurus; | 138 | d->m_system = System_Zaurus; |
140 | m_embedix = true; | 139 | m_embedix = true; |
141 | } | 140 | } |
142 | else | 141 | else |
143 | { | 142 | { |
144 | d->m_vendorstr = "OpenZaurus Team"; | 143 | d->m_vendorstr = "OpenZaurus Team"; |
145 | d->m_systemstr = "OpenZaurus"; | 144 | d->m_systemstr = "OpenZaurus"; |
146 | d->m_system = System_OpenZaurus; | 145 | d->m_system = System_OpenZaurus; |
147 | // sysver already gathered | 146 | // sysver already gathered |
@@ -178,48 +177,62 @@ void Zaurus::init(const QString& cpu_info) | |||
178 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 177 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
179 | } else if ( model == "SHARP Boxer" ) { | 178 | } else if ( model == "SHARP Boxer" ) { |
180 | d->m_model = Model_Zaurus_SLC7x0; | 179 | d->m_model = Model_Zaurus_SLC7x0; |
181 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 180 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
182 | } else if ( model == "SHARP Poodle" ) { | 181 | } else if ( model == "SHARP Poodle" ) { |
183 | d->m_model = Model_Zaurus_SLB600; | 182 | d->m_model = Model_Zaurus_SLB600; |
184 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 183 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
185 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 184 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
186 | d->m_model = Model_Zaurus_SL5500; | 185 | d->m_model = Model_Zaurus_SL5500; |
187 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 186 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
188 | } else if ( model == "SHARP Tosa" ) { | 187 | } else if ( model == "SHARP Tosa" ) { |
189 | d->m_model = Model_Zaurus_SL6000; | 188 | d->m_model = Model_Zaurus_SL6000; |
190 | d->m_modelstr = "Zaurus SL-6000"; | 189 | d->m_modelstr = "Zaurus SL-6000"; |
191 | } else if ( model == "SHARP Spitz" ) { | 190 | } else if ( model == "SHARP Spitz" ) { |
192 | d->m_model = Model_Zaurus_SLC3000; | 191 | d->m_model = Model_Zaurus_SLC3000; |
193 | d->m_modelstr = "Zaurus SL-C3000"; | 192 | d->m_modelstr = "Zaurus SL-C3000"; |
194 | } else if ( model == "SHARP Akita" ) { | 193 | } else if ( model == "SHARP Akita" ) { |
195 | d->m_model = Model_Zaurus_SLC1000; | 194 | d->m_model = Model_Zaurus_SLC1000; |
196 | d->m_modelstr = "Zaurus SL-C1000"; | 195 | d->m_modelstr = "Zaurus SL-C1000"; |
197 | } else { | 196 | } else { |
198 | d->m_model = Model_Zaurus_SL5500; | 197 | d->m_model = Model_Zaurus_SL5500; |
199 | d->m_modelstr = "Unknown Zaurus"; | 198 | d->m_modelstr = "Unknown Zaurus"; |
200 | } | 199 | } |
201 | 200 | ||
201 | // set path to backlight device in kernel 2.6 | ||
202 | switch ( d->m_model ) { | ||
203 | case Model_Zaurus_SLB600: // fallthrough | ||
204 | case Model_Zaurus_SL5500: | ||
205 | m_backlightdev = "/sys/class/backlight/locomo-backlight/"; | ||
206 | break; | ||
207 | case Model_Zaurus_SL6000: | ||
208 | m_backlightdev = "/sys/class/backlight/tosa-bl/"; | ||
209 | break; | ||
210 | default: | ||
211 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | ||
212 | break; | ||
213 | } | ||
214 | |||
202 | // set initial rotation | 215 | // set initial rotation |
203 | switch( d->m_model ) { | 216 | switch( d->m_model ) { |
204 | case Model_Zaurus_SL6000: // fallthrough | 217 | case Model_Zaurus_SL6000: // fallthrough |
205 | case Model_Zaurus_SLA300: | 218 | case Model_Zaurus_SLA300: |
206 | d->m_rotation = Rot0; | 219 | d->m_rotation = Rot0; |
207 | break; | 220 | break; |
208 | case Model_Zaurus_SLC3000: // fallthrough | 221 | case Model_Zaurus_SLC3000: // fallthrough |
209 | case Model_Zaurus_SLC1000: // fallthrough | 222 | case Model_Zaurus_SLC1000: // fallthrough |
210 | case Model_Zaurus_SLC7x0: | 223 | case Model_Zaurus_SLC7x0: |
211 | d->m_rotation = rotation(); | 224 | d->m_rotation = rotation(); |
212 | d->m_direction = direction(); | 225 | d->m_direction = direction(); |
213 | break; | 226 | break; |
214 | case Model_Zaurus_SLB600: // fallthrough | 227 | case Model_Zaurus_SLB600: // fallthrough |
215 | case Model_Zaurus_SL5000: // fallthrough | 228 | case Model_Zaurus_SL5000: // fallthrough |
216 | case Model_Zaurus_SL5500: // fallthrough | 229 | case Model_Zaurus_SL5500: // fallthrough |
217 | default: | 230 | default: |
218 | d->m_rotation = Rot270; | 231 | d->m_rotation = Rot270; |
219 | break; | 232 | break; |
220 | } | 233 | } |
221 | m_leds[0] = Led_Off; | 234 | m_leds[0] = Led_Off; |
222 | 235 | ||
223 | if ( m_embedix ) | 236 | if ( m_embedix ) |
224 | qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); | 237 | qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); |
225 | else | 238 | else |
@@ -390,109 +403,109 @@ bool Zaurus::setLedState( OLed which, OLedState st ) | |||
390 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 403 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
391 | m_leds [0] = st; | 404 | m_leds [0] = st; |
392 | return true; | 405 | return true; |
393 | } | 406 | } |
394 | } | 407 | } |
395 | } | 408 | } |
396 | return false; | 409 | return false; |
397 | } | 410 | } |
398 | 411 | ||
399 | int Zaurus::displayBrightnessResolution() const | 412 | int Zaurus::displayBrightnessResolution() const |
400 | { | 413 | { |
401 | int res = 1; | 414 | int res = 1; |
402 | if (m_embedix) | 415 | if (m_embedix) |
403 | { | 416 | { |
404 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 417 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
405 | if ( fd ) | 418 | if ( fd ) |
406 | { | 419 | { |
407 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 420 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
408 | ::close( fd ); | 421 | ::close( fd ); |
409 | return value ? value : res; | 422 | return value ? value : res; |
410 | } | 423 | } |
411 | } | 424 | } |
412 | else | 425 | else |
413 | { | 426 | { |
414 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); | 427 | int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); |
415 | if ( fd ) | 428 | if ( fd ) |
416 | { | 429 | { |
417 | char buf[100]; | 430 | char buf[100]; |
418 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | 431 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); |
419 | ::close( fd ); | 432 | ::close( fd ); |
420 | } | 433 | } |
421 | } | 434 | } |
422 | return res; | 435 | return res; |
423 | } | 436 | } |
424 | 437 | ||
425 | bool Zaurus::setDisplayBrightness( int bright ) | 438 | bool Zaurus::setDisplayBrightness( int bright ) |
426 | { | 439 | { |
427 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); | 440 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); |
428 | bool res = false; | 441 | bool res = false; |
429 | 442 | ||
430 | if ( bright > 255 ) bright = 255; | 443 | if ( bright > 255 ) bright = 255; |
431 | if ( bright < 0 ) bright = 0; | 444 | if ( bright < 0 ) bright = 0; |
432 | 445 | ||
433 | int numberOfSteps = displayBrightnessResolution(); | 446 | int numberOfSteps = displayBrightnessResolution(); |
434 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 447 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
435 | 448 | ||
436 | if ( m_embedix ) | 449 | if ( m_embedix ) |
437 | { | 450 | { |
438 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 451 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
439 | if ( fd ) | 452 | if ( fd ) |
440 | { | 453 | { |
441 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | 454 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); |
442 | ::close( fd ); | 455 | ::close( fd ); |
443 | } | 456 | } |
444 | } | 457 | } |
445 | else | 458 | else |
446 | { | 459 | { |
447 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); | 460 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
448 | if ( fd ) | 461 | if ( fd ) |
449 | { | 462 | { |
450 | char buf[100]; | 463 | char buf[100]; |
451 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 464 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
452 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 465 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
453 | ::close( fd ); | 466 | ::close( fd ); |
454 | } | 467 | } |
455 | } | 468 | } |
456 | return res; | 469 | return res; |
457 | } | 470 | } |
458 | 471 | ||
459 | bool Zaurus::setDisplayStatus( bool on ) | 472 | bool Zaurus::setDisplayStatus( bool on ) |
460 | { | 473 | { |
461 | bool res = false; | 474 | bool res = false; |
462 | if ( m_embedix ) | 475 | if ( m_embedix ) |
463 | { | 476 | { |
464 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 477 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
465 | if ( fd ) | 478 | if ( fd ) |
466 | { | 479 | { |
467 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 480 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
468 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 481 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
469 | ::close ( fd ); | 482 | ::close ( fd ); |
470 | } | 483 | } |
471 | } | 484 | } |
472 | else | 485 | else |
473 | { | 486 | { |
474 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); | 487 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); |
475 | if ( fd ) | 488 | if ( fd ) |
476 | { | 489 | { |
477 | char buf[10]; | 490 | char buf[10]; |
478 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 491 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
479 | buf[1] = '\0'; | 492 | buf[1] = '\0'; |
480 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 493 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
481 | ::close( fd ); | 494 | ::close( fd ); |
482 | } | 495 | } |
483 | } | 496 | } |
484 | return res; | 497 | return res; |
485 | } | 498 | } |
486 | 499 | ||
487 | Transformation Zaurus::rotation() const | 500 | Transformation Zaurus::rotation() const |
488 | { | 501 | { |
489 | qDebug( "Zaurus::rotation()" ); | 502 | qDebug( "Zaurus::rotation()" ); |
490 | Transformation rot; | 503 | Transformation rot; |
491 | 504 | ||
492 | switch ( d->m_model ) { | 505 | switch ( d->m_model ) { |
493 | case Model_Zaurus_SLC3000: // fallthrough | 506 | case Model_Zaurus_SLC3000: // fallthrough |
494 | case Model_Zaurus_SLC1000: // fallthrough | 507 | case Model_Zaurus_SLC1000: // fallthrough |
495 | case Model_Zaurus_SLC7x0: | 508 | case Model_Zaurus_SLC7x0: |
496 | { | 509 | { |
497 | OHingeStatus hs = readHingeSensor(); | 510 | OHingeStatus hs = readHingeSensor(); |
498 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 511 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 4250356..4314aff 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -1,36 +1,36 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_ZAURUS | 30 | #ifndef ODEVICE_ZAURUS |
31 | #define ODEVICE_ZAURUS | 31 | #define ODEVICE_ZAURUS |
32 | 32 | ||
33 | #include "odevice_abstractmobiledevice.h" | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
@@ -104,41 +104,42 @@ class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter | |||
104 | virtual bool setDisplayBrightness( int b ); | 104 | virtual bool setDisplayBrightness( int b ); |
105 | virtual bool setDisplayStatus( bool on ); | 105 | virtual bool setDisplayStatus( bool on ); |
106 | virtual int displayBrightnessResolution() const; | 106 | virtual int displayBrightnessResolution() const; |
107 | 107 | ||
108 | virtual void playAlarmSound(); | 108 | virtual void playAlarmSound(); |
109 | virtual void playKeySound(); | 109 | virtual void playKeySound(); |
110 | virtual void playTouchSound(); | 110 | virtual void playTouchSound(); |
111 | 111 | ||
112 | virtual QValueList <OLed> ledList() const; | 112 | virtual QValueList <OLed> ledList() const; |
113 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 113 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
114 | virtual OLedState ledState( OLed led ) const; | 114 | virtual OLedState ledState( OLed led ) const; |
115 | virtual bool setLedState( OLed led, OLedState st ); | 115 | virtual bool setLedState( OLed led, OLedState st ); |
116 | 116 | ||
117 | virtual bool hasHingeSensor() const; | 117 | virtual bool hasHingeSensor() const; |
118 | virtual OHingeStatus readHingeSensor() const; | 118 | virtual OHingeStatus readHingeSensor() const; |
119 | 119 | ||
120 | virtual Transformation rotation() const; | 120 | virtual Transformation rotation() const; |
121 | virtual ODirection direction() const; | 121 | virtual ODirection direction() const; |
122 | virtual bool suspend(); | 122 | virtual bool suspend(); |
123 | 123 | ||
124 | protected: | 124 | protected: |
125 | virtual void buzzer( int snd ); | 125 | virtual void buzzer( int snd ); |
126 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 126 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
127 | 127 | ||
128 | QString m_backlightdev; | ||
128 | OLedState m_leds[1]; | 129 | OLedState m_leds[1]; |
129 | bool m_embedix; | 130 | bool m_embedix; |
130 | }; | 131 | }; |
131 | 132 | ||
132 | struct z_button { | 133 | struct z_button { |
133 | Qt::Key code; | 134 | Qt::Key code; |
134 | char *utext; | 135 | char *utext; |
135 | char *pix; | 136 | char *pix; |
136 | char *fpressedservice; | 137 | char *fpressedservice; |
137 | char *fpressedaction; | 138 | char *fpressedaction; |
138 | char *fheldservice; | 139 | char *fheldservice; |
139 | char *fheldaction; | 140 | char *fheldaction; |
140 | }; | 141 | }; |
141 | } | 142 | } |
142 | } | 143 | } |
143 | } | 144 | } |
144 | #endif | 145 | #endif |