summaryrefslogtreecommitdiff
authorkergoth <kergoth>2003-04-19 20:47:28 (UTC)
committer kergoth <kergoth>2003-04-19 20:47:28 (UTC)
commitc502394063598e63591e06072802f1c5a9e0c266 (patch) (unidiff)
tree66b5e6c888f2370437a399aa8bea7659a04cdb95
parenteb276a6663540849ef98819eeaa8f935a7e1b945 (diff)
downloadopie-c502394063598e63591e06072802f1c5a9e0c266.zip
opie-c502394063598e63591e06072802f1c5a9e0c266.tar.gz
opie-c502394063598e63591e06072802f1c5a9e0c266.tar.bz2
Add SL-C700 button handling, so we can handle the keycode for the physical screen rotation.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 713cc90..cb7dd74 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1,89 +1,92 @@
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#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
37 37
38#include "odevice.h" 38#include "odevice.h"
39 39
40#include <qwindowsystem_qws.h> 40#include <qwindowsystem_qws.h>
41 41
42#ifndef ARRAY_SIZE
43#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
44#endif
42 45
43// _IO and friends are only defined in kernel headers ... 46// _IO and friends are only defined in kernel headers ...
44 47
45#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 48#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
46 49
47#define OD_IO(type,number) OD_IOC(0,type,number,0) 50#define OD_IO(type,number) OD_IOC(0,type,number,0)
48#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 51#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
49#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 52#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
50#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 53#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
51 54
52using namespace Opie; 55using namespace Opie;
53 56
54class ODeviceData { 57class ODeviceData {
55public: 58public:
56 bool m_qwsserver : 1; 59 bool m_qwsserver : 1;
57 60
58 QString m_vendorstr; 61 QString m_vendorstr;
59 OVendor m_vendor; 62 OVendor m_vendor;
60 63
61 QString m_modelstr; 64 QString m_modelstr;
62 OModel m_model; 65 OModel m_model;
63 66
64 QString m_systemstr; 67 QString m_systemstr;
65 OSystem m_system; 68 OSystem m_system;
66 69
67 QString m_sysverstr; 70 QString m_sysverstr;
68 71
69 Transformation m_rotation; 72 Transformation m_rotation;
70 ODirection m_direction; 73 ODirection m_direction;
71 74
72 QValueList <ODeviceButton> *m_buttons; 75 QValueList <ODeviceButton> *m_buttons;
73 uint m_holdtime; 76 uint m_holdtime;
74}; 77};
75 78
76 79
77class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 80class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
78protected: 81protected:
79 virtual void init ( ); 82 virtual void init ( );
80 virtual void initButtons ( ); 83 virtual void initButtons ( );
81 84
82public: 85public:
83 virtual bool setSoftSuspend ( bool soft ); 86 virtual bool setSoftSuspend ( bool soft );
84 87
85 virtual bool setDisplayBrightness ( int b ); 88 virtual bool setDisplayBrightness ( int b );
86 virtual int displayBrightnessResolution ( ) const; 89 virtual int displayBrightnessResolution ( ) const;
87 90
88 virtual void alarmSound ( ); 91 virtual void alarmSound ( );
89 92
@@ -160,96 +163,119 @@ struct i_button {
160 { Model_iPAQ_H38xx | Model_iPAQ_H39xx, 163 { Model_iPAQ_H38xx | Model_iPAQ_H39xx,
161 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 164 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
162 "devicebuttons/ipaq_mail", 165 "devicebuttons/ipaq_mail",
163 "mail", "raise()", 166 "mail", "raise()",
164 "mail", "newMail()" }, 167 "mail", "newMail()" },
165 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 168 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
166 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 169 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
167 "devicebuttons/ipaq_home", 170 "devicebuttons/ipaq_home",
168 "QPE/Launcher", "home()", 171 "QPE/Launcher", "home()",
169 "buttonsettings", "raise()" }, 172 "buttonsettings", "raise()" },
170 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, 173 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx,
171 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 174 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
172 "devicebuttons/ipaq_record", 175 "devicebuttons/ipaq_record",
173 "QPE/VMemo", "toggleRecord()", 176 "QPE/VMemo", "toggleRecord()",
174 "sound", "raise()" }, 177 "sound", "raise()" },
175}; 178};
176 179
177struct z_button { 180struct z_button {
178 Qt::Key code; 181 Qt::Key code;
179 char *utext; 182 char *utext;
180 char *pix; 183 char *pix;
181 char *fpressedservice; 184 char *fpressedservice;
182 char *fpressedaction; 185 char *fpressedaction;
183 char *fheldservice; 186 char *fheldservice;
184 char *fheldaction; 187 char *fheldaction;
185} z_buttons [] = { 188} z_buttons [] = {
186 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 189 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
187 "devicebuttons/z_calendar", 190 "devicebuttons/z_calendar",
188 "datebook", "nextView()", 191 "datebook", "nextView()",
189 "today", "raise()" }, 192 "today", "raise()" },
190 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 193 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
191 "devicebuttons/z_contact", 194 "devicebuttons/z_contact",
192 "addressbook", "raise()", 195 "addressbook", "raise()",
193 "addressbook", "beamBusinessCard()" }, 196 "addressbook", "beamBusinessCard()" },
194 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 197 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
195 "devicebuttons/z_home", 198 "devicebuttons/z_home",
196 "QPE/Launcher", "home()", 199 "QPE/Launcher", "home()",
197 "buttonsettings", "raise()" }, 200 "buttonsettings", "raise()" },
198 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 201 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
199 "devicebuttons/z_menu", 202 "devicebuttons/z_menu",
200 "QPE/TaskBar", "toggleMenu()", 203 "QPE/TaskBar", "toggleMenu()",
201 "QPE/TaskBar", "toggleStartMenu()" }, 204 "QPE/TaskBar", "toggleStartMenu()" },
202 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 205 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
203 "devicebuttons/z_mail", 206 "devicebuttons/z_mail",
204 "mail", "raise()", 207 "mail", "raise()",
205 "mail", "newMail()" }, 208 "mail", "newMail()" },
206}; 209};
207 210
211struct z_button z_buttons_c700 [] = {
212 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
213 "devicebuttons/z_calendar",
214 "datebook", "nextView()",
215 "today", "raise()" },
216 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
217 "devicebuttons/z_contact",
218 "addressbook", "raise()",
219 "addressbook", "beamBusinessCard()" },
220 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
221 "devicebuttons/z_home",
222 "QPE/Launcher", "home()",
223 "buttonsettings", "raise()" },
224 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
225 "devicebuttons/z_menu",
226 "QPE/TaskBar", "toggleMenu()",
227 "QPE/TaskBar", "toggleStartMenu()" },
228 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
229 "",
230 "QPE/Rotation", "flip()",
231 "QPE/Rotation", "flip()" },
232};
233
208static QCString makeChannel ( const char *str ) 234static QCString makeChannel ( const char *str )
209{ 235{
210 if ( str && !::strchr ( str, '/' )) 236 if ( str && !::strchr ( str, '/' ))
211 return QCString ( "QPE/Application/" ) + str; 237 return QCString ( "QPE/Application/" ) + str;
212 else 238 else
213 return str; 239 return str;
214} 240}
215 241
216 242
217 243
218 244
219ODevice *ODevice::inst ( ) 245ODevice *ODevice::inst ( )
220{ 246{
221 static ODevice *dev = 0; 247 static ODevice *dev = 0;
222 248
223 if ( !dev ) { 249 if ( !dev ) {
224 if ( QFile::exists ( "/proc/hal/model" )) 250 if ( QFile::exists ( "/proc/hal/model" ))
225 dev = new iPAQ ( ); 251 dev = new iPAQ ( );
226 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 252 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
227 dev = new Zaurus ( ); 253 dev = new Zaurus ( );
228 else 254 else
229 dev = new ODevice ( ); 255 dev = new ODevice ( );
230 256
231 dev-> init ( ); 257 dev-> init ( );
232 } 258 }
233 return dev; 259 return dev;
234} 260}
235 261
236 262
237/************************************************** 263/**************************************************
238 * 264 *
239 * common 265 * common
240 * 266 *
241 **************************************************/ 267 **************************************************/
242 268
243 269
244ODevice::ODevice ( ) 270ODevice::ODevice ( )
245{ 271{
246 d = new ODeviceData; 272 d = new ODeviceData;
247 273
248 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 274 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
249 275
250 d-> m_modelstr = "Unknown"; 276 d-> m_modelstr = "Unknown";
251 d-> m_model = Model_Unknown; 277 d-> m_model = Model_Unknown;
252 d-> m_vendorstr = "Unknown"; 278 d-> m_vendorstr = "Unknown";
253 d-> m_vendor = Vendor_Unknown; 279 d-> m_vendor = Vendor_Unknown;
254 d-> m_systemstr = "Unknown"; 280 d-> m_systemstr = "Unknown";
255 d-> m_system = System_Unknown; 281 d-> m_system = System_Unknown;
@@ -1096,137 +1122,150 @@ void Zaurus::init ( )
1096{ 1122{
1097 d-> m_vendorstr = "Sharp"; 1123 d-> m_vendorstr = "Sharp";
1098 d-> m_vendor = Vendor_Sharp; 1124 d-> m_vendor = Vendor_Sharp;
1099 1125
1100 QFile f ( "/proc/filesystems" ); 1126 QFile f ( "/proc/filesystems" );
1101 1127
1102 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 1128 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
1103 d-> m_vendorstr = "OpenZaurus Team"; 1129 d-> m_vendorstr = "OpenZaurus Team";
1104 d-> m_systemstr = "OpenZaurus"; 1130 d-> m_systemstr = "OpenZaurus";
1105 d-> m_system = System_OpenZaurus; 1131 d-> m_system = System_OpenZaurus;
1106 1132
1107 f. close ( ); 1133 f. close ( );
1108 1134
1109 f. setName ( "/etc/oz_version" ); 1135 f. setName ( "/etc/oz_version" );
1110 if ( f. open ( IO_ReadOnly )) { 1136 if ( f. open ( IO_ReadOnly )) {
1111 QTextStream ts ( &f ); 1137 QTextStream ts ( &f );
1112 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 1138 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
1113 f. close ( ); 1139 f. close ( );
1114 } 1140 }
1115 } 1141 }
1116 else { 1142 else {
1117 d-> m_systemstr = "Zaurus"; 1143 d-> m_systemstr = "Zaurus";
1118 d-> m_system = System_Zaurus; 1144 d-> m_system = System_Zaurus;
1119 } 1145 }
1120 1146
1121 f. setName ( "/proc/deviceinfo/product" ); 1147 f. setName ( "/proc/deviceinfo/product" );
1122 if ( f. open ( IO_ReadOnly ) ) { 1148 if ( f. open ( IO_ReadOnly ) ) {
1123 QTextStream ts ( &f ); 1149 QTextStream ts ( &f );
1124 QString model = ts. readLine ( ); 1150 QString model = ts. readLine ( );
1125 f. close ( ); 1151 f. close ( );
1126 1152
1127 d-> m_modelstr = QString("Zaurus ") + model; 1153 d-> m_modelstr = QString("Zaurus ") + model;
1128 if ( model == "SL-5500" ) 1154 if ( model == "SL-5500" )
1129 d-> m_model = Model_Zaurus_SL5500; 1155 d-> m_model = Model_Zaurus_SL5500;
1130 else if ( model == "SL-C700" ) 1156 else if ( model == "SL-C700" )
1131 d-> m_model = Model_Zaurus_SLC700; 1157 d-> m_model = Model_Zaurus_SLC700;
1132 else if ( model == "SL-A300" ) 1158 else if ( model == "SL-A300" )
1133 d-> m_model = Model_Zaurus_SLA300; 1159 d-> m_model = Model_Zaurus_SLA300;
1134 else if ( model == "SL-B600" || model == "SL-5600" ) 1160 else if ( model == "SL-B600" || model == "SL-5600" )
1135 d-> m_model = Model_Zaurus_SLB600; 1161 d-> m_model = Model_Zaurus_SLB600;
1136 else 1162 else
1137 d-> m_model = Model_Zaurus_SL5000; 1163 d-> m_model = Model_Zaurus_SL5000;
1138 } 1164 }
1139 else { 1165 else {
1140 d-> m_model = Model_Zaurus_SL5000; 1166 d-> m_model = Model_Zaurus_SL5000;
1141 d-> m_modelstr = "Zaurus (model unknown)"; 1167 d-> m_modelstr = "Zaurus (model unknown)";
1142 } 1168 }
1143 1169
1170 bool flipstate = false;
1144 switch ( d-> m_model ) { 1171 switch ( d-> m_model ) {
1145 case Model_Zaurus_SLA300: 1172 case Model_Zaurus_SLA300:
1146 d-> m_rotation = Rot0; 1173 d-> m_rotation = Rot0;
1147 break; 1174 break;
1148 case Model_Zaurus_SLC700: 1175 case Model_Zaurus_SLC700:
1149 bool flipstate = false;
1150 // Note: need to 1) set flipstate based on physical screen orientation 1176 // Note: need to 1) set flipstate based on physical screen orientation
1151 // and 2) check to see if the user overrode the rotation direction 1177 // and 2) check to see if the user overrode the rotation direction
1152 // using appearance, and if so, remove that item from the Config to 1178 // using appearance, and if so, remove that item from the Config to
1153 // ensure the rotate applet flips us back to the previous state. 1179 // ensure the rotate applet flips us back to the previous state.
1154 if ( flipstate ) { 1180 if ( flipstate ) {
1155 // 480x640 1181 // 480x640
1156 d-> m_rotation = Rot0; 1182 d-> m_rotation = Rot0;
1157 d-> m_direction = CW; 1183 d-> m_direction = CW;
1158 } else { 1184 } else {
1159 // 640x480 1185 // 640x480
1160 d-> m_rotation = Rot270; 1186 d-> m_rotation = Rot270;
1161 d-> m_direction = CCW; 1187 d-> m_direction = CCW;
1162 } 1188 }
1163 break; 1189 break;
1164 case Model_Zaurus_SLB600: 1190 case Model_Zaurus_SLB600:
1165 case Model_Zaurus_SL5500: 1191 case Model_Zaurus_SL5500:
1166 case Model_Zaurus_SL5000: 1192 case Model_Zaurus_SL5000:
1167 default: 1193 default:
1168 d-> m_rotation = Rot270; 1194 d-> m_rotation = Rot270;
1169 break; 1195 break;
1170 } 1196 }
1171 m_leds [0] = Led_Off; 1197 m_leds [0] = Led_Off;
1172} 1198}
1173 1199
1174void Zaurus::initButtons ( ) 1200void Zaurus::initButtons ( )
1175{ 1201{
1176 if ( d-> m_buttons ) 1202 if ( d-> m_buttons )
1177 return; 1203 return;
1178 1204
1179 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 1205 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
1180 1206
1181 d-> m_buttons = new QValueList <ODeviceButton>; 1207 d-> m_buttons = new QValueList <ODeviceButton>;
1182 1208
1183 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { 1209 struct z_button * pz_buttons;
1184 z_button *zb = z_buttons + i; 1210 int buttoncount;
1211 switch ( d-> m_model ) {
1212 case Model_Zaurus_SLC700:
1213 pz_buttons = z_buttons_c700;
1214 buttoncount = ARRAY_SIZE(z_buttons_c700);
1215 break;
1216 default:
1217 pz_buttons = z_buttons;
1218 buttoncount = ARRAY_SIZE(z_buttons);
1219 break;
1220 }
1221
1222 for ( int i = 0; i < buttoncount; i++ ) {
1223 struct z_button *zb = pz_buttons + i;
1185 ODeviceButton b; 1224 ODeviceButton b;
1186 1225
1187 b. setKeycode ( zb-> code ); 1226 b. setKeycode ( zb-> code );
1188 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1227 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1189 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1228 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1190 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); 1229 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction ));
1191 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); 1230 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction ));
1192 1231
1193 d-> m_buttons-> append ( b ); 1232 d-> m_buttons-> append ( b );
1194 } 1233 }
1195 1234
1196 reloadButtonMapping ( ); 1235 reloadButtonMapping ( );
1197 1236
1198 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1237 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1199 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1238 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1200} 1239}
1201 1240
1202#include <unistd.h> 1241#include <unistd.h>
1203#include <fcntl.h> 1242#include <fcntl.h>
1204#include <sys/ioctl.h> 1243#include <sys/ioctl.h>
1205 1244
1206//#include <asm/sharp_char.h> // including kernel headers is evil ... 1245//#include <asm/sharp_char.h> // including kernel headers is evil ...
1207 1246
1208#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1247#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1209 1248
1210 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1249 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1211#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1250#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1212 1251
1213#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1252#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1214#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1253#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1215#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1254#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1216 1255
1217/* --- for SHARP_BUZZER device --- */ 1256/* --- for SHARP_BUZZER device --- */
1218 1257
1219 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1258 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1220//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1259//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1221 1260
1222#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1261#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1223#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1262#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1224#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1263#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1225#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1264#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1226#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1265#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1227 1266
1228//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1267//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1229//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1268//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1230 1269
1231//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1270//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1232//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1271//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */