-rw-r--r-- | libopie/odevice.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index d78277f..501b601 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -966,385 +966,385 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
966 | if ( newkeycode != Key_unknown ) | 966 | if ( newkeycode != Key_unknown ) |
967 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 967 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
968 | return true; | 968 | return true; |
969 | } | 969 | } |
970 | else | 970 | else |
971 | return false; | 971 | return false; |
972 | } | 972 | } |
973 | 973 | ||
974 | void iPAQ::timerEvent ( QTimerEvent * ) | 974 | void iPAQ::timerEvent ( QTimerEvent * ) |
975 | { | 975 | { |
976 | killTimer ( m_power_timer ); | 976 | killTimer ( m_power_timer ); |
977 | m_power_timer = 0; | 977 | m_power_timer = 0; |
978 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 978 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
979 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 979 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
980 | } | 980 | } |
981 | 981 | ||
982 | 982 | ||
983 | void iPAQ::alarmSound ( ) | 983 | void iPAQ::alarmSound ( ) |
984 | { | 984 | { |
985 | #ifndef QT_NO_SOUND | 985 | #ifndef QT_NO_SOUND |
986 | static Sound snd ( "alarm" ); | 986 | static Sound snd ( "alarm" ); |
987 | int fd; | 987 | int fd; |
988 | int vol; | 988 | int vol; |
989 | bool vol_reset = false; | 989 | bool vol_reset = false; |
990 | 990 | ||
991 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 991 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
992 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 992 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
993 | Config cfg ( "qpe" ); | 993 | Config cfg ( "qpe" ); |
994 | cfg. setGroup ( "Volume" ); | 994 | cfg. setGroup ( "Volume" ); |
995 | 995 | ||
996 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 996 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
997 | if ( volalarm < 0 ) | 997 | if ( volalarm < 0 ) |
998 | volalarm = 0; | 998 | volalarm = 0; |
999 | else if ( volalarm > 100 ) | 999 | else if ( volalarm > 100 ) |
1000 | volalarm = 100; | 1000 | volalarm = 100; |
1001 | volalarm |= ( volalarm << 8 ); | 1001 | volalarm |= ( volalarm << 8 ); |
1002 | 1002 | ||
1003 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 1003 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
1004 | vol_reset = true; | 1004 | vol_reset = true; |
1005 | } | 1005 | } |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | snd. play ( ); | 1008 | snd. play ( ); |
1009 | while ( !snd. isFinished ( )) | 1009 | while ( !snd. isFinished ( )) |
1010 | qApp-> processEvents ( ); | 1010 | qApp-> processEvents ( ); |
1011 | 1011 | ||
1012 | if ( fd >= 0 ) { | 1012 | if ( fd >= 0 ) { |
1013 | if ( vol_reset ) | 1013 | if ( vol_reset ) |
1014 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 1014 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
1015 | ::close ( fd ); | 1015 | ::close ( fd ); |
1016 | } | 1016 | } |
1017 | #endif | 1017 | #endif |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | 1020 | ||
1021 | bool iPAQ::setSoftSuspend ( bool soft ) | 1021 | bool iPAQ::setSoftSuspend ( bool soft ) |
1022 | { | 1022 | { |
1023 | bool res = false; | 1023 | bool res = false; |
1024 | int fd; | 1024 | int fd; |
1025 | 1025 | ||
1026 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 1026 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
1027 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 1027 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
1028 | res = true; | 1028 | res = true; |
1029 | else | 1029 | else |
1030 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 1030 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
1031 | 1031 | ||
1032 | ::close ( fd ); | 1032 | ::close ( fd ); |
1033 | } | 1033 | } |
1034 | else | 1034 | else |
1035 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 1035 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
1036 | 1036 | ||
1037 | return res; | 1037 | return res; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | 1040 | ||
1041 | bool iPAQ::setDisplayBrightness ( int bright ) | 1041 | bool iPAQ::setDisplayBrightness ( int bright ) |
1042 | { | 1042 | { |
1043 | bool res = false; | 1043 | bool res = false; |
1044 | int fd; | 1044 | int fd; |
1045 | 1045 | ||
1046 | if ( bright > 255 ) | 1046 | if ( bright > 255 ) |
1047 | bright = 255; | 1047 | bright = 255; |
1048 | if ( bright < 0 ) | 1048 | if ( bright < 0 ) |
1049 | bright = 0; | 1049 | bright = 0; |
1050 | 1050 | ||
1051 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 1051 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
1052 | FLITE_IN bl; | 1052 | FLITE_IN bl; |
1053 | bl. mode = 1; | 1053 | bl. mode = 1; |
1054 | bl. pwr = bright ? 1 : 0; | 1054 | bl. pwr = bright ? 1 : 0; |
1055 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 1055 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
1056 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 1056 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
1057 | ::close ( fd ); | 1057 | ::close ( fd ); |
1058 | } | 1058 | } |
1059 | return res; | 1059 | return res; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | int iPAQ::displayBrightnessResolution ( ) const | 1062 | int iPAQ::displayBrightnessResolution ( ) const |
1063 | { | 1063 | { |
1064 | switch ( model ( )) { | 1064 | switch ( model ( )) { |
1065 | case Model_iPAQ_H31xx: | 1065 | case Model_iPAQ_H31xx: |
1066 | case Model_iPAQ_H36xx: | 1066 | case Model_iPAQ_H36xx: |
1067 | case Model_iPAQ_H37xx: | 1067 | case Model_iPAQ_H37xx: |
1068 | return 128; // really 256, but >128 could damage the LCD | 1068 | return 128; // really 256, but >128 could damage the LCD |
1069 | 1069 | ||
1070 | case Model_iPAQ_H38xx: | 1070 | case Model_iPAQ_H38xx: |
1071 | case Model_iPAQ_H39xx: | 1071 | case Model_iPAQ_H39xx: |
1072 | return 64; | 1072 | return 64; |
1073 | 1073 | ||
1074 | default: | 1074 | default: |
1075 | return 2; | 1075 | return 2; |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | 1079 | ||
1080 | bool iPAQ::hasLightSensor ( ) const | 1080 | bool iPAQ::hasLightSensor ( ) const |
1081 | { | 1081 | { |
1082 | return true; | 1082 | return true; |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | int iPAQ::readLightSensor ( ) | 1085 | int iPAQ::readLightSensor ( ) |
1086 | { | 1086 | { |
1087 | int fd; | 1087 | int fd; |
1088 | int val = -1; | 1088 | int val = -1; |
1089 | 1089 | ||
1090 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 1090 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
1091 | char buffer [8]; | 1091 | char buffer [8]; |
1092 | 1092 | ||
1093 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 1093 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
1094 | char *endptr; | 1094 | char *endptr; |
1095 | 1095 | ||
1096 | buffer [4] = 0; | 1096 | buffer [4] = 0; |
1097 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 1097 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
1098 | 1098 | ||
1099 | if ( *endptr != 0 ) | 1099 | if ( *endptr != 0 ) |
1100 | val = -1; | 1100 | val = -1; |
1101 | } | 1101 | } |
1102 | ::close ( fd ); | 1102 | ::close ( fd ); |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | return val; | 1105 | return val; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | int iPAQ::lightSensorResolution ( ) const | 1108 | int iPAQ::lightSensorResolution ( ) const |
1109 | { | 1109 | { |
1110 | return 256; | 1110 | return 256; |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | /************************************************** | 1113 | /************************************************** |
1114 | * | 1114 | * |
1115 | * Zaurus | 1115 | * Zaurus |
1116 | * | 1116 | * |
1117 | **************************************************/ | 1117 | **************************************************/ |
1118 | 1118 | ||
1119 | 1119 | ||
1120 | 1120 | ||
1121 | void Zaurus::init ( ) | 1121 | void Zaurus::init ( ) |
1122 | { | 1122 | { |
1123 | d-> m_vendorstr = "Sharp"; | 1123 | d-> m_vendorstr = "Sharp"; |
1124 | d-> m_vendor = Vendor_Sharp; | 1124 | d-> m_vendor = Vendor_Sharp; |
1125 | 1125 | ||
1126 | QFile f ( "/proc/filesystems" ); | 1126 | QFile f ( "/proc/filesystems" ); |
1127 | QString model; | 1127 | QString model; |
1128 | 1128 | ||
1129 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 1129 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
1130 | d-> m_vendorstr = "OpenZaurus Team"; | 1130 | d-> m_vendorstr = "OpenZaurus Team"; |
1131 | d-> m_systemstr = "OpenZaurus"; | 1131 | d-> m_systemstr = "OpenZaurus"; |
1132 | d-> m_system = System_OpenZaurus; | 1132 | d-> m_system = System_OpenZaurus; |
1133 | 1133 | ||
1134 | f. close ( ); | 1134 | f. close ( ); |
1135 | 1135 | ||
1136 | f. setName ( "/etc/oz_version" ); | 1136 | f. setName ( "/etc/oz_version" ); |
1137 | if ( f. open ( IO_ReadOnly )) { | 1137 | if ( f. open ( IO_ReadOnly )) { |
1138 | QTextStream ts ( &f ); | 1138 | QTextStream ts ( &f ); |
1139 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); | 1139 | d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); |
1140 | f. close ( ); | 1140 | f. close ( ); |
1141 | } | 1141 | } |
1142 | } | 1142 | } |
1143 | else { | 1143 | else { |
1144 | d-> m_systemstr = "Zaurus"; | 1144 | d-> m_systemstr = "Zaurus"; |
1145 | d-> m_system = System_Zaurus; | 1145 | d-> m_system = System_Zaurus; |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | f. setName ( "/proc/cpuinfo" ); | 1148 | f. setName ( "/proc/cpuinfo" ); |
1149 | if ( f. open ( IO_ReadOnly ) ) { | 1149 | if ( f. open ( IO_ReadOnly ) ) { |
1150 | QTextStream ts ( &f ); | 1150 | QTextStream ts ( &f ); |
1151 | QString line; | 1151 | QString line; |
1152 | while( line = ts. readLine ( ) ) { | 1152 | while( line = ts. readLine ( ) ) { |
1153 | if ( line. left ( 8 ) == "Hardware" ) | 1153 | if ( line. left ( 8 ) == "Hardware" ) |
1154 | break; | 1154 | break; |
1155 | } | 1155 | } |
1156 | int loc = line. find ( ":" ); | 1156 | int loc = line. find ( ":" ); |
1157 | if ( loc != -1 ) | 1157 | if ( loc != -1 ) |
1158 | model = line. mid ( loc + 2 ). simplifyWhitespace( ); | 1158 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | if ( model == "SHARP Corgi" ) { | 1161 | if ( model == "SHARP Corgi" ) { |
1162 | d-> m_model = Model_Zaurus_SLC700; | 1162 | d-> m_model = Model_Zaurus_SLC700; |
1163 | d-> m_modelstr = "Zaurus SL-C700"; | 1163 | d-> m_modelstr = "Zaurus SL-C700"; |
1164 | } else if ( model == "SHARP Poodle" ) { | 1164 | } else if ( model == "SHARP Poodle" ) { |
1165 | d-> m_model = Model_Zaurus_SLB600; | 1165 | d-> m_model = Model_Zaurus_SLB600; |
1166 | d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; | 1166 | d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; |
1167 | } else if ( model = "Sharp-Collie" ) { | 1167 | } else if ( model = "Sharp-Collie" ) { |
1168 | d-> m_model = Model_Zaurus_SL5500; | 1168 | d-> m_model = Model_Zaurus_SL5500; |
1169 | d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 1169 | d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
1170 | } else { | 1170 | } else { |
1171 | d-> m_model = Model_Zaurus_SL5500; | 1171 | d-> m_model = Model_Zaurus_SL5500; |
1172 | d-> m_modelstr = "Zaurus (Model unknown)"; | 1172 | d-> m_modelstr = "Zaurus (Model unknown)"; |
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | bool flipstate = false; | 1175 | bool flipstate = false; |
1176 | switch ( d-> m_model ) { | 1176 | switch ( d-> m_model ) { |
1177 | case Model_Zaurus_SLA300: | 1177 | case Model_Zaurus_SLA300: |
1178 | d-> m_rotation = Rot0; | 1178 | d-> m_rotation = Rot0; |
1179 | break; | 1179 | break; |
1180 | case Model_Zaurus_SLC700: | 1180 | case Model_Zaurus_SLC700: |
1181 | // Note: need to 1) set flipstate based on physical screen orientation | 1181 | // Note: need to 1) set flipstate based on physical screen orientation |
1182 | // and 2) check to see if the user overrode the rotation direction | 1182 | // and 2) check to see if the user overrode the rotation direction |
1183 | // using appearance, and if so, remove that item from the Config to | 1183 | // using appearance, and if so, remove that item from the Config to |
1184 | // ensure the rotate applet flips us back to the previous state. | 1184 | // ensure the rotate applet flips us back to the previous state. |
1185 | if ( flipstate ) { | 1185 | if ( flipstate ) { |
1186 | // 480x640 | 1186 | // 480x640 |
1187 | d-> m_rotation = Rot0; | 1187 | d-> m_rotation = Rot0; |
1188 | d-> m_direction = CW; | 1188 | d-> m_direction = CW; |
1189 | } else { | 1189 | } else { |
1190 | // 640x480 | 1190 | // 640x480 |
1191 | d-> m_rotation = Rot270; | 1191 | d-> m_rotation = Rot270; |
1192 | d-> m_direction = CCW; | 1192 | d-> m_direction = CCW; |
1193 | } | 1193 | } |
1194 | break; | 1194 | break; |
1195 | case Model_Zaurus_SLB600: | 1195 | case Model_Zaurus_SLB600: |
1196 | case Model_Zaurus_SL5500: | 1196 | case Model_Zaurus_SL5500: |
1197 | case Model_Zaurus_SL5000: | 1197 | case Model_Zaurus_SL5000: |
1198 | default: | 1198 | default: |
1199 | d-> m_rotation = Rot270; | 1199 | d-> m_rotation = Rot270; |
1200 | break; | 1200 | break; |
1201 | } | 1201 | } |
1202 | m_leds [0] = Led_Off; | 1202 | m_leds [0] = Led_Off; |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | void Zaurus::initButtons ( ) | 1205 | void Zaurus::initButtons ( ) |
1206 | { | 1206 | { |
1207 | if ( d-> m_buttons ) | 1207 | if ( d-> m_buttons ) |
1208 | return; | 1208 | return; |
1209 | 1209 | ||
1210 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 1210 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
1211 | 1211 | ||
1212 | d-> m_buttons = new QValueList <ODeviceButton>; | 1212 | d-> m_buttons = new QValueList <ODeviceButton>; |
1213 | 1213 | ||
1214 | struct z_button * pz_buttons; | 1214 | struct z_button * pz_buttons; |
1215 | int buttoncount; | 1215 | int buttoncount; |
1216 | switch ( d-> m_model ) { | 1216 | switch ( d-> m_model ) { |
1217 | case Model_Zaurus_SLC700: | 1217 | case Model_Zaurus_SLC700: |
1218 | pz_buttons = z_buttons_c700; | 1218 | pz_buttons = z_buttons_c700; |
1219 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 1219 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
1220 | break; | 1220 | break; |
1221 | default: | 1221 | default: |
1222 | pz_buttons = z_buttons; | 1222 | pz_buttons = z_buttons; |
1223 | buttoncount = ARRAY_SIZE(z_buttons); | 1223 | buttoncount = ARRAY_SIZE(z_buttons); |
1224 | break; | 1224 | break; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | for ( int i = 0; i < buttoncount; i++ ) { | 1227 | for ( int i = 0; i < buttoncount; i++ ) { |
1228 | struct z_button *zb = pz_buttons + i; | 1228 | struct z_button *zb = pz_buttons + i; |
1229 | ODeviceButton b; | 1229 | ODeviceButton b; |
1230 | 1230 | ||
1231 | b. setKeycode ( zb-> code ); | 1231 | b. setKeycode ( zb-> code ); |
1232 | b. setUserText ( QObject::tr ( "Button", zb-> utext )); | 1232 | b. setUserText ( QObject::tr ( "Button", zb-> utext )); |
1233 | b. setPixmap ( Resource::loadPixmap ( zb-> pix )); | 1233 | b. setPixmap ( Resource::loadPixmap ( zb-> pix )); |
1234 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); | 1234 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); |
1235 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); | 1235 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); |
1236 | 1236 | ||
1237 | d-> m_buttons-> append ( b ); | 1237 | d-> m_buttons-> append ( b ); |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | reloadButtonMapping ( ); | 1240 | reloadButtonMapping ( ); |
1241 | 1241 | ||
1242 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 1242 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
1243 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 1243 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | #include <unistd.h> | 1246 | #include <unistd.h> |
1247 | #include <fcntl.h> | 1247 | #include <fcntl.h> |
1248 | #include <sys/ioctl.h> | 1248 | #include <sys/ioctl.h> |
1249 | 1249 | ||
1250 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 1250 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
1251 | 1251 | ||
1252 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 1252 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
1253 | 1253 | ||
1254 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1254 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1255 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 1255 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
1256 | 1256 | ||
1257 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 1257 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
1258 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 1258 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
1259 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 1259 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
1260 | 1260 | ||
1261 | /* --- for SHARP_BUZZER device --- */ | 1261 | /* --- for SHARP_BUZZER device --- */ |
1262 | 1262 | ||
1263 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1263 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1264 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 1264 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
1265 | 1265 | ||
1266 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 1266 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
1267 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 1267 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
1268 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 1268 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
1269 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 1269 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
1270 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 1270 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
1271 | 1271 | ||
1272 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 1272 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
1273 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 1273 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
1274 | 1274 | ||
1275 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 1275 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
1276 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 1276 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
1277 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 1277 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
1278 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 1278 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
1279 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 1279 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
1280 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 1280 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
1281 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 1281 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
1282 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 1282 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
1283 | 1283 | ||
1284 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 1284 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
1285 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 1285 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
1286 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 1286 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
1287 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 1287 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
1288 | // | 1288 | // |
1289 | 1289 | ||
1290 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 1290 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
1291 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 1291 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
1292 | 1292 | ||
1293 | typedef struct sharp_led_status { | 1293 | typedef struct sharp_led_status { |
1294 | int which; /* select which LED status is wanted. */ | 1294 | int which; /* select which LED status is wanted. */ |
1295 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 1295 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
1296 | } sharp_led_status; | 1296 | } sharp_led_status; |
1297 | 1297 | ||
1298 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 1298 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
1299 | 1299 | ||
1300 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 1300 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
1301 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 1301 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
1302 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 1302 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
1303 | 1303 | ||
1304 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 1304 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
1305 | 1305 | ||
1306 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 1306 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
1307 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 1307 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
1308 | #define APM_EVT_POWER_BUTTON (1 << 0) | 1308 | #define APM_EVT_POWER_BUTTON (1 << 0) |
1309 | 1309 | ||
1310 | #define FL_IOCTL_STEP_CONTRAST 100 | 1310 | #define FL_IOCTL_STEP_CONTRAST 100 |
1311 | 1311 | ||
1312 | 1312 | ||
1313 | void Zaurus::buzzer ( int sound ) | 1313 | void Zaurus::buzzer ( int sound ) |
1314 | { | 1314 | { |
1315 | static int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 1315 | static int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
1316 | 1316 | ||
1317 | if ( fd >= 0 ) { | 1317 | if ( fd >= 0 ) { |
1318 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 1318 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
1319 | ::close ( fd ); | 1319 | ::close ( fd ); |
1320 | } | 1320 | } |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | 1323 | ||
1324 | void Zaurus::alarmSound ( ) | 1324 | void Zaurus::alarmSound ( ) |
1325 | { | 1325 | { |
1326 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); | 1326 | buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | void Zaurus::touchSound ( ) | 1329 | void Zaurus::touchSound ( ) |
1330 | { | 1330 | { |
1331 | buzzer ( SHARP_BUZ_TOUCHSOUND ); | 1331 | buzzer ( SHARP_BUZ_TOUCHSOUND ); |
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | void Zaurus::keySound ( ) | 1334 | void Zaurus::keySound ( ) |
1335 | { | 1335 | { |
1336 | buzzer ( SHARP_BUZ_KEYSOUND ); | 1336 | buzzer ( SHARP_BUZ_KEYSOUND ); |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | 1339 | ||
1340 | QValueList <OLed> Zaurus::ledList ( ) const | 1340 | QValueList <OLed> Zaurus::ledList ( ) const |
1341 | { | 1341 | { |
1342 | QValueList <OLed> vl; | 1342 | QValueList <OLed> vl; |
1343 | vl << Led_Mail; | 1343 | vl << Led_Mail; |
1344 | return vl; | 1344 | return vl; |
1345 | } | 1345 | } |
1346 | 1346 | ||
1347 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const | 1347 | QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const |
1348 | { | 1348 | { |
1349 | QValueList <OLedState> vl; | 1349 | QValueList <OLedState> vl; |
1350 | 1350 | ||