-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.h | 44 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 27 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 1 |
3 files changed, 50 insertions, 22 deletions
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.h b/libopie2/opiecore/device/odevice_abstractmobiledevice.h index 9467e82..335b02f 100644 --- a/libopie2/opiecore/device/odevice_abstractmobiledevice.h +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.h | |||
@@ -1,64 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> | 3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> |
4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> | 4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> |
5 | 5 | ||
6 | 6 | ||
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE | 33 | #ifndef OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE |
34 | #define OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE | 34 | #define OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE |
35 | 35 | ||
36 | #include "odevice.h" | 36 | #include "odevice.h" |
37 | 37 | ||
38 | namespace Opie { | 38 | namespace Opie { |
39 | namespace Core { | 39 | namespace Core { |
40 | /** | 40 | /** |
41 | * @short Common Implementations for Linux Handheld Devices | 41 | * @short Common Implementations for Linux Handheld Devices |
42 | * | 42 | * |
43 | * Abstract Class with implementation for suspending using | 43 | * Abstract Class with implementation for suspending using |
44 | * asynchrnonus apm implementations and displaystatus using | 44 | * asynchrnonus apm implementations and displaystatus using |
45 | * the Linux Frame Buffer API | 45 | * the Linux Frame Buffer API |
46 | * | 46 | * |
47 | */ | 47 | */ |
48 | class OAbstractMobileDevice : public ODevice { | 48 | class OAbstractMobileDevice : public ODevice { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | protected: | 50 | protected: |
51 | OAbstractMobileDevice(); | 51 | OAbstractMobileDevice(); |
52 | void setAPMTimeOut( int time ); | 52 | void setAPMTimeOut( int time ); |
53 | public: | 53 | public: |
54 | virtual bool suspend(); | 54 | virtual bool suspend(); |
55 | virtual bool setDisplayStatus(bool); | 55 | virtual bool setDisplayStatus(bool); |
56 | 56 | ||
57 | private: | 57 | protected: |
58 | int m_timeOut; | 58 | int m_timeOut; |
59 | }; | 59 | }; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | #endif | 64 | #endif |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 72378ff..8aefc13 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,630 +1,657 @@ | |||
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,2003,2004 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> |
49 | #include <signal.h> | 49 | #include <signal.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/time.h> | 51 | #include <sys/time.h> |
52 | #include <unistd.h> | 52 | #include <unistd.h> |
53 | #ifndef QT_NO_SOUND | 53 | #ifndef QT_NO_SOUND |
54 | #include <linux/soundcard.h> | 54 | #include <linux/soundcard.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | using namespace Opie::Core; | 57 | using namespace Opie::Core; |
58 | using namespace Opie::Core::Internal; | 58 | using namespace Opie::Core::Internal; |
59 | 59 | ||
60 | struct z_button z_buttons [] = { | 60 | struct z_button z_buttons [] = { |
61 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 61 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
62 | "devicebuttons/z_calendar", | 62 | "devicebuttons/z_calendar", |
63 | "datebook", "nextView()", | 63 | "datebook", "nextView()", |
64 | "today", "raise()" }, | 64 | "today", "raise()" }, |
65 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 65 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
66 | "devicebuttons/z_contact", | 66 | "devicebuttons/z_contact", |
67 | "addressbook", "raise()", | 67 | "addressbook", "raise()", |
68 | "addressbook", "beamBusinessCard()" }, | 68 | "addressbook", "beamBusinessCard()" }, |
69 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 69 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
70 | "devicebuttons/z_home", | 70 | "devicebuttons/z_home", |
71 | "QPE/Launcher", "home()", | 71 | "QPE/Launcher", "home()", |
72 | "buttonsettings", "raise()" }, | 72 | "buttonsettings", "raise()" }, |
73 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 73 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
74 | "devicebuttons/z_menu", | 74 | "devicebuttons/z_menu", |
75 | "QPE/TaskBar", "toggleMenu()", | 75 | "QPE/TaskBar", "toggleMenu()", |
76 | "QPE/TaskBar", "toggleStartMenu()" }, | 76 | "QPE/TaskBar", "toggleStartMenu()" }, |
77 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 77 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
78 | "devicebuttons/z_mail", | 78 | "devicebuttons/z_mail", |
79 | "opiemail", "raise()", | 79 | "opiemail", "raise()", |
80 | "opiemail", "newMail()" }, | 80 | "opiemail", "newMail()" }, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | struct z_button z_buttons_c700 [] = { | 83 | struct z_button z_buttons_c700 [] = { |
84 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 84 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
85 | "devicebuttons/z_calendar", | 85 | "devicebuttons/z_calendar", |
86 | "datebook", "nextView()", | 86 | "datebook", "nextView()", |
87 | "today", "raise()" }, | 87 | "today", "raise()" }, |
88 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 88 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
89 | "devicebuttons/z_contact", | 89 | "devicebuttons/z_contact", |
90 | "addressbook", "raise()", | 90 | "addressbook", "raise()", |
91 | "addressbook", "beamBusinessCard()" }, | 91 | "addressbook", "beamBusinessCard()" }, |
92 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 92 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
93 | "devicebuttons/z_home", | 93 | "devicebuttons/z_home", |
94 | "QPE/Launcher", "home()", | 94 | "QPE/Launcher", "home()", |
95 | "buttonsettings", "raise()" }, | 95 | "buttonsettings", "raise()" }, |
96 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 96 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
97 | "devicebuttons/z_menu", | 97 | "devicebuttons/z_menu", |
98 | "QPE/TaskBar", "toggleMenu()", | 98 | "QPE/TaskBar", "toggleMenu()", |
99 | "QPE/TaskBar", "toggleStartMenu()" }, | 99 | "QPE/TaskBar", "toggleStartMenu()" }, |
100 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 100 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
101 | "devicebuttons/z_mail", | 101 | "devicebuttons/z_mail", |
102 | "opiemail", "raise()", | 102 | "opiemail", "raise()", |
103 | "opiemail", "newMail()" }, | 103 | "opiemail", "newMail()" }, |
104 | 104 | ||
105 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), | 105 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), |
106 | "devicebuttons/z_hinge1", | 106 | "devicebuttons/z_hinge1", |
107 | "QPE/Rotation", "rotateDefault()",0}, | 107 | "QPE/Rotation", "rotateDefault()",0}, |
108 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), | 108 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), |
109 | "devicebuttons/z_hinge2", | 109 | "devicebuttons/z_hinge2", |
110 | "QPE/Rotation", "rotateDefault()",0}, | 110 | "QPE/Rotation", "rotateDefault()",0}, |
111 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), | 111 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), |
112 | "devicebuttons/z_hinge3", | 112 | "devicebuttons/z_hinge3", |
113 | "QPE/Rotation", "rotateDefault()",0}, | 113 | "QPE/Rotation", "rotateDefault()",0}, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 116 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
117 | // class up into individual classes. We need three classes | 117 | // class up into individual classes. We need three classes |
118 | // | 118 | // |
119 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 119 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
120 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 120 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
121 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) | 121 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) |
122 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) | 122 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) |
123 | // | 123 | // |
124 | // Only question right now is: Do we really need to do it? Because as soon | 124 | // Only question right now is: Do we really need to do it? Because as soon |
125 | // as the OpenZaurus kernel is ready, there will be a unified interface for all | 125 | // as the OpenZaurus kernel is ready, there will be a unified interface for all |
126 | // Zaurus models (concerning apm, backlight, buttons, etc.) | 126 | // Zaurus models (concerning apm, backlight, buttons, etc.) |
127 | // | 127 | // |
128 | // Comments? - mickeyl. | 128 | // Comments? - mickeyl. |
129 | 129 | ||
130 | void Zaurus::init(const QString& cpu_info) | 130 | void Zaurus::init(const QString& cpu_info) |
131 | { | 131 | { |
132 | // Set the time to wait until the system is realy suspended | 132 | // Set the time to wait until the system is realy suspended |
133 | // the delta between apm --suspend and sleeping | 133 | // the delta between apm --suspend and sleeping |
134 | setAPMTimeOut( 15000 ); | 134 | setAPMTimeOut( 15000 ); |
135 | 135 | ||
136 | // generic distribution code already scanned /etc/issue at that point - | 136 | // generic distribution code already scanned /etc/issue at that point - |
137 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 137 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
138 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 138 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
139 | { | 139 | { |
140 | d->m_vendorstr = "Sharp"; | 140 | d->m_vendorstr = "Sharp"; |
141 | d->m_vendor = Vendor_Sharp; | 141 | d->m_vendor = Vendor_Sharp; |
142 | d->m_systemstr = "Zaurus"; | 142 | d->m_systemstr = "Zaurus"; |
143 | d->m_system = System_Zaurus; | 143 | d->m_system = System_Zaurus; |
144 | m_embedix = true; | 144 | m_embedix = true; |
145 | } | 145 | } |
146 | else | 146 | else |
147 | { | 147 | { |
148 | d->m_vendorstr = "OpenZaurus Team"; | 148 | d->m_vendorstr = "OpenZaurus Team"; |
149 | d->m_systemstr = "OpenZaurus"; | 149 | d->m_systemstr = "OpenZaurus"; |
150 | d->m_system = System_OpenZaurus; | 150 | d->m_system = System_OpenZaurus; |
151 | // sysver already gathered | 151 | // sysver already gathered |
152 | 152 | ||
153 | // OpenZaurus sometimes uses the embedix kernel, check if this is one | 153 | // OpenZaurus sometimes uses the embedix kernel, check if this is one |
154 | FILE *uname = popen("uname -r", "r"); | 154 | FILE *uname = popen("uname -r", "r"); |
155 | QFile f; | 155 | QFile f; |
156 | QString line; | 156 | QString line; |
157 | if ( f.open(IO_ReadOnly, uname) ) { | 157 | if ( f.open(IO_ReadOnly, uname) ) { |
158 | QTextStream ts ( &f ); | 158 | QTextStream ts ( &f ); |
159 | line = ts. readLine(); | 159 | line = ts. readLine(); |
160 | int loc = line. find ( "embedix" ); | 160 | int loc = line. find ( "embedix" ); |
161 | if ( loc != -1 ) | 161 | if ( loc != -1 ) |
162 | m_embedix = true; | 162 | m_embedix = true; |
163 | else | 163 | else |
164 | m_embedix = false; | 164 | m_embedix = false; |
165 | f.close(); | 165 | f.close(); |
166 | } | 166 | } |
167 | pclose(uname); | 167 | pclose(uname); |
168 | } | 168 | } |
169 | 169 | ||
170 | // check the Zaurus model | 170 | // check the Zaurus model |
171 | QString model; | 171 | QString model; |
172 | int loc = cpu_info.find( ":" ); | 172 | int loc = cpu_info.find( ":" ); |
173 | if ( loc != -1 ) | 173 | if ( loc != -1 ) |
174 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 174 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
175 | else | 175 | else |
176 | model = cpu_info; | 176 | model = cpu_info; |
177 | 177 | ||
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 { | 202 | } else { |
203 | d->m_model = Model_Zaurus_SL5500; | 203 | d->m_model = Model_Zaurus_SL5500; |
204 | d->m_modelstr = "Unknown Zaurus"; | 204 | d->m_modelstr = "Unknown Zaurus"; |
205 | } | 205 | } |
206 | 206 | ||
207 | // set initial rotation | 207 | // set initial rotation |
208 | switch( d->m_model ) { | 208 | switch( d->m_model ) { |
209 | case Model_Zaurus_SL6000: // fallthrough | 209 | case Model_Zaurus_SL6000: // fallthrough |
210 | case Model_Zaurus_SLA300: | 210 | case Model_Zaurus_SLA300: |
211 | d->m_rotation = Rot0; | 211 | d->m_rotation = Rot0; |
212 | break; | 212 | break; |
213 | case Model_Zaurus_SLC3000: // fallthrough | 213 | case Model_Zaurus_SLC3000: // fallthrough |
214 | case Model_Zaurus_SLC7x0: | 214 | case Model_Zaurus_SLC7x0: |
215 | d->m_rotation = rotation(); | 215 | d->m_rotation = rotation(); |
216 | d->m_direction = direction(); | 216 | d->m_direction = direction(); |
217 | break; | 217 | break; |
218 | case Model_Zaurus_SLB600: // fallthrough | 218 | case Model_Zaurus_SLB600: // fallthrough |
219 | case Model_Zaurus_SL5000: // fallthrough | 219 | case Model_Zaurus_SL5000: // fallthrough |
220 | case Model_Zaurus_SL5500: // fallthrough | 220 | case Model_Zaurus_SL5500: // fallthrough |
221 | default: | 221 | default: |
222 | d->m_rotation = Rot270; | 222 | d->m_rotation = Rot270; |
223 | break; | 223 | break; |
224 | } | 224 | } |
225 | m_leds[0] = Led_Off; | 225 | m_leds[0] = Led_Off; |
226 | 226 | ||
227 | if ( m_embedix ) | 227 | if ( m_embedix ) |
228 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); | 228 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); |
229 | else | 229 | else |
230 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); | 230 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); |
231 | } | 231 | } |
232 | 232 | ||
233 | void Zaurus::initButtons() | 233 | void Zaurus::initButtons() |
234 | { | 234 | { |
235 | if ( d->m_buttons ) | 235 | if ( d->m_buttons ) |
236 | return; | 236 | return; |
237 | 237 | ||
238 | 238 | ||
239 | d->m_buttons = new QValueList <ODeviceButton>; | 239 | d->m_buttons = new QValueList <ODeviceButton>; |
240 | 240 | ||
241 | struct z_button * pz_buttons; | 241 | struct z_button * pz_buttons; |
242 | int buttoncount; | 242 | int buttoncount; |
243 | switch ( d->m_model ) { | 243 | switch ( d->m_model ) { |
244 | case Model_Zaurus_SLC3000: // fallthrough | 244 | case Model_Zaurus_SLC3000: // fallthrough |
245 | case Model_Zaurus_SLC7x0: | 245 | case Model_Zaurus_SLC7x0: |
246 | if ( isQWS( ) ) { | 246 | if ( isQWS( ) ) { |
247 | addPreHandler(this); // hinge-sensor-handler | 247 | addPreHandler(this); // hinge-sensor-handler |
248 | } | 248 | } |
249 | pz_buttons = z_buttons_c700; | 249 | pz_buttons = z_buttons_c700; |
250 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 250 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
251 | break; | 251 | break; |
252 | default: | 252 | default: |
253 | pz_buttons = z_buttons; | 253 | pz_buttons = z_buttons; |
254 | buttoncount = ARRAY_SIZE(z_buttons); | 254 | buttoncount = ARRAY_SIZE(z_buttons); |
255 | break; | 255 | break; |
256 | } | 256 | } |
257 | 257 | ||
258 | for ( int i = 0; i < buttoncount; i++ ) { | 258 | for ( int i = 0; i < buttoncount; i++ ) { |
259 | struct z_button *zb = pz_buttons + i; | 259 | struct z_button *zb = pz_buttons + i; |
260 | ODeviceButton b; | 260 | ODeviceButton b; |
261 | 261 | ||
262 | b.setKeycode( zb->code ); | 262 | b.setKeycode( zb->code ); |
263 | b.setUserText( QObject::tr( "Button", zb->utext )); | 263 | b.setUserText( QObject::tr( "Button", zb->utext )); |
264 | b.setPixmap( Resource::loadPixmap( zb->pix )); | 264 | b.setPixmap( Resource::loadPixmap( zb->pix )); |
265 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 265 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
266 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 266 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
267 | d->m_buttons->append( b ); | 267 | d->m_buttons->append( b ); |
268 | } | 268 | } |
269 | 269 | ||
270 | reloadButtonMapping(); | 270 | reloadButtonMapping(); |
271 | } | 271 | } |
272 | 272 | ||
273 | 273 | ||
274 | 274 | ||
275 | typedef struct sharp_led_status { | 275 | typedef struct sharp_led_status { |
276 | int which; /* select which LED status is wanted. */ | 276 | int which; /* select which LED status is wanted. */ |
277 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 277 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
278 | } sharp_led_status; | 278 | } sharp_led_status; |
279 | 279 | ||
280 | void Zaurus::buzzer( int sound ) | 280 | void Zaurus::buzzer( int sound ) |
281 | { | 281 | { |
282 | #ifndef QT_NO_SOUND | 282 | #ifndef QT_NO_SOUND |
283 | Sound *snd = 0; | 283 | Sound *snd = 0; |
284 | 284 | ||
285 | // All devices except SL5500 have a DSP device | 285 | // All devices except SL5500 have a DSP device |
286 | if ( d->m_model != Model_Zaurus_SL5000 | 286 | if ( d->m_model != Model_Zaurus_SL5000 |
287 | && d->m_model != Model_Zaurus_SL5500 ) { | 287 | && d->m_model != Model_Zaurus_SL5500 ) { |
288 | 288 | ||
289 | switch ( sound ){ | 289 | switch ( sound ){ |
290 | case SHARP_BUZ_TOUCHSOUND: { | 290 | case SHARP_BUZ_TOUCHSOUND: { |
291 | static Sound touch_sound("touchsound"); | 291 | static Sound touch_sound("touchsound"); |
292 | snd = &touch_sound; | 292 | snd = &touch_sound; |
293 | } | 293 | } |
294 | break; | 294 | break; |
295 | case SHARP_BUZ_KEYSOUND: { | 295 | case SHARP_BUZ_KEYSOUND: { |
296 | static Sound key_sound( "keysound" ); | 296 | static Sound key_sound( "keysound" ); |
297 | snd = &key_sound; | 297 | snd = &key_sound; |
298 | } | 298 | } |
299 | break; | 299 | break; |
300 | case SHARP_BUZ_SCHEDULE_ALARM: | 300 | case SHARP_BUZ_SCHEDULE_ALARM: |
301 | default: { | 301 | default: { |
302 | static Sound alarm_sound("alarm"); | 302 | static Sound alarm_sound("alarm"); |
303 | snd = &alarm_sound; | 303 | snd = &alarm_sound; |
304 | } | 304 | } |
305 | break; | 305 | break; |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | // If a soundname is defined, we expect that this device has | 309 | // If a soundname is defined, we expect that this device has |
310 | // sound capabilities.. Otherwise we expect to have the buzzer | 310 | // sound capabilities.. Otherwise we expect to have the buzzer |
311 | // device.. | 311 | // device.. |
312 | if ( snd && snd->isFinished() ){ | 312 | if ( snd && snd->isFinished() ){ |
313 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 313 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
314 | snd->play(); | 314 | snd->play(); |
315 | } else if( !snd ) { | 315 | } else if( !snd ) { |
316 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 316 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
317 | 317 | ||
318 | if ( fd >= 0 ) { | 318 | if ( fd >= 0 ) { |
319 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 319 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
320 | ::close ( fd ); | 320 | ::close ( fd ); |
321 | } | 321 | } |
322 | 322 | ||
323 | } | 323 | } |
324 | #endif | 324 | #endif |
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | ||
328 | void Zaurus::playAlarmSound() | 328 | void Zaurus::playAlarmSound() |
329 | { | 329 | { |
330 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 330 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
331 | } | 331 | } |
332 | 332 | ||
333 | void Zaurus::playTouchSound() | 333 | void Zaurus::playTouchSound() |
334 | { | 334 | { |
335 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 335 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
336 | } | 336 | } |
337 | 337 | ||
338 | void Zaurus::playKeySound() | 338 | void Zaurus::playKeySound() |
339 | { | 339 | { |
340 | buzzer( SHARP_BUZ_KEYSOUND ); | 340 | buzzer( SHARP_BUZ_KEYSOUND ); |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | QValueList <OLed> Zaurus::ledList() const | 344 | QValueList <OLed> Zaurus::ledList() const |
345 | { | 345 | { |
346 | QValueList <OLed> vl; | 346 | QValueList <OLed> vl; |
347 | vl << Led_Mail; | 347 | vl << Led_Mail; |
348 | return vl; | 348 | return vl; |
349 | } | 349 | } |
350 | 350 | ||
351 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const | 351 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const |
352 | { | 352 | { |
353 | QValueList <OLedState> vl; | 353 | QValueList <OLedState> vl; |
354 | 354 | ||
355 | if ( l == Led_Mail ) | 355 | if ( l == Led_Mail ) |
356 | vl << Led_Off << Led_On << Led_BlinkSlow; | 356 | vl << Led_Off << Led_On << Led_BlinkSlow; |
357 | return vl; | 357 | return vl; |
358 | } | 358 | } |
359 | 359 | ||
360 | OLedState Zaurus::ledState( OLed which ) const | 360 | OLedState Zaurus::ledState( OLed which ) const |
361 | { | 361 | { |
362 | if ( which == Led_Mail ) | 362 | if ( which == Led_Mail ) |
363 | return m_leds [0]; | 363 | return m_leds [0]; |
364 | else | 364 | else |
365 | return Led_Off; | 365 | return Led_Off; |
366 | } | 366 | } |
367 | 367 | ||
368 | bool Zaurus::setLedState( OLed which, OLedState st ) | 368 | bool Zaurus::setLedState( OLed which, OLedState st ) |
369 | { | 369 | { |
370 | // Currently not supported on non_embedix kernels | 370 | // Currently not supported on non_embedix kernels |
371 | if (!m_embedix) | 371 | if (!m_embedix) |
372 | { | 372 | { |
373 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); | 373 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); |
374 | return false; | 374 | return false; |
375 | } | 375 | } |
376 | 376 | ||
377 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 377 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
378 | 378 | ||
379 | if ( which == Led_Mail ) { | 379 | if ( which == Led_Mail ) { |
380 | if ( fd >= 0 ) { | 380 | if ( fd >= 0 ) { |
381 | struct sharp_led_status leds; | 381 | struct sharp_led_status leds; |
382 | ::memset ( &leds, 0, sizeof( leds )); | 382 | ::memset ( &leds, 0, sizeof( leds )); |
383 | leds. which = SHARP_LED_MAIL_EXISTS; | 383 | leds. which = SHARP_LED_MAIL_EXISTS; |
384 | bool ok = true; | 384 | bool ok = true; |
385 | 385 | ||
386 | switch ( st ) { | 386 | switch ( st ) { |
387 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 387 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
388 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 388 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
389 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 389 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
390 | default : ok = false; | 390 | default : ok = false; |
391 | } | 391 | } |
392 | 392 | ||
393 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 393 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
394 | m_leds [0] = st; | 394 | m_leds [0] = st; |
395 | return true; | 395 | return true; |
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | return false; | 399 | return false; |
400 | } | 400 | } |
401 | 401 | ||
402 | int Zaurus::displayBrightnessResolution() const | 402 | int Zaurus::displayBrightnessResolution() const |
403 | { | 403 | { |
404 | int res = 1; | 404 | int res = 1; |
405 | if (m_embedix) | 405 | if (m_embedix) |
406 | { | 406 | { |
407 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 407 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
408 | if ( fd ) | 408 | if ( fd ) |
409 | { | 409 | { |
410 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 410 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
411 | ::close( fd ); | 411 | ::close( fd ); |
412 | return value ? value : res; | 412 | return value ? value : res; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | else | 415 | else |
416 | { | 416 | { |
417 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); | 417 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); |
418 | if ( fd ) | 418 | if ( fd ) |
419 | { | 419 | { |
420 | char buf[100]; | 420 | char buf[100]; |
421 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | 421 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); |
422 | ::close( fd ); | 422 | ::close( fd ); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | return res; | 425 | return res; |
426 | } | 426 | } |
427 | 427 | ||
428 | bool Zaurus::setDisplayBrightness( int bright ) | 428 | bool Zaurus::setDisplayBrightness( int bright ) |
429 | { | 429 | { |
430 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); | 430 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); |
431 | bool res = false; | 431 | bool res = false; |
432 | 432 | ||
433 | if ( bright > 255 ) bright = 255; | 433 | if ( bright > 255 ) bright = 255; |
434 | if ( bright < 0 ) bright = 0; | 434 | if ( bright < 0 ) bright = 0; |
435 | 435 | ||
436 | int numberOfSteps = displayBrightnessResolution(); | 436 | int numberOfSteps = displayBrightnessResolution(); |
437 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 437 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
438 | 438 | ||
439 | if ( m_embedix ) | 439 | if ( m_embedix ) |
440 | { | 440 | { |
441 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 441 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
442 | if ( fd ) | 442 | if ( fd ) |
443 | { | 443 | { |
444 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | 444 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); |
445 | ::close( fd ); | 445 | ::close( fd ); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | else | 448 | else |
449 | { | 449 | { |
450 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); | 450 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); |
451 | if ( fd ) | 451 | if ( fd ) |
452 | { | 452 | { |
453 | char buf[100]; | 453 | char buf[100]; |
454 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 454 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
455 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 455 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
456 | ::close( fd ); | 456 | ::close( fd ); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | return res; | 459 | return res; |
460 | } | 460 | } |
461 | 461 | ||
462 | bool Zaurus::setDisplayStatus( bool on ) | 462 | bool Zaurus::setDisplayStatus( bool on ) |
463 | { | 463 | { |
464 | bool res = false; | 464 | bool res = false; |
465 | if ( m_embedix ) | 465 | if ( m_embedix ) |
466 | { | 466 | { |
467 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 467 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
468 | if ( fd ) | 468 | if ( fd ) |
469 | { | 469 | { |
470 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 470 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
471 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 471 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
472 | ::close ( fd ); | 472 | ::close ( fd ); |
473 | } | 473 | } |
474 | } | 474 | } |
475 | else | 475 | else |
476 | { | 476 | { |
477 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); | 477 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); |
478 | if ( fd ) | 478 | if ( fd ) |
479 | { | 479 | { |
480 | char buf[10]; | 480 | char buf[10]; |
481 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 481 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
482 | buf[1] = '\0'; | 482 | buf[1] = '\0'; |
483 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 483 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
484 | ::close( fd ); | 484 | ::close( fd ); |
485 | } | 485 | } |
486 | } | 486 | } |
487 | return res; | 487 | return res; |
488 | } | 488 | } |
489 | 489 | ||
490 | Transformation Zaurus::rotation() const | 490 | Transformation Zaurus::rotation() const |
491 | { | 491 | { |
492 | qDebug( "Zaurus::rotation()" ); | 492 | qDebug( "Zaurus::rotation()" ); |
493 | Transformation rot; | 493 | Transformation rot; |
494 | 494 | ||
495 | switch ( d->m_model ) { | 495 | switch ( d->m_model ) { |
496 | case Model_Zaurus_SLC3000: // fallthrough | 496 | case Model_Zaurus_SLC3000: // fallthrough |
497 | case Model_Zaurus_SLC7x0: | 497 | case Model_Zaurus_SLC7x0: |
498 | { | 498 | { |
499 | OHingeStatus hs = readHingeSensor(); | 499 | OHingeStatus hs = readHingeSensor(); |
500 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 500 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
501 | 501 | ||
502 | if ( m_embedix ) | 502 | if ( m_embedix ) |
503 | { | 503 | { |
504 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 504 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
505 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 505 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
506 | else rot = Rot270; | 506 | else rot = Rot270; |
507 | } | 507 | } |
508 | else | 508 | else |
509 | { | 509 | { |
510 | if ( hs == CASE_PORTRAIT ) rot = Rot90; | 510 | if ( hs == CASE_PORTRAIT ) rot = Rot90; |
511 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 511 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
512 | else rot = Rot0; | 512 | else rot = Rot0; |
513 | } | 513 | } |
514 | } | 514 | } |
515 | break; | 515 | break; |
516 | case Model_Zaurus_SL6000: | 516 | case Model_Zaurus_SL6000: |
517 | case Model_Zaurus_SLB600: | 517 | case Model_Zaurus_SLB600: |
518 | case Model_Zaurus_SLA300: | 518 | case Model_Zaurus_SLA300: |
519 | case Model_Zaurus_SL5500: | 519 | case Model_Zaurus_SL5500: |
520 | case Model_Zaurus_SL5000: | 520 | case Model_Zaurus_SL5000: |
521 | default: | 521 | default: |
522 | rot = d->m_rotation; | 522 | rot = d->m_rotation; |
523 | break; | 523 | break; |
524 | } | 524 | } |
525 | 525 | ||
526 | return rot; | 526 | return rot; |
527 | } | 527 | } |
528 | ODirection Zaurus::direction() const | 528 | ODirection Zaurus::direction() const |
529 | { | 529 | { |
530 | ODirection dir; | 530 | ODirection dir; |
531 | 531 | ||
532 | switch ( d->m_model ) { | 532 | switch ( d->m_model ) { |
533 | case Model_Zaurus_SLC3000: // fallthrough | 533 | case Model_Zaurus_SLC3000: // fallthrough |
534 | case Model_Zaurus_SLC7x0: { | 534 | case Model_Zaurus_SLC7x0: { |
535 | OHingeStatus hs = readHingeSensor(); | 535 | OHingeStatus hs = readHingeSensor(); |
536 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 536 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
537 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 537 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
538 | else dir = CW; | 538 | else dir = CW; |
539 | } | 539 | } |
540 | break; | 540 | break; |
541 | case Model_Zaurus_SL6000: | 541 | case Model_Zaurus_SL6000: |
542 | case Model_Zaurus_SLA300: | 542 | case Model_Zaurus_SLA300: |
543 | case Model_Zaurus_SLB600: | 543 | case Model_Zaurus_SLB600: |
544 | case Model_Zaurus_SL5500: | 544 | case Model_Zaurus_SL5500: |
545 | case Model_Zaurus_SL5000: | 545 | case Model_Zaurus_SL5000: |
546 | default: dir = d->m_direction; | 546 | default: dir = d->m_direction; |
547 | break; | 547 | break; |
548 | } | 548 | } |
549 | return dir; | 549 | return dir; |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | ||
553 | bool Zaurus::hasHingeSensor() const | 553 | bool Zaurus::hasHingeSensor() const |
554 | { | 554 | { |
555 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; | 555 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; |
556 | } | 556 | } |
557 | 557 | ||
558 | OHingeStatus Zaurus::readHingeSensor() const | 558 | OHingeStatus Zaurus::readHingeSensor() const |
559 | { | 559 | { |
560 | if (m_embedix) | 560 | if (m_embedix) |
561 | { | 561 | { |
562 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); | 562 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); |
563 | if (handle == -1) | 563 | if (handle == -1) |
564 | { | 564 | { |
565 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror | 565 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror |
566 | return CASE_UNKNOWN; | 566 | return CASE_UNKNOWN; |
567 | } | 567 | } |
568 | else | 568 | else |
569 | { | 569 | { |
570 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); | 570 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); |
571 | ::close (handle); | 571 | ::close (handle); |
572 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) | 572 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) |
573 | { | 573 | { |
574 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); | 574 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); |
575 | return static_cast<OHingeStatus>( retval ); | 575 | return static_cast<OHingeStatus>( retval ); |
576 | } | 576 | } |
577 | else | 577 | else |
578 | { | 578 | { |
579 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 579 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
580 | return CASE_UNKNOWN; | 580 | return CASE_UNKNOWN; |
581 | } | 581 | } |
582 | } | 582 | } |
583 | } | 583 | } |
584 | else | 584 | else |
585 | { | 585 | { |
586 | // corgi keyboard is event source 0 in OZ kernel 2.6 | 586 | // corgi keyboard is event source 0 in OZ kernel 2.6 |
587 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); | 587 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); |
588 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; | 588 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; |
589 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; | 589 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; |
590 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; | 590 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; |
591 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 591 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
592 | return CASE_UNKNOWN; | 592 | return CASE_UNKNOWN; |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | /* | 596 | /* |
597 | * Take code from iPAQ device. | 597 | * Take code from iPAQ device. |
598 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. | 598 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. |
599 | * I hope that is ok - Alwin | 599 | * I hope that is ok - Alwin |
600 | */ | 600 | */ |
601 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 601 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
602 | { | 602 | { |
603 | int newkeycode = keycode; | 603 | int newkeycode = keycode; |
604 | 604 | ||
605 | if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false; | 605 | if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false; |
606 | 606 | ||
607 | /* map cursor keys depending on the hinge status */ | 607 | /* map cursor keys depending on the hinge status */ |
608 | switch ( keycode ) { | 608 | switch ( keycode ) { |
609 | // Rotate cursor keys | 609 | // Rotate cursor keys |
610 | case Key_Left : | 610 | case Key_Left : |
611 | case Key_Right: | 611 | case Key_Right: |
612 | case Key_Up : | 612 | case Key_Up : |
613 | case Key_Down : | 613 | case Key_Down : |
614 | { | 614 | { |
615 | if (rotation()==Rot90) { | 615 | if (rotation()==Rot90) { |
616 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 616 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
617 | } | 617 | } |
618 | } | 618 | } |
619 | break; | 619 | break; |
620 | 620 | ||
621 | } | 621 | } |
622 | if (newkeycode!=keycode) { | 622 | if (newkeycode!=keycode) { |
623 | if ( newkeycode != Key_unknown ) { | 623 | if ( newkeycode != Key_unknown ) { |
624 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 624 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
625 | } | 625 | } |
626 | return true; | 626 | return true; |
627 | } | 627 | } |
628 | return false; | 628 | return false; |
629 | } | 629 | } |
630 | 630 | ||
631 | bool Zaurus::suspend() { | ||
632 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
633 | return false; | ||
634 | |||
635 | bool res = false; | ||
636 | OAbstractMobileDevice::sendSuspendmsg(); | ||
637 | |||
638 | struct timeval tvs, tvn; | ||
639 | ::gettimeofday ( &tvs, 0 ); | ||
640 | |||
641 | ::sync(); // flush fs caches | ||
642 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
643 | |||
644 | // This is needed because some apm implementations are asynchronous and we | ||
645 | // can not be sure when exactly the device is really suspended | ||
646 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | ||
647 | // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here. | ||
648 | |||
649 | if ( res && m_embedix) { | ||
650 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | ||
651 | ::usleep ( 200 * 1000 ); | ||
652 | ::gettimeofday ( &tvn, 0 ); | ||
653 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); | ||
654 | } | ||
655 | |||
656 | return res; | ||
657 | } | ||
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 1fb0cd9..4548e35 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -1,143 +1,144 @@ | |||
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,2003,2004 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_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> |
37 | 37 | ||
38 | #ifndef ARRAY_SIZE | 38 | #ifndef ARRAY_SIZE |
39 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 39 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | // _IO and friends are only defined in kernel headers ... | 42 | // _IO and friends are only defined in kernel headers ... |
43 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 43 | #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) | 44 | #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)) | 45 | #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)) | 46 | #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)) | 47 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
48 | 48 | ||
49 | // Audio | 49 | // Audio |
50 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 50 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
51 | 51 | ||
52 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 52 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
53 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 53 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
54 | 54 | ||
55 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 55 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
56 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 56 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
57 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 57 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
58 | 58 | ||
59 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 59 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
60 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 60 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
61 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 61 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
62 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 62 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
63 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 63 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
64 | 64 | ||
65 | // LED | 65 | // LED |
66 | #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 66 | #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
67 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 67 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
68 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 68 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
69 | 69 | ||
70 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 70 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
71 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 71 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
72 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 72 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
73 | 73 | ||
74 | // Rotation and Power Management | 74 | // Rotation and Power Management |
75 | #define SHARP_IOCTL_GET_ROTATION 0x413c | 75 | #define SHARP_IOCTL_GET_ROTATION 0x413c |
76 | 76 | ||
77 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 77 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
78 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 78 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
79 | #define APM_EVT_POWER_BUTTON (1 << 0) | 79 | #define APM_EVT_POWER_BUTTON (1 << 0) |
80 | 80 | ||
81 | // Brightness Embedix | 81 | // Brightness Embedix |
82 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" | 82 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" |
83 | #define SHARP_FL_IOCTL_ON 1 | 83 | #define SHARP_FL_IOCTL_ON 1 |
84 | #define SHARP_FL_IOCTL_OFF 2 | 84 | #define SHARP_FL_IOCTL_OFF 2 |
85 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 | 85 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 |
86 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 | 86 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 |
87 | #define SHARP_FL_IOCTL_GET_STEP 102 | 87 | #define SHARP_FL_IOCTL_GET_STEP 102 |
88 | 88 | ||
89 | // Vesa Standard | 89 | // Vesa Standard |
90 | #define FB_BLANK_UNBLANK 0 | 90 | #define FB_BLANK_UNBLANK 0 |
91 | #define FB_BLANK_POWERDOWN 4 | 91 | #define FB_BLANK_POWERDOWN 4 |
92 | 92 | ||
93 | namespace Opie { | 93 | namespace Opie { |
94 | namespace Core { | 94 | namespace Core { |
95 | namespace Internal { | 95 | namespace Internal { |
96 | 96 | ||
97 | class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter | 97 | class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter |
98 | { | 98 | { |
99 | protected: | 99 | protected: |
100 | virtual void init(const QString&); | 100 | virtual void init(const QString&); |
101 | virtual void initButtons(); | 101 | virtual void initButtons(); |
102 | 102 | ||
103 | public: | 103 | public: |
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 | 123 | ||
123 | protected: | 124 | protected: |
124 | virtual void buzzer( int snd ); | 125 | virtual void buzzer( int snd ); |
125 | 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 ); |
126 | 127 | ||
127 | OLedState m_leds[1]; | 128 | OLedState m_leds[1]; |
128 | bool m_embedix; | 129 | bool m_embedix; |
129 | }; | 130 | }; |
130 | 131 | ||
131 | struct z_button { | 132 | struct z_button { |
132 | Qt::Key code; | 133 | Qt::Key code; |
133 | char *utext; | 134 | char *utext; |
134 | char *pix; | 135 | char *pix; |
135 | char *fpressedservice; | 136 | char *fpressedservice; |
136 | char *fpressedaction; | 137 | char *fpressedaction; |
137 | char *fheldservice; | 138 | char *fheldservice; |
138 | char *fheldaction; | 139 | char *fheldaction; |
139 | }; | 140 | }; |
140 | } | 141 | } |
141 | } | 142 | } |
142 | } | 143 | } |
143 | #endif | 144 | #endif |