summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-05-07 13:44:23 (UTC)
committer mickeyl <mickeyl>2003-05-07 13:44:23 (UTC)
commit4619398b4712062e65d1919156edea38785c590e (patch) (unidiff)
tree4d00604960974ca16f9d40468bce4c096e2a76b0
parent83f53eede83728c131b1134ae0a674a7d8f6f00a (diff)
downloadopie-4619398b4712062e65d1919156edea38785c590e.zip
opie-4619398b4712062e65d1919156edea38785c590e.tar.gz
opie-4619398b4712062e65d1919156edea38785c590e.tar.bz2
fix bug kergoth introduced in rev 1.43
fd was an integer static to the function which means that the assignment only happens once. This is ok, when we don't close the device, but not if we close it after usage. Thanks to eilers for confirming! I wonder why noone else spotted this...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 62e3569..7d862cd 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1243,129 +1243,129 @@ void Zaurus::initButtons ( )
1243 1243
1244#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1244#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1245 1245
1246 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1246 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1247#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1247#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1248 1248
1249#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1249#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1250#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1250#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1251#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1251#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1252 1252
1253/* --- for SHARP_BUZZER device --- */ 1253/* --- for SHARP_BUZZER device --- */
1254 1254
1255 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1255 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1256//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1256//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1257 1257
1258#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1258#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1259#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1259#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1260#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1260#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1261#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1261#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1262#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1262#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1263 1263
1264//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1264//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1265//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1265//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1266 1266
1267//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1267//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1268//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1268//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1269//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1269//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1270//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1270//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1271//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1271//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1272//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1272//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1273//#define SHARP_PDA_APPSTART 9 /* application start */ 1273//#define SHARP_PDA_APPSTART 9 /* application start */
1274//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1274//#define SHARP_PDA_APPQUIT 10 /* application ends */
1275 1275
1276//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1276//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1277//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1277//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1278//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1278//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1279//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1279//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1280// 1280//
1281 1281
1282 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1282 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1283#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1283#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
1284 1284
1285typedef struct sharp_led_status { 1285typedef struct sharp_led_status {
1286 int which; /* select which LED status is wanted. */ 1286 int which; /* select which LED status is wanted. */
1287 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 1287 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
1288} sharp_led_status; 1288} sharp_led_status;
1289 1289
1290#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 1290#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
1291 1291
1292#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 1292#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
1293#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 1293#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
1294#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 1294#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
1295 1295
1296// #include <asm/sharp_apm.h> // including kernel headers is evil ... 1296// #include <asm/sharp_apm.h> // including kernel headers is evil ...
1297 1297
1298#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 1298#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
1299#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 1299#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
1300#define APM_EVT_POWER_BUTTON (1 << 0) 1300#define APM_EVT_POWER_BUTTON (1 << 0)
1301 1301
1302#define FL_IOCTL_STEP_CONTRAST 100 1302#define FL_IOCTL_STEP_CONTRAST 100
1303 1303
1304 1304
1305void Zaurus::buzzer ( int sound ) 1305void Zaurus::buzzer ( int sound )
1306{ 1306{
1307 static int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 1307 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
1308 1308
1309 if ( fd >= 0 ) { 1309 if ( fd >= 0 ) {
1310 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 1310 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
1311 ::close ( fd ); 1311 ::close ( fd );
1312 } 1312 }
1313} 1313}
1314 1314
1315 1315
1316void Zaurus::alarmSound ( ) 1316void Zaurus::alarmSound ( )
1317{ 1317{
1318 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 1318 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
1319} 1319}
1320 1320
1321void Zaurus::touchSound ( ) 1321void Zaurus::touchSound ( )
1322{ 1322{
1323 buzzer ( SHARP_BUZ_TOUCHSOUND ); 1323 buzzer ( SHARP_BUZ_TOUCHSOUND );
1324} 1324}
1325 1325
1326void Zaurus::keySound ( ) 1326void Zaurus::keySound ( )
1327{ 1327{
1328 buzzer ( SHARP_BUZ_KEYSOUND ); 1328 buzzer ( SHARP_BUZ_KEYSOUND );
1329} 1329}
1330 1330
1331 1331
1332QValueList <OLed> Zaurus::ledList ( ) const 1332QValueList <OLed> Zaurus::ledList ( ) const
1333{ 1333{
1334 QValueList <OLed> vl; 1334 QValueList <OLed> vl;
1335 vl << Led_Mail; 1335 vl << Led_Mail;
1336 return vl; 1336 return vl;
1337} 1337}
1338 1338
1339QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 1339QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const
1340{ 1340{
1341 QValueList <OLedState> vl; 1341 QValueList <OLedState> vl;
1342 1342
1343 if ( l == Led_Mail ) 1343 if ( l == Led_Mail )
1344 vl << Led_Off << Led_On << Led_BlinkSlow; 1344 vl << Led_Off << Led_On << Led_BlinkSlow;
1345 return vl; 1345 return vl;
1346} 1346}
1347 1347
1348OLedState Zaurus::ledState ( OLed which ) const 1348OLedState Zaurus::ledState ( OLed which ) const
1349{ 1349{
1350 if ( which == Led_Mail ) 1350 if ( which == Led_Mail )
1351 return m_leds [0]; 1351 return m_leds [0];
1352 else 1352 else
1353 return Led_Off; 1353 return Led_Off;
1354} 1354}
1355 1355
1356bool Zaurus::setLedState ( OLed which, OLedState st ) 1356bool Zaurus::setLedState ( OLed which, OLedState st )
1357{ 1357{
1358 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 1358 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
1359 1359
1360 if ( which == Led_Mail ) { 1360 if ( which == Led_Mail ) {
1361 if ( fd >= 0 ) { 1361 if ( fd >= 0 ) {
1362 struct sharp_led_status leds; 1362 struct sharp_led_status leds;
1363 ::memset ( &leds, 0, sizeof( leds )); 1363 ::memset ( &leds, 0, sizeof( leds ));
1364 leds. which = SHARP_LED_MAIL_EXISTS; 1364 leds. which = SHARP_LED_MAIL_EXISTS;
1365 bool ok = true; 1365 bool ok = true;
1366 1366
1367 switch ( st ) { 1367 switch ( st ) {
1368 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 1368 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
1369 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 1369 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
1370 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 1370 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
1371 default : ok = false; 1371 default : ok = false;