-rw-r--r-- | libopie/odevice.cpp | 107 |
1 files changed, 73 insertions, 34 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 61c24f4..dea24a8 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -2,3 +2,3 @@ | |||
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 |
@@ -7,3 +7,3 @@ | |||
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, |
@@ -12,3 +12,3 @@ | |||
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 |
@@ -55,3 +55,3 @@ public: | |||
55 | class ODeviceZaurus : public ODevice { | 55 | class ODeviceZaurus : public ODevice { |
56 | protected: | 56 | protected: |
57 | virtual void init ( ); | 57 | virtual void init ( ); |
@@ -62,3 +62,3 @@ public: | |||
62 | virtual void touchSound ( ); | 62 | virtual void touchSound ( ); |
63 | 63 | ||
64 | virtual uint hasLeds ( ) const; | 64 | virtual uint hasLeds ( ) const; |
@@ -94,3 +94,3 @@ ODevice::ODevice ( ) | |||
94 | d = new ODeviceData; | 94 | d = new ODeviceData; |
95 | 95 | ||
96 | d-> m_modelstr = "Unknown"; | 96 | d-> m_modelstr = "Unknown"; |
@@ -100,3 +100,3 @@ ODevice::ODevice ( ) | |||
100 | d-> m_systemstr = "Unkown"; | 100 | d-> m_systemstr = "Unkown"; |
101 | d-> m_system = OSYSTEM_Unknown; | 101 | d-> m_system = OSYSTEM_Unknown; |
102 | } | 102 | } |
@@ -144,2 +144,3 @@ void ODevice::alarmSound ( ) | |||
144 | { | 144 | { |
145 | #ifndef QT_QWS_EBX | ||
145 | #ifndef QT_NO_SOUND | 146 | #ifndef QT_NO_SOUND |
@@ -150,2 +151,3 @@ void ODevice::alarmSound ( ) | |||
150 | #endif | 151 | #endif |
152 | #endif | ||
151 | } | 153 | } |
@@ -154,2 +156,3 @@ void ODevice::keySound ( ) | |||
154 | { | 156 | { |
157 | #ifndef QT_QWS_EBX | ||
155 | #ifndef QT_NO_SOUND | 158 | #ifndef QT_NO_SOUND |
@@ -160,2 +163,3 @@ void ODevice::keySound ( ) | |||
160 | #endif | 163 | #endif |
164 | #endif | ||
161 | } | 165 | } |
@@ -164,7 +168,12 @@ void ODevice::touchSound ( ) | |||
164 | { | 168 | { |
169 | |||
170 | #ifndef QT_QWS_EBX | ||
165 | #ifndef QT_NO_SOUND | 171 | #ifndef QT_NO_SOUND |
166 | static Sound snd ( "touchsound" ); | 172 | static Sound snd ( "touchsound" ); |
167 | 173 | qDebug("touchSound"); | |
168 | if ( snd. isFinished ( )) | 174 | if ( snd. isFinished ( )) { |
169 | snd. play ( ); | 175 | snd. play ( ); |
176 | qDebug("sound should play"); | ||
177 | } | ||
178 | #endif | ||
170 | #endif | 179 | #endif |
@@ -196,11 +205,11 @@ void ODeviceIPAQ::init ( ) | |||
196 | d-> m_vendorstr = "HP"; | 205 | d-> m_vendorstr = "HP"; |
197 | d-> m_vendor = OVENDOR_HP; | 206 | d-> m_vendor = OVENDOR_HP; |
198 | 207 | ||
199 | QFile f ( "/proc/hal/model" ); | 208 | QFile f ( "/proc/hal/model" ); |
200 | 209 | ||
201 | if ( f. open ( IO_ReadOnly )) { | 210 | if ( f. open ( IO_ReadOnly )) { |
202 | QTextStream ts ( &f ); | 211 | QTextStream ts ( &f ); |
203 | 212 | ||
204 | d-> m_modelstr = "H" + ts. readLine ( ); | 213 | d-> m_modelstr = "H" + ts. readLine ( ); |
205 | 214 | ||
206 | if ( d-> m_modelstr == "H3100" ) | 215 | if ( d-> m_modelstr == "H3100" ) |
@@ -215,3 +224,3 @@ void ODeviceIPAQ::init ( ) | |||
215 | d-> m_model = OMODEL_Unknown; | 224 | d-> m_model = OMODEL_Unknown; |
216 | 225 | ||
217 | f. close ( ); | 226 | f. close ( ); |
@@ -223,3 +232,3 @@ void ODeviceIPAQ::init ( ) | |||
223 | } | 232 | } |
224 | 233 | ||
225 | d-> m_leds [0] = OLED_Off; | 234 | d-> m_leds [0] = OLED_Off; |
@@ -234,3 +243,3 @@ void ODeviceIPAQ::init ( ) | |||
234 | 243 | ||
235 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 244 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
236 | 245 | ||
@@ -244,6 +253,6 @@ typedef struct h3600_ts_led { | |||
244 | 253 | ||
245 | // #define IOC_H3600_TS_MAGIC 'f' | 254 | // #define IOC_H3600_TS_MAGIC 'f' |
246 | // #define LED_ON _IOW(IOC_H3600_TS_MAGIC, 5, struct h3600_ts_led) | 255 | // #define LED_ON _IOW(IOC_H3600_TS_MAGIC, 5, struct h3600_ts_led) |
247 | #define LED_ON (( 1<<30 ) | ( 'f'<<8 ) | ( 5 ) | ( sizeof(struct h3600_ts_led)<<16 )) // _IOW only defined in kernel headers :( | 256 | #define LED_ON (( 1<<30 ) | ( 'f'<<8 ) | ( 5 ) | ( sizeof(struct h3600_ts_led)<<16 )) // _IOW only defined in kernel headers :( |
248 | 257 | ||
249 | 258 | ||
@@ -251,2 +260,3 @@ void ODeviceIPAQ::alarmSound ( ) | |||
251 | { | 260 | { |
261 | #if defined( QT_QWS_IPAQ ) // IPAQ | ||
252 | #ifndef QT_NO_SOUND | 262 | #ifndef QT_NO_SOUND |
@@ -268,5 +278,5 @@ void ODeviceIPAQ::alarmSound ( ) | |||
268 | else if ( volalarm > 100 ) | 278 | else if ( volalarm > 100 ) |
269 | volalarm = 100; | 279 | volalarm = 100; |
270 | volalarm |= ( volalarm << 8 ); | 280 | volalarm |= ( volalarm << 8 ); |
271 | 281 | ||
272 | if (( volalarm & 0xff ) > ( vol & 0xff )) { | 282 | if (( volalarm & 0xff ) > ( vol & 0xff )) { |
@@ -288,2 +298,3 @@ void ODeviceIPAQ::alarmSound ( ) | |||
288 | #endif | 298 | #endif |
299 | #endif | ||
289 | } | 300 | } |
@@ -300,3 +311,3 @@ OLedState ODeviceIPAQ::led ( uint which ) const | |||
300 | else | 311 | else |
301 | return OLED_Off; | 312 | return OLED_Off; |
302 | } | 313 | } |
@@ -305,6 +316,6 @@ bool ODeviceIPAQ::setLed ( uint which, OLedState st ) | |||
305 | { | 316 | { |
306 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR|O_NONBLOCK ); | 317 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR|O_NONBLOCK ); |
307 | 318 | ||
308 | if ( which == 0 ) { | 319 | if ( which == 0 ) { |
309 | if ( fd >= 0 ) { | 320 | if ( fd >= 0 ) { |
310 | struct h3600_ts_led leds; | 321 | struct h3600_ts_led leds; |
@@ -315,3 +326,3 @@ bool ODeviceIPAQ::setLed ( uint which, OLedState st ) | |||
315 | leds. OffOnBlink = 2; | 326 | leds. OffOnBlink = 2; |
316 | 327 | ||
317 | switch ( st ) { | 328 | switch ( st ) { |
@@ -322,3 +333,3 @@ bool ODeviceIPAQ::setLed ( uint which, OLedState st ) | |||
322 | } | 333 | } |
323 | 334 | ||
324 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 335 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
@@ -339,6 +350,6 @@ bool ODeviceIPAQ::setLed ( uint which, OLedState st ) | |||
339 | 350 | ||
340 | //#if defined( QT_QWS_CUSTOM ) // Zaurus | 351 | //#if defined( QT_QWS_EBX ) // Zaurus |
341 | 352 | ||
342 | void ODeviceZaurus::init ( ) | 353 | void ODeviceZaurus::init ( ) |
343 | { | 354 | { |
344 | d-> m_modelstr = "Zaurus SL5000"; | 355 | d-> m_modelstr = "Zaurus SL5000"; |
@@ -349,3 +360,3 @@ void ODeviceZaurus::init ( ) | |||
349 | QFile f ( "/proc/filesystems" ); | 360 | QFile f ( "/proc/filesystems" ); |
350 | 361 | ||
351 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 362 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
@@ -353,5 +364,5 @@ void ODeviceZaurus::init ( ) | |||
353 | d-> m_system = OSYSTEM_OpenZaurus; | 364 | d-> m_system = OSYSTEM_OpenZaurus; |
354 | 365 | ||
355 | f. close ( ); | 366 | f. close ( ); |
356 | } | 367 | } |
357 | else { | 368 | else { |
@@ -374,3 +385,3 @@ void ODeviceZaurus::init ( ) | |||
374 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 385 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
375 | 386 | ||
376 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 387 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
@@ -378,3 +389,31 @@ void ODeviceZaurus::init ( ) | |||
378 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 389 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
379 | 390 | ||
391 | /* --- for SHARP_BUZZER device --- */ | ||
392 | |||
393 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
394 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
395 | |||
396 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | ||
397 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | ||
398 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | ||
399 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | ||
400 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | ||
401 | |||
402 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
403 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
404 | |||
405 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | ||
406 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | ||
407 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | ||
408 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | ||
409 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | ||
410 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | ||
411 | //#define SHARP_PDA_APPSTART 9 /* application start */ | ||
412 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | ||
413 | |||
414 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
415 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | ||
416 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | ||
417 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | ||
418 | // | ||
380 | 419 | ||
@@ -387,3 +426,3 @@ typedef struct sharp_led_status { | |||
387 | } sharp_led_status; | 426 | } sharp_led_status; |
388 | 427 | ||
389 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 428 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |