author | sandman <sandman> | 2002-12-17 23:38:52 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-17 23:38:52 (UTC) |
commit | 96a9654c2fccce382a4a9ad5d2d0b991b4191468 (patch) (unidiff) | |
tree | 4ecc6cbec54d3bc51fabfed4c51b494ef4c75583 | |
parent | 9a30159e1b0ac09b0be5918daae8c9530bf17d1d (diff) | |
download | opie-96a9654c2fccce382a4a9ad5d2d0b991b4191468.zip opie-96a9654c2fccce382a4a9ad5d2d0b991b4191468.tar.gz opie-96a9654c2fccce382a4a9ad5d2d0b991b4191468.tar.bz2 |
fix for alarm volume handling on iPAQs
-rw-r--r-- | libopie/odevice.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9fd3ae2..c947630 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1,964 +1,962 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #include <linux/soundcard.h> | 26 | #include <linux/soundcard.h> |
27 | #include <math.h> | 27 | #include <math.h> |
28 | 28 | ||
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpe/sound.h> | 33 | #include <qpe/sound.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | 36 | ||
37 | #include "odevice.h" | 37 | #include "odevice.h" |
38 | 38 | ||
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | 40 | ||
41 | 41 | ||
42 | // _IO and friends are only defined in kernel headers ... | 42 | // _IO and friends are only defined in kernel headers ... |
43 | 43 | ||
44 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 44 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
45 | 45 | ||
46 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 46 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
47 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 47 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
48 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 48 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
49 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 49 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
50 | 50 | ||
51 | using namespace Opie; | 51 | using namespace Opie; |
52 | 52 | ||
53 | class ODeviceData { | 53 | class ODeviceData { |
54 | public: | 54 | public: |
55 | bool m_qwsserver; | 55 | bool m_qwsserver; |
56 | 56 | ||
57 | QString m_vendorstr; | 57 | QString m_vendorstr; |
58 | OVendor m_vendor; | 58 | OVendor m_vendor; |
59 | 59 | ||
60 | QString m_modelstr; | 60 | QString m_modelstr; |
61 | OModel m_model; | 61 | OModel m_model; |
62 | 62 | ||
63 | QString m_systemstr; | 63 | QString m_systemstr; |
64 | OSystem m_system; | 64 | OSystem m_system; |
65 | 65 | ||
66 | QString m_sysverstr; | 66 | QString m_sysverstr; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | 69 | ||
70 | class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter { | 70 | class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter { |
71 | protected: | 71 | protected: |
72 | virtual void init ( ); | 72 | virtual void init ( ); |
73 | 73 | ||
74 | public: | 74 | public: |
75 | virtual bool setSoftSuspend ( bool soft ); | 75 | virtual bool setSoftSuspend ( bool soft ); |
76 | 76 | ||
77 | virtual bool setDisplayBrightness ( int b ); | 77 | virtual bool setDisplayBrightness ( int b ); |
78 | virtual int displayBrightnessResolution ( ) const; | 78 | virtual int displayBrightnessResolution ( ) const; |
79 | 79 | ||
80 | virtual void alarmSound ( ); | 80 | virtual void alarmSound ( ); |
81 | 81 | ||
82 | virtual QValueList <OLed> ledList ( ) const; | 82 | virtual QValueList <OLed> ledList ( ) const; |
83 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 83 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
84 | virtual OLedState ledState ( OLed led ) const; | 84 | virtual OLedState ledState ( OLed led ) const; |
85 | virtual bool setLedState ( OLed led, OLedState st ); | 85 | virtual bool setLedState ( OLed led, OLedState st ); |
86 | 86 | ||
87 | virtual bool hasLightSensor ( ) const; | 87 | virtual bool hasLightSensor ( ) const; |
88 | virtual int readLightSensor ( ); | 88 | virtual int readLightSensor ( ); |
89 | virtual int lightSensorResolution ( ) const; | 89 | virtual int lightSensorResolution ( ) const; |
90 | 90 | ||
91 | //virtual QValueList <int> keyList ( ) const; | 91 | //virtual QValueList <int> keyList ( ) const; |
92 | 92 | ||
93 | protected: | 93 | protected: |
94 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 94 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
95 | virtual void timerEvent ( QTimerEvent *te ); | 95 | virtual void timerEvent ( QTimerEvent *te ); |
96 | 96 | ||
97 | int m_power_timer; | 97 | int m_power_timer; |
98 | 98 | ||
99 | OLedState m_leds [2]; | 99 | OLedState m_leds [2]; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | class Zaurus : public ODevice { | 102 | class Zaurus : public ODevice { |
103 | protected: | 103 | protected: |
104 | virtual void init ( ); | 104 | virtual void init ( ); |
105 | 105 | ||
106 | public: | 106 | public: |
107 | virtual bool setSoftSuspend ( bool soft ); | 107 | virtual bool setSoftSuspend ( bool soft ); |
108 | 108 | ||
109 | virtual bool setDisplayBrightness ( int b ); | 109 | virtual bool setDisplayBrightness ( int b ); |
110 | virtual int displayBrightnessResolution ( ) const; | 110 | virtual int displayBrightnessResolution ( ) const; |
111 | 111 | ||
112 | virtual void alarmSound ( ); | 112 | virtual void alarmSound ( ); |
113 | virtual void keySound ( ); | 113 | virtual void keySound ( ); |
114 | virtual void touchSound ( ); | 114 | virtual void touchSound ( ); |
115 | 115 | ||
116 | virtual QValueList <OLed> ledList ( ) const; | 116 | virtual QValueList <OLed> ledList ( ) const; |
117 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 117 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
118 | virtual OLedState ledState ( OLed led ) const; | 118 | virtual OLedState ledState ( OLed led ) const; |
119 | virtual bool setLedState ( OLed led, OLedState st ); | 119 | virtual bool setLedState ( OLed led, OLedState st ); |
120 | 120 | ||
121 | //virtual QValueList <int> keyList ( ) const; | 121 | //virtual QValueList <int> keyList ( ) const; |
122 | 122 | ||
123 | protected: | 123 | protected: |
124 | virtual void buzzer ( int snd ); | 124 | virtual void buzzer ( int snd ); |
125 | 125 | ||
126 | OLedState m_leds [1]; | 126 | OLedState m_leds [1]; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | ODevice *ODevice::inst ( ) | 135 | ODevice *ODevice::inst ( ) |
136 | { | 136 | { |
137 | static ODevice *dev = 0; | 137 | static ODevice *dev = 0; |
138 | 138 | ||
139 | if ( !dev ) { | 139 | if ( !dev ) { |
140 | if ( QFile::exists ( "/proc/hal/model" )) | 140 | if ( QFile::exists ( "/proc/hal/model" )) |
141 | dev = new iPAQ ( ); | 141 | dev = new iPAQ ( ); |
142 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 142 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
143 | dev = new Zaurus ( ); | 143 | dev = new Zaurus ( ); |
144 | else | 144 | else |
145 | dev = new ODevice ( ); | 145 | dev = new ODevice ( ); |
146 | 146 | ||
147 | dev-> init ( ); | 147 | dev-> init ( ); |
148 | } | 148 | } |
149 | return dev; | 149 | return dev; |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | /************************************************** | 153 | /************************************************** |
154 | * | 154 | * |
155 | * common | 155 | * common |
156 | * | 156 | * |
157 | **************************************************/ | 157 | **************************************************/ |
158 | 158 | ||
159 | 159 | ||
160 | ODevice::ODevice ( ) | 160 | ODevice::ODevice ( ) |
161 | { | 161 | { |
162 | d = new ODeviceData; | 162 | d = new ODeviceData; |
163 | 163 | ||
164 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 164 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
165 | 165 | ||
166 | d-> m_modelstr = "Unknown"; | 166 | d-> m_modelstr = "Unknown"; |
167 | d-> m_model = Model_Unknown; | 167 | d-> m_model = Model_Unknown; |
168 | d-> m_vendorstr = "Unkown"; | 168 | d-> m_vendorstr = "Unkown"; |
169 | d-> m_vendor = Vendor_Unknown; | 169 | d-> m_vendor = Vendor_Unknown; |
170 | d-> m_systemstr = "Unkown"; | 170 | d-> m_systemstr = "Unkown"; |
171 | d-> m_system = System_Unknown; | 171 | d-> m_system = System_Unknown; |
172 | d-> m_sysverstr = "0.0"; | 172 | d-> m_sysverstr = "0.0"; |
173 | } | 173 | } |
174 | 174 | ||
175 | void ODevice::init ( ) | 175 | void ODevice::init ( ) |
176 | { | 176 | { |
177 | } | 177 | } |
178 | 178 | ||
179 | ODevice::~ODevice ( ) | 179 | ODevice::~ODevice ( ) |
180 | { | 180 | { |
181 | delete d; | 181 | delete d; |
182 | } | 182 | } |
183 | 183 | ||
184 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 184 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
185 | { | 185 | { |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | 188 | ||
189 | //#include <linux/apm_bios.h> | 189 | //#include <linux/apm_bios.h> |
190 | 190 | ||
191 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 191 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
192 | 192 | ||
193 | 193 | ||
194 | bool ODevice::suspend ( ) | 194 | bool ODevice::suspend ( ) |
195 | { | 195 | { |
196 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend | 196 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend |
197 | return false; | 197 | return false; |
198 | 198 | ||
199 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 199 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
200 | return false; | 200 | return false; |
201 | 201 | ||
202 | bool res = false; | 202 | bool res = false; |
203 | 203 | ||
204 | struct timeval tvs, tvn; | 204 | struct timeval tvs, tvn; |
205 | ::gettimeofday ( &tvs, 0 ); | 205 | ::gettimeofday ( &tvs, 0 ); |
206 | 206 | ||
207 | ::sync ( ); // flush fs caches | 207 | ::sync ( ); // flush fs caches |
208 | res = ( ::system ( "apm --suspend" ) == 0 ); | 208 | res = ( ::system ( "apm --suspend" ) == 0 ); |
209 | 209 | ||
210 | // This is needed because the iPAQ apm implementation is asynchronous and we | 210 | // This is needed because the iPAQ apm implementation is asynchronous and we |
211 | // can not be sure when exactly the device is really suspended | 211 | // can not be sure when exactly the device is really suspended |
212 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 212 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
213 | 213 | ||
214 | if ( res ) { | 214 | if ( res ) { |
215 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 215 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
216 | ::usleep ( 200 * 1000 ); | 216 | ::usleep ( 200 * 1000 ); |
217 | ::gettimeofday ( &tvn, 0 ); | 217 | ::gettimeofday ( &tvn, 0 ); |
218 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 218 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
219 | } | 219 | } |
220 | 220 | ||
221 | return res; | 221 | return res; |
222 | } | 222 | } |
223 | 223 | ||
224 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 224 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
225 | 225 | ||
226 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 226 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
227 | 227 | ||
228 | /* VESA Blanking Levels */ | 228 | /* VESA Blanking Levels */ |
229 | #define VESA_NO_BLANKING 0 | 229 | #define VESA_NO_BLANKING 0 |
230 | #define VESA_VSYNC_SUSPEND 1 | 230 | #define VESA_VSYNC_SUSPEND 1 |
231 | #define VESA_HSYNC_SUSPEND 2 | 231 | #define VESA_HSYNC_SUSPEND 2 |
232 | #define VESA_POWERDOWN 3 | 232 | #define VESA_POWERDOWN 3 |
233 | 233 | ||
234 | 234 | ||
235 | bool ODevice::setDisplayStatus ( bool on ) | 235 | bool ODevice::setDisplayStatus ( bool on ) |
236 | { | 236 | { |
237 | if ( d-> m_model == Model_Unknown ) | 237 | if ( d-> m_model == Model_Unknown ) |
238 | return false; | 238 | return false; |
239 | 239 | ||
240 | bool res = false; | 240 | bool res = false; |
241 | int fd; | 241 | int fd; |
242 | 242 | ||
243 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 243 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
244 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 244 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
245 | ::close ( fd ); | 245 | ::close ( fd ); |
246 | } | 246 | } |
247 | return res; | 247 | return res; |
248 | } | 248 | } |
249 | 249 | ||
250 | bool ODevice::setDisplayBrightness ( int ) | 250 | bool ODevice::setDisplayBrightness ( int ) |
251 | { | 251 | { |
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | int ODevice::displayBrightnessResolution ( ) const | 255 | int ODevice::displayBrightnessResolution ( ) const |
256 | { | 256 | { |
257 | return 16; | 257 | return 16; |
258 | } | 258 | } |
259 | 259 | ||
260 | QString ODevice::vendorString ( ) const | 260 | QString ODevice::vendorString ( ) const |
261 | { | 261 | { |
262 | return d-> m_vendorstr; | 262 | return d-> m_vendorstr; |
263 | } | 263 | } |
264 | 264 | ||
265 | OVendor ODevice::vendor ( ) const | 265 | OVendor ODevice::vendor ( ) const |
266 | { | 266 | { |
267 | return d-> m_vendor; | 267 | return d-> m_vendor; |
268 | } | 268 | } |
269 | 269 | ||
270 | QString ODevice::modelString ( ) const | 270 | QString ODevice::modelString ( ) const |
271 | { | 271 | { |
272 | return d-> m_modelstr; | 272 | return d-> m_modelstr; |
273 | } | 273 | } |
274 | 274 | ||
275 | OModel ODevice::model ( ) const | 275 | OModel ODevice::model ( ) const |
276 | { | 276 | { |
277 | return d-> m_model; | 277 | return d-> m_model; |
278 | } | 278 | } |
279 | 279 | ||
280 | QString ODevice::systemString ( ) const | 280 | QString ODevice::systemString ( ) const |
281 | { | 281 | { |
282 | return d-> m_systemstr; | 282 | return d-> m_systemstr; |
283 | } | 283 | } |
284 | 284 | ||
285 | OSystem ODevice::system ( ) const | 285 | OSystem ODevice::system ( ) const |
286 | { | 286 | { |
287 | return d-> m_system; | 287 | return d-> m_system; |
288 | } | 288 | } |
289 | 289 | ||
290 | QString ODevice::systemVersionString ( ) const | 290 | QString ODevice::systemVersionString ( ) const |
291 | { | 291 | { |
292 | return d-> m_sysverstr; | 292 | return d-> m_sysverstr; |
293 | } | 293 | } |
294 | 294 | ||
295 | void ODevice::alarmSound ( ) | 295 | void ODevice::alarmSound ( ) |
296 | { | 296 | { |
297 | #ifndef QT_NO_SOUND | 297 | #ifndef QT_NO_SOUND |
298 | static Sound snd ( "alarm" ); | 298 | static Sound snd ( "alarm" ); |
299 | 299 | ||
300 | if ( snd. isFinished ( )) | 300 | if ( snd. isFinished ( )) |
301 | snd. play ( ); | 301 | snd. play ( ); |
302 | #endif | 302 | #endif |
303 | } | 303 | } |
304 | 304 | ||
305 | void ODevice::keySound ( ) | 305 | void ODevice::keySound ( ) |
306 | { | 306 | { |
307 | #ifndef QT_NO_SOUND | 307 | #ifndef QT_NO_SOUND |
308 | static Sound snd ( "keysound" ); | 308 | static Sound snd ( "keysound" ); |
309 | 309 | ||
310 | if ( snd. isFinished ( )) | 310 | if ( snd. isFinished ( )) |
311 | snd. play ( ); | 311 | snd. play ( ); |
312 | #endif | 312 | #endif |
313 | } | 313 | } |
314 | 314 | ||
315 | void ODevice::touchSound ( ) | 315 | void ODevice::touchSound ( ) |
316 | { | 316 | { |
317 | 317 | ||
318 | #ifndef QT_NO_SOUND | 318 | #ifndef QT_NO_SOUND |
319 | static Sound snd ( "touchsound" ); | 319 | static Sound snd ( "touchsound" ); |
320 | 320 | ||
321 | if ( snd. isFinished ( )) | 321 | if ( snd. isFinished ( )) |
322 | snd. play ( ); | 322 | snd. play ( ); |
323 | #endif | 323 | #endif |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | QValueList <OLed> ODevice::ledList ( ) const | 327 | QValueList <OLed> ODevice::ledList ( ) const |
328 | { | 328 | { |
329 | return QValueList <OLed> ( ); | 329 | return QValueList <OLed> ( ); |
330 | } | 330 | } |
331 | 331 | ||
332 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 332 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
333 | { | 333 | { |
334 | return QValueList <OLedState> ( ); | 334 | return QValueList <OLedState> ( ); |
335 | } | 335 | } |
336 | 336 | ||
337 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 337 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
338 | { | 338 | { |
339 | return Led_Off; | 339 | return Led_Off; |
340 | } | 340 | } |
341 | 341 | ||
342 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) | 342 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) |
343 | { | 343 | { |
344 | return false; | 344 | return false; |
345 | } | 345 | } |
346 | 346 | ||
347 | bool ODevice::hasLightSensor ( ) const | 347 | bool ODevice::hasLightSensor ( ) const |
348 | { | 348 | { |
349 | return false; | 349 | return false; |
350 | } | 350 | } |
351 | 351 | ||
352 | int ODevice::readLightSensor ( ) | 352 | int ODevice::readLightSensor ( ) |
353 | { | 353 | { |
354 | return -1; | 354 | return -1; |
355 | } | 355 | } |
356 | 356 | ||
357 | int ODevice::lightSensorResolution ( ) const | 357 | int ODevice::lightSensorResolution ( ) const |
358 | { | 358 | { |
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | //QValueList <int> ODevice::keyList ( ) const | 362 | //QValueList <int> ODevice::keyList ( ) const |
363 | //{ | 363 | //{ |
364 | //return QValueList <int> ( ); | 364 | //return QValueList <int> ( ); |
365 | //} | 365 | //} |
366 | 366 | ||
367 | 367 | ||
368 | 368 | ||
369 | /************************************************** | 369 | /************************************************** |
370 | * | 370 | * |
371 | * iPAQ | 371 | * iPAQ |
372 | * | 372 | * |
373 | **************************************************/ | 373 | **************************************************/ |
374 | 374 | ||
375 | void iPAQ::init ( ) | 375 | void iPAQ::init ( ) |
376 | { | 376 | { |
377 | d-> m_vendorstr = "HP"; | 377 | d-> m_vendorstr = "HP"; |
378 | d-> m_vendor = Vendor_HP; | 378 | d-> m_vendor = Vendor_HP; |
379 | 379 | ||
380 | QFile f ( "/proc/hal/model" ); | 380 | QFile f ( "/proc/hal/model" ); |
381 | 381 | ||
382 | if ( f. open ( IO_ReadOnly )) { | 382 | if ( f. open ( IO_ReadOnly )) { |
383 | QTextStream ts ( &f ); | 383 | QTextStream ts ( &f ); |
384 | 384 | ||
385 | d-> m_modelstr = "H" + ts. readLine ( ); | 385 | d-> m_modelstr = "H" + ts. readLine ( ); |
386 | 386 | ||
387 | if ( d-> m_modelstr == "H3100" ) | 387 | if ( d-> m_modelstr == "H3100" ) |
388 | d-> m_model = Model_iPAQ_H31xx; | 388 | d-> m_model = Model_iPAQ_H31xx; |
389 | else if ( d-> m_modelstr == "H3600" ) | 389 | else if ( d-> m_modelstr == "H3600" ) |
390 | d-> m_model = Model_iPAQ_H36xx; | 390 | d-> m_model = Model_iPAQ_H36xx; |
391 | else if ( d-> m_modelstr == "H3700" ) | 391 | else if ( d-> m_modelstr == "H3700" ) |
392 | d-> m_model = Model_iPAQ_H37xx; | 392 | d-> m_model = Model_iPAQ_H37xx; |
393 | else if ( d-> m_modelstr == "H3800" ) | 393 | else if ( d-> m_modelstr == "H3800" ) |
394 | d-> m_model = Model_iPAQ_H38xx; | 394 | d-> m_model = Model_iPAQ_H38xx; |
395 | else if ( d-> m_modelstr == "H3900" ) | 395 | else if ( d-> m_modelstr == "H3900" ) |
396 | d-> m_model = Model_iPAQ_H39xx; | 396 | d-> m_model = Model_iPAQ_H39xx; |
397 | else | 397 | else |
398 | d-> m_model = Model_Unknown; | 398 | d-> m_model = Model_Unknown; |
399 | 399 | ||
400 | f. close ( ); | 400 | f. close ( ); |
401 | } | 401 | } |
402 | 402 | ||
403 | f. setName ( "/etc/familiar-version" ); | 403 | f. setName ( "/etc/familiar-version" ); |
404 | if ( f. open ( IO_ReadOnly )) { | 404 | if ( f. open ( IO_ReadOnly )) { |
405 | d-> m_systemstr = "Familiar"; | 405 | d-> m_systemstr = "Familiar"; |
406 | d-> m_system = System_Familiar; | 406 | d-> m_system = System_Familiar; |
407 | 407 | ||
408 | QTextStream ts ( &f ); | 408 | QTextStream ts ( &f ); |
409 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 409 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
410 | 410 | ||
411 | f. close ( ); | 411 | f. close ( ); |
412 | } | 412 | } |
413 | 413 | ||
414 | m_leds [0] = m_leds [1] = Led_Off; | 414 | m_leds [0] = m_leds [1] = Led_Off; |
415 | 415 | ||
416 | m_power_timer = 0; | 416 | m_power_timer = 0; |
417 | 417 | ||
418 | if ( d-> m_qwsserver ) | 418 | if ( d-> m_qwsserver ) |
419 | QWSServer::setKeyboardFilter ( this ); | 419 | QWSServer::setKeyboardFilter ( this ); |
420 | } | 420 | } |
421 | 421 | ||
422 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 422 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
423 | 423 | ||
424 | typedef struct { | 424 | typedef struct { |
425 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 425 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
426 | unsigned char TotalTime; /* Units of 5 seconds */ | 426 | unsigned char TotalTime; /* Units of 5 seconds */ |
427 | unsigned char OnTime; /* units of 100m/s */ | 427 | unsigned char OnTime; /* units of 100m/s */ |
428 | unsigned char OffTime; /* units of 100m/s */ | 428 | unsigned char OffTime; /* units of 100m/s */ |
429 | } LED_IN; | 429 | } LED_IN; |
430 | 430 | ||
431 | typedef struct { | 431 | typedef struct { |
432 | unsigned char mode; | 432 | unsigned char mode; |
433 | unsigned char pwr; | 433 | unsigned char pwr; |
434 | unsigned char brightness; | 434 | unsigned char brightness; |
435 | } FLITE_IN; | 435 | } FLITE_IN; |
436 | 436 | ||
437 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 437 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
438 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 438 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
439 | 439 | ||
440 | 440 | ||
441 | 441 | ||
442 | QValueList <OLed> iPAQ::ledList ( ) const | 442 | QValueList <OLed> iPAQ::ledList ( ) const |
443 | { | 443 | { |
444 | QValueList <OLed> vl; | 444 | QValueList <OLed> vl; |
445 | vl << Led_Power; | 445 | vl << Led_Power; |
446 | 446 | ||
447 | if ( d-> m_model == Model_iPAQ_H38xx ) | 447 | if ( d-> m_model == Model_iPAQ_H38xx ) |
448 | vl << Led_BlueTooth; | 448 | vl << Led_BlueTooth; |
449 | return vl; | 449 | return vl; |
450 | } | 450 | } |
451 | 451 | ||
452 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 452 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
453 | { | 453 | { |
454 | QValueList <OLedState> vl; | 454 | QValueList <OLedState> vl; |
455 | 455 | ||
456 | if ( l == Led_Power ) | 456 | if ( l == Led_Power ) |
457 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 457 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
458 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) | 458 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) |
459 | vl << Led_Off; // << Led_On << ??? | 459 | vl << Led_Off; // << Led_On << ??? |
460 | 460 | ||
461 | return vl; | 461 | return vl; |
462 | } | 462 | } |
463 | 463 | ||
464 | OLedState iPAQ::ledState ( OLed l ) const | 464 | OLedState iPAQ::ledState ( OLed l ) const |
465 | { | 465 | { |
466 | switch ( l ) { | 466 | switch ( l ) { |
467 | case Led_Power: | 467 | case Led_Power: |
468 | return m_leds [0]; | 468 | return m_leds [0]; |
469 | case Led_BlueTooth: | 469 | case Led_BlueTooth: |
470 | return m_leds [1]; | 470 | return m_leds [1]; |
471 | default: | 471 | default: |
472 | return Led_Off; | 472 | return Led_Off; |
473 | } | 473 | } |
474 | } | 474 | } |
475 | 475 | ||
476 | bool iPAQ::setLedState ( OLed l, OLedState st ) | 476 | bool iPAQ::setLedState ( OLed l, OLedState st ) |
477 | { | 477 | { |
478 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); | 478 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); |
479 | 479 | ||
480 | if ( l == Led_Power ) { | 480 | if ( l == Led_Power ) { |
481 | if ( fd >= 0 ) { | 481 | if ( fd >= 0 ) { |
482 | LED_IN leds; | 482 | LED_IN leds; |
483 | ::memset ( &leds, 0, sizeof( leds )); | 483 | ::memset ( &leds, 0, sizeof( leds )); |
484 | leds. TotalTime = 0; | 484 | leds. TotalTime = 0; |
485 | leds. OnTime = 0; | 485 | leds. OnTime = 0; |
486 | leds. OffTime = 1; | 486 | leds. OffTime = 1; |
487 | leds. OffOnBlink = 2; | 487 | leds. OffOnBlink = 2; |
488 | 488 | ||
489 | switch ( st ) { | 489 | switch ( st ) { |
490 | case Led_Off : leds. OffOnBlink = 0; break; | 490 | case Led_Off : leds. OffOnBlink = 0; break; |
491 | case Led_On : leds. OffOnBlink = 1; break; | 491 | case Led_On : leds. OffOnBlink = 1; break; |
492 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 492 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
493 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 493 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
494 | } | 494 | } |
495 | 495 | ||
496 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 496 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
497 | m_leds [0] = st; | 497 | m_leds [0] = st; |
498 | return true; | 498 | return true; |
499 | } | 499 | } |
500 | } | 500 | } |
501 | } | 501 | } |
502 | return false; | 502 | return false; |
503 | } | 503 | } |
504 | 504 | ||
505 | 505 | ||
506 | //QValueList <int> iPAQ::keyList ( ) const | 506 | //QValueList <int> iPAQ::keyList ( ) const |
507 | //{ | 507 | //{ |
508 | //QValueList <int> vl; | 508 | //QValueList <int> vl; |
509 | //vl << HardKey_Datebook << HardKey_Contacts << ( model ( ) == Model_iPAQ_H38xx ? HardKey_Mail : HardKey_Menu ) << HardKey_Home << HardKey_Record << HardKey_Suspend << HardKey_Backlight; | 509 | //vl << HardKey_Datebook << HardKey_Contacts << ( model ( ) == Model_iPAQ_H38xx ? HardKey_Mail : HardKey_Menu ) << HardKey_Home << HardKey_Record << HardKey_Suspend << HardKey_Backlight; |
510 | //return vl; | 510 | //return vl; |
511 | //} | 511 | //} |
512 | 512 | ||
513 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 513 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
514 | { | 514 | { |
515 | int newkeycode = keycode; | 515 | int newkeycode = keycode; |
516 | 516 | ||
517 | switch ( keycode ) { | 517 | switch ( keycode ) { |
518 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 518 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
519 | case HardKey_Menu: { | 519 | case HardKey_Menu: { |
520 | if (( d-> m_model == Model_iPAQ_H38xx ) || | 520 | if (( d-> m_model == Model_iPAQ_H38xx ) || |
521 | ( d-> m_model == Model_iPAQ_H39xx )) { | 521 | ( d-> m_model == Model_iPAQ_H39xx )) { |
522 | newkeycode = HardKey_Mail; | 522 | newkeycode = HardKey_Mail; |
523 | } | 523 | } |
524 | break; | 524 | break; |
525 | } | 525 | } |
526 | 526 | ||
527 | // Rotate cursor keys 180° | 527 | // Rotate cursor keys 180° |
528 | case Key_Left : | 528 | case Key_Left : |
529 | case Key_Right: | 529 | case Key_Right: |
530 | case Key_Up : | 530 | case Key_Up : |
531 | case Key_Down : { | 531 | case Key_Down : { |
532 | if (( d-> m_model == Model_iPAQ_H31xx ) || | 532 | if (( d-> m_model == Model_iPAQ_H31xx ) || |
533 | ( d-> m_model == Model_iPAQ_H38xx )) { | 533 | ( d-> m_model == Model_iPAQ_H38xx )) { |
534 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 534 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
535 | } | 535 | } |
536 | break; | 536 | break; |
537 | } | 537 | } |
538 | 538 | ||
539 | // map Power Button short/long press to F34/F35 | 539 | // map Power Button short/long press to F34/F35 |
540 | case Key_SysReq: { | 540 | case Key_SysReq: { |
541 | if ( isPress ) { | 541 | if ( isPress ) { |
542 | if ( m_power_timer ) | 542 | if ( m_power_timer ) |
543 | killTimer ( m_power_timer ); | 543 | killTimer ( m_power_timer ); |
544 | m_power_timer = startTimer ( 500 ); | 544 | m_power_timer = startTimer ( 500 ); |
545 | } | 545 | } |
546 | else if ( m_power_timer ) { | 546 | else if ( m_power_timer ) { |
547 | killTimer ( m_power_timer ); | 547 | killTimer ( m_power_timer ); |
548 | m_power_timer = 0; | 548 | m_power_timer = 0; |
549 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 549 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
550 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 550 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
551 | } | 551 | } |
552 | newkeycode = Key_unknown; | 552 | newkeycode = Key_unknown; |
553 | break; | 553 | break; |
554 | } | 554 | } |
555 | } | 555 | } |
556 | 556 | ||
557 | if ( newkeycode != keycode ) { | 557 | if ( newkeycode != keycode ) { |
558 | if ( newkeycode != Key_unknown ) | 558 | if ( newkeycode != Key_unknown ) |
559 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 559 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
560 | return true; | 560 | return true; |
561 | } | 561 | } |
562 | else | 562 | else |
563 | return false; | 563 | return false; |
564 | } | 564 | } |
565 | 565 | ||
566 | void iPAQ::timerEvent ( QTimerEvent * ) | 566 | void iPAQ::timerEvent ( QTimerEvent * ) |
567 | { | 567 | { |
568 | killTimer ( m_power_timer ); | 568 | killTimer ( m_power_timer ); |
569 | m_power_timer = 0; | 569 | m_power_timer = 0; |
570 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 570 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
571 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 571 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | void iPAQ::alarmSound ( ) | 575 | void iPAQ::alarmSound ( ) |
576 | { | 576 | { |
577 | #ifndef QT_NO_SOUND | 577 | #ifndef QT_NO_SOUND |
578 | static Sound snd ( "alarm" ); | 578 | static Sound snd ( "alarm" ); |
579 | int fd; | 579 | int fd; |
580 | int vol; | 580 | int vol; |
581 | bool vol_reset = false; | 581 | bool vol_reset = false; |
582 | 582 | ||
583 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 583 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
584 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 584 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
585 | Config cfg ( "qpe" ); | 585 | Config cfg ( "qpe" ); |
586 | cfg. setGroup ( "Volume" ); | 586 | cfg. setGroup ( "Volume" ); |
587 | 587 | ||
588 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 588 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
589 | if ( volalarm < 0 ) | 589 | if ( volalarm < 0 ) |
590 | volalarm = 0; | 590 | volalarm = 0; |
591 | else if ( volalarm > 100 ) | 591 | else if ( volalarm > 100 ) |
592 | volalarm = 100; | 592 | volalarm = 100; |
593 | volalarm |= ( volalarm << 8 ); | 593 | volalarm |= ( volalarm << 8 ); |
594 | 594 | ||
595 | if (( volalarm & 0xff ) > ( vol & 0xff )) { | 595 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
596 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 596 | vol_reset = true; |
597 | vol_reset = true; | ||
598 | } | ||
599 | } | 597 | } |
600 | } | 598 | } |
601 | 599 | ||
602 | snd. play ( ); | 600 | snd. play ( ); |
603 | while ( !snd. isFinished ( )) | 601 | while ( !snd. isFinished ( )) |
604 | qApp-> processEvents ( ); | 602 | qApp-> processEvents ( ); |
605 | 603 | ||
606 | if ( fd >= 0 ) { | 604 | if ( fd >= 0 ) { |
607 | if ( vol_reset ) | 605 | if ( vol_reset ) |
608 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 606 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
609 | ::close ( fd ); | 607 | ::close ( fd ); |
610 | } | 608 | } |
611 | #endif | 609 | #endif |
612 | } | 610 | } |
613 | 611 | ||
614 | 612 | ||
615 | bool iPAQ::setSoftSuspend ( bool soft ) | 613 | bool iPAQ::setSoftSuspend ( bool soft ) |
616 | { | 614 | { |
617 | bool res = false; | 615 | bool res = false; |
618 | int fd; | 616 | int fd; |
619 | 617 | ||
620 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 618 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
621 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 619 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
622 | res = true; | 620 | res = true; |
623 | else | 621 | else |
624 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 622 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
625 | 623 | ||
626 | ::close ( fd ); | 624 | ::close ( fd ); |
627 | } | 625 | } |
628 | else | 626 | else |
629 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 627 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
630 | 628 | ||
631 | return res; | 629 | return res; |
632 | } | 630 | } |
633 | 631 | ||
634 | 632 | ||
635 | bool iPAQ::setDisplayBrightness ( int bright ) | 633 | bool iPAQ::setDisplayBrightness ( int bright ) |
636 | { | 634 | { |
637 | bool res = false; | 635 | bool res = false; |
638 | int fd; | 636 | int fd; |
639 | 637 | ||
640 | if ( bright > 255 ) | 638 | if ( bright > 255 ) |
641 | bright = 255; | 639 | bright = 255; |
642 | if ( bright < 0 ) | 640 | if ( bright < 0 ) |
643 | bright = 0; | 641 | bright = 0; |
644 | 642 | ||
645 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 643 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
646 | FLITE_IN bl; | 644 | FLITE_IN bl; |
647 | bl. mode = 1; | 645 | bl. mode = 1; |
648 | bl. pwr = bright ? 1 : 0; | 646 | bl. pwr = bright ? 1 : 0; |
649 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 647 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
650 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 648 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
651 | ::close ( fd ); | 649 | ::close ( fd ); |
652 | } | 650 | } |
653 | return res; | 651 | return res; |
654 | } | 652 | } |
655 | 653 | ||
656 | int iPAQ::displayBrightnessResolution ( ) const | 654 | int iPAQ::displayBrightnessResolution ( ) const |
657 | { | 655 | { |
658 | switch ( model ( )) { | 656 | switch ( model ( )) { |
659 | case Model_iPAQ_H31xx: | 657 | case Model_iPAQ_H31xx: |
660 | case Model_iPAQ_H36xx: | 658 | case Model_iPAQ_H36xx: |
661 | case Model_iPAQ_H37xx: | 659 | case Model_iPAQ_H37xx: |
662 | return 128; // really 256, but >128 could damage the LCD | 660 | return 128; // really 256, but >128 could damage the LCD |
663 | 661 | ||
664 | case Model_iPAQ_H38xx: | 662 | case Model_iPAQ_H38xx: |
665 | case Model_iPAQ_H39xx: | 663 | case Model_iPAQ_H39xx: |
666 | return 64; | 664 | return 64; |
667 | 665 | ||
668 | default: | 666 | default: |
669 | return 2; | 667 | return 2; |
670 | } | 668 | } |
671 | } | 669 | } |
672 | 670 | ||
673 | 671 | ||
674 | bool iPAQ::hasLightSensor ( ) const | 672 | bool iPAQ::hasLightSensor ( ) const |
675 | { | 673 | { |
676 | return true; | 674 | return true; |
677 | } | 675 | } |
678 | 676 | ||
679 | int iPAQ::readLightSensor ( ) | 677 | int iPAQ::readLightSensor ( ) |
680 | { | 678 | { |
681 | int fd; | 679 | int fd; |
682 | int val = -1; | 680 | int val = -1; |
683 | 681 | ||
684 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 682 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
685 | char buffer [8]; | 683 | char buffer [8]; |
686 | 684 | ||
687 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 685 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
688 | char *endptr; | 686 | char *endptr; |
689 | 687 | ||
690 | buffer [4] = 0; | 688 | buffer [4] = 0; |
691 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 689 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
692 | 690 | ||
693 | if ( *endptr != 0 ) | 691 | if ( *endptr != 0 ) |
694 | val = -1; | 692 | val = -1; |
695 | } | 693 | } |
696 | ::close ( fd ); | 694 | ::close ( fd ); |
697 | } | 695 | } |
698 | 696 | ||
699 | return val; | 697 | return val; |
700 | } | 698 | } |
701 | 699 | ||
702 | int iPAQ::lightSensorResolution ( ) const | 700 | int iPAQ::lightSensorResolution ( ) const |
703 | { | 701 | { |
704 | return 256; | 702 | return 256; |
705 | } | 703 | } |
706 | 704 | ||
707 | /************************************************** | 705 | /************************************************** |
708 | * | 706 | * |
709 | * Zaurus | 707 | * Zaurus |
710 | * | 708 | * |
711 | **************************************************/ | 709 | **************************************************/ |
712 | 710 | ||
713 | 711 | ||
714 | 712 | ||
715 | void Zaurus::init ( ) | 713 | void Zaurus::init ( ) |
716 | { | 714 | { |
717 | d-> m_vendorstr = "Sharp"; | 715 | d-> m_vendorstr = "Sharp"; |
718 | d-> m_vendor = Vendor_Sharp; | 716 | d-> m_vendor = Vendor_Sharp; |
719 | 717 | ||
720 | QFile f ( "/proc/filesystems" ); | 718 | QFile f ( "/proc/filesystems" ); |
721 | 719 | ||
722 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 720 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
723 | d-> m_vendorstr = "OpenZaurus Team"; | 721 | d-> m_vendorstr = "OpenZaurus Team"; |
724 | d-> m_systemstr = "OpenZaurus"; | 722 | d-> m_systemstr = "OpenZaurus"; |
725 | d-> m_system = System_OpenZaurus; | 723 | d-> m_system = System_OpenZaurus; |
726 | 724 | ||
727 | f. close ( ); | 725 | f. close ( ); |
728 | 726 | ||
729 | f. setName ( "/etc/oz_version" ); | 727 | f. setName ( "/etc/oz_version" ); |
730 | if ( f. open ( IO_ReadOnly )) { | 728 | if ( f. open ( IO_ReadOnly )) { |
731 | QTextStream ts ( &f ); | 729 | QTextStream ts ( &f ); |
732 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); | 730 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); |
733 | f. close ( ); | 731 | f. close ( ); |
734 | } | 732 | } |
735 | } | 733 | } |
736 | else { | 734 | else { |
737 | d-> m_systemstr = "Zaurus"; | 735 | d-> m_systemstr = "Zaurus"; |
738 | d-> m_system = System_Zaurus; | 736 | d-> m_system = System_Zaurus; |
739 | } | 737 | } |
740 | 738 | ||
741 | f. setName ( "/proc/deviceinfo/product" ); | 739 | f. setName ( "/proc/deviceinfo/product" ); |
742 | if ( f. open ( IO_ReadOnly ) ) { | 740 | if ( f. open ( IO_ReadOnly ) ) { |
743 | QTextStream ts ( &f ); | 741 | QTextStream ts ( &f ); |
744 | QString model = ts. readLine ( ); | 742 | QString model = ts. readLine ( ); |
745 | f. close ( ); | 743 | f. close ( ); |
746 | if ( model == "SL-5000D" ) { | 744 | if ( model == "SL-5000D" ) { |
747 | d-> m_model = Model_Zaurus_SL5000; | 745 | d-> m_model = Model_Zaurus_SL5000; |
748 | d-> m_modelstr = "Zaurus SL-5000D"; | 746 | d-> m_modelstr = "Zaurus SL-5000D"; |
749 | } else if ( model == "SL-5500" ) { | 747 | } else if ( model == "SL-5500" ) { |
750 | d-> m_model = Model_Zaurus_SL5500; | 748 | d-> m_model = Model_Zaurus_SL5500; |
751 | d-> m_modelstr = "Zaurus SL-5500"; | 749 | d-> m_modelstr = "Zaurus SL-5500"; |
752 | } | 750 | } |
753 | } | 751 | } |
754 | else { | 752 | else { |
755 | d-> m_model = Model_Zaurus_SL5000; | 753 | d-> m_model = Model_Zaurus_SL5000; |
756 | d-> m_modelstr = "Zaurus SL-5000D (unverified)"; | 754 | d-> m_modelstr = "Zaurus SL-5000D (unverified)"; |
757 | } | 755 | } |
758 | 756 | ||
759 | m_leds [0] = Led_Off; | 757 | m_leds [0] = Led_Off; |
760 | } | 758 | } |
761 | 759 | ||
762 | #include <unistd.h> | 760 | #include <unistd.h> |
763 | #include <fcntl.h> | 761 | #include <fcntl.h> |
764 | #include <sys/ioctl.h> | 762 | #include <sys/ioctl.h> |
765 | 763 | ||
766 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 764 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
767 | 765 | ||
768 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 766 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
769 | 767 | ||
770 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 768 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
771 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 769 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
772 | 770 | ||
773 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 771 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
774 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 772 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
775 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 773 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
776 | 774 | ||
777 | /* --- for SHARP_BUZZER device --- */ | 775 | /* --- for SHARP_BUZZER device --- */ |
778 | 776 | ||
779 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 777 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
780 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 778 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
781 | 779 | ||
782 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 780 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
783 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 781 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
784 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 782 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
785 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 783 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
786 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 784 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
787 | 785 | ||
788 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 786 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
789 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 787 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
790 | 788 | ||
791 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 789 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
792 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 790 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
793 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 791 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
794 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 792 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
795 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 793 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
796 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 794 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
797 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 795 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
798 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 796 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
799 | 797 | ||
800 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 798 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
801 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 799 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
802 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 800 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
803 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 801 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
804 | // | 802 | // |
805 | 803 | ||
806 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 804 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
807 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 805 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
808 | 806 | ||
809 | typedef struct sharp_led_status { | 807 | typedef struct sharp_led_status { |
810 | int which; /* select which LED status is wanted. */ | 808 | int which; /* select which LED status is wanted. */ |
811 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 809 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
812 | } sharp_led_status; | 810 | } sharp_led_status; |
813 | 811 | ||
814 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 812 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
815 | 813 | ||
816 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 814 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
817 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 815 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
818 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 816 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
819 | 817 | ||
820 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 818 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
821 | 819 | ||
822 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 820 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
823 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 821 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
824 | #define APM_EVT_POWER_BUTTON (1 << 0) | 822 | #define APM_EVT_POWER_BUTTON (1 << 0) |
825 | 823 | ||
826 | #define FL_IOCTL_STEP_CONTRAST 100 | 824 | #define FL_IOCTL_STEP_CONTRAST 100 |
827 | 825 | ||
828 | 826 | ||
829 | void Zaurus::buzzer ( int sound ) | 827 | void Zaurus::buzzer ( int sound ) |
830 | { | 828 | { |
831 | static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); | 829 | static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); |
832 | 830 | ||
833 | if ( fd >= 0 ) | 831 | if ( fd >= 0 ) |
834 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 832 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
835 | } | 833 | } |
836 | 834 | ||
837 | 835 | ||
838 | void Zaurus::alarmSound ( ) | 836 | void Zaurus::alarmSound ( ) |
839 | { | 837 | { |
840 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 838 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
841 | } | 839 | } |
842 | 840 | ||
843 | void Zaurus::touchSound ( ) | 841 | void Zaurus::touchSound ( ) |
844 | { | 842 | { |
845 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 843 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
846 | } | 844 | } |
847 | 845 | ||
848 | void Zaurus::keySound ( ) | 846 | void Zaurus::keySound ( ) |
849 | { | 847 | { |
850 | buzzer ( SHARP_BUZ_KEYSOUND ); | 848 | buzzer ( SHARP_BUZ_KEYSOUND ); |
851 | } | 849 | } |
852 | 850 | ||
853 | 851 | ||
854 | QValueList <OLed> Zaurus::ledList ( ) const | 852 | QValueList <OLed> Zaurus::ledList ( ) const |
855 | { | 853 | { |
856 | QValueList <OLed> vl; | 854 | QValueList <OLed> vl; |
857 | vl << Led_Mail; | 855 | vl << Led_Mail; |
858 | return vl; | 856 | return vl; |
859 | } | 857 | } |
860 | 858 | ||
861 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | 859 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const |
862 | { | 860 | { |
863 | QValueList <OLedState> vl; | 861 | QValueList <OLedState> vl; |
864 | 862 | ||
865 | if ( l == Led_Mail ) | 863 | if ( l == Led_Mail ) |
866 | vl << Led_Off << Led_On << Led_BlinkSlow; | 864 | vl << Led_Off << Led_On << Led_BlinkSlow; |
867 | return vl; | 865 | return vl; |
868 | } | 866 | } |
869 | 867 | ||
870 | OLedState Zaurus::ledState ( OLed which ) const | 868 | OLedState Zaurus::ledState ( OLed which ) const |
871 | { | 869 | { |
872 | if ( which == Led_Mail ) | 870 | if ( which == Led_Mail ) |
873 | return m_leds [0]; | 871 | return m_leds [0]; |
874 | else | 872 | else |
875 | return Led_Off; | 873 | return Led_Off; |
876 | } | 874 | } |
877 | 875 | ||
878 | bool Zaurus::setLedState ( OLed which, OLedState st ) | 876 | bool Zaurus::setLedState ( OLed which, OLedState st ) |
879 | { | 877 | { |
880 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 878 | static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
881 | 879 | ||
882 | if ( which == Led_Mail ) { | 880 | if ( which == Led_Mail ) { |
883 | if ( fd >= 0 ) { | 881 | if ( fd >= 0 ) { |
884 | struct sharp_led_status leds; | 882 | struct sharp_led_status leds; |
885 | ::memset ( &leds, 0, sizeof( leds )); | 883 | ::memset ( &leds, 0, sizeof( leds )); |
886 | leds. which = SHARP_LED_MAIL_EXISTS; | 884 | leds. which = SHARP_LED_MAIL_EXISTS; |
887 | bool ok = true; | 885 | bool ok = true; |
888 | 886 | ||
889 | switch ( st ) { | 887 | switch ( st ) { |
890 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 888 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
891 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 889 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
892 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 890 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
893 | default : ok = false; | 891 | default : ok = false; |
894 | } | 892 | } |
895 | 893 | ||
896 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 894 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
897 | m_leds [0] = st; | 895 | m_leds [0] = st; |
898 | return true; | 896 | return true; |
899 | } | 897 | } |
900 | } | 898 | } |
901 | } | 899 | } |
902 | return false; | 900 | return false; |
903 | } | 901 | } |
904 | 902 | ||
905 | bool Zaurus::setSoftSuspend ( bool soft ) | 903 | bool Zaurus::setSoftSuspend ( bool soft ) |
906 | { | 904 | { |
907 | bool res = false; | 905 | bool res = false; |
908 | int fd; | 906 | int fd; |
909 | 907 | ||
910 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | 908 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || |
911 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | 909 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { |
912 | 910 | ||
913 | int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources | 911 | int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources |
914 | 912 | ||
915 | if ( sources >= 0 ) { | 913 | if ( sources >= 0 ) { |
916 | if ( soft ) | 914 | if ( soft ) |
917 | sources &= ~APM_EVT_POWER_BUTTON; | 915 | sources &= ~APM_EVT_POWER_BUTTON; |
918 | else | 916 | else |
919 | sources |= APM_EVT_POWER_BUTTON; | 917 | sources |= APM_EVT_POWER_BUTTON; |
920 | 918 | ||
921 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources | 919 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources |
922 | res = true; | 920 | res = true; |
923 | else | 921 | else |
924 | perror ( "APM_IOCGEVTSRC" ); | 922 | perror ( "APM_IOCGEVTSRC" ); |
925 | } | 923 | } |
926 | else | 924 | else |
927 | perror ( "APM_IOCGEVTSRC" ); | 925 | perror ( "APM_IOCGEVTSRC" ); |
928 | 926 | ||
929 | ::close ( fd ); | 927 | ::close ( fd ); |
930 | } | 928 | } |
931 | else | 929 | else |
932 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); | 930 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); |
933 | 931 | ||
934 | return res; | 932 | return res; |
935 | } | 933 | } |
936 | 934 | ||
937 | 935 | ||
938 | bool Zaurus::setDisplayBrightness ( int bright ) | 936 | bool Zaurus::setDisplayBrightness ( int bright ) |
939 | { | 937 | { |
940 | bool res = false; | 938 | bool res = false; |
941 | int fd; | 939 | int fd; |
942 | 940 | ||
943 | if ( bright > 255 ) | 941 | if ( bright > 255 ) |
944 | bright = 255; | 942 | bright = 255; |
945 | if ( bright < 0 ) | 943 | if ( bright < 0 ) |
946 | bright = 0; | 944 | bright = 0; |
947 | 945 | ||
948 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { | 946 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { |
949 | int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus | 947 | int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus |
950 | if ( bright && !bl ) | 948 | if ( bright && !bl ) |
951 | bl = 1; | 949 | bl = 1; |
952 | res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); | 950 | res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); |
953 | ::close ( fd ); | 951 | ::close ( fd ); |
954 | } | 952 | } |
955 | return res; | 953 | return res; |
956 | } | 954 | } |
957 | 955 | ||
958 | 956 | ||
959 | int Zaurus::displayBrightnessResolution ( ) const | 957 | int Zaurus::displayBrightnessResolution ( ) const |
960 | { | 958 | { |
961 | return 5; | 959 | return 5; |
962 | } | 960 | } |
963 | 961 | ||
964 | 962 | ||