Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 8aefc13..3bd7f6e 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,48 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Â Â Â Â Â Â Â Copyright (C) 2002,2003,2004 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; either version 2 of the License, |
12 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
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 | #include "odevice_zaurus.h" | 30 | #include "odevice_zaurus.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <opie2/oinputsystem.h> | 39 | #include <opie2/oinputsystem.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | #include <qpe/sound.h> | 42 | #include <qpe/sound.h> |
43 | #include <qpe/qcopenvelope_qws.h> | 43 | #include <qpe/qcopenvelope_qws.h> |
44 | 44 | ||
45 | /* STD */ | 45 | /* STD */ |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #include <math.h> | 47 | #include <math.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
@@ -178,91 +178,96 @@ void Zaurus::init(const QString& cpu_info) | |||
178 | if ( model == "SHARP Corgi" ) { | 178 | if ( model == "SHARP Corgi" ) { |
179 | d->m_model = Model_Zaurus_SLC7x0; | 179 | d->m_model = Model_Zaurus_SLC7x0; |
180 | d->m_modelstr = "Zaurus SL-C700"; | 180 | d->m_modelstr = "Zaurus SL-C700"; |
181 | } else if ( model == "SHARP Shepherd" ) { | 181 | } else if ( model == "SHARP Shepherd" ) { |
182 | d->m_model = Model_Zaurus_SLC7x0; | 182 | d->m_model = Model_Zaurus_SLC7x0; |
183 | d->m_modelstr = "Zaurus SL-C750"; | 183 | d->m_modelstr = "Zaurus SL-C750"; |
184 | } else if ( model == "SHARP Husky" ) { | 184 | } else if ( model == "SHARP Husky" ) { |
185 | d->m_model = Model_Zaurus_SLC7x0; | 185 | d->m_model = Model_Zaurus_SLC7x0; |
186 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 186 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
187 | } else if ( model == "SHARP Boxer" ) { | 187 | } else if ( model == "SHARP Boxer" ) { |
188 | d->m_model = Model_Zaurus_SLC7x0; | 188 | d->m_model = Model_Zaurus_SLC7x0; |
189 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 189 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
190 | } else if ( model == "SHARP Poodle" ) { | 190 | } else if ( model == "SHARP Poodle" ) { |
191 | d->m_model = Model_Zaurus_SLB600; | 191 | d->m_model = Model_Zaurus_SLB600; |
192 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 192 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
193 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 193 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
194 | d->m_model = Model_Zaurus_SL5500; | 194 | d->m_model = Model_Zaurus_SL5500; |
195 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 195 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
196 | } else if ( model == "SHARP Tosa" ) { | 196 | } else if ( model == "SHARP Tosa" ) { |
197 | d->m_model = Model_Zaurus_SL6000; | 197 | d->m_model = Model_Zaurus_SL6000; |
198 | d->m_modelstr = "Zaurus SL-6000"; | 198 | d->m_modelstr = "Zaurus SL-6000"; |
199 | } else if ( model == "SHARP Spitz" ) { | 199 | } else if ( model == "SHARP Spitz" ) { |
200 | d->m_model = Model_Zaurus_SLC3000; | 200 | d->m_model = Model_Zaurus_SLC3000; |
201 | d->m_modelstr = "Zaurus SL-C3000"; | 201 | d->m_modelstr = "Zaurus SL-C3000"; |
202 | } else if ( model == "SHARP Akita" ) { | ||
203 | d->m_model = Model_Zaurus_SLC1000; | ||
204 | d->m_modelstr = "Zaurus SL-C1000"; | ||
202 | } else { | 205 | } else { |
203 | d->m_model = Model_Zaurus_SL5500; | 206 | d->m_model = Model_Zaurus_SL5500; |
204 | d->m_modelstr = "Unknown Zaurus"; | 207 | d->m_modelstr = "Unknown Zaurus"; |
205 | } | 208 | } |
206 | 209 | ||
207 | // set initial rotation | 210 | // set initial rotation |
208 | switch( d->m_model ) { | 211 | switch( d->m_model ) { |
209 | case Model_Zaurus_SL6000: // fallthrough | 212 | case Model_Zaurus_SL6000: // fallthrough |
210 | case Model_Zaurus_SLA300: | 213 | case Model_Zaurus_SLA300: |
211 | d->m_rotation = Rot0; | 214 | d->m_rotation = Rot0; |
212 | break; | 215 | break; |
213 | case Model_Zaurus_SLC3000: // fallthrough | 216 | case Model_Zaurus_SLC3000: // fallthrough |
217 | case Model_Zaurus_SLC1000: // fallthrough | ||
214 | case Model_Zaurus_SLC7x0: | 218 | case Model_Zaurus_SLC7x0: |
215 | d->m_rotation = rotation(); | 219 | d->m_rotation = rotation(); |
216 | d->m_direction = direction(); | 220 | d->m_direction = direction(); |
217 | break; | 221 | break; |
218 | case Model_Zaurus_SLB600: // fallthrough | 222 | case Model_Zaurus_SLB600: // fallthrough |
219 | case Model_Zaurus_SL5000: // fallthrough | 223 | case Model_Zaurus_SL5000: // fallthrough |
220 | case Model_Zaurus_SL5500: // fallthrough | 224 | case Model_Zaurus_SL5500: // fallthrough |
221 | default: | 225 | default: |
222 | d->m_rotation = Rot270; | 226 | d->m_rotation = Rot270; |
223 | break; | 227 | break; |
224 | } | 228 | } |
225 | m_leds[0] = Led_Off; | 229 | m_leds[0] = Led_Off; |
226 | 230 | ||
227 | if ( m_embedix ) | 231 | if ( m_embedix ) |
228 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); | 232 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); |
229 | else | 233 | else |
230 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); | 234 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); |
231 | } | 235 | } |
232 | 236 | ||
233 | void Zaurus::initButtons() | 237 | void Zaurus::initButtons() |
234 | { | 238 | { |
235 | if ( d->m_buttons ) | 239 | if ( d->m_buttons ) |
236 | return; | 240 | return; |
237 | 241 | ||
238 | 242 | ||
239 | d->m_buttons = new QValueList <ODeviceButton>; | 243 | d->m_buttons = new QValueList <ODeviceButton>; |
240 | 244 | ||
241 | struct z_button * pz_buttons; | 245 | struct z_button * pz_buttons; |
242 | int buttoncount; | 246 | int buttoncount; |
243 | switch ( d->m_model ) { | 247 | switch ( d->m_model ) { |
244 | case Model_Zaurus_SLC3000: // fallthrough | 248 | case Model_Zaurus_SLC3000: // fallthrough |
249 | case Model_Zaurus_SLC1000: // fallthrough | ||
245 | case Model_Zaurus_SLC7x0: | 250 | case Model_Zaurus_SLC7x0: |
246 | if ( isQWS( ) ) { | 251 | if ( isQWS( ) ) { |
247 | addPreHandler(this); // hinge-sensor-handler | 252 | addPreHandler(this); // hinge-sensor-handler |
248 | } | 253 | } |
249 | pz_buttons = z_buttons_c700; | 254 | pz_buttons = z_buttons_c700; |
250 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 255 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
251 | break; | 256 | break; |
252 | default: | 257 | default: |
253 | pz_buttons = z_buttons; | 258 | pz_buttons = z_buttons; |
254 | buttoncount = ARRAY_SIZE(z_buttons); | 259 | buttoncount = ARRAY_SIZE(z_buttons); |
255 | break; | 260 | break; |
256 | } | 261 | } |
257 | 262 | ||
258 | for ( int i = 0; i < buttoncount; i++ ) { | 263 | for ( int i = 0; i < buttoncount; i++ ) { |
259 | struct z_button *zb = pz_buttons + i; | 264 | struct z_button *zb = pz_buttons + i; |
260 | ODeviceButton b; | 265 | ODeviceButton b; |
261 | 266 | ||
262 | b.setKeycode( zb->code ); | 267 | b.setKeycode( zb->code ); |
263 | b.setUserText( QObject::tr( "Button", zb->utext )); | 268 | b.setUserText( QObject::tr( "Button", zb->utext )); |
264 | b.setPixmap( Resource::loadPixmap( zb->pix )); | 269 | b.setPixmap( Resource::loadPixmap( zb->pix )); |
265 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 270 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
266 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 271 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
267 | d->m_buttons->append( b ); | 272 | d->m_buttons->append( b ); |
268 | } | 273 | } |
@@ -473,107 +478,109 @@ bool Zaurus::setDisplayStatus( bool on ) | |||
473 | } | 478 | } |
474 | } | 479 | } |
475 | else | 480 | else |
476 | { | 481 | { |
477 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); | 482 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); |
478 | if ( fd ) | 483 | if ( fd ) |
479 | { | 484 | { |
480 | char buf[10]; | 485 | char buf[10]; |
481 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 486 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
482 | buf[1] = '\0'; | 487 | buf[1] = '\0'; |
483 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 488 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
484 | ::close( fd ); | 489 | ::close( fd ); |
485 | } | 490 | } |
486 | } | 491 | } |
487 | return res; | 492 | return res; |
488 | } | 493 | } |
489 | 494 | ||
490 | Transformation Zaurus::rotation() const | 495 | Transformation Zaurus::rotation() const |
491 | { | 496 | { |
492 | qDebug( "Zaurus::rotation()" ); | 497 | qDebug( "Zaurus::rotation()" ); |
493 | Transformation rot; | 498 | Transformation rot; |
494 | 499 | ||
495 | switch ( d->m_model ) { | 500 | switch ( d->m_model ) { |
496 | case Model_Zaurus_SLC3000: // fallthrough | 501 | case Model_Zaurus_SLC3000: // fallthrough |
502 | case Model_Zaurus_SLC1000: // fallthrough | ||
497 | case Model_Zaurus_SLC7x0: | 503 | case Model_Zaurus_SLC7x0: |
498 | { | 504 | { |
499 | OHingeStatus hs = readHingeSensor(); | 505 | OHingeStatus hs = readHingeSensor(); |
500 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 506 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
501 | 507 | ||
502 | if ( m_embedix ) | 508 | if ( m_embedix ) |
503 | { | 509 | { |
504 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 510 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
505 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 511 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
506 | else rot = Rot270; | 512 | else rot = Rot270; |
507 | } | 513 | } |
508 | else | 514 | else |
509 | { | 515 | { |
510 | if ( hs == CASE_PORTRAIT ) rot = Rot90; | 516 | if ( hs == CASE_PORTRAIT ) rot = Rot90; |
511 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 517 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
512 | else rot = Rot0; | 518 | else rot = Rot0; |
513 | } | 519 | } |
514 | } | 520 | } |
515 | break; | 521 | break; |
516 | case Model_Zaurus_SL6000: | 522 | case Model_Zaurus_SL6000: |
517 | case Model_Zaurus_SLB600: | 523 | case Model_Zaurus_SLB600: |
518 | case Model_Zaurus_SLA300: | 524 | case Model_Zaurus_SLA300: |
519 | case Model_Zaurus_SL5500: | 525 | case Model_Zaurus_SL5500: |
520 | case Model_Zaurus_SL5000: | 526 | case Model_Zaurus_SL5000: |
521 | default: | 527 | default: |
522 | rot = d->m_rotation; | 528 | rot = d->m_rotation; |
523 | break; | 529 | break; |
524 | } | 530 | } |
525 | 531 | ||
526 | return rot; | 532 | return rot; |
527 | } | 533 | } |
528 | ODirection Zaurus::direction() const | 534 | ODirection Zaurus::direction() const |
529 | { | 535 | { |
530 | ODirection dir; | 536 | ODirection dir; |
531 | 537 | ||
532 | switch ( d->m_model ) { | 538 | switch ( d->m_model ) { |
533 | case Model_Zaurus_SLC3000: // fallthrough | 539 | case Model_Zaurus_SLC3000: // fallthrough |
540 | case Model_Zaurus_SLC1000: // fallthrough | ||
534 | case Model_Zaurus_SLC7x0: { | 541 | case Model_Zaurus_SLC7x0: { |
535 | OHingeStatus hs = readHingeSensor(); | 542 | OHingeStatus hs = readHingeSensor(); |
536 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 543 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
537 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 544 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
538 | else dir = CW; | 545 | else dir = CW; |
539 | } | 546 | } |
540 | break; | 547 | break; |
541 | case Model_Zaurus_SL6000: | 548 | case Model_Zaurus_SL6000: |
542 | case Model_Zaurus_SLA300: | 549 | case Model_Zaurus_SLA300: |
543 | case Model_Zaurus_SLB600: | 550 | case Model_Zaurus_SLB600: |
544 | case Model_Zaurus_SL5500: | 551 | case Model_Zaurus_SL5500: |
545 | case Model_Zaurus_SL5000: | 552 | case Model_Zaurus_SL5000: |
546 | default: dir = d->m_direction; | 553 | default: dir = d->m_direction; |
547 | break; | 554 | break; |
548 | } | 555 | } |
549 | return dir; | 556 | return dir; |
550 | 557 | ||
551 | } | 558 | } |
552 | 559 | ||
553 | bool Zaurus::hasHingeSensor() const | 560 | bool Zaurus::hasHingeSensor() const |
554 | { | 561 | { |
555 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; | 562 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000 || d->m_model == Model_Zaurus_SLC1000; |
556 | } | 563 | } |
557 | 564 | ||
558 | OHingeStatus Zaurus::readHingeSensor() const | 565 | OHingeStatus Zaurus::readHingeSensor() const |
559 | { | 566 | { |
560 | if (m_embedix) | 567 | if (m_embedix) |
561 | { | 568 | { |
562 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); | 569 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); |
563 | if (handle == -1) | 570 | if (handle == -1) |
564 | { | 571 | { |
565 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror | 572 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror |
566 | return CASE_UNKNOWN; | 573 | return CASE_UNKNOWN; |
567 | } | 574 | } |
568 | else | 575 | else |
569 | { | 576 | { |
570 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); | 577 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); |
571 | ::close (handle); | 578 | ::close (handle); |
572 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) | 579 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) |
573 | { | 580 | { |
574 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); | 581 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); |
575 | return static_cast<OHingeStatus>( retval ); | 582 | return static_cast<OHingeStatus>( retval ); |
576 | } | 583 | } |
577 | else | 584 | else |
578 | { | 585 | { |
579 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 586 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
@@ -581,49 +588,49 @@ OHingeStatus Zaurus::readHingeSensor() const | |||
581 | } | 588 | } |
582 | } | 589 | } |
583 | } | 590 | } |
584 | else | 591 | else |
585 | { | 592 | { |
586 | // corgi keyboard is event source 0 in OZ kernel 2.6 | 593 | // corgi keyboard is event source 0 in OZ kernel 2.6 |
587 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); | 594 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); |
588 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; | 595 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; |
589 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; | 596 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; |
590 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; | 597 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; |
591 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 598 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
592 | return CASE_UNKNOWN; | 599 | return CASE_UNKNOWN; |
593 | } | 600 | } |
594 | } | 601 | } |
595 | 602 | ||
596 | /* | 603 | /* |
597 | * Take code from iPAQ device. | 604 | * Take code from iPAQ device. |
598 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. | 605 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. |
599 | * I hope that is ok - Alwin | 606 | * I hope that is ok - Alwin |
600 | */ | 607 | */ |
601 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 608 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
602 | { | 609 | { |
603 | int newkeycode = keycode; | 610 | int newkeycode = keycode; |
604 | 611 | ||
605 | if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false; | 612 | if (d->m_model != Model_Zaurus_SLC7x0 && d->m_model != Model_Zaurus_SLC3000 && d->m_model != Model_Zaurus_SLC1000) return false; |
606 | 613 | ||
607 | /* map cursor keys depending on the hinge status */ | 614 | /* map cursor keys depending on the hinge status */ |
608 | switch ( keycode ) { | 615 | switch ( keycode ) { |
609 | // Rotate cursor keys | 616 | // Rotate cursor keys |
610 | case Key_Left : | 617 | case Key_Left : |
611 | case Key_Right: | 618 | case Key_Right: |
612 | case Key_Up : | 619 | case Key_Up : |
613 | case Key_Down : | 620 | case Key_Down : |
614 | { | 621 | { |
615 | if (rotation()==Rot90) { | 622 | if (rotation()==Rot90) { |
616 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 623 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
617 | } | 624 | } |
618 | } | 625 | } |
619 | break; | 626 | break; |
620 | 627 | ||
621 | } | 628 | } |
622 | if (newkeycode!=keycode) { | 629 | if (newkeycode!=keycode) { |
623 | if ( newkeycode != Key_unknown ) { | 630 | if ( newkeycode != Key_unknown ) { |
624 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 631 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
625 | } | 632 | } |
626 | return true; | 633 | return true; |
627 | } | 634 | } |
628 | return false; | 635 | return false; |
629 | } | 636 | } |