-rw-r--r-- | libopie2/opiecore/device/odevice.h | 200 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_palm.cpp | 222 |
2 files changed, 295 insertions, 127 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index c6306e7..f80183c 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -1,278 +1,294 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | (C) 2002-2006 The Opie Team <opie-devel@handhelds.org> | 3 | (C) 2002-2006 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; version 2 of the License. | 11 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 12 | ._= =} : |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_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 | 41 | ||
42 | 42 | ||
43 | #include <qstrlist.h> | 43 | #include <qstrlist.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | 46 | ||
47 | class Sound; | 47 | class Sound; |
48 | 48 | ||
49 | namespace Opie{ | 49 | namespace Opie{ |
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum OModel { |
57 | Model_Unknown, // = 0 | 57 | Model_Unknown, // = 0 |
58 | 58 | ||
59 | Model_Series_Mask = 0xffff0000, | 59 | Model_Series_Mask = 0xfff00000, |
60 | 60 | ||
61 | Model_iPAQ = ( 1 << 16 ), | 61 | Model_iPAQ = ( 1 << 20 ), |
62 | 62 | ||
63 | Model_iPAQ_All = ( Model_iPAQ | 0xffff ), | 63 | Model_iPAQ_All = ( Model_iPAQ | 0xfffff ), |
64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), | 64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x00001 ), |
65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), | 65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x00002 ), |
66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x0004 ), | 66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x00004 ), |
67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x0008 ), | 67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x00008 ), |
68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x0010 ), | 68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x00010 ), |
69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0020 ), | 69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x00020 ), |
70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x0040 ), | 70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x00040 ), |
71 | Model_iPAQ_H191x = ( Model_iPAQ | 0x0080 ), | 71 | Model_iPAQ_H191x = ( Model_iPAQ | 0x00080 ), |
72 | Model_iPAQ_H1940 = ( Model_iPAQ | 0x0100 ), | 72 | Model_iPAQ_H1940 = ( Model_iPAQ | 0x00100 ), |
73 | Model_iPAQ_HX4700 = ( Model_iPAQ | 0x0200 ), | 73 | Model_iPAQ_HX4700 = ( Model_iPAQ | 0x00200 ), |
74 | Model_iPAQ_H4xxx = ( Model_iPAQ | 0x0400 ), | 74 | Model_iPAQ_H4xxx = ( Model_iPAQ | 0x00400 ), |
75 | 75 | ||
76 | Model_Jornada = ( 3 << 17 ), | 76 | Model_Jornada = ( 2 << 20 ), |
77 | 77 | ||
78 | Model_Jornada_56x = ( Model_Jornada | 0x0001 ), | 78 | Model_Jornada_56x = ( Model_Jornada | 0x00001 ), |
79 | Model_Jornada_720 = ( Model_Jornada | 0x0002 ), | 79 | Model_Jornada_720 = ( Model_Jornada | 0x00002 ), |
80 | Model_Jornada_820 = ( Model_Jornada | 0x0004 ), | 80 | Model_Jornada_820 = ( Model_Jornada | 0x00004 ), |
81 | 81 | ||
82 | Model_Zaurus = ( 2 << 16 ), | 82 | Model_Zaurus = ( 3 << 20 ), |
83 | 83 | ||
84 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), | 84 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x00001 ), |
85 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), | 85 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x00002 ), |
86 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0004 ), | 86 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x00004 ), |
87 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0008 ), | 87 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x00008 ), |
88 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0010 ), | 88 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x00010 ), |
89 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0020 ), | 89 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x00020 ), |
90 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0040 ), | 90 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x00040 ), |
91 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0080 ), | 91 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x00080 ), |
92 | Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0100 ), | 92 | Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x00100 ), |
93 | 93 | ||
94 | Model_SIMpad = ( 3 << 16 ), | 94 | Model_SIMpad = ( 4 << 20 ), |
95 | 95 | ||
96 | Model_SIMpad_All = ( Model_SIMpad | 0xffff ), | 96 | Model_SIMpad_All = ( Model_SIMpad | 0xfffff ), |
97 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), | 97 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x00001 ), |
98 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), | 98 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x00002 ), |
99 | Model_SIMpad_SLC = ( Model_SIMpad | 0x0004 ), | 99 | Model_SIMpad_SLC = ( Model_SIMpad | 0x00004 ), |
100 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x0008 ), | 100 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x00008 ), |
101 | 101 | ||
102 | Model_Ramses = ( 4 << 16 ), | 102 | Model_Ramses = ( 5 << 20 ), |
103 | 103 | ||
104 | Model_Ramses_All = ( Model_Ramses | 0xffff ), | 104 | Model_Ramses_All = ( Model_Ramses | 0xfffff ), |
105 | Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ), | 105 | Model_Ramses_MNCI = ( Model_Ramses | 0x00001 ), |
106 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ), | 106 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x00002 ), |
107 | 107 | ||
108 | Model_Yopy = ( 5 << 16 ), | 108 | Model_Yopy = ( 6 << 20 ), |
109 | 109 | ||
110 | Model_Yopy_All = ( Model_Yopy | 0xffff ), | 110 | Model_Yopy_All = ( Model_Yopy | 0xfffff ), |
111 | Model_Yopy_3000 = ( Model_Yopy | 0x0001 ), | 111 | Model_Yopy_3000 = ( Model_Yopy | 0x00001 ), |
112 | Model_Yopy_3500 = ( Model_Yopy | 0x0002 ), | 112 | Model_Yopy_3500 = ( Model_Yopy | 0x00002 ), |
113 | Model_Yopy_3700 = ( Model_Yopy | 0x0004 ), | 113 | Model_Yopy_3700 = ( Model_Yopy | 0x00004 ), |
114 | 114 | ||
115 | Model_Beagle = ( 6 << 16 ), | 115 | Model_Beagle = ( 7 << 20 ), |
116 | 116 | ||
117 | Model_Beagle_All = ( Model_Beagle | 0xffff ), | 117 | Model_Beagle_All = ( Model_Beagle | 0xfffff ), |
118 | Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ), | 118 | Model_Beagle_PA100 = ( Model_Beagle | 0x00001 ), |
119 | 119 | ||
120 | Model_GenuineIntel = ( 7 << 16 ), | 120 | Model_GenuineIntel = ( 8 << 20 ), |
121 | 121 | ||
122 | Model_MyPal = ( 8 << 16 ), | 122 | Model_MyPal = ( 9 << 20 ), |
123 | 123 | ||
124 | Model_MyPal_All = ( Model_MyPal | 0xffff ), | 124 | Model_MyPal_All = ( Model_MyPal | 0xfffff ), |
125 | Model_MyPal_620 = ( Model_MyPal | 0x0001 ), | 125 | Model_MyPal_620 = ( Model_MyPal | 0x00001 ), |
126 | Model_MyPal_716 = ( Model_MyPal | 0x0002 ), | 126 | Model_MyPal_716 = ( Model_MyPal | 0x00002 ), |
127 | Model_MyPal_730 = ( Model_MyPal | 0x0004 ), | 127 | Model_MyPal_730 = ( Model_MyPal | 0x00004 ), |
128 | 128 | ||
129 | Model_HTC = ( 9 << 16 ), | 129 | Model_HTC = ( 10 << 20 ), |
130 | 130 | ||
131 | Model_HTC_All = ( Model_HTC | 0xffff ), | 131 | Model_HTC_All = ( Model_HTC | 0xfffff ), |
132 | Model_HTC_Universal = ( Model_HTC | 0x0001 ), | 132 | Model_HTC_Universal = ( Model_HTC | 0x00001 ), |
133 | Model_HTC_Alpine = ( Model_HTC | 0x0002 ), | 133 | Model_HTC_Alpine = ( Model_HTC | 0x00002 ), |
134 | Model_HTC_Apache = ( Model_HTC | 0x0004 ), | 134 | Model_HTC_Apache = ( Model_HTC | 0x00004 ), |
135 | Model_HTC_Beetles = ( Model_HTC | 0x0008 ), | 135 | Model_HTC_Beetles = ( Model_HTC | 0x00008 ), |
136 | Model_HTC_Blueangel = ( Model_HTC | 0x0010 ), | 136 | Model_HTC_Blueangel = ( Model_HTC | 0x00010 ), |
137 | Model_HTC_Himalaya = ( Model_HTC | 0x0020 ), | 137 | Model_HTC_Himalaya = ( Model_HTC | 0x00020 ), |
138 | Model_HTC_Magician = ( Model_HTC | 0x0040 ), | 138 | Model_HTC_Magician = ( Model_HTC | 0x00040 ), |
139 | 139 | ||
140 | Model_Motorola = ( 2 << 17 ), | 140 | Model_Motorola = ( 11 << 20 ), |
141 | 141 | ||
142 | Model_Motorola_All = ( Model_Motorola | 0xffff ), | 142 | Model_Motorola_All = ( Model_Motorola | 0xfffff ), |
143 | Model_Motorola_EZX = ( Model_Motorola | 0x0001 ), | 143 | Model_Motorola_EZX = ( Model_Motorola | 0x00001 ), |
144 | 144 | ||
145 | Model_Palm = ( 1 << 17), | 145 | Model_Palm = ( 12 << 20 ), |
146 | 146 | ||
147 | Model_Palm_All = ( Model_Palm | 0xffff ), | 147 | Model_Palm_All = ( Model_Palm | 0xfffff ), |
148 | Model_Palm_LD = ( Model_Palm | 0x0001 ), | 148 | Model_Palm_TT = ( Model_Palm | 0x00001 ), |
149 | Model_Palm_TX = ( Model_Palm | 0x0002 ), | 149 | Model_Palm_TT2 = ( Model_Palm | 0x00002 ), |
150 | Model_Palm_Z72 = ( Model_Palm | 0x0004 ), | 150 | Model_Palm_TT3 = ( Model_Palm | 0x00004 ), |
151 | Model_Palm_TT5 = ( Model_Palm | 0x00008 ), | ||
152 | Model_Palm_TC = ( Model_Palm | 0x00010 ), | ||
153 | Model_Palm_TE = ( Model_Palm | 0x00020 ), | ||
154 | Model_Palm_TE2 = ( Model_Palm | 0x00040 ), | ||
155 | Model_Palm_LD = ( Model_Palm | 0x00080 ), | ||
156 | Model_Palm_TX = ( Model_Palm | 0x00100 ), | ||
157 | Model_Palm_Z71 = ( Model_Palm | 0x00200 ), | ||
158 | Model_Palm_Z72 = ( Model_Palm | 0x00400 ), | ||
159 | Model_Palm_T600 = ( Model_Palm | 0x00800 ), | ||
160 | Model_Palm_T650 = ( Model_Palm | 0x01000 ), | ||
161 | Model_Palm_T680 = ( Model_Palm | 0x02000 ), | ||
162 | Model_Palm_T700W = ( Model_Palm | 0x04000 ), | ||
163 | Model_Palm_T700P = ( Model_Palm | 0x08000 ), | ||
164 | Model_Palm_T750 = ( Model_Palm | 0x10000 ), | ||
165 | Model_Palm_T755P = ( Model_Palm | 0x20000 ), | ||
166 | Model_Palm_FOLEO = ( Model_Palm | 0x40000 ), | ||
151 | 167 | ||
152 | }; | 168 | }; |
153 | 169 | ||
154 | /** | 170 | /** |
155 | * The vendor of the device | 171 | * The vendor of the device |
156 | */ | 172 | */ |
157 | enum OVendor { | 173 | enum OVendor { |
158 | Vendor_Unknown, | 174 | Vendor_Unknown, |
159 | 175 | ||
160 | Vendor_HP, | 176 | Vendor_HP, |
161 | Vendor_Sharp, | 177 | Vendor_Sharp, |
162 | Vendor_SIEMENS, | 178 | Vendor_SIEMENS, |
163 | Vendor_MundN, | 179 | Vendor_MundN, |
164 | Vendor_GMate, | 180 | Vendor_GMate, |
165 | Vendor_MasterIA, | 181 | Vendor_MasterIA, |
166 | Vendor_GenuineIntel, | 182 | Vendor_GenuineIntel, |
167 | Vendor_Asus, | 183 | Vendor_Asus, |
168 | Vendor_HTC, | 184 | Vendor_HTC, |
169 | Vendor_Motorola, | 185 | Vendor_Motorola, |
170 | Vendor_Palm, | 186 | Vendor_Palm, |
171 | }; | 187 | }; |
172 | 188 | ||
173 | /** | 189 | /** |
174 | * The System used | 190 | * The System used |
175 | */ | 191 | */ |
176 | enum OSystem { | 192 | enum OSystem { |
177 | System_Unknown, | 193 | System_Unknown, |
178 | 194 | ||
179 | System_Familiar, | 195 | System_Familiar, |
180 | System_Zaurus, | 196 | System_Zaurus, |
181 | System_OpenZaurus, | 197 | System_OpenZaurus, |
182 | System_Linupy, | 198 | System_Linupy, |
183 | System_OpenEmbedded, | 199 | System_OpenEmbedded, |
184 | System_PC, | 200 | System_PC, |
185 | System_OpenEZX, | 201 | System_OpenEZX, |
186 | System_Angstrom, | 202 | System_Angstrom, |
187 | }; | 203 | }; |
188 | 204 | ||
189 | typedef struct { | 205 | typedef struct { |
190 | OSystem system; | 206 | OSystem system; |
191 | char* sysstr; | 207 | char* sysstr; |
192 | char* sysvfile; | 208 | char* sysvfile; |
193 | } ODistribution; | 209 | } ODistribution; |
194 | 210 | ||
195 | extern ODistribution distributions[]; | 211 | extern ODistribution distributions[]; |
196 | 212 | ||
197 | 213 | ||
198 | enum OLedState { | 214 | enum OLedState { |
199 | Led_Off, | 215 | Led_Off, |
200 | Led_On, | 216 | Led_On, |
201 | Led_BlinkSlow, | 217 | Led_BlinkSlow, |
202 | Led_BlinkFast | 218 | Led_BlinkFast |
203 | }; | 219 | }; |
204 | 220 | ||
205 | enum OLed { | 221 | enum OLed { |
206 | Led_Mail, | 222 | Led_Mail, |
207 | Led_Power, | 223 | Led_Power, |
208 | Led_BlueTooth | 224 | Led_BlueTooth |
209 | }; | 225 | }; |
210 | 226 | ||
211 | enum OHardKey { | 227 | enum OHardKey { |
212 | HardKey_Datebook = Qt::Key_F9, | 228 | HardKey_Datebook = Qt::Key_F9, |
213 | HardKey_Contacts = Qt::Key_F10, | 229 | HardKey_Contacts = Qt::Key_F10, |
214 | HardKey_Menu = Qt::Key_F11, | 230 | HardKey_Menu = Qt::Key_F11, |
215 | HardKey_Home = Qt::Key_F12, | 231 | HardKey_Home = Qt::Key_F12, |
216 | HardKey_Mail = Qt::Key_F13, | 232 | HardKey_Mail = Qt::Key_F13, |
217 | HardKey_Record = Qt::Key_F24, | 233 | HardKey_Record = Qt::Key_F24, |
218 | HardKey_Suspend = Qt::Key_F34, | 234 | HardKey_Suspend = Qt::Key_F34, |
219 | HardKey_Backlight = Qt::Key_F35, | 235 | HardKey_Backlight = Qt::Key_F35, |
220 | HardKey_Action = Qt::Key_F10, | 236 | HardKey_Action = Qt::Key_F10, |
221 | HardKey_OK = Qt::Key_F11, | 237 | HardKey_OK = Qt::Key_F11, |
222 | HardKey_End = Qt::Key_F12, | 238 | HardKey_End = Qt::Key_F12, |
223 | }; | 239 | }; |
224 | 240 | ||
225 | enum ODirection { | 241 | enum ODirection { |
226 | CW = 0, | 242 | CW = 0, |
227 | CCW = 1, | 243 | CCW = 1, |
228 | Flip = 2, | 244 | Flip = 2, |
229 | }; | 245 | }; |
230 | 246 | ||
231 | enum OHingeStatus { | 247 | enum OHingeStatus { |
232 | CASE_CLOSED = 3, | 248 | CASE_CLOSED = 3, |
233 | CASE_PORTRAIT = 2, | 249 | CASE_PORTRAIT = 2, |
234 | CASE_LANDSCAPE = 0, | 250 | CASE_LANDSCAPE = 0, |
235 | CASE_UNKNOWN = 1, | 251 | CASE_UNKNOWN = 1, |
236 | }; | 252 | }; |
237 | 253 | ||
238 | /* default button for qvfb or such | 254 | /* default button for qvfb or such |
239 | * see odevice.cpp for details. | 255 | * see odevice.cpp for details. |
240 | * hint: manage a user defined button for qvfb? | 256 | * hint: manage a user defined button for qvfb? |
241 | * alwin | 257 | * alwin |
242 | */ | 258 | */ |
243 | struct default_button { | 259 | struct default_button { |
244 | Qt::Key code; | 260 | Qt::Key code; |
245 | char *utext; | 261 | char *utext; |
246 | char *pix; | 262 | char *pix; |
247 | char *fpressedservice; | 263 | char *fpressedservice; |
248 | char *fpressedaction; | 264 | char *fpressedaction; |
249 | char *fheldservice; | 265 | char *fheldservice; |
250 | char *fheldaction; | 266 | char *fheldaction; |
251 | }; | 267 | }; |
252 | 268 | ||
253 | /** | 269 | /** |
254 | * A singleton which gives informations about device specefic option | 270 | * A singleton which gives informations about device specefic option |
255 | * like the Hardware used, LEDs, the Base Distribution and | 271 | * like the Hardware used, LEDs, the Base Distribution and |
256 | * hardware key mappings. | 272 | * hardware key mappings. |
257 | * | 273 | * |
258 | * @short A small class for device specific options | 274 | * @short A small class for device specific options |
259 | * @see QObject | 275 | * @see QObject |
260 | * @author Robert Griebl | 276 | * @author Robert Griebl |
261 | * @version 1.0 | 277 | * @version 1.0 |
262 | */ | 278 | */ |
263 | class ODevice : public QObject | 279 | class ODevice : public QObject |
264 | { | 280 | { |
265 | Q_OBJECT | 281 | Q_OBJECT |
266 | 282 | ||
267 | private: | 283 | private: |
268 | /* disable copy */ | 284 | /* disable copy */ |
269 | ODevice ( const ODevice & ); | 285 | ODevice ( const ODevice & ); |
270 | 286 | ||
271 | protected: | 287 | protected: |
272 | ODevice(); | 288 | ODevice(); |
273 | virtual void init(const QString&); | 289 | virtual void init(const QString&); |
274 | virtual void initButtons(); | 290 | virtual void initButtons(); |
275 | static void sendSuspendmsg(); | 291 | static void sendSuspendmsg(); |
276 | 292 | ||
277 | ODeviceData *d; | 293 | ODeviceData *d; |
278 | 294 | ||
diff --git a/libopie2/opiecore/device/odevice_palm.cpp b/libopie2/opiecore/device/odevice_palm.cpp index d40dfce..892083e 100644 --- a/libopie2/opiecore/device/odevice_palm.cpp +++ b/libopie2/opiecore/device/odevice_palm.cpp | |||
@@ -1,288 +1,440 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> | 4 | Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | � � � � � �.>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | �_;:, � � .> � �:=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, � > �. � <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, � � .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | � � �._= =} � � � : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | � � .%`+i> � � � _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. � �.:, � � . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= � � � = � � � ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= � -. � � .` � � .: details. |
22 | : = ...= . :.=- | 22 | : � � = �...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | �-. � .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | � -_. . . � )=. �= Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "odevice_palm.h" | 31 | #include "odevice_palm.h" |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #include <qgfx_qws.h> | 38 | #include <qgfx_qws.h> |
39 | 39 | ||
40 | /* OPIE */ | 40 | /* OPIE */ |
41 | #include <qpe/config.h> | 41 | #include <qpe/config.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 | #include <opie2/okeyfilter.h> | 45 | #include <opie2/okeyfilter.h> |
46 | #include <opie2/oresource.h> | 46 | #include <opie2/oresource.h> |
47 | 47 | ||
48 | /* STD */ | 48 | /* STD */ |
49 | #include <fcntl.h> | 49 | #include <fcntl.h> |
50 | #include <math.h> | 50 | #include <math.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <signal.h> | 52 | #include <signal.h> |
53 | #include <sys/ioctl.h> | 53 | #include <sys/ioctl.h> |
54 | #include <sys/time.h> | 54 | #include <sys/time.h> |
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | #ifndef QT_NO_SOUND | 56 | #ifndef QT_NO_SOUND |
57 | #include <linux/soundcard.h> | 57 | #include <linux/soundcard.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | using namespace Opie::Core; | 60 | using namespace Opie::Core; |
61 | using namespace Opie::Core::Internal; | 61 | using namespace Opie::Core::Internal; |
62 | 62 | ||
63 | struct palm_button palm_buttons [] = { | 63 | struct palm_button palm_buttons [] = { |
64 | { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, | 64 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
65 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | ||
66 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
67 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
68 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
65 | Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ), | 69 | Qt::Key_F9, QT_TRANSLATE_NOOP( "Button", "Home Button" ), |
66 | "devicebuttons/palm_home", | 70 | "devicebuttons/palm_home", |
67 | "QPE/Launcher", "home()", | 71 | "QPE/Launcher", "home()", |
68 | "buttonsettings", "raise()" }, | 72 | "buttonsettings", "raise()" }, |
69 | { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, | 73 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
74 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | ||
75 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
76 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
77 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
70 | Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ), | 78 | Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Calendar Button" ), |
71 | "devicebuttons/palm_calendar", | 79 | "devicebuttons/palm_calendar", |
72 | "datebook", "nextView()", | 80 | "datebook", "nextView()", |
73 | "today", "raise()" }, | 81 | "today", "raise()" }, |
74 | { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, | 82 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
83 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | ||
84 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
85 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
86 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
75 | Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ), | 87 | Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "Todo Button" ), |
76 | "devicebuttons/palm_todo", | 88 | "devicebuttons/palm_todo", |
77 | "todolist", "raise()", | 89 | "todolist", "raise()", |
78 | "todolist", "create()" }, | 90 | "todolist", "create()" }, |
79 | { Model_Palm_TX | Model_Palm_LD | Model_Palm_Z72, | 91 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
92 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | | ||
93 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
94 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
95 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
80 | Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ), | 96 | Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "Mail Button" ), |
81 | "devicebuttons/palm_mail", | 97 | "devicebuttons/palm_mail", |
82 | "opiemail", "raise()", | 98 | "opiemail", "raise()", |
83 | "opiemail", "newmail()" }, | 99 | "opiemail", "newmail()" }, |
84 | { Model_Palm_LD, | 100 | { Model_Palm_LD | Model_Palm_Z72 | Model_Palm_T600 | Model_Palm_T650 | |
85 | Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Voice Memo Button" ), | 101 | Model_Palm_T680 | Model_Palm_T700W | Model_Palm_T700P | |
86 | "devicebuttons/palm_voice_memo", | 102 | Model_Palm_T750 | Model_Palm_T755P, |
87 | "QPE/TaskBar", "toggleMenu()", | 103 | Qt::Key_F7, QT_TRANSLATE_NOOP( "Button", "Record Button" ), |
88 | "QPE/TaskBar", "toggleStartMenu()" }, | 104 | "devicebuttons/palm_record", |
89 | { Model_Palm_LD, | 105 | "QPE/VMemo", "toggleRecord()", |
90 | Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Rotate Button" ), | 106 | "sound", "raise()" }, |
91 | "devicebuttons/palm_rotate", | 107 | { Model_Palm_TT | Model_Palm_TT2 | Model_Palm_TT3 | Model_Palm_TT5 | |
92 | "QPE/Rotation", "flip()",0,0}, | 108 | Model_Palm_TE | Model_Palm_TE2 | Model_Palm_TC | Model_Palm_LD | |
109 | Model_Palm_TX | Model_Palm_Z71 | Model_Palm_Z72 | Model_Palm_T600 | | ||
110 | Model_Palm_T650 | Model_Palm_T680 | Model_Palm_T700W | | ||
111 | Model_Palm_T700P | Model_Palm_T750 | Model_Palm_T755P, | ||
112 | Qt::Key_F8, QT_TRANSLATE_NOOP( "Button", "Suspend Button" ), | ||
113 | "devicebuttons/palm_suspend", | ||
114 | "suspend", "raise()", | ||
115 | "suspend", "raise()" }, | ||
93 | }; | 116 | }; |
94 | 117 | ||
95 | void Palm::init(const QString& cpu_info) | 118 | void Palm::init(const QString& cpu_info) |
96 | { | 119 | { |
97 | d->m_vendorstr = "Palm"; | 120 | d->m_vendorstr = "Palm"; |
98 | d->m_vendor = Vendor_Palm; | 121 | d->m_vendor = Vendor_Palm; |
99 | 122 | ||
100 | QString model = "unknown"; | 123 | QString model = "unknown"; |
101 | 124 | ||
102 | int loc = cpu_info.find( ":" ); | 125 | int loc = cpu_info.find( ":" ); |
103 | if ( loc != -1 ) | 126 | if ( loc != -1 ) |
104 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 127 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
105 | else | 128 | else |
106 | model = cpu_info; | 129 | model = cpu_info; |
107 | 130 | ||
108 | if ( model == "Palm LifeDrive" ) { | 131 | if ( model == "Palm Tungsten T" ) { |
132 | d->m_modelstr = "Palm Tungsten|T"; | ||
133 | d->m_model = Model_Palm_TT; | ||
134 | } | ||
135 | else if ( model == "Palm Tungsten T2" ) { | ||
136 | d->m_modelstr = "Palm Tungsten|T2"; | ||
137 | d->m_model = Model_Palm_TT2; | ||
138 | } | ||
139 | else if ( model == "Palm Tungsten T3" ) { | ||
140 | d->m_modelstr = "Palm Tungsten|T3"; | ||
141 | d->m_model = Model_Palm_TT3; | ||
142 | } | ||
143 | else if ( model == "Palm Tungsten T5" ) { | ||
144 | d->m_modelstr = "Palm Tungsten|T5"; | ||
145 | d->m_model = Model_Palm_TT5; | ||
146 | } | ||
147 | else if ( model == "Palm Tungsten C" ) { | ||
148 | d->m_modelstr = "Palm Tungsten|C"; | ||
149 | d->m_model = Model_Palm_TC; | ||
150 | } | ||
151 | else if ( model == "Palm Tungsten E" ) { | ||
152 | d->m_modelstr = "Palm Tungsten|E"; | ||
153 | d->m_model = Model_Palm_TE; | ||
154 | } | ||
155 | else if ( model == "Palm Tungsten E2" ) { | ||
156 | d->m_modelstr = "Palm Tungsten|E2"; | ||
157 | d->m_model = Model_Palm_TE2; | ||
158 | } | ||
159 | else if ( model == "Palm LifeDrive" ) { | ||
109 | d->m_modelstr = "Palm LifeDrive"; | 160 | d->m_modelstr = "Palm LifeDrive"; |
110 | d->m_model = Model_Palm_LD; | 161 | d->m_model = Model_Palm_LD; |
111 | } | 162 | } |
112 | else if ( model == "Palm TX" ) { | 163 | else if ( model == "Palm TX" ) { |
113 | d->m_modelstr = "Palm TX"; | 164 | d->m_modelstr = "Palm TX"; |
114 | d->m_model = Model_Palm_TX; | 165 | d->m_model = Model_Palm_TX; |
115 | } | 166 | } |
167 | else if ( model == "Palm Zire 71" ) { | ||
168 | d->m_modelstr = "Palm Zire 71"; | ||
169 | d->m_model = Model_Palm_Z71; | ||
170 | } | ||
116 | else if ( model == "Palm Zire 72" ) { | 171 | else if ( model == "Palm Zire 72" ) { |
117 | d->m_modelstr = "Palm Zire 72"; | 172 | d->m_modelstr = "Palm Zire 72"; |
118 | d->m_model = Model_Palm_Z72; | 173 | d->m_model = Model_Palm_Z72; |
119 | } | 174 | } |
175 | else if ( model == "Palm Treo 600" ) { | ||
176 | d->m_modelstr = "Palm Treo 600"; | ||
177 | d->m_model = Model_Palm_T600; | ||
178 | } | ||
179 | else if ( model == "Palm Treo 650" ) { | ||
180 | d->m_modelstr = "Palm Treo 650"; | ||
181 | d->m_model = Model_Palm_T650; | ||
182 | } | ||
183 | else if ( model == "Palm Treo 680" ) { | ||
184 | d->m_modelstr = "Palm Treo 680"; | ||
185 | d->m_model = Model_Palm_T680; | ||
186 | } | ||
187 | else if ( model == "Palm Treo 700w" ) { | ||
188 | d->m_modelstr = "Palm Treo 700w/700wx"; | ||
189 | d->m_model = Model_Palm_T700W; | ||
190 | } | ||
191 | else if ( model == "Palm Treo 700p" ) { | ||
192 | d->m_modelstr = "Palm Treo 700p"; | ||
193 | d->m_model = Model_Palm_T700P; | ||
194 | } | ||
195 | else if ( model == "Palm Treo 750" ) { | ||
196 | d->m_modelstr = "Palm Treo 750"; | ||
197 | d->m_model = Model_Palm_T750; | ||
198 | } | ||
199 | else if ( model == "Palm Treo 755p" ) { | ||
200 | d->m_modelstr= "Palm Treo 755"; | ||
201 | d->m_model= Model_Palm_T755P; | ||
202 | } | ||
203 | else if ( model == "Palm Foleo" ) { | ||
204 | d->m_modelstr= "Palm Foleo"; | ||
205 | d->m_model= Model_Palm_FOLEO; | ||
206 | } | ||
120 | else | 207 | else |
121 | d->m_model = Model_Unknown; | 208 | d->m_model = Model_Unknown; |
122 | 209 | ||
123 | switch ( d->m_model ) | 210 | switch ( d->m_model ) |
124 | { | 211 | { |
212 | case Model_Palm_TT3: | ||
213 | case Model_Palm_TT5: | ||
214 | case Model_Palm_TC: | ||
125 | case Model_Palm_LD: | 215 | case Model_Palm_LD: |
126 | case Model_Palm_TX: | 216 | case Model_Palm_TX: |
217 | case Model_Palm_TE2: | ||
127 | case Model_Palm_Z72: | 218 | case Model_Palm_Z72: |
128 | m_backlightdev = "/sys/class/backlight/pxapwm-bl/"; | 219 | m_backlightdev = "/sys/class/backlight/pxapwm-bl/"; |
129 | d->m_rotation = Rot0; | 220 | d->m_rotation = Rot0; |
130 | d->m_direction = CCW; | 221 | d->m_direction = CCW; |
131 | d->m_qteDriver = "Transformed"; | 222 | d->m_qteDriver = "Transformed"; |
132 | break; | 223 | break; |
224 | case Model_Palm_T600: | ||
225 | case Model_Palm_TT: | ||
226 | case Model_Palm_TT2: | ||
227 | case Model_Palm_TE: | ||
228 | case Model_Palm_Z71: | ||
229 | m_backlightdev = "/sys/class/backlight/omap-bl/"; | ||
230 | break; | ||
231 | case Model_Palm_T650: | ||
232 | case Model_Palm_T680: | ||
233 | case Model_Palm_T700W: | ||
234 | case Model_Palm_T700P: | ||
235 | case Model_Palm_T750: | ||
236 | case Model_Palm_T755P: | ||
237 | m_backlightdev = "/sys/class/backlight/corgi-bl/"; | ||
238 | break; | ||
239 | |||
133 | default: | 240 | default: |
134 | m_backlightdev = ""; | 241 | m_backlightdev = ""; |
135 | } | 242 | } |
136 | 243 | ||
137 | } | 244 | } |
138 | 245 | ||
139 | 246 | ||
140 | void Palm::initButtons() | 247 | void Palm::initButtons() |
141 | { | 248 | { |
142 | 249 | ||
143 | if ( d->m_buttons ) | 250 | if ( d->m_buttons ) |
144 | return ; | 251 | return ; |
145 | 252 | ||
146 | if ( isQWS( ) ) { | 253 | if ( isQWS( ) ) { |
147 | addPreHandler(this); | 254 | addPreHandler(this); |
148 | } | 255 | } |
149 | 256 | ||
150 | d->m_buttons = new QValueList <ODeviceButton>; | 257 | d->m_buttons = new QValueList <ODeviceButton>; |
151 | 258 | ||
152 | for ( uint i = 0; i < ( sizeof( palm_buttons ) / sizeof( palm_button ) ); i++ ) | 259 | for ( uint i = 0; i < ( sizeof( palm_buttons ) / sizeof( palm_button ) ); i++ ) |
153 | { | 260 | { |
154 | palm_button *ib = palm_buttons + i; | 261 | palm_button *ib = palm_buttons + i; |
155 | ODeviceButton b; | 262 | ODeviceButton b; |
156 | 263 | ||
157 | if (( ib->model & d->m_model ) == d->m_model ) { | 264 | if (( ib->model & d->m_model ) == d->m_model ) { |
158 | b. setKeycode ( ib->code ); | 265 | b. setKeycode ( ib->code ); |
159 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 266 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
160 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); | 267 | b. setPixmap ( OResource::loadPixmap ( ib->pix )); |
161 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 268 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
162 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 269 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
163 | 270 | ||
164 | d->m_buttons->append ( b ); | 271 | d->m_buttons->append ( b ); |
165 | } | 272 | } |
166 | } | 273 | } |
167 | reloadButtonMapping(); | 274 | reloadButtonMapping(); |
168 | } | 275 | } |
169 | 276 | ||
170 | 277 | ||
171 | bool Palm::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 278 | bool Palm::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
172 | { | 279 | { |
173 | int newkeycode = keycode; | 280 | int newkeycode = keycode; |
174 | 281 | ||
175 | if (qt_screen->transformOrientation() != Rot0){ | 282 | if (qt_screen->transformOrientation() != Rot0){ |
176 | 283 | ||
177 | switch ( keycode ) { | 284 | switch ( keycode ) { |
178 | case Key_Left : | 285 | case Key_Left : |
179 | case Key_Right: | 286 | case Key_Right: |
180 | case Key_Up : | 287 | case Key_Up : |
181 | case Key_Down : | 288 | case Key_Down : |
182 | newkeycode = Key_Left + ( keycode - Key_Left + (int) qt_screen->transformOrientation() ) % 4; | 289 | newkeycode = Key_Left + ( keycode - Key_Left + (int) qt_screen->transformOrientation() ) % 4; |
183 | default: | 290 | default: |
184 | break; | 291 | break; |
185 | } | 292 | } |
186 | 293 | ||
187 | if (newkeycode!=keycode) { | 294 | if (newkeycode!=keycode) { |
188 | if ( newkeycode != Key_unknown ) { | 295 | if ( newkeycode != Key_unknown ) { |
189 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 296 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
190 | } | 297 | } |
191 | return true; | 298 | return true; |
192 | } | 299 | } |
193 | 300 | ||
194 | } | 301 | } |
195 | 302 | ||
196 | return false; | 303 | return false; |
197 | } | 304 | } |
198 | 305 | ||
199 | 306 | ||
200 | bool Palm::suspend() | 307 | bool Palm::suspend() |
201 | { | 308 | { |
202 | // some Palms do not implement their own power management at the moment. | 309 | // some Palms do not implement their own power management at the moment. |
203 | 310 | ||
204 | bool res = false; | 311 | bool res = false; |
205 | 312 | ||
206 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 313 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
207 | return false; | 314 | return false; |
208 | 315 | ||
209 | switch ( d->m_model ) { | 316 | switch ( d->m_model ) { |
317 | case Model_Palm_TT: | ||
318 | case Model_Palm_TT2: | ||
319 | case Model_Palm_TT3: | ||
320 | case Model_Palm_TT5: | ||
321 | case Model_Palm_TE: | ||
322 | case Model_Palm_TE2: | ||
323 | case Model_Palm_TC: | ||
210 | case Model_Palm_LD: | 324 | case Model_Palm_LD: |
325 | case Model_Palm_TX: | ||
326 | case Model_Palm_Z71: | ||
211 | case Model_Palm_Z72: | 327 | case Model_Palm_Z72: |
328 | case Model_Palm_T600: | ||
329 | case Model_Palm_T650: | ||
330 | case Model_Palm_T680: | ||
331 | case Model_Palm_T700W: | ||
332 | case Model_Palm_T700P: | ||
333 | case Model_Palm_T750: | ||
334 | case Model_Palm_T755P: | ||
212 | { | 335 | { |
213 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); | 336 | QCopChannel::send( "QPE/System", "aboutToSuspend()" ); |
214 | 337 | ||
215 | ::sync(); // flush fs caches | 338 | ::sync(); // flush fs caches |
216 | res = ( ::system ( "apm --suspend" ) == 0 ); | 339 | res = ( ::system ( "apm --suspend" ) == 0 ); |
217 | 340 | ||
218 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); | 341 | QCopChannel::send( "QPE/System", "returnFromSuspend()" ); |
219 | } | 342 | } |
220 | break; | 343 | break; |
221 | default: | 344 | default: |
222 | break; | 345 | break; |
223 | } | 346 | } |
224 | 347 | ||
225 | return res; | 348 | return res; |
226 | } | 349 | } |
227 | 350 | ||
228 | 351 | ||
229 | int Palm::displayBrightnessResolution() const | 352 | int Palm::displayBrightnessResolution() const |
230 | { | 353 | { |
231 | int res = 1; | 354 | int res = 1; |
232 | int fd = -1; | 355 | int fd = -1; |
233 | 356 | ||
234 | switch ( d->m_model ) | 357 | switch ( d->m_model ) |
235 | { | 358 | { |
359 | case Model_Palm_TT: | ||
360 | case Model_Palm_TT2: | ||
361 | case Model_Palm_TT3: | ||
362 | case Model_Palm_TT5: | ||
363 | case Model_Palm_TE: | ||
364 | case Model_Palm_TE2: | ||
365 | case Model_Palm_TC: | ||
236 | case Model_Palm_LD: | 366 | case Model_Palm_LD: |
237 | case Model_Palm_TX: | 367 | case Model_Palm_TX: |
368 | case Model_Palm_Z71: | ||
238 | case Model_Palm_Z72: | 369 | case Model_Palm_Z72: |
370 | case Model_Palm_T600: | ||
371 | case Model_Palm_T650: | ||
372 | case Model_Palm_T680: | ||
373 | case Model_Palm_T700W: | ||
374 | case Model_Palm_T700P: | ||
375 | case Model_Palm_T750: | ||
376 | case Model_Palm_T755P: | ||
239 | fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); | 377 | fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); |
240 | if ( fd != -1) | 378 | if ( fd != -1) |
241 | { | 379 | { |
242 | char buf[100]; | 380 | char buf[100]; |
243 | if ( ::read( fd, &buf[0], sizeof buf ) > 0 ) | 381 | if ( ::read( fd, &buf[0], sizeof buf ) > 0 ) |
244 | ::sscanf( &buf[0], "%d", &res ); | 382 | ::sscanf( &buf[0], "%d", &res ); |
245 | ::close( fd ); | 383 | ::close( fd ); |
246 | } | 384 | } |
247 | break; | 385 | break; |
248 | 386 | ||
249 | default: | 387 | default: |
250 | res = 1; | 388 | res = 1; |
251 | } | 389 | } |
252 | 390 | ||
253 | return res; | 391 | return res; |
254 | } | 392 | } |
255 | 393 | ||
256 | 394 | ||
257 | bool Palm::setDisplayBrightness( int bright ) | 395 | bool Palm::setDisplayBrightness( int bright ) |
258 | { | 396 | { |
259 | bool res = false; | 397 | bool res = false; |
260 | 398 | ||
261 | if ( bright > 255 ) bright = 255; | 399 | if ( bright > 255 ) bright = 255; |
262 | if ( bright < 0 ) bright = 0; | 400 | if ( bright < 0 ) bright = 0; |
263 | 401 | ||
264 | int numberOfSteps = displayBrightnessResolution(); | 402 | int numberOfSteps = displayBrightnessResolution(); |
265 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 403 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
266 | int fd = -1; | 404 | int fd = -1; |
267 | 405 | ||
268 | switch ( d->m_model ) | 406 | switch ( d->m_model ) |
269 | { | 407 | { |
270 | 408 | case Model_Palm_TT: | |
409 | case Model_Palm_TT2: | ||
410 | case Model_Palm_TT3: | ||
411 | case Model_Palm_TT5: | ||
412 | case Model_Palm_TE: | ||
413 | case Model_Palm_TE2: | ||
414 | case Model_Palm_TC: | ||
271 | case Model_Palm_LD: | 415 | case Model_Palm_LD: |
272 | case Model_Palm_TX: | 416 | case Model_Palm_TX: |
417 | case Model_Palm_Z71: | ||
273 | case Model_Palm_Z72: | 418 | case Model_Palm_Z72: |
419 | case Model_Palm_T600: | ||
420 | case Model_Palm_T650: | ||
421 | case Model_Palm_T680: | ||
422 | case Model_Palm_T700W: | ||
423 | case Model_Palm_T700P: | ||
424 | case Model_Palm_T750: | ||
425 | case Model_Palm_T755P: | ||
274 | fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | 426 | fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
275 | if ( fd != -1 ) | 427 | if ( fd != -1 ) |
276 | { | 428 | { |
277 | char buf[100]; | 429 | char buf[100]; |
278 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 430 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
279 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 431 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
280 | ::close( fd ); | 432 | ::close( fd ); |
281 | } | 433 | } |
282 | break; | 434 | break; |
283 | 435 | ||
284 | default: | 436 | default: |
285 | res = false; | 437 | res = false; |
286 | } | 438 | } |
287 | return res; | 439 | return res; |
288 | } | 440 | } |