-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 53 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 45 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 3 |
4 files changed, 58 insertions, 46 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 0068d88..cd3a84c 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -1,95 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 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_ipaq.h" | 30 | #include "odevice_ipaq.h" |
31 | #include "odevice_jornada.h" | 31 | #include "odevice_jornada.h" |
32 | #include "odevice_ramses.h" | 32 | #include "odevice_ramses.h" |
33 | #include "odevice_simpad.h" | 33 | #include "odevice_simpad.h" |
34 | #include "odevice_yopy.h" | 34 | #include "odevice_yopy.h" |
35 | #include "odevice_zaurus.h" | 35 | #include "odevice_zaurus.h" |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qwindowsystem_qws.h> | 41 | #include <qwindowsystem_qws.h> |
42 | 42 | ||
43 | /* OPIE */ | 43 | /* OPIE */ |
44 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
45 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
46 | #include <qpe/sound.h> | 46 | #include <qpe/sound.h> |
47 | #include <qpe/qcopenvelope_qws.h> | 47 | #include <qpe/qcopenvelope_qws.h> |
48 | #include <opie2/okeyfilter.h> | ||
48 | 49 | ||
49 | /* STD */ | 50 | /* STD */ |
50 | #include <fcntl.h> | 51 | #include <fcntl.h> |
51 | #include <math.h> | 52 | #include <math.h> |
52 | #include <stdlib.h> | 53 | #include <stdlib.h> |
53 | #include <signal.h> | 54 | #include <signal.h> |
54 | #include <sys/ioctl.h> | 55 | #include <sys/ioctl.h> |
55 | #include <sys/time.h> | 56 | #include <sys/time.h> |
56 | #include <unistd.h> | 57 | #include <unistd.h> |
57 | #ifndef QT_NO_SOUND | 58 | #ifndef QT_NO_SOUND |
58 | #include <linux/soundcard.h> | 59 | #include <linux/soundcard.h> |
59 | #endif | 60 | #endif |
60 | 61 | ||
61 | namespace Opie { | 62 | namespace Opie { |
62 | namespace Core { | 63 | namespace Core { |
63 | 64 | ||
64 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 65 | static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
65 | 66 | ||
66 | 67 | ||
67 | /* STATIC and common implementation */ | 68 | /* STATIC and common implementation */ |
68 | /* EXPORT */ ODistribution distributions[] = { | 69 | /* EXPORT */ ODistribution distributions[] = { |
69 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | 70 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, |
70 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | 71 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, |
71 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | 72 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, |
72 | { System_Unknown, "Linux", "/etc/issue" }, | 73 | { System_Unknown, "Linux", "/etc/issue" }, |
73 | }; | 74 | }; |
74 | 75 | ||
75 | 76 | ||
76 | /* EXPORT */ bool isQWS(){ | 77 | /* EXPORT */ bool isQWS(){ |
77 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 78 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
78 | } | 79 | } |
79 | 80 | ||
80 | /* EXPORT */ QCString makeChannel ( const char *str ){ | 81 | /* EXPORT */ QCString makeChannel ( const char *str ){ |
81 | if ( str && !::strchr ( str, '/' )) | 82 | if ( str && !::strchr ( str, '/' )) |
82 | return QCString ( "QPE/Application/" ) + str; | 83 | return QCString ( "QPE/Application/" ) + str; |
83 | else | 84 | else |
84 | return str; | 85 | return str; |
85 | } | 86 | } |
86 | 87 | ||
87 | 88 | ||
88 | 89 | ||
89 | /* Now the default implementation of ODevice */ | 90 | /* Now the default implementation of ODevice */ |
90 | 91 | ||
91 | struct default_button default_buttons [] = { | 92 | struct default_button default_buttons [] = { |
92 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 93 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
93 | "devicebuttons/z_calendar", | 94 | "devicebuttons/z_calendar", |
94 | "datebook", "nextView()", | 95 | "datebook", "nextView()", |
95 | "today", "raise()" }, | 96 | "today", "raise()" }, |
@@ -667,51 +668,61 @@ void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) | |||
667 | return; | 668 | return; |
668 | 669 | ||
669 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 670 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
670 | b. setPressedAction ( action ); | 671 | b. setPressedAction ( action ); |
671 | 672 | ||
672 | mb_chan=b. pressedAction(). channel(); | 673 | mb_chan=b. pressedAction(). channel(); |
673 | 674 | ||
674 | Config buttonFile ( "ButtonSettings" ); | 675 | Config buttonFile ( "ButtonSettings" ); |
675 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 676 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
676 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); | 677 | buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); |
677 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); | 678 | buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction(). message()); |
678 | 679 | ||
679 | //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); | 680 | //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction(). data())); |
680 | 681 | ||
681 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 682 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
682 | } | 683 | } |
683 | 684 | ||
684 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | 685 | void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) |
685 | { | 686 | { |
686 | initButtons(); | 687 | initButtons(); |
687 | 688 | ||
688 | if ( button >= (int) d->m_buttons->count()) | 689 | if ( button >= (int) d->m_buttons->count()) |
689 | return; | 690 | return; |
690 | 691 | ||
691 | ODeviceButton &b = ( *d->m_buttons ) [button]; | 692 | ODeviceButton &b = ( *d->m_buttons ) [button]; |
692 | b. setHeldAction ( action ); | 693 | b. setHeldAction ( action ); |
693 | 694 | ||
694 | Config buttonFile ( "ButtonSettings" ); | 695 | Config buttonFile ( "ButtonSettings" ); |
695 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 696 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
696 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); | 697 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); |
697 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); | 698 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); |
698 | 699 | ||
699 | //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); | 700 | //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); |
700 | 701 | ||
701 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 702 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
702 | } | 703 | } |
703 | void ODevice::virtual_hook(int, void* ){ | 704 | void ODevice::virtual_hook(int, void* ){ |
704 | 705 | ||
705 | } | 706 | } |
706 | 707 | ||
707 | void ODevice::sendSuspendmsg() | 708 | void ODevice::sendSuspendmsg() |
708 | { | 709 | { |
709 | if ( isQWS() ) | 710 | if ( isQWS() ) |
710 | return; | 711 | return; |
711 | 712 | ||
712 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); | 713 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); |
713 | } | 714 | } |
714 | 715 | ||
716 | void ODevice::addPreHandler(QWSServer::KeyboardFilter*aFilter) | ||
717 | { | ||
718 | Opie::Core::OKeyFilter::inst()->addPreHandler(aFilter); | ||
719 | } | ||
720 | |||
721 | void ODevice::remPreHandler(QWSServer::KeyboardFilter*aFilter) | ||
722 | { | ||
723 | Opie::Core::OKeyFilter::inst()->remPreHandler(aFilter); | ||
724 | } | ||
725 | |||
715 | 726 | ||
716 | } | 727 | } |
717 | } | 728 | } |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 0465d7e..762d3f1 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -1,89 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 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 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qstrlist.h> | 41 | #include <qstrlist.h> |
42 | #include <qwindowsystem_qws.h> | ||
42 | 43 | ||
43 | namespace Opie{ | 44 | namespace Opie{ |
44 | namespace Core{ | 45 | namespace Core{ |
45 | 46 | ||
46 | class ODeviceData; | 47 | class ODeviceData; |
47 | /** | 48 | /** |
48 | * The available devices | 49 | * The available devices |
49 | */ | 50 | */ |
50 | enum OModel { | 51 | enum OModel { |
51 | Model_Unknown, // = 0 | 52 | Model_Unknown, // = 0 |
52 | 53 | ||
53 | Model_Series_Mask = 0xff000000, | 54 | Model_Series_Mask = 0xff000000, |
54 | 55 | ||
55 | Model_iPAQ = ( 1 << 24 ), | 56 | Model_iPAQ = ( 1 << 24 ), |
56 | 57 | ||
57 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 58 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
58 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 59 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
59 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 60 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
60 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 61 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
61 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 62 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
62 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 63 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
63 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), | 64 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), |
64 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), | 65 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), |
65 | 66 | ||
66 | Model_Jornada = ( 6 << 24 ), | 67 | Model_Jornada = ( 6 << 24 ), |
67 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 68 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
68 | 69 | ||
69 | Model_Zaurus = ( 2 << 24 ), | 70 | Model_Zaurus = ( 2 << 24 ), |
70 | 71 | ||
71 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 72 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
72 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 73 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
73 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 74 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
74 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 75 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
75 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 76 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
76 | 77 | ||
77 | Model_SIMpad = ( 3 << 24 ), | 78 | Model_SIMpad = ( 3 << 24 ), |
78 | 79 | ||
79 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 80 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
80 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 81 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
81 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 82 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
82 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 83 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
83 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 84 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
84 | 85 | ||
85 | Model_Ramses = ( 4 << 24 ), | 86 | Model_Ramses = ( 4 << 24 ), |
86 | 87 | ||
87 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 88 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
88 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 89 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
89 | 90 | ||
@@ -274,85 +275,87 @@ public: | |||
274 | 275 | ||
275 | virtual bool hasHingeSensor() const; | 276 | virtual bool hasHingeSensor() const; |
276 | virtual OHingeStatus readHingeSensor(); | 277 | virtual OHingeStatus readHingeSensor(); |
277 | 278 | ||
278 | const QStrList &allowedCpuFrequencies() const; | 279 | const QStrList &allowedCpuFrequencies() const; |
279 | bool setCurrentCpuFrequency(uint index); | 280 | bool setCurrentCpuFrequency(uint index); |
280 | 281 | ||
281 | /** | 282 | /** |
282 | * Returns the available buttons on this device. The number and location | 283 | * Returns the available buttons on this device. The number and location |
283 | * of buttons will vary depending on the device. Button numbers will be assigned | 284 | * of buttons will vary depending on the device. Button numbers will be assigned |
284 | * by the device manufacturer and will be from most preferred button to least preffered | 285 | * by the device manufacturer and will be from most preferred button to least preffered |
285 | * button. Note that this list only contains "user mappable" buttons. | 286 | * button. Note that this list only contains "user mappable" buttons. |
286 | * | 287 | * |
287 | * @todo Make method const and take care of calling initButtons or make that const too | 288 | * @todo Make method const and take care of calling initButtons or make that const too |
288 | * | 289 | * |
289 | */ | 290 | */ |
290 | const QValueList<ODeviceButton> &buttons(); | 291 | const QValueList<ODeviceButton> &buttons(); |
291 | 292 | ||
292 | /** | 293 | /** |
293 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 294 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
294 | * returns 0L | 295 | * returns 0L |
295 | */ | 296 | */ |
296 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 297 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
297 | 298 | ||
298 | /** | 299 | /** |
299 | * Reassigns the pressed action for \a button. To return to the factory | 300 | * Reassigns the pressed action for \a button. To return to the factory |
300 | * default pass an empty string as \a qcopMessage. | 301 | * default pass an empty string as \a qcopMessage. |
301 | */ | 302 | */ |
302 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 303 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
303 | 304 | ||
304 | /** | 305 | /** |
305 | * Reassigns the held action for \a button. To return to the factory | 306 | * Reassigns the held action for \a button. To return to the factory |
306 | * default pass an empty string as \a qcopMessage. | 307 | * default pass an empty string as \a qcopMessage. |
307 | */ | 308 | */ |
308 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 309 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
309 | 310 | ||
310 | /** | 311 | /** |
311 | * How long (in ms) you have to press a button for a "hold" action | 312 | * How long (in ms) you have to press a button for a "hold" action |
312 | */ | 313 | */ |
313 | uint buttonHoldTime() const; | 314 | uint buttonHoldTime() const; |
314 | 315 | ||
315 | signals: | 316 | signals: |
316 | void buttonMappingChanged(); | 317 | void buttonMappingChanged(); |
317 | 318 | ||
318 | private slots: | 319 | private slots: |
319 | void systemMessage ( const QCString &, const QByteArray & ); | 320 | void systemMessage ( const QCString &, const QByteArray & ); |
320 | 321 | ||
321 | protected: | 322 | protected: |
323 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); | ||
324 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); | ||
322 | void reloadButtonMapping(); | 325 | void reloadButtonMapping(); |
323 | /* ugly virtual hook */ | 326 | /* ugly virtual hook */ |
324 | virtual void virtual_hook( int id, void* data ); | 327 | virtual void virtual_hook( int id, void* data ); |
325 | }; | 328 | }; |
326 | 329 | ||
327 | class ODeviceData { | 330 | class ODeviceData { |
328 | 331 | ||
329 | public: | 332 | public: |
330 | QString m_vendorstr; | 333 | QString m_vendorstr; |
331 | OVendor m_vendor; | 334 | OVendor m_vendor; |
332 | 335 | ||
333 | QString m_modelstr; | 336 | QString m_modelstr; |
334 | OModel m_model; | 337 | OModel m_model; |
335 | 338 | ||
336 | QString m_systemstr; | 339 | QString m_systemstr; |
337 | OSystem m_system; | 340 | OSystem m_system; |
338 | 341 | ||
339 | QString m_sysverstr; | 342 | QString m_sysverstr; |
340 | 343 | ||
341 | Transformation m_rotation; | 344 | Transformation m_rotation; |
342 | ODirection m_direction; | 345 | ODirection m_direction; |
343 | 346 | ||
344 | QValueList <ODeviceButton> *m_buttons; | 347 | QValueList <ODeviceButton> *m_buttons; |
345 | uint m_holdtime; | 348 | uint m_holdtime; |
346 | QStrList *m_cpu_frequencies; | 349 | QStrList *m_cpu_frequencies; |
347 | }; | 350 | }; |
348 | 351 | ||
349 | extern bool isQWS(); | 352 | extern bool isQWS(); |
350 | extern QCString makeChannel ( const char *str ); | 353 | extern QCString makeChannel ( const char *str ); |
351 | } | 354 | } |
352 | } | 355 | } |
353 | 356 | ||
354 | 357 | ||
355 | 358 | ||
356 | 359 | ||
357 | #endif | 360 | #endif |
358 | 361 | ||
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 791e409..21fed99 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -124,98 +124,97 @@ void iPAQ::init(const QString& model) | |||
124 | 124 | ||
125 | if ( d->m_modelstr == "H3100" ) | 125 | if ( d->m_modelstr == "H3100" ) |
126 | d->m_model = Model_iPAQ_H31xx; | 126 | d->m_model = Model_iPAQ_H31xx; |
127 | else if ( d->m_modelstr == "H3600" ) | 127 | else if ( d->m_modelstr == "H3600" ) |
128 | d->m_model = Model_iPAQ_H36xx; | 128 | d->m_model = Model_iPAQ_H36xx; |
129 | else if ( d->m_modelstr == "H3700" ) | 129 | else if ( d->m_modelstr == "H3700" ) |
130 | d->m_model = Model_iPAQ_H37xx; | 130 | d->m_model = Model_iPAQ_H37xx; |
131 | else if ( d->m_modelstr == "H3800" ) | 131 | else if ( d->m_modelstr == "H3800" ) |
132 | d->m_model = Model_iPAQ_H38xx; | 132 | d->m_model = Model_iPAQ_H38xx; |
133 | else if ( d->m_modelstr == "H3900" ) | 133 | else if ( d->m_modelstr == "H3900" ) |
134 | d->m_model = Model_iPAQ_H39xx; | 134 | d->m_model = Model_iPAQ_H39xx; |
135 | else if ( d->m_modelstr == "H5400" ) | 135 | else if ( d->m_modelstr == "H5400" ) |
136 | d->m_model = Model_iPAQ_H5xxx; | 136 | d->m_model = Model_iPAQ_H5xxx; |
137 | else if ( d->m_modelstr == "H2200" ) | 137 | else if ( d->m_modelstr == "H2200" ) |
138 | d->m_model = Model_iPAQ_H22xx; | 138 | d->m_model = Model_iPAQ_H22xx; |
139 | else | 139 | else |
140 | d->m_model = Model_Unknown; | 140 | d->m_model = Model_Unknown; |
141 | 141 | ||
142 | switch ( d->m_model ) { | 142 | switch ( d->m_model ) { |
143 | case Model_iPAQ_H31xx: | 143 | case Model_iPAQ_H31xx: |
144 | case Model_iPAQ_H38xx: | 144 | case Model_iPAQ_H38xx: |
145 | d->m_rotation = Rot90; | 145 | d->m_rotation = Rot90; |
146 | break; | 146 | break; |
147 | case Model_iPAQ_H5xxx: | 147 | case Model_iPAQ_H5xxx: |
148 | case Model_iPAQ_H22xx: | 148 | case Model_iPAQ_H22xx: |
149 | d->m_rotation = Rot0; | 149 | d->m_rotation = Rot0; |
150 | break; | 150 | break; |
151 | case Model_iPAQ_H36xx: | 151 | case Model_iPAQ_H36xx: |
152 | case Model_iPAQ_H37xx: | 152 | case Model_iPAQ_H37xx: |
153 | case Model_iPAQ_H39xx: | 153 | case Model_iPAQ_H39xx: |
154 | default: | 154 | default: |
155 | d->m_rotation = Rot270; | 155 | d->m_rotation = Rot270; |
156 | break; | 156 | break; |
157 | 157 | ||
158 | } | 158 | } |
159 | 159 | ||
160 | m_leds [0] = m_leds [1] = Led_Off; | 160 | m_leds [0] = m_leds [1] = Led_Off; |
161 | 161 | ||
162 | m_power_timer = 0; | 162 | m_power_timer = 0; |
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | void iPAQ::initButtons() | 166 | void iPAQ::initButtons() |
167 | { | 167 | { |
168 | if ( d->m_buttons ) | 168 | if ( d->m_buttons ) |
169 | return; | 169 | return; |
170 | 170 | ||
171 | if ( isQWS( ) ) { | 171 | if ( isQWS( ) ) { |
172 | Opie::Core::OKeyFilter::inst()->addPreHandler(this); | 172 | addPreHandler(this); |
173 | //QWSServer::setKeyboardFilter ( this ); | ||
174 | } | 173 | } |
175 | 174 | ||
176 | d->m_buttons = new QValueList <ODeviceButton>; | 175 | d->m_buttons = new QValueList <ODeviceButton>; |
177 | 176 | ||
178 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 177 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
179 | i_button *ib = ipaq_buttons + i; | 178 | i_button *ib = ipaq_buttons + i; |
180 | ODeviceButton b; | 179 | ODeviceButton b; |
181 | 180 | ||
182 | if (( ib->model & d->m_model ) == d->m_model ) { | 181 | if (( ib->model & d->m_model ) == d->m_model ) { |
183 | b. setKeycode ( ib->code ); | 182 | b. setKeycode ( ib->code ); |
184 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 183 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
185 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 184 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
186 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 185 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
187 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 186 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
188 | 187 | ||
189 | d->m_buttons->append ( b ); | 188 | d->m_buttons->append ( b ); |
190 | } | 189 | } |
191 | } | 190 | } |
192 | reloadButtonMapping(); | 191 | reloadButtonMapping(); |
193 | 192 | ||
194 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 193 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
195 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 194 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
196 | } | 195 | } |
197 | 196 | ||
198 | QValueList <OLed> iPAQ::ledList() const | 197 | QValueList <OLed> iPAQ::ledList() const |
199 | { | 198 | { |
200 | QValueList <OLed> vl; | 199 | QValueList <OLed> vl; |
201 | vl << Led_Power; | 200 | vl << Led_Power; |
202 | 201 | ||
203 | if ( d->m_model == Model_iPAQ_H38xx ) | 202 | if ( d->m_model == Model_iPAQ_H38xx ) |
204 | vl << Led_BlueTooth; | 203 | vl << Led_BlueTooth; |
205 | return vl; | 204 | return vl; |
206 | } | 205 | } |
207 | 206 | ||
208 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 207 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
209 | { | 208 | { |
210 | QValueList <OLedState> vl; | 209 | QValueList <OLedState> vl; |
211 | 210 | ||
212 | if ( l == Led_Power ) | 211 | if ( l == Led_Power ) |
213 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 212 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
214 | else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) | 213 | else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) |
215 | vl << Led_Off; // << Led_On << ??? | 214 | vl << Led_Off; // << Led_On << ??? |
216 | 215 | ||
217 | return vl; | 216 | return vl; |
218 | } | 217 | } |
219 | 218 | ||
220 | OLedState iPAQ::ledState ( OLed l ) const | 219 | OLedState iPAQ::ledState ( OLed l ) const |
221 | { | 220 | { |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 6c3253c..bf46e43 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -102,98 +102,97 @@ struct s_button simpad_buttons [] = { | |||
102 | /* | 102 | /* |
103 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 103 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
104 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 104 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
105 | "devicebuttons/simpad_lower_upper", | 105 | "devicebuttons/simpad_lower_upper", |
106 | "QPE/Launcher", "home()", | 106 | "QPE/Launcher", "home()", |
107 | "buttonsettings", "raise()" }, | 107 | "buttonsettings", "raise()" }, |
108 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 108 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
109 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 109 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
110 | "devicebuttons/simpad_upper_lower", | 110 | "devicebuttons/simpad_upper_lower", |
111 | "QPE/Launcher", "home()", | 111 | "QPE/Launcher", "home()", |
112 | "buttonsettings", "raise()" }, | 112 | "buttonsettings", "raise()" }, |
113 | */ | 113 | */ |
114 | }; | 114 | }; |
115 | 115 | ||
116 | void SIMpad::init(const QString&) | 116 | void SIMpad::init(const QString&) |
117 | { | 117 | { |
118 | d->m_vendorstr = "SIEMENS"; | 118 | d->m_vendorstr = "SIEMENS"; |
119 | d->m_vendor = Vendor_SIEMENS; | 119 | d->m_vendor = Vendor_SIEMENS; |
120 | 120 | ||
121 | 121 | ||
122 | //TODO Implement model checking | 122 | //TODO Implement model checking |
123 | //FIXME For now we assume an SL4 | 123 | //FIXME For now we assume an SL4 |
124 | 124 | ||
125 | d->m_modelstr = "SL4"; | 125 | d->m_modelstr = "SL4"; |
126 | d->m_model = Model_SIMpad_SL4; | 126 | d->m_model = Model_SIMpad_SL4; |
127 | 127 | ||
128 | switch ( d->m_model ) { | 128 | switch ( d->m_model ) { |
129 | default: | 129 | default: |
130 | d->m_rotation = Rot0; | 130 | d->m_rotation = Rot0; |
131 | d->m_direction = CCW; | 131 | d->m_direction = CCW; |
132 | d->m_holdtime = 1000; // 1000ms | 132 | d->m_holdtime = 1000; // 1000ms |
133 | 133 | ||
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | 136 | ||
137 | //Distribution detecting code is now in base class | 137 | //Distribution detecting code is now in base class |
138 | m_leds [0] = m_leds [1] = Led_Off; | 138 | m_leds [0] = m_leds [1] = Led_Off; |
139 | 139 | ||
140 | m_power_timer = 0; | 140 | m_power_timer = 0; |
141 | 141 | ||
142 | } | 142 | } |
143 | 143 | ||
144 | void SIMpad::initButtons() | 144 | void SIMpad::initButtons() |
145 | { | 145 | { |
146 | if ( d->m_buttons ) | 146 | if ( d->m_buttons ) |
147 | return; | 147 | return; |
148 | 148 | ||
149 | if ( isQWS( ) ) { | 149 | if ( isQWS( ) ) { |
150 | Opie::Core::OKeyFilter::inst()->addPreHandler(this); | 150 | addPreHandler(this); |
151 | // QWSServer::setKeyboardFilter ( this ); | ||
152 | } | 151 | } |
153 | 152 | ||
154 | 153 | ||
155 | d->m_buttons = new QValueList <ODeviceButton>; | 154 | d->m_buttons = new QValueList <ODeviceButton>; |
156 | 155 | ||
157 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 156 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { |
158 | s_button *sb = simpad_buttons + i; | 157 | s_button *sb = simpad_buttons + i; |
159 | ODeviceButton b; | 158 | ODeviceButton b; |
160 | 159 | ||
161 | if (( sb->model & d->m_model ) == d->m_model ) { | 160 | if (( sb->model & d->m_model ) == d->m_model ) { |
162 | b. setKeycode ( sb->code ); | 161 | b. setKeycode ( sb->code ); |
163 | b. setUserText ( QObject::tr ( "Button", sb->utext )); | 162 | b. setUserText ( QObject::tr ( "Button", sb->utext )); |
164 | b. setPixmap ( Resource::loadPixmap ( sb->pix )); | 163 | b. setPixmap ( Resource::loadPixmap ( sb->pix )); |
165 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction )); | 164 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction )); |
166 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction )); | 165 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction )); |
167 | 166 | ||
168 | d->m_buttons->append ( b ); | 167 | d->m_buttons->append ( b ); |
169 | } | 168 | } |
170 | } | 169 | } |
171 | reloadButtonMapping(); | 170 | reloadButtonMapping(); |
172 | 171 | ||
173 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 172 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
174 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); | 173 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
175 | } | 174 | } |
176 | 175 | ||
177 | // SIMpad boardcontrol register CS3 | 176 | // SIMpad boardcontrol register CS3 |
178 | #define SIMPAD_BOARDCONTROL "/proc/cs3" | 177 | #define SIMPAD_BOARDCONTROL "/proc/cs3" |
179 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA | 178 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA |
180 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA | 179 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA |
181 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's | 180 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's |
182 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V | 181 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V |
183 | #define SIMPAD_DISPLAY_ON 0x0010 | 182 | #define SIMPAD_DISPLAY_ON 0x0010 |
184 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 | 183 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 |
185 | #define SIMPAD_MQ_RESET 0x0040 | 184 | #define SIMPAD_MQ_RESET 0x0040 |
186 | #define SIMPAD_PCMCIA_RESET 0x0080 | 185 | #define SIMPAD_PCMCIA_RESET 0x0080 |
187 | #define SIMPAD_DECT_POWER_ON 0x0100 | 186 | #define SIMPAD_DECT_POWER_ON 0x0100 |
188 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave | 187 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave |
189 | #define SIMPAD_RS232_ON 0x0400 | 188 | #define SIMPAD_RS232_ON 0x0400 |
190 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave | 189 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave |
191 | #define SIMPAD_LED2_ON 0x1000 | 190 | #define SIMPAD_LED2_ON 0x1000 |
192 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode | 191 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode |
193 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit | 192 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit |
194 | #define SIMPAD_RESET_SIMCARD 0x8000 | 193 | #define SIMPAD_RESET_SIMCARD 0x8000 |
195 | 194 | ||
196 | //SIMpad touchscreen backlight strength control | 195 | //SIMpad touchscreen backlight strength control |
197 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" | 196 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" |
198 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 | 197 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 |
199 | 198 | ||