summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
authorkergoth <kergoth>2003-04-01 20:33:39 (UTC)
committer kergoth <kergoth>2003-04-01 20:33:39 (UTC)
commit76b83c2b77e626fadf1d1bbbfd19a9a8a795334b (patch) (unidiff)
tree02d425c7e185842d0a12d9fe3d0b6377005fed67 /libopie/odevice.cpp
parenta7ad29eb41163eec88b3bd835108bd80140ff086 (diff)
downloadopie-76b83c2b77e626fadf1d1bbbfd19a9a8a795334b.zip
opie-76b83c2b77e626fadf1d1bbbfd19a9a8a795334b.tar.gz
opie-76b83c2b77e626fadf1d1bbbfd19a9a8a795334b.tar.bz2
Open zaurus buzzer device as write only, and close it.
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 55ba7bd..cea4f35 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1082,100 +1082,102 @@ void Zaurus::initButtons ( )
1082#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1082#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1083#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1083#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1084#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1084#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1085#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1085#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1086 1086
1087//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1087//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1088//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1088//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1089 1089
1090//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1090//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1091//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1091//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1092//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1092//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1093//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1093//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1094//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1094//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1095//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1095//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1096//#define SHARP_PDA_APPSTART 9 /* application start */ 1096//#define SHARP_PDA_APPSTART 9 /* application start */
1097//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1097//#define SHARP_PDA_APPQUIT 10 /* application ends */
1098 1098
1099//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1099//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1100//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1100//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1101//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1101//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1102//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1102//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1103// 1103//
1104 1104
1105 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1105 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1106#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1106#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
1107 1107
1108typedef struct sharp_led_status { 1108typedef struct sharp_led_status {
1109 int which; /* select which LED status is wanted. */ 1109 int which; /* select which LED status is wanted. */
1110 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 1110 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
1111} sharp_led_status; 1111} sharp_led_status;
1112 1112
1113#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 1113#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
1114 1114
1115#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 1115#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
1116#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 1116#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
1117#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 1117#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
1118 1118
1119// #include <asm/sharp_apm.h> // including kernel headers is evil ... 1119// #include <asm/sharp_apm.h> // including kernel headers is evil ...
1120 1120
1121#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 1121#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
1122#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 1122#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
1123#define APM_EVT_POWER_BUTTON (1 << 0) 1123#define APM_EVT_POWER_BUTTON (1 << 0)
1124 1124
1125#define FL_IOCTL_STEP_CONTRAST 100 1125#define FL_IOCTL_STEP_CONTRAST 100
1126 1126
1127 1127
1128void Zaurus::buzzer ( int sound ) 1128void Zaurus::buzzer ( int sound )
1129{ 1129{
1130 static int fd = ::open ( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); 1130 static int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
1131 1131
1132 if ( fd >= 0 ) 1132 if ( fd >= 0 ) {
1133 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 1133 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
1134 ::close ( fd );
1135 }
1134} 1136}
1135 1137
1136 1138
1137void Zaurus::alarmSound ( ) 1139void Zaurus::alarmSound ( )
1138{ 1140{
1139 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 1141 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
1140} 1142}
1141 1143
1142void Zaurus::touchSound ( ) 1144void Zaurus::touchSound ( )
1143{ 1145{
1144 buzzer ( SHARP_BUZ_TOUCHSOUND ); 1146 buzzer ( SHARP_BUZ_TOUCHSOUND );
1145} 1147}
1146 1148
1147void Zaurus::keySound ( ) 1149void Zaurus::keySound ( )
1148{ 1150{
1149 buzzer ( SHARP_BUZ_KEYSOUND ); 1151 buzzer ( SHARP_BUZ_KEYSOUND );
1150} 1152}
1151 1153
1152 1154
1153QValueList <OLed> Zaurus::ledList ( ) const 1155QValueList <OLed> Zaurus::ledList ( ) const
1154{ 1156{
1155 QValueList <OLed> vl; 1157 QValueList <OLed> vl;
1156 vl << Led_Mail; 1158 vl << Led_Mail;
1157 return vl; 1159 return vl;
1158} 1160}
1159 1161
1160QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 1162QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const
1161{ 1163{
1162 QValueList <OLedState> vl; 1164 QValueList <OLedState> vl;
1163 1165
1164 if ( l == Led_Mail ) 1166 if ( l == Led_Mail )
1165 vl << Led_Off << Led_On << Led_BlinkSlow; 1167 vl << Led_Off << Led_On << Led_BlinkSlow;
1166 return vl; 1168 return vl;
1167} 1169}
1168 1170
1169OLedState Zaurus::ledState ( OLed which ) const 1171OLedState Zaurus::ledState ( OLed which ) const
1170{ 1172{
1171 if ( which == Led_Mail ) 1173 if ( which == Led_Mail )
1172 return m_leds [0]; 1174 return m_leds [0];
1173 else 1175 else
1174 return Led_Off; 1176 return Led_Off;
1175} 1177}
1176 1178
1177bool Zaurus::setLedState ( OLed which, OLedState st ) 1179bool Zaurus::setLedState ( OLed which, OLedState st )
1178{ 1180{
1179 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 1181 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
1180 1182
1181 if ( which == Led_Mail ) { 1183 if ( which == Led_Mail ) {