author | mickeyl <mickeyl> | 2005-03-31 19:03:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-03-31 19:03:55 (UTC) |
commit | 44bfce59cd3cfb2fa6d75675dee5db5edb36e522 (patch) (unidiff) | |
tree | c470f3900644e80f7ed975723780563c28aa219a | |
parent | a06caf5772561e9ce6842dc414686601a78d179c (diff) | |
download | opie-44bfce59cd3cfb2fa6d75675dee5db5edb36e522.zip opie-44bfce59cd3cfb2fa6d75675dee5db5edb36e522.tar.gz opie-44bfce59cd3cfb2fa6d75675dee5db5edb36e522.tar.bz2 |
add basic support for the Sharp SL-C1000 (Akita) PDA
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 53 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 42 |
3 files changed, 52 insertions, 44 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index e7cd82a..5db43ff 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -1,379 +1,380 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 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 = 0xff000000, | 59 | Model_Series_Mask = 0xff000000, |
60 | 60 | ||
61 | Model_iPAQ = ( 1 << 24 ), | 61 | Model_iPAQ = ( 1 << 24 ), |
62 | 62 | ||
63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), | 69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), |
70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), | 70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), |
71 | 71 | ||
72 | Model_Jornada = ( 6 << 24 ), | 72 | Model_Jornada = ( 6 << 24 ), |
73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
74 | Model_Jornada_720 = ( Model_Jornada | 0x000002 ), | 74 | Model_Jornada_720 = ( Model_Jornada | 0x000002 ), |
75 | 75 | ||
76 | Model_Zaurus = ( 2 << 24 ), | 76 | Model_Zaurus = ( 2 << 24 ), |
77 | 77 | ||
78 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 78 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
79 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 79 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
80 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 80 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
81 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 81 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
82 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 82 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
83 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), | 83 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), |
84 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), | 84 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), |
85 | Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x000008 ), | ||
85 | 86 | ||
86 | Model_SIMpad = ( 3 << 24 ), | 87 | Model_SIMpad = ( 3 << 24 ), |
87 | 88 | ||
88 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 89 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
89 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 90 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
90 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 91 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
91 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 92 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
92 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 93 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
93 | 94 | ||
94 | Model_Ramses = ( 4 << 24 ), | 95 | Model_Ramses = ( 4 << 24 ), |
95 | 96 | ||
96 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 97 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
97 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 98 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
98 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), | 99 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), |
99 | 100 | ||
100 | Model_Yopy = ( 5 << 24 ), | 101 | Model_Yopy = ( 5 << 24 ), |
101 | 102 | ||
102 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 103 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
103 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 104 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
104 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 105 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
105 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 106 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
106 | 107 | ||
107 | Model_Beagle = ( 6 << 24 ), | 108 | Model_Beagle = ( 6 << 24 ), |
108 | 109 | ||
109 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), | 110 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), |
110 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), | 111 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), |
111 | 112 | ||
112 | Model_GenuineIntel = ( 7 << 24 ) | 113 | Model_GenuineIntel = ( 7 << 24 ) |
113 | 114 | ||
114 | }; | 115 | }; |
115 | 116 | ||
116 | /** | 117 | /** |
117 | * The vendor of the device | 118 | * The vendor of the device |
118 | */ | 119 | */ |
119 | enum OVendor { | 120 | enum OVendor { |
120 | Vendor_Unknown, | 121 | Vendor_Unknown, |
121 | 122 | ||
122 | Vendor_HP, | 123 | Vendor_HP, |
123 | Vendor_Sharp, | 124 | Vendor_Sharp, |
124 | Vendor_SIEMENS, | 125 | Vendor_SIEMENS, |
125 | Vendor_MundN, | 126 | Vendor_MundN, |
126 | Vendor_GMate, | 127 | Vendor_GMate, |
127 | Vendor_MasterIA, | 128 | Vendor_MasterIA, |
128 | Vendor_GenuineIntel | 129 | Vendor_GenuineIntel |
129 | }; | 130 | }; |
130 | 131 | ||
131 | /** | 132 | /** |
132 | * The System used | 133 | * The System used |
133 | */ | 134 | */ |
134 | enum OSystem { | 135 | enum OSystem { |
135 | System_Unknown, | 136 | System_Unknown, |
136 | 137 | ||
137 | System_Familiar, | 138 | System_Familiar, |
138 | System_Zaurus, | 139 | System_Zaurus, |
139 | System_OpenZaurus, | 140 | System_OpenZaurus, |
140 | System_Linupy, | 141 | System_Linupy, |
141 | System_OpenEmbedded, | 142 | System_OpenEmbedded, |
142 | System_PC | 143 | System_PC |
143 | }; | 144 | }; |
144 | 145 | ||
145 | typedef struct { | 146 | typedef struct { |
146 | OSystem system; | 147 | OSystem system; |
147 | char* sysstr; | 148 | char* sysstr; |
148 | char* sysvfile; | 149 | char* sysvfile; |
149 | } ODistribution; | 150 | } ODistribution; |
150 | 151 | ||
151 | extern ODistribution distributions[]; | 152 | extern ODistribution distributions[]; |
152 | 153 | ||
153 | 154 | ||
154 | enum OLedState { | 155 | enum OLedState { |
155 | Led_Off, | 156 | Led_Off, |
156 | Led_On, | 157 | Led_On, |
157 | Led_BlinkSlow, | 158 | Led_BlinkSlow, |
158 | Led_BlinkFast | 159 | Led_BlinkFast |
159 | }; | 160 | }; |
160 | 161 | ||
161 | enum OLed { | 162 | enum OLed { |
162 | Led_Mail, | 163 | Led_Mail, |
163 | Led_Power, | 164 | Led_Power, |
164 | Led_BlueTooth | 165 | Led_BlueTooth |
165 | }; | 166 | }; |
166 | 167 | ||
167 | enum OHardKey { | 168 | enum OHardKey { |
168 | HardKey_Datebook = Qt::Key_F9, | 169 | HardKey_Datebook = Qt::Key_F9, |
169 | HardKey_Contacts = Qt::Key_F10, | 170 | HardKey_Contacts = Qt::Key_F10, |
170 | HardKey_Menu = Qt::Key_F11, | 171 | HardKey_Menu = Qt::Key_F11, |
171 | HardKey_Home = Qt::Key_F12, | 172 | HardKey_Home = Qt::Key_F12, |
172 | HardKey_Mail = Qt::Key_F13, | 173 | HardKey_Mail = Qt::Key_F13, |
173 | HardKey_Record = Qt::Key_F24, | 174 | HardKey_Record = Qt::Key_F24, |
174 | HardKey_Suspend = Qt::Key_F34, | 175 | HardKey_Suspend = Qt::Key_F34, |
175 | HardKey_Backlight = Qt::Key_F35, | 176 | HardKey_Backlight = Qt::Key_F35, |
176 | HardKey_Action = Qt::Key_F10, | 177 | HardKey_Action = Qt::Key_F10, |
177 | HardKey_OK = Qt::Key_F11, | 178 | HardKey_OK = Qt::Key_F11, |
178 | HardKey_End = Qt::Key_F12, | 179 | HardKey_End = Qt::Key_F12, |
179 | }; | 180 | }; |
180 | 181 | ||
181 | enum ODirection { | 182 | enum ODirection { |
182 | CW = 0, | 183 | CW = 0, |
183 | CCW = 1, | 184 | CCW = 1, |
184 | Flip = 2, | 185 | Flip = 2, |
185 | }; | 186 | }; |
186 | 187 | ||
187 | enum OHingeStatus { | 188 | enum OHingeStatus { |
188 | CASE_CLOSED = 3, | 189 | CASE_CLOSED = 3, |
189 | CASE_PORTRAIT = 2, | 190 | CASE_PORTRAIT = 2, |
190 | CASE_LANDSCAPE = 0, | 191 | CASE_LANDSCAPE = 0, |
191 | CASE_UNKNOWN = 1, | 192 | CASE_UNKNOWN = 1, |
192 | }; | 193 | }; |
193 | 194 | ||
194 | /* default button for qvfb or such | 195 | /* default button for qvfb or such |
195 | * see odevice.cpp for details. | 196 | * see odevice.cpp for details. |
196 | * hint: manage a user defined button for qvfb? | 197 | * hint: manage a user defined button for qvfb? |
197 | * alwin | 198 | * alwin |
198 | */ | 199 | */ |
199 | struct default_button { | 200 | struct default_button { |
200 | Qt::Key code; | 201 | Qt::Key code; |
201 | char *utext; | 202 | char *utext; |
202 | char *pix; | 203 | char *pix; |
203 | char *fpressedservice; | 204 | char *fpressedservice; |
204 | char *fpressedaction; | 205 | char *fpressedaction; |
205 | char *fheldservice; | 206 | char *fheldservice; |
206 | char *fheldaction; | 207 | char *fheldaction; |
207 | }; | 208 | }; |
208 | 209 | ||
209 | /** | 210 | /** |
210 | * A singleton which gives informations about device specefic option | 211 | * A singleton which gives informations about device specefic option |
211 | * like the Hardware used, LEDs, the Base Distribution and | 212 | * like the Hardware used, LEDs, the Base Distribution and |
212 | * hardware key mappings. | 213 | * hardware key mappings. |
213 | * | 214 | * |
214 | * @short A small class for device specefic options | 215 | * @short A small class for device specefic options |
215 | * @see QObject | 216 | * @see QObject |
216 | * @author Robert Griebl | 217 | * @author Robert Griebl |
217 | * @version 1.0 | 218 | * @version 1.0 |
218 | */ | 219 | */ |
219 | class ODevice : public QObject | 220 | class ODevice : public QObject |
220 | { | 221 | { |
221 | Q_OBJECT | 222 | Q_OBJECT |
222 | 223 | ||
223 | private: | 224 | private: |
224 | /* disable copy */ | 225 | /* disable copy */ |
225 | ODevice ( const ODevice & ); | 226 | ODevice ( const ODevice & ); |
226 | 227 | ||
227 | protected: | 228 | protected: |
228 | ODevice(); | 229 | ODevice(); |
229 | virtual void init(const QString&); | 230 | virtual void init(const QString&); |
230 | virtual void initButtons(); | 231 | virtual void initButtons(); |
231 | static void sendSuspendmsg(); | 232 | static void sendSuspendmsg(); |
232 | 233 | ||
233 | ODeviceData *d; | 234 | ODeviceData *d; |
234 | 235 | ||
235 | public: | 236 | public: |
236 | // sandman do we want to allow destructions? -zecke? | 237 | // sandman do we want to allow destructions? -zecke? |
237 | virtual ~ODevice(); | 238 | virtual ~ODevice(); |
238 | 239 | ||
239 | static ODevice *inst(); | 240 | static ODevice *inst(); |
240 | 241 | ||
241 | // information | 242 | // information |
242 | 243 | ||
243 | QString modelString() const; | 244 | QString modelString() const; |
244 | OModel model() const; | 245 | OModel model() const; |
245 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } | 246 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } |
246 | 247 | ||
247 | QString vendorString() const; | 248 | QString vendorString() const; |
248 | OVendor vendor() const; | 249 | OVendor vendor() const; |
249 | 250 | ||
250 | QString systemString() const; | 251 | QString systemString() const; |
251 | OSystem system() const; | 252 | OSystem system() const; |
252 | 253 | ||
253 | QString systemVersionString() const; | 254 | QString systemVersionString() const; |
254 | 255 | ||
255 | virtual Transformation rotation() const; | 256 | virtual Transformation rotation() const; |
256 | virtual ODirection direction() const; | 257 | virtual ODirection direction() const; |
257 | 258 | ||
258 | // system | 259 | // system |
259 | virtual bool suspend(); | 260 | virtual bool suspend(); |
260 | 261 | ||
261 | virtual bool setDisplayStatus ( bool on ); | 262 | virtual bool setDisplayStatus ( bool on ); |
262 | virtual bool setDisplayBrightness ( int brightness ); | 263 | virtual bool setDisplayBrightness ( int brightness ); |
263 | virtual int displayBrightnessResolution() const; | 264 | virtual int displayBrightnessResolution() const; |
264 | virtual bool setDisplayContrast ( int contrast ); | 265 | virtual bool setDisplayContrast ( int contrast ); |
265 | virtual int displayContrastResolution() const; | 266 | virtual int displayContrastResolution() const; |
266 | 267 | ||
267 | // don't add new virtual methods, use this: | 268 | // don't add new virtual methods, use this: |
268 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 269 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
269 | // and in your subclass do overwrite | 270 | // and in your subclass do overwrite |
270 | // protected virtual int virtual_hook(int, void *) | 271 | // protected virtual int virtual_hook(int, void *) |
271 | // which is defined below | 272 | // which is defined below |
272 | 273 | ||
273 | // input / output | 274 | // input / output |
274 | virtual void playAlarmSound(); | 275 | virtual void playAlarmSound(); |
275 | virtual void playKeySound(); | 276 | virtual void playKeySound(); |
276 | virtual void playTouchSound(); | 277 | virtual void playTouchSound(); |
277 | 278 | ||
278 | virtual QValueList <OLed> ledList() const; | 279 | virtual QValueList <OLed> ledList() const; |
279 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 280 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
280 | virtual OLedState ledState ( OLed led ) const; | 281 | virtual OLedState ledState ( OLed led ) const; |
281 | virtual bool setLedState ( OLed led, OLedState st ); | 282 | virtual bool setLedState ( OLed led, OLedState st ); |
282 | 283 | ||
283 | virtual bool hasLightSensor() const; | 284 | virtual bool hasLightSensor() const; |
284 | virtual int readLightSensor(); | 285 | virtual int readLightSensor(); |
285 | virtual int lightSensorResolution() const; | 286 | virtual int lightSensorResolution() const; |
286 | 287 | ||
287 | virtual bool hasHingeSensor() const; | 288 | virtual bool hasHingeSensor() const; |
288 | virtual OHingeStatus readHingeSensor()const; | 289 | virtual OHingeStatus readHingeSensor()const; |
289 | 290 | ||
290 | const QStrList &allowedCpuFrequencies() const; | 291 | const QStrList &allowedCpuFrequencies() const; |
291 | bool setCurrentCpuFrequency(uint index); | 292 | bool setCurrentCpuFrequency(uint index); |
292 | 293 | ||
293 | /** | 294 | /** |
294 | * Returns the available buttons on this device. The number and location | 295 | * Returns the available buttons on this device. The number and location |
295 | * of buttons will vary depending on the device. Button numbers will be assigned | 296 | * of buttons will vary depending on the device. Button numbers will be assigned |
296 | * by the device manufacturer and will be from most preferred button to least preffered | 297 | * by the device manufacturer and will be from most preferred button to least preffered |
297 | * button. Note that this list only contains "user mappable" buttons. | 298 | * button. Note that this list only contains "user mappable" buttons. |
298 | * | 299 | * |
299 | * @todo Make method const and take care of calling initButtons or make that const too | 300 | * @todo Make method const and take care of calling initButtons or make that const too |
300 | * | 301 | * |
301 | */ | 302 | */ |
302 | const QValueList<ODeviceButton> &buttons(); | 303 | const QValueList<ODeviceButton> &buttons(); |
303 | 304 | ||
304 | /** | 305 | /** |
305 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 306 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
306 | * returns 0L | 307 | * returns 0L |
307 | */ | 308 | */ |
308 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 309 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
309 | 310 | ||
310 | /** | 311 | /** |
311 | * Reassigns the pressed action for \a button. To return to the factory | 312 | * Reassigns the pressed action for \a button. To return to the factory |
312 | * default pass an empty string as \a qcopMessage. | 313 | * default pass an empty string as \a qcopMessage. |
313 | */ | 314 | */ |
314 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 315 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
315 | 316 | ||
316 | /** | 317 | /** |
317 | * Reassigns the held action for \a button. To return to the factory | 318 | * Reassigns the held action for \a button. To return to the factory |
318 | * default pass an empty string as \a qcopMessage. | 319 | * default pass an empty string as \a qcopMessage. |
319 | */ | 320 | */ |
320 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 321 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
321 | 322 | ||
322 | /** | 323 | /** |
323 | * How long (in ms) you have to press a button for a "hold" action | 324 | * How long (in ms) you have to press a button for a "hold" action |
324 | */ | 325 | */ |
325 | uint buttonHoldTime() const; | 326 | uint buttonHoldTime() const; |
326 | 327 | ||
327 | signals: | 328 | signals: |
328 | void buttonMappingChanged(); | 329 | void buttonMappingChanged(); |
329 | 330 | ||
330 | private slots: | 331 | private slots: |
331 | void systemMessage ( const QCString &, const QByteArray & ); | 332 | void systemMessage ( const QCString &, const QByteArray & ); |
332 | void playingStopped(); | 333 | void playingStopped(); |
333 | 334 | ||
334 | protected: | 335 | protected: |
335 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); | 336 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); |
336 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); | 337 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); |
337 | void reloadButtonMapping(); | 338 | void reloadButtonMapping(); |
338 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); | 339 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); |
339 | 340 | ||
340 | /* ugly virtual hook */ | 341 | /* ugly virtual hook */ |
341 | virtual void virtual_hook( int id, void* data ); | 342 | virtual void virtual_hook( int id, void* data ); |
342 | }; | 343 | }; |
343 | 344 | ||
344 | class ODeviceData { | 345 | class ODeviceData { |
345 | 346 | ||
346 | public: | 347 | public: |
347 | QString m_vendorstr; | 348 | QString m_vendorstr; |
348 | OVendor m_vendor; | 349 | OVendor m_vendor; |
349 | 350 | ||
350 | QString m_modelstr; | 351 | QString m_modelstr; |
351 | OModel m_model; | 352 | OModel m_model; |
352 | 353 | ||
353 | QString m_systemstr; | 354 | QString m_systemstr; |
354 | OSystem m_system; | 355 | OSystem m_system; |
355 | 356 | ||
356 | QString m_sysverstr; | 357 | QString m_sysverstr; |
357 | 358 | ||
358 | Transformation m_rotation; | 359 | Transformation m_rotation; |
359 | ODirection m_direction; | 360 | ODirection m_direction; |
360 | 361 | ||
361 | QValueList <ODeviceButton> *m_buttons; | 362 | QValueList <ODeviceButton> *m_buttons; |
362 | uint m_holdtime; | 363 | uint m_holdtime; |
363 | QStrList *m_cpu_frequencies; | 364 | QStrList *m_cpu_frequencies; |
364 | bool m_initializedButtonQcop : 1; | 365 | bool m_initializedButtonQcop : 1; |
365 | 366 | ||
366 | /* values for changeMixerForAlarm */ | 367 | /* values for changeMixerForAlarm */ |
367 | int m_sound, m_vol, m_mixer; | 368 | int m_sound, m_vol, m_mixer; |
368 | }; | 369 | }; |
369 | 370 | ||
370 | extern bool isQWS(); | 371 | extern bool isQWS(); |
371 | extern QCString makeChannel ( const char *str ); | 372 | extern QCString makeChannel ( const char *str ); |
372 | } | 373 | } |
373 | } | 374 | } |
374 | 375 | ||
375 | 376 | ||
376 | 377 | ||
377 | 378 | ||
378 | #endif | 379 | #endif |
379 | 380 | ||
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 8aefc13..3bd7f6e 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,657 +1,664 @@ | |||
1 | /* | 1 | /* |
2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Â Â Â Â Â Â Â Copyright (C) 2002,2003,2004 The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | Â Â Â Â Â Â .>+-= | 6 | .>+-= |
7 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, Â Â .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | Â Â .%`+i> Â Â Â _;_. | 13 | .%`+i> _;_. |
14 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= Â -. Â Â .` Â Â .: details. | 20 | ++= -. .` .: details. |
21 | Â : Â Â = Â ...= . :.=- | 21 | : = ...= . :.=- |
22 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | Â -_. . . Â )=. Â = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_zaurus.h" | 30 | #include "odevice_zaurus.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <opie2/oinputsystem.h> | 39 | #include <opie2/oinputsystem.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | #include <qpe/sound.h> | 42 | #include <qpe/sound.h> |
43 | #include <qpe/qcopenvelope_qws.h> | 43 | #include <qpe/qcopenvelope_qws.h> |
44 | 44 | ||
45 | /* STD */ | 45 | /* STD */ |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | #include <math.h> | 47 | #include <math.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
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 if ( model == "SHARP Akita" ) { | ||
203 | d->m_model = Model_Zaurus_SLC1000; | ||
204 | d->m_modelstr = "Zaurus SL-C1000"; | ||
202 | } else { | 205 | } else { |
203 | d->m_model = Model_Zaurus_SL5500; | 206 | d->m_model = Model_Zaurus_SL5500; |
204 | d->m_modelstr = "Unknown Zaurus"; | 207 | d->m_modelstr = "Unknown Zaurus"; |
205 | } | 208 | } |
206 | 209 | ||
207 | // set initial rotation | 210 | // set initial rotation |
208 | switch( d->m_model ) { | 211 | switch( d->m_model ) { |
209 | case Model_Zaurus_SL6000: // fallthrough | 212 | case Model_Zaurus_SL6000: // fallthrough |
210 | case Model_Zaurus_SLA300: | 213 | case Model_Zaurus_SLA300: |
211 | d->m_rotation = Rot0; | 214 | d->m_rotation = Rot0; |
212 | break; | 215 | break; |
213 | case Model_Zaurus_SLC3000: // fallthrough | 216 | case Model_Zaurus_SLC3000: // fallthrough |
217 | case Model_Zaurus_SLC1000: // fallthrough | ||
214 | case Model_Zaurus_SLC7x0: | 218 | case Model_Zaurus_SLC7x0: |
215 | d->m_rotation = rotation(); | 219 | d->m_rotation = rotation(); |
216 | d->m_direction = direction(); | 220 | d->m_direction = direction(); |
217 | break; | 221 | break; |
218 | case Model_Zaurus_SLB600: // fallthrough | 222 | case Model_Zaurus_SLB600: // fallthrough |
219 | case Model_Zaurus_SL5000: // fallthrough | 223 | case Model_Zaurus_SL5000: // fallthrough |
220 | case Model_Zaurus_SL5500: // fallthrough | 224 | case Model_Zaurus_SL5500: // fallthrough |
221 | default: | 225 | default: |
222 | d->m_rotation = Rot270; | 226 | d->m_rotation = Rot270; |
223 | break; | 227 | break; |
224 | } | 228 | } |
225 | m_leds[0] = Led_Off; | 229 | m_leds[0] = Led_Off; |
226 | 230 | ||
227 | if ( m_embedix ) | 231 | if ( m_embedix ) |
228 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); | 232 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); |
229 | else | 233 | else |
230 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); | 234 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); |
231 | } | 235 | } |
232 | 236 | ||
233 | void Zaurus::initButtons() | 237 | void Zaurus::initButtons() |
234 | { | 238 | { |
235 | if ( d->m_buttons ) | 239 | if ( d->m_buttons ) |
236 | return; | 240 | return; |
237 | 241 | ||
238 | 242 | ||
239 | d->m_buttons = new QValueList <ODeviceButton>; | 243 | d->m_buttons = new QValueList <ODeviceButton>; |
240 | 244 | ||
241 | struct z_button * pz_buttons; | 245 | struct z_button * pz_buttons; |
242 | int buttoncount; | 246 | int buttoncount; |
243 | switch ( d->m_model ) { | 247 | switch ( d->m_model ) { |
244 | case Model_Zaurus_SLC3000: // fallthrough | 248 | case Model_Zaurus_SLC3000: // fallthrough |
249 | case Model_Zaurus_SLC1000: // fallthrough | ||
245 | case Model_Zaurus_SLC7x0: | 250 | case Model_Zaurus_SLC7x0: |
246 | if ( isQWS( ) ) { | 251 | if ( isQWS( ) ) { |
247 | addPreHandler(this); // hinge-sensor-handler | 252 | addPreHandler(this); // hinge-sensor-handler |
248 | } | 253 | } |
249 | pz_buttons = z_buttons_c700; | 254 | pz_buttons = z_buttons_c700; |
250 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 255 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
251 | break; | 256 | break; |
252 | default: | 257 | default: |
253 | pz_buttons = z_buttons; | 258 | pz_buttons = z_buttons; |
254 | buttoncount = ARRAY_SIZE(z_buttons); | 259 | buttoncount = ARRAY_SIZE(z_buttons); |
255 | break; | 260 | break; |
256 | } | 261 | } |
257 | 262 | ||
258 | for ( int i = 0; i < buttoncount; i++ ) { | 263 | for ( int i = 0; i < buttoncount; i++ ) { |
259 | struct z_button *zb = pz_buttons + i; | 264 | struct z_button *zb = pz_buttons + i; |
260 | ODeviceButton b; | 265 | ODeviceButton b; |
261 | 266 | ||
262 | b.setKeycode( zb->code ); | 267 | b.setKeycode( zb->code ); |
263 | b.setUserText( QObject::tr( "Button", zb->utext )); | 268 | b.setUserText( QObject::tr( "Button", zb->utext )); |
264 | b.setPixmap( Resource::loadPixmap( zb->pix )); | 269 | b.setPixmap( Resource::loadPixmap( zb->pix )); |
265 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 270 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
266 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 271 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
267 | d->m_buttons->append( b ); | 272 | d->m_buttons->append( b ); |
268 | } | 273 | } |
269 | 274 | ||
270 | reloadButtonMapping(); | 275 | reloadButtonMapping(); |
271 | } | 276 | } |
272 | 277 | ||
273 | 278 | ||
274 | 279 | ||
275 | typedef struct sharp_led_status { | 280 | typedef struct sharp_led_status { |
276 | int which; /* select which LED status is wanted. */ | 281 | int which; /* select which LED status is wanted. */ |
277 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 282 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
278 | } sharp_led_status; | 283 | } sharp_led_status; |
279 | 284 | ||
280 | void Zaurus::buzzer( int sound ) | 285 | void Zaurus::buzzer( int sound ) |
281 | { | 286 | { |
282 | #ifndef QT_NO_SOUND | 287 | #ifndef QT_NO_SOUND |
283 | Sound *snd = 0; | 288 | Sound *snd = 0; |
284 | 289 | ||
285 | // All devices except SL5500 have a DSP device | 290 | // All devices except SL5500 have a DSP device |
286 | if ( d->m_model != Model_Zaurus_SL5000 | 291 | if ( d->m_model != Model_Zaurus_SL5000 |
287 | && d->m_model != Model_Zaurus_SL5500 ) { | 292 | && d->m_model != Model_Zaurus_SL5500 ) { |
288 | 293 | ||
289 | switch ( sound ){ | 294 | switch ( sound ){ |
290 | case SHARP_BUZ_TOUCHSOUND: { | 295 | case SHARP_BUZ_TOUCHSOUND: { |
291 | static Sound touch_sound("touchsound"); | 296 | static Sound touch_sound("touchsound"); |
292 | snd = &touch_sound; | 297 | snd = &touch_sound; |
293 | } | 298 | } |
294 | break; | 299 | break; |
295 | case SHARP_BUZ_KEYSOUND: { | 300 | case SHARP_BUZ_KEYSOUND: { |
296 | static Sound key_sound( "keysound" ); | 301 | static Sound key_sound( "keysound" ); |
297 | snd = &key_sound; | 302 | snd = &key_sound; |
298 | } | 303 | } |
299 | break; | 304 | break; |
300 | case SHARP_BUZ_SCHEDULE_ALARM: | 305 | case SHARP_BUZ_SCHEDULE_ALARM: |
301 | default: { | 306 | default: { |
302 | static Sound alarm_sound("alarm"); | 307 | static Sound alarm_sound("alarm"); |
303 | snd = &alarm_sound; | 308 | snd = &alarm_sound; |
304 | } | 309 | } |
305 | break; | 310 | break; |
306 | } | 311 | } |
307 | } | 312 | } |
308 | 313 | ||
309 | // If a soundname is defined, we expect that this device has | 314 | // If a soundname is defined, we expect that this device has |
310 | // sound capabilities.. Otherwise we expect to have the buzzer | 315 | // sound capabilities.. Otherwise we expect to have the buzzer |
311 | // device.. | 316 | // device.. |
312 | if ( snd && snd->isFinished() ){ | 317 | if ( snd && snd->isFinished() ){ |
313 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 318 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
314 | snd->play(); | 319 | snd->play(); |
315 | } else if( !snd ) { | 320 | } else if( !snd ) { |
316 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 321 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
317 | 322 | ||
318 | if ( fd >= 0 ) { | 323 | if ( fd >= 0 ) { |
319 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 324 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
320 | ::close ( fd ); | 325 | ::close ( fd ); |
321 | } | 326 | } |
322 | 327 | ||
323 | } | 328 | } |
324 | #endif | 329 | #endif |
325 | } | 330 | } |
326 | 331 | ||
327 | 332 | ||
328 | void Zaurus::playAlarmSound() | 333 | void Zaurus::playAlarmSound() |
329 | { | 334 | { |
330 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 335 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
331 | } | 336 | } |
332 | 337 | ||
333 | void Zaurus::playTouchSound() | 338 | void Zaurus::playTouchSound() |
334 | { | 339 | { |
335 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 340 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
336 | } | 341 | } |
337 | 342 | ||
338 | void Zaurus::playKeySound() | 343 | void Zaurus::playKeySound() |
339 | { | 344 | { |
340 | buzzer( SHARP_BUZ_KEYSOUND ); | 345 | buzzer( SHARP_BUZ_KEYSOUND ); |
341 | } | 346 | } |
342 | 347 | ||
343 | 348 | ||
344 | QValueList <OLed> Zaurus::ledList() const | 349 | QValueList <OLed> Zaurus::ledList() const |
345 | { | 350 | { |
346 | QValueList <OLed> vl; | 351 | QValueList <OLed> vl; |
347 | vl << Led_Mail; | 352 | vl << Led_Mail; |
348 | return vl; | 353 | return vl; |
349 | } | 354 | } |
350 | 355 | ||
351 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const | 356 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const |
352 | { | 357 | { |
353 | QValueList <OLedState> vl; | 358 | QValueList <OLedState> vl; |
354 | 359 | ||
355 | if ( l == Led_Mail ) | 360 | if ( l == Led_Mail ) |
356 | vl << Led_Off << Led_On << Led_BlinkSlow; | 361 | vl << Led_Off << Led_On << Led_BlinkSlow; |
357 | return vl; | 362 | return vl; |
358 | } | 363 | } |
359 | 364 | ||
360 | OLedState Zaurus::ledState( OLed which ) const | 365 | OLedState Zaurus::ledState( OLed which ) const |
361 | { | 366 | { |
362 | if ( which == Led_Mail ) | 367 | if ( which == Led_Mail ) |
363 | return m_leds [0]; | 368 | return m_leds [0]; |
364 | else | 369 | else |
365 | return Led_Off; | 370 | return Led_Off; |
366 | } | 371 | } |
367 | 372 | ||
368 | bool Zaurus::setLedState( OLed which, OLedState st ) | 373 | bool Zaurus::setLedState( OLed which, OLedState st ) |
369 | { | 374 | { |
370 | // Currently not supported on non_embedix kernels | 375 | // Currently not supported on non_embedix kernels |
371 | if (!m_embedix) | 376 | if (!m_embedix) |
372 | { | 377 | { |
373 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); | 378 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); |
374 | return false; | 379 | return false; |
375 | } | 380 | } |
376 | 381 | ||
377 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 382 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
378 | 383 | ||
379 | if ( which == Led_Mail ) { | 384 | if ( which == Led_Mail ) { |
380 | if ( fd >= 0 ) { | 385 | if ( fd >= 0 ) { |
381 | struct sharp_led_status leds; | 386 | struct sharp_led_status leds; |
382 | ::memset ( &leds, 0, sizeof( leds )); | 387 | ::memset ( &leds, 0, sizeof( leds )); |
383 | leds. which = SHARP_LED_MAIL_EXISTS; | 388 | leds. which = SHARP_LED_MAIL_EXISTS; |
384 | bool ok = true; | 389 | bool ok = true; |
385 | 390 | ||
386 | switch ( st ) { | 391 | switch ( st ) { |
387 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 392 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
388 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 393 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
389 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 394 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
390 | default : ok = false; | 395 | default : ok = false; |
391 | } | 396 | } |
392 | 397 | ||
393 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 398 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
394 | m_leds [0] = st; | 399 | m_leds [0] = st; |
395 | return true; | 400 | return true; |
396 | } | 401 | } |
397 | } | 402 | } |
398 | } | 403 | } |
399 | return false; | 404 | return false; |
400 | } | 405 | } |
401 | 406 | ||
402 | int Zaurus::displayBrightnessResolution() const | 407 | int Zaurus::displayBrightnessResolution() const |
403 | { | 408 | { |
404 | int res = 1; | 409 | int res = 1; |
405 | if (m_embedix) | 410 | if (m_embedix) |
406 | { | 411 | { |
407 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 412 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
408 | if ( fd ) | 413 | if ( fd ) |
409 | { | 414 | { |
410 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 415 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
411 | ::close( fd ); | 416 | ::close( fd ); |
412 | return value ? value : res; | 417 | return value ? value : res; |
413 | } | 418 | } |
414 | } | 419 | } |
415 | else | 420 | else |
416 | { | 421 | { |
417 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); | 422 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); |
418 | if ( fd ) | 423 | if ( fd ) |
419 | { | 424 | { |
420 | char buf[100]; | 425 | char buf[100]; |
421 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | 426 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); |
422 | ::close( fd ); | 427 | ::close( fd ); |
423 | } | 428 | } |
424 | } | 429 | } |
425 | return res; | 430 | return res; |
426 | } | 431 | } |
427 | 432 | ||
428 | bool Zaurus::setDisplayBrightness( int bright ) | 433 | bool Zaurus::setDisplayBrightness( int bright ) |
429 | { | 434 | { |
430 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); | 435 | //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); |
431 | bool res = false; | 436 | bool res = false; |
432 | 437 | ||
433 | if ( bright > 255 ) bright = 255; | 438 | if ( bright > 255 ) bright = 255; |
434 | if ( bright < 0 ) bright = 0; | 439 | if ( bright < 0 ) bright = 0; |
435 | 440 | ||
436 | int numberOfSteps = displayBrightnessResolution(); | 441 | int numberOfSteps = displayBrightnessResolution(); |
437 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 442 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
438 | 443 | ||
439 | if ( m_embedix ) | 444 | if ( m_embedix ) |
440 | { | 445 | { |
441 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 446 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
442 | if ( fd ) | 447 | if ( fd ) |
443 | { | 448 | { |
444 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | 449 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); |
445 | ::close( fd ); | 450 | ::close( fd ); |
446 | } | 451 | } |
447 | } | 452 | } |
448 | else | 453 | else |
449 | { | 454 | { |
450 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); | 455 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); |
451 | if ( fd ) | 456 | if ( fd ) |
452 | { | 457 | { |
453 | char buf[100]; | 458 | char buf[100]; |
454 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 459 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
455 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 460 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
456 | ::close( fd ); | 461 | ::close( fd ); |
457 | } | 462 | } |
458 | } | 463 | } |
459 | return res; | 464 | return res; |
460 | } | 465 | } |
461 | 466 | ||
462 | bool Zaurus::setDisplayStatus( bool on ) | 467 | bool Zaurus::setDisplayStatus( bool on ) |
463 | { | 468 | { |
464 | bool res = false; | 469 | bool res = false; |
465 | if ( m_embedix ) | 470 | if ( m_embedix ) |
466 | { | 471 | { |
467 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 472 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
468 | if ( fd ) | 473 | if ( fd ) |
469 | { | 474 | { |
470 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 475 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
471 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 476 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
472 | ::close ( fd ); | 477 | ::close ( fd ); |
473 | } | 478 | } |
474 | } | 479 | } |
475 | else | 480 | else |
476 | { | 481 | { |
477 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); | 482 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); |
478 | if ( fd ) | 483 | if ( fd ) |
479 | { | 484 | { |
480 | char buf[10]; | 485 | char buf[10]; |
481 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 486 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
482 | buf[1] = '\0'; | 487 | buf[1] = '\0'; |
483 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 488 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
484 | ::close( fd ); | 489 | ::close( fd ); |
485 | } | 490 | } |
486 | } | 491 | } |
487 | return res; | 492 | return res; |
488 | } | 493 | } |
489 | 494 | ||
490 | Transformation Zaurus::rotation() const | 495 | Transformation Zaurus::rotation() const |
491 | { | 496 | { |
492 | qDebug( "Zaurus::rotation()" ); | 497 | qDebug( "Zaurus::rotation()" ); |
493 | Transformation rot; | 498 | Transformation rot; |
494 | 499 | ||
495 | switch ( d->m_model ) { | 500 | switch ( d->m_model ) { |
496 | case Model_Zaurus_SLC3000: // fallthrough | 501 | case Model_Zaurus_SLC3000: // fallthrough |
502 | case Model_Zaurus_SLC1000: // fallthrough | ||
497 | case Model_Zaurus_SLC7x0: | 503 | case Model_Zaurus_SLC7x0: |
498 | { | 504 | { |
499 | OHingeStatus hs = readHingeSensor(); | 505 | OHingeStatus hs = readHingeSensor(); |
500 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 506 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
501 | 507 | ||
502 | if ( m_embedix ) | 508 | if ( m_embedix ) |
503 | { | 509 | { |
504 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 510 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
505 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 511 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
506 | else rot = Rot270; | 512 | else rot = Rot270; |
507 | } | 513 | } |
508 | else | 514 | else |
509 | { | 515 | { |
510 | if ( hs == CASE_PORTRAIT ) rot = Rot90; | 516 | if ( hs == CASE_PORTRAIT ) rot = Rot90; |
511 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 517 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
512 | else rot = Rot0; | 518 | else rot = Rot0; |
513 | } | 519 | } |
514 | } | 520 | } |
515 | break; | 521 | break; |
516 | case Model_Zaurus_SL6000: | 522 | case Model_Zaurus_SL6000: |
517 | case Model_Zaurus_SLB600: | 523 | case Model_Zaurus_SLB600: |
518 | case Model_Zaurus_SLA300: | 524 | case Model_Zaurus_SLA300: |
519 | case Model_Zaurus_SL5500: | 525 | case Model_Zaurus_SL5500: |
520 | case Model_Zaurus_SL5000: | 526 | case Model_Zaurus_SL5000: |
521 | default: | 527 | default: |
522 | rot = d->m_rotation; | 528 | rot = d->m_rotation; |
523 | break; | 529 | break; |
524 | } | 530 | } |
525 | 531 | ||
526 | return rot; | 532 | return rot; |
527 | } | 533 | } |
528 | ODirection Zaurus::direction() const | 534 | ODirection Zaurus::direction() const |
529 | { | 535 | { |
530 | ODirection dir; | 536 | ODirection dir; |
531 | 537 | ||
532 | switch ( d->m_model ) { | 538 | switch ( d->m_model ) { |
533 | case Model_Zaurus_SLC3000: // fallthrough | 539 | case Model_Zaurus_SLC3000: // fallthrough |
540 | case Model_Zaurus_SLC1000: // fallthrough | ||
534 | case Model_Zaurus_SLC7x0: { | 541 | case Model_Zaurus_SLC7x0: { |
535 | OHingeStatus hs = readHingeSensor(); | 542 | OHingeStatus hs = readHingeSensor(); |
536 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 543 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
537 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 544 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
538 | else dir = CW; | 545 | else dir = CW; |
539 | } | 546 | } |
540 | break; | 547 | break; |
541 | case Model_Zaurus_SL6000: | 548 | case Model_Zaurus_SL6000: |
542 | case Model_Zaurus_SLA300: | 549 | case Model_Zaurus_SLA300: |
543 | case Model_Zaurus_SLB600: | 550 | case Model_Zaurus_SLB600: |
544 | case Model_Zaurus_SL5500: | 551 | case Model_Zaurus_SL5500: |
545 | case Model_Zaurus_SL5000: | 552 | case Model_Zaurus_SL5000: |
546 | default: dir = d->m_direction; | 553 | default: dir = d->m_direction; |
547 | break; | 554 | break; |
548 | } | 555 | } |
549 | return dir; | 556 | return dir; |
550 | 557 | ||
551 | } | 558 | } |
552 | 559 | ||
553 | bool Zaurus::hasHingeSensor() const | 560 | bool Zaurus::hasHingeSensor() const |
554 | { | 561 | { |
555 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; | 562 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000 || d->m_model == Model_Zaurus_SLC1000; |
556 | } | 563 | } |
557 | 564 | ||
558 | OHingeStatus Zaurus::readHingeSensor() const | 565 | OHingeStatus Zaurus::readHingeSensor() const |
559 | { | 566 | { |
560 | if (m_embedix) | 567 | if (m_embedix) |
561 | { | 568 | { |
562 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); | 569 | int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); |
563 | if (handle == -1) | 570 | if (handle == -1) |
564 | { | 571 | { |
565 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror | 572 | qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror |
566 | return CASE_UNKNOWN; | 573 | return CASE_UNKNOWN; |
567 | } | 574 | } |
568 | else | 575 | else |
569 | { | 576 | { |
570 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); | 577 | int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); |
571 | ::close (handle); | 578 | ::close (handle); |
572 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) | 579 | if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) |
573 | { | 580 | { |
574 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); | 581 | qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); |
575 | return static_cast<OHingeStatus>( retval ); | 582 | return static_cast<OHingeStatus>( retval ); |
576 | } | 583 | } |
577 | else | 584 | else |
578 | { | 585 | { |
579 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 586 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
580 | return CASE_UNKNOWN; | 587 | return CASE_UNKNOWN; |
581 | } | 588 | } |
582 | } | 589 | } |
583 | } | 590 | } |
584 | else | 591 | else |
585 | { | 592 | { |
586 | // corgi keyboard is event source 0 in OZ kernel 2.6 | 593 | // corgi keyboard is event source 0 in OZ kernel 2.6 |
587 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); | 594 | OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); |
588 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; | 595 | if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; |
589 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; | 596 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; |
590 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; | 597 | else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; |
591 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); | 598 | qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); |
592 | return CASE_UNKNOWN; | 599 | return CASE_UNKNOWN; |
593 | } | 600 | } |
594 | } | 601 | } |
595 | 602 | ||
596 | /* | 603 | /* |
597 | * Take code from iPAQ device. | 604 | * Take code from iPAQ device. |
598 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. | 605 | * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. |
599 | * I hope that is ok - Alwin | 606 | * I hope that is ok - Alwin |
600 | */ | 607 | */ |
601 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 608 | bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
602 | { | 609 | { |
603 | int newkeycode = keycode; | 610 | int newkeycode = keycode; |
604 | 611 | ||
605 | if (d->m_model!=Model_Zaurus_SLC3000 && d->m_model!=Model_Zaurus_SLC7x0) return false; | 612 | if (d->m_model != Model_Zaurus_SLC7x0 && d->m_model != Model_Zaurus_SLC3000 && d->m_model != Model_Zaurus_SLC1000) return false; |
606 | 613 | ||
607 | /* map cursor keys depending on the hinge status */ | 614 | /* map cursor keys depending on the hinge status */ |
608 | switch ( keycode ) { | 615 | switch ( keycode ) { |
609 | // Rotate cursor keys | 616 | // Rotate cursor keys |
610 | case Key_Left : | 617 | case Key_Left : |
611 | case Key_Right: | 618 | case Key_Right: |
612 | case Key_Up : | 619 | case Key_Up : |
613 | case Key_Down : | 620 | case Key_Down : |
614 | { | 621 | { |
615 | if (rotation()==Rot90) { | 622 | if (rotation()==Rot90) { |
616 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 623 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
617 | } | 624 | } |
618 | } | 625 | } |
619 | break; | 626 | break; |
620 | 627 | ||
621 | } | 628 | } |
622 | if (newkeycode!=keycode) { | 629 | if (newkeycode!=keycode) { |
623 | if ( newkeycode != Key_unknown ) { | 630 | if ( newkeycode != Key_unknown ) { |
624 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 631 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
625 | } | 632 | } |
626 | return true; | 633 | return true; |
627 | } | 634 | } |
628 | return false; | 635 | return false; |
629 | } | 636 | } |
630 | 637 | ||
631 | bool Zaurus::suspend() { | 638 | bool Zaurus::suspend() { |
632 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 639 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
633 | return false; | 640 | return false; |
634 | 641 | ||
635 | bool res = false; | 642 | bool res = false; |
636 | OAbstractMobileDevice::sendSuspendmsg(); | 643 | OAbstractMobileDevice::sendSuspendmsg(); |
637 | 644 | ||
638 | struct timeval tvs, tvn; | 645 | struct timeval tvs, tvn; |
639 | ::gettimeofday ( &tvs, 0 ); | 646 | ::gettimeofday ( &tvs, 0 ); |
640 | 647 | ||
641 | ::sync(); // flush fs caches | 648 | ::sync(); // flush fs caches |
642 | res = ( ::system ( "apm --suspend" ) == 0 ); | 649 | res = ( ::system ( "apm --suspend" ) == 0 ); |
643 | 650 | ||
644 | // This is needed because some apm implementations are asynchronous and we | 651 | // This is needed because some apm implementations are asynchronous and we |
645 | // can not be sure when exactly the device is really suspended | 652 | // 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. | 653 | // 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. | 654 | // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here. |
648 | 655 | ||
649 | if ( res && m_embedix) { | 656 | if ( res && m_embedix) { |
650 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 657 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
651 | ::usleep ( 200 * 1000 ); | 658 | ::usleep ( 200 * 1000 ); |
652 | ::gettimeofday ( &tvn, 0 ); | 659 | ::gettimeofday ( &tvn, 0 ); |
653 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); | 660 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); |
654 | } | 661 | } |
655 | 662 | ||
656 | return res; | 663 | return res; |
657 | } | 664 | } |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 4548e35..4250356 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -1,144 +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-2005 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | Â Â Â Â Â Â .>+-= | 6 | .>+-= |
7 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, Â Â .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | Â Â .%`+i> Â Â Â _;_. | 13 | .%`+i> _;_. |
14 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= Â -. Â Â .` Â Â .: details. | 20 | ++= -. .` .: details. |
21 | Â : Â Â = Â ...= . :.=- | 21 | : = ...= . :.=- |
22 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | Â -_. . . Â )=. Â = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #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 | virtual bool suspend(); |
123 | 123 | ||
124 | protected: | 124 | protected: |
125 | virtual void buzzer( int snd ); | 125 | virtual void buzzer( int snd ); |
126 | 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 ); |
127 | 127 | ||
128 | OLedState m_leds[1]; | 128 | OLedState m_leds[1]; |
129 | bool m_embedix; | 129 | bool m_embedix; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | struct z_button { | 132 | struct z_button { |
133 | Qt::Key code; | 133 | Qt::Key code; |
134 | char *utext; | 134 | char *utext; |
135 | char *pix; | 135 | char *pix; |
136 | char *fpressedservice; | 136 | char *fpressedservice; |
137 | char *fpressedaction; | 137 | char *fpressedaction; |
138 | char *fheldservice; | 138 | char *fheldservice; |
139 | char *fheldaction; | 139 | char *fheldaction; |
140 | }; | 140 | }; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | #endif | 144 | #endif |