-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 73 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 6 |
2 files changed, 71 insertions, 8 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 33d5cd6..a75f566 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -23,48 +23,50 @@ | |||
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 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/oinputsystem.h> | 33 | #include <opie2/oinputsystem.h> |
34 | #include <opie2/oresource.h> | 34 | #include <opie2/oresource.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/sound.h> | 37 | #include <qpe/sound.h> |
38 | 38 | ||
39 | /* QT */ | 39 | /* QT */ |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | #include <qwindowsystem_qws.h> | 43 | #include <qwindowsystem_qws.h> |
44 | #include <qcopchannel_qws.h> | 44 | #include <qcopchannel_qws.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | #include <string.h> | ||
48 | #include <errno.h> | ||
47 | #include <fcntl.h> | 49 | #include <fcntl.h> |
48 | #include <math.h> | 50 | #include <math.h> |
49 | #include <stdlib.h> | 51 | #include <stdlib.h> |
50 | #include <signal.h> | 52 | #include <signal.h> |
51 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
52 | #include <sys/time.h> | 54 | #include <sys/time.h> |
53 | #include <unistd.h> | 55 | #include <unistd.h> |
54 | #ifndef QT_NO_SOUND | 56 | #ifndef QT_NO_SOUND |
55 | #include <linux/soundcard.h> | 57 | #include <linux/soundcard.h> |
56 | #endif | 58 | #endif |
57 | 59 | ||
58 | using namespace Opie::Core; | 60 | using namespace Opie::Core; |
59 | using namespace Opie::Core::Internal; | 61 | using namespace Opie::Core::Internal; |
60 | 62 | ||
61 | struct z_button z_buttons [] = { | 63 | struct z_button z_buttons [] = { |
62 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 64 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
63 | "devicebuttons/z_calendar", | 65 | "devicebuttons/z_calendar", |
64 | "datebook", "nextView()", | 66 | "datebook", "nextView()", |
65 | "today", "raise()" }, | 67 | "today", "raise()" }, |
66 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 68 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
67 | "devicebuttons/z_contact", | 69 | "devicebuttons/z_contact", |
68 | "addressbook", "raise()", | 70 | "addressbook", "raise()", |
69 | "addressbook", "beamBusinessCard()" }, | 71 | "addressbook", "beamBusinessCard()" }, |
70 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 72 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
@@ -283,50 +285,52 @@ void Zaurus::init(const QString& cpu_info) | |||
283 | qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); | 285 | qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); |
284 | else | 286 | else |
285 | qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); | 287 | qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); |
286 | } | 288 | } |
287 | 289 | ||
288 | void Zaurus::initButtons() | 290 | void Zaurus::initButtons() |
289 | { | 291 | { |
290 | if ( d->m_buttons ) | 292 | if ( d->m_buttons ) |
291 | return; | 293 | return; |
292 | 294 | ||
293 | d->m_buttons = new QValueList <ODeviceButton>; | 295 | d->m_buttons = new QValueList <ODeviceButton>; |
294 | 296 | ||
295 | struct z_button * pz_buttons; | 297 | struct z_button * pz_buttons; |
296 | int buttoncount; | 298 | int buttoncount; |
297 | switch ( d->m_model ) | 299 | switch ( d->m_model ) |
298 | { | 300 | { |
299 | case Model_Zaurus_SL6000: | 301 | case Model_Zaurus_SL6000: |
300 | pz_buttons = z_buttons_6000; | 302 | pz_buttons = z_buttons_6000; |
301 | buttoncount = ARRAY_SIZE(z_buttons_6000); | 303 | buttoncount = ARRAY_SIZE(z_buttons_6000); |
302 | break; | 304 | break; |
303 | case Model_Zaurus_SLC3100: // fallthrough | 305 | case Model_Zaurus_SLC3100: // fallthrough |
304 | case Model_Zaurus_SLC3000: // fallthrough | 306 | case Model_Zaurus_SLC3000: // fallthrough |
305 | case Model_Zaurus_SLC1000: // fallthrough | 307 | case Model_Zaurus_SLC1000: // fallthrough |
306 | case Model_Zaurus_SLC7x0: | 308 | case Model_Zaurus_SLC7x0: |
307 | if ( isQWS( ) ) { | 309 | if ( isQWS( ) ) |
308 | addPreHandler(this); // hinge-sensor-handler | 310 | { // setup hinge sensor stuff |
311 | addPreHandler(this); | ||
312 | initHingeSensor(); | ||
309 | } | 313 | } |
310 | pz_buttons = z_buttons_c700; | 314 | pz_buttons = z_buttons_c700; |
311 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 315 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
312 | break; | 316 | break; |
313 | default: | 317 | default: |
314 | pz_buttons = z_buttons; | 318 | pz_buttons = z_buttons; |
315 | buttoncount = ARRAY_SIZE(z_buttons); | 319 | buttoncount = ARRAY_SIZE(z_buttons); |
316 | break; | 320 | break; |
317 | } | 321 | } |
318 | 322 | ||
319 | for ( int i = 0; i < buttoncount; i++ ) { | 323 | for ( int i = 0; i < buttoncount; i++ ) { |
320 | struct z_button *zb = pz_buttons + i; | 324 | struct z_button *zb = pz_buttons + i; |
321 | ODeviceButton b; | 325 | ODeviceButton b; |
322 | 326 | ||
323 | b.setKeycode( zb->code ); | 327 | b.setKeycode( zb->code ); |
324 | b.setUserText( QObject::tr( "Button", zb->utext )); | 328 | b.setUserText( QObject::tr( "Button", zb->utext )); |
325 | b.setPixmap( OResource::loadPixmap( zb->pix )); | 329 | b.setPixmap( OResource::loadPixmap( zb->pix )); |
326 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 330 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
327 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 331 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
328 | d->m_buttons->append( b ); | 332 | d->m_buttons->append( b ); |
329 | } | 333 | } |
330 | 334 | ||
331 | reloadButtonMapping(); | 335 | reloadButtonMapping(); |
332 | } | 336 | } |
@@ -641,55 +645,108 @@ OHingeStatus Zaurus::readHingeSensor() const | |||
641 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); | 645 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); |
642 | if (handle == -1) | 646 | if (handle == -1) |
643 | { | 647 | { |
644 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror | 648 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror |
645 | return CASE_UNKNOWN; | 649 | return CASE_UNKNOWN; |
646 | } | 650 | } |
647 | else | 651 | else |
648 | { | 652 | { |
649 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); | 653 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); |
650 | ::close (handle); | 654 | ::close (handle); |
651 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) | 655 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) |
652 | { | 656 | { |
653 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); | 657 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); |
654 | return static_cast<OHingeStatus>( retval ); | 658 | return static_cast<OHingeStatus>( retval ); |
655 | } | 659 | } |
656 | else | 660 | else |
657 | { | 661 | { |
658 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 662 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
659 | return CASE_UNKNOWN; | 663 | return CASE_UNKNOWN; |
660 | } | 664 | } |
661 | } | 665 | } |
662 | } | 666 | } |
663 | else | 667 | else |
664 | { | 668 | { |
665 | // corgi keyboard is event source 0 in OZ kernel 2.6 | 669 | /* |
670 | * The corgi keyboard is event source 0 in OZ kernel 2.6. | ||
671 | * Hinge status is reported via Input System Switchs 0 and 1 like that: | ||
672 | * | ||
673 | * ------------------------- | ||
674 | * | SW0 | SW1 | CASE | | ||
675 | * |-----|-----|-----------| | ||
676 | * | 0 0 Landscape | | ||
677 | * | 0 1 Portrait | | ||
678 | * | 1 0 Unknown | | ||
679 | * | 1 1 Closed | | ||
680 | * ------------------------- | ||
681 | */ | ||
666 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); | 682 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); |
667 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; | 683 | bool switch0 = true; |
668 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; | 684 | bool switch1 = false; |
669 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; | 685 | if ( keyboard ) |
670 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 686 | { |
671 | return CASE_UNKNOWN; | 687 | switch0 = keyboard->isHeld( OInputDevice::Switch0 ); |
688 | switch1 = keyboard->isHeld( OInputDevice::Switch1 ); | ||
689 | } | ||
690 | if ( switch0 ) | ||
691 | { | ||
692 | return switch1 ? CASE_CLOSED : CASE_UNKNOWN; | ||
693 | } | ||
694 | else | ||
695 | { | ||
696 | return switch1 ? CASE_PORTRAIT : CASE_LANDSCAPE; | ||
697 | } | ||
698 | } | ||
699 | } | ||
700 | |||
701 | void Zaurus::initHingeSensor() | ||
702 | { | ||
703 | if ( m_embedix ) return; | ||
704 | |||
705 | m_hinge.setName( "/dev/input/event0" ); | ||
706 | if ( !m_hinge.open( IO_ReadOnly ) ) | ||
707 | { | ||
708 | qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); | ||
709 | return; | ||
710 | } | ||
711 | |||
712 | QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); | ||
713 | QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); | ||
714 | } | ||
715 | |||
716 | void Zaurus::hingeSensorTriggered() | ||
717 | { | ||
718 | qDebug( "Zaurus::hingeSensorTriggered() - got event" ); | ||
719 | struct input_event e; | ||
720 | if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 ) | ||
721 | { | ||
722 | qDebug( "Zaurus::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value ); | ||
723 | if ( e.type != EV_SW ) return; | ||
724 | if ( readHingeSensor() != CASE_UNKNOWN ) | ||
725 | { | ||
726 | qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); | ||
727 | QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); | ||
728 | } | ||
672 | } | 729 | } |
673 | } | 730 | } |
674 | 731 | ||
675 | /* | 732 | /* |
676 | * Take code from iPAQ device. | 733 | * Take code from iPAQ device. |
677 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. | 734 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. |
678 | * I hope that is ok - Alwin | 735 | * I hope that is ok - Alwin |
679 | */ | 736 | */ |
680 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 737 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
681 | { | 738 | { |
682 | int newkeycode = keycode; | 739 | int newkeycode = keycode; |
683 | 740 | ||
684 | if ( !hasHingeSensor() ) return false; | 741 | if ( !hasHingeSensor() ) return false; |
685 | 742 | ||
686 | /* map cursor keys depending on the hinge status */ | 743 | /* map cursor keys depending on the hinge status */ |
687 | switch ( keycode ) { | 744 | switch ( keycode ) { |
688 | // Rotate cursor keys | 745 | // Rotate cursor keys |
689 | case Key_Left : | 746 | case Key_Left : |
690 | case Key_Right: | 747 | case Key_Right: |
691 | case Key_Up : | 748 | case Key_Up : |
692 | case Key_Down : | 749 | case Key_Down : |
693 | { | 750 | { |
694 | if (rotation()==Rot90) { | 751 | if (rotation()==Rot90) { |
695 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 752 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 677e29f..bf30bc6 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -12,48 +12,49 @@ | |||
12 | ._= =} : | 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 <qfile.h> | ||
36 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
37 | 38 | ||
38 | #ifndef ARRAY_SIZE | 39 | #ifndef ARRAY_SIZE |
39 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 40 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | // _IO and friends are only defined in kernel headers ... | 43 | // _IO and friends are only defined in kernel headers ... |
43 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 44 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
44 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 45 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
45 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 46 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
46 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 47 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
47 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 48 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
48 | 49 | ||
49 | // Audio | 50 | // Audio |
50 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 51 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
51 | 52 | ||
52 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 53 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
53 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 54 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
54 | 55 | ||
55 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 56 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
56 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 57 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
57 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 58 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
58 | 59 | ||
59 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 60 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
@@ -78,68 +79,73 @@ | |||
78 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 79 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
79 | #define APM_EVT_POWER_BUTTON (1 << 0) | 80 | #define APM_EVT_POWER_BUTTON (1 << 0) |
80 | 81 | ||
81 | // Brightness Embedix | 82 | // Brightness Embedix |
82 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" | 83 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" |
83 | #define SHARP_FL_IOCTL_ON 1 | 84 | #define SHARP_FL_IOCTL_ON 1 |
84 | #define SHARP_FL_IOCTL_OFF 2 | 85 | #define SHARP_FL_IOCTL_OFF 2 |
85 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 | 86 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 |
86 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 | 87 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 |
87 | #define SHARP_FL_IOCTL_GET_STEP 102 | 88 | #define SHARP_FL_IOCTL_GET_STEP 102 |
88 | 89 | ||
89 | // Vesa Standard | 90 | // Vesa Standard |
90 | #define FB_BLANK_UNBLANK 0 | 91 | #define FB_BLANK_UNBLANK 0 |
91 | #define FB_BLANK_POWERDOWN 4 | 92 | #define FB_BLANK_POWERDOWN 4 |
92 | 93 | ||
93 | namespace Opie { | 94 | namespace Opie { |
94 | namespace Core { | 95 | namespace Core { |
95 | namespace Internal { | 96 | namespace Internal { |
96 | 97 | ||
97 | class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter | 98 | class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter |
98 | { | 99 | { |
99 | protected: | 100 | protected: |
100 | virtual void init(const QString&); | 101 | virtual void init(const QString&); |
101 | virtual void initButtons(); | 102 | virtual void initButtons(); |
103 | void initHingeSensor(); | ||
104 | |||
105 | protected slots: | ||
106 | void hingeSensorTriggered(); | ||
102 | 107 | ||
103 | public: | 108 | public: |
104 | virtual bool setDisplayBrightness( int b ); | 109 | virtual bool setDisplayBrightness( int b ); |
105 | virtual bool setDisplayStatus( bool on ); | 110 | virtual bool setDisplayStatus( bool on ); |
106 | virtual int displayBrightnessResolution() const; | 111 | virtual int displayBrightnessResolution() const; |
107 | 112 | ||
108 | virtual void playAlarmSound(); | 113 | virtual void playAlarmSound(); |
109 | virtual void playKeySound(); | 114 | virtual void playKeySound(); |
110 | virtual void playTouchSound(); | 115 | virtual void playTouchSound(); |
111 | 116 | ||
112 | virtual QValueList <OLed> ledList() const; | 117 | virtual QValueList <OLed> ledList() const; |
113 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 118 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
114 | virtual OLedState ledState( OLed led ) const; | 119 | virtual OLedState ledState( OLed led ) const; |
115 | virtual bool setLedState( OLed led, OLedState st ); | 120 | virtual bool setLedState( OLed led, OLedState st ); |
116 | 121 | ||
117 | virtual bool hasHingeSensor() const; | 122 | virtual bool hasHingeSensor() const; |
118 | virtual OHingeStatus readHingeSensor() const; | 123 | virtual OHingeStatus readHingeSensor() const; |
119 | 124 | ||
120 | virtual Transformation rotation() const; | 125 | virtual Transformation rotation() const; |
121 | virtual ODirection direction() const; | 126 | virtual ODirection direction() const; |
122 | virtual bool suspend(); | 127 | virtual bool suspend(); |
123 | 128 | ||
124 | protected: | 129 | protected: |
125 | virtual void buzzer( int snd ); | 130 | virtual void buzzer( int snd ); |
126 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 131 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
127 | 132 | ||
128 | QString m_backlightdev; | 133 | QString m_backlightdev; |
129 | OLedState m_leds[1]; | 134 | OLedState m_leds[1]; |
130 | bool m_embedix; | 135 | bool m_embedix; |
136 | QFile m_hinge; | ||
131 | }; | 137 | }; |
132 | 138 | ||
133 | struct z_button { | 139 | struct z_button { |
134 | Qt::Key code; | 140 | Qt::Key code; |
135 | char *utext; | 141 | char *utext; |
136 | char *pix; | 142 | char *pix; |
137 | char *fpressedservice; | 143 | char *fpressedservice; |
138 | char *fpressedaction; | 144 | char *fpressedaction; |
139 | char *fheldservice; | 145 | char *fheldservice; |
140 | char *fheldaction; | 146 | char *fheldaction; |
141 | }; | 147 | }; |
142 | } | 148 | } |
143 | } | 149 | } |
144 | } | 150 | } |
145 | #endif | 151 | #endif |