summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index d5e3c5c..80975c9 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -215,129 +215,129 @@ static QCString makeChannel ( const char *str )
215 215
216ODevice *ODevice::inst ( ) 216ODevice *ODevice::inst ( )
217{ 217{
218 static ODevice *dev = 0; 218 static ODevice *dev = 0;
219 219
220 if ( !dev ) { 220 if ( !dev ) {
221 if ( QFile::exists ( "/proc/hal/model" )) 221 if ( QFile::exists ( "/proc/hal/model" ))
222 dev = new iPAQ ( ); 222 dev = new iPAQ ( );
223 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 223 else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
224 dev = new Zaurus ( ); 224 dev = new Zaurus ( );
225 else 225 else
226 dev = new ODevice ( ); 226 dev = new ODevice ( );
227 227
228 dev-> init ( ); 228 dev-> init ( );
229 } 229 }
230 return dev; 230 return dev;
231} 231}
232 232
233 233
234/************************************************** 234/**************************************************
235 * 235 *
236 * common 236 * common
237 * 237 *
238 **************************************************/ 238 **************************************************/
239 239
240 240
241ODevice::ODevice ( ) 241ODevice::ODevice ( )
242{ 242{
243 d = new ODeviceData; 243 d = new ODeviceData;
244 244
245 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 245 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
246 246
247 d-> m_modelstr = "Unknown"; 247 d-> m_modelstr = "Unknown";
248 d-> m_model = Model_Unknown; 248 d-> m_model = Model_Unknown;
249 d-> m_vendorstr = "Unknown"; 249 d-> m_vendorstr = "Unknown";
250 d-> m_vendor = Vendor_Unknown; 250 d-> m_vendor = Vendor_Unknown;
251 d-> m_systemstr = "Unknown"; 251 d-> m_systemstr = "Unknown";
252 d-> m_system = System_Unknown; 252 d-> m_system = System_Unknown;
253 d-> m_sysverstr = "0.0"; 253 d-> m_sysverstr = "0.0";
254 d-> m_rotation = Rot0; 254 d-> m_rotation = Rot0;
255 255
256 d-> m_holdtime = 1000; // 1000ms 256 d-> m_holdtime = 1000; // 1000ms
257 257
258 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 258 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
259 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 259 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
260} 260}
261 261
262void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 262void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
263{ 263{
264 if ( msg == "deviceButtonMappingChanged()" ) { 264 if ( msg == "deviceButtonMappingChanged()" ) {
265 reloadButtonMapping ( ); 265 reloadButtonMapping ( );
266 } 266 }
267} 267}
268 268
269void ODevice::init ( ) 269void ODevice::init ( )
270{ 270{
271 // Simulation uses iPAQ 3660 device buttons 271 // Simulation uses iPAQ 3660 device buttons
272 272
273 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 273 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
274 i_button *ib = ipaq_buttons + i; 274 i_button *ib = ipaq_buttons + i;
275 ODeviceButton b; 275 ODeviceButton b;
276 276
277 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 277 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
278 b. setKeycode ( ib-> code ); 278 b. setKeycode ( ib-> code );
279 b. setUserText ( qApp-> translate ( "Button", ib-> utext )); 279 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
280 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 280 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
281 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 281 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
282 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 282 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
283 d-> m_buttons. append ( b ); 283 d-> m_buttons. append ( b );
284 } 284 }
285 } 285 }
286 reloadButtonMapping ( ); 286 reloadButtonMapping ( );
287} 287}
288 288
289ODevice::~ODevice ( ) 289ODevice::~ODevice ( )
290{ 290{
291 delete d; 291 delete d;
292} 292}
293 293
294bool ODevice::setSoftSuspend ( bool /*soft*/ ) 294bool ODevice::setSoftSuspend ( bool /*soft*/ )
295{ 295{
296 return false; 296 return false;
297} 297}
298 298
299//#include <linux/apm_bios.h> 299//#include <linux/apm_bios.h>
300 300
301#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 301#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
302 302
303 303
304bool ODevice::suspend ( ) 304bool ODevice::suspend ( )
305{ 305{
306 if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend 306 if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend
307 return false; 307 return false;
308 308
309 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 309 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
310 return false; 310 return false;
311 311
312 bool res = false; 312 bool res = false;
313 313
314 struct timeval tvs, tvn; 314 struct timeval tvs, tvn;
315 ::gettimeofday ( &tvs, 0 ); 315 ::gettimeofday ( &tvs, 0 );
316 316
317 ::sync ( ); // flush fs caches 317 ::sync ( ); // flush fs caches
318 res = ( ::system ( "apm --suspend" ) == 0 ); 318 res = ( ::system ( "apm --suspend" ) == 0 );
319 319
320 // This is needed because the iPAQ apm implementation is asynchronous and we 320 // This is needed because the iPAQ apm implementation is asynchronous and we
321 // can not be sure when exactly the device is really suspended 321 // can not be sure when exactly the device is really suspended
322 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 322 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
323 323
324 if ( res ) { 324 if ( res ) {
325 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 325 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
326 ::usleep ( 200 * 1000 ); 326 ::usleep ( 200 * 1000 );
327 ::gettimeofday ( &tvn, 0 ); 327 ::gettimeofday ( &tvn, 0 );
328 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 328 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
329 } 329 }
330 330
331 return res; 331 return res;
332} 332}
333 333
334//#include <linux/fb.h> better not rely on kernel headers in userspace ... 334//#include <linux/fb.h> better not rely on kernel headers in userspace ...
335 335
336#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 336#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
337 337
338/* VESA Blanking Levels */ 338/* VESA Blanking Levels */
339#define VESA_NO_BLANKING 0 339#define VESA_NO_BLANKING 0
340#define VESA_VSYNC_SUSPEND 1 340#define VESA_VSYNC_SUSPEND 1
341#define VESA_HSYNC_SUSPEND 2 341#define VESA_HSYNC_SUSPEND 2
342#define VESA_POWERDOWN 3 342#define VESA_POWERDOWN 3
343 343
@@ -573,129 +573,129 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
573 **************************************************/ 573 **************************************************/
574 574
575void iPAQ::init ( ) 575void iPAQ::init ( )
576{ 576{
577 d-> m_vendorstr = "HP"; 577 d-> m_vendorstr = "HP";
578 d-> m_vendor = Vendor_HP; 578 d-> m_vendor = Vendor_HP;
579 579
580 QFile f ( "/proc/hal/model" ); 580 QFile f ( "/proc/hal/model" );
581 581
582 if ( f. open ( IO_ReadOnly )) { 582 if ( f. open ( IO_ReadOnly )) {
583 QTextStream ts ( &f ); 583 QTextStream ts ( &f );
584 584
585 d-> m_modelstr = "H" + ts. readLine ( ); 585 d-> m_modelstr = "H" + ts. readLine ( );
586 586
587 if ( d-> m_modelstr == "H3100" ) 587 if ( d-> m_modelstr == "H3100" )
588 d-> m_model = Model_iPAQ_H31xx; 588 d-> m_model = Model_iPAQ_H31xx;
589 else if ( d-> m_modelstr == "H3600" ) 589 else if ( d-> m_modelstr == "H3600" )
590 d-> m_model = Model_iPAQ_H36xx; 590 d-> m_model = Model_iPAQ_H36xx;
591 else if ( d-> m_modelstr == "H3700" ) 591 else if ( d-> m_modelstr == "H3700" )
592 d-> m_model = Model_iPAQ_H37xx; 592 d-> m_model = Model_iPAQ_H37xx;
593 else if ( d-> m_modelstr == "H3800" ) 593 else if ( d-> m_modelstr == "H3800" )
594 d-> m_model = Model_iPAQ_H38xx; 594 d-> m_model = Model_iPAQ_H38xx;
595 else if ( d-> m_modelstr == "H3900" ) 595 else if ( d-> m_modelstr == "H3900" )
596 d-> m_model = Model_iPAQ_H39xx; 596 d-> m_model = Model_iPAQ_H39xx;
597 else 597 else
598 d-> m_model = Model_Unknown; 598 d-> m_model = Model_Unknown;
599 599
600 f. close ( ); 600 f. close ( );
601 } 601 }
602 602
603 switch ( d-> m_model ) { 603 switch ( d-> m_model ) {
604 case Model_iPAQ_H31xx: 604 case Model_iPAQ_H31xx:
605 case Model_iPAQ_H38xx: 605 case Model_iPAQ_H38xx:
606 d-> m_rotation = Rot90; 606 d-> m_rotation = Rot90;
607 break; 607 break;
608 case Model_iPAQ_H36xx: 608 case Model_iPAQ_H36xx:
609 case Model_iPAQ_H37xx: 609 case Model_iPAQ_H37xx:
610 case Model_iPAQ_H39xx: 610 case Model_iPAQ_H39xx:
611 default: 611 default:
612 d-> m_rotation = Rot270; 612 d-> m_rotation = Rot270;
613 break; 613 break;
614 } 614 }
615 615
616 f. setName ( "/etc/familiar-version" ); 616 f. setName ( "/etc/familiar-version" );
617 if ( f. open ( IO_ReadOnly )) { 617 if ( f. open ( IO_ReadOnly )) {
618 d-> m_systemstr = "Familiar"; 618 d-> m_systemstr = "Familiar";
619 d-> m_system = System_Familiar; 619 d-> m_system = System_Familiar;
620 620
621 QTextStream ts ( &f ); 621 QTextStream ts ( &f );
622 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 622 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
623 623
624 f. close ( ); 624 f. close ( );
625 } 625 }
626 626
627 m_leds [0] = m_leds [1] = Led_Off; 627 m_leds [0] = m_leds [1] = Led_Off;
628 628
629 m_power_timer = 0; 629 m_power_timer = 0;
630 630
631 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 631 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
632 i_button *ib = ipaq_buttons + i; 632 i_button *ib = ipaq_buttons + i;
633 ODeviceButton b; 633 ODeviceButton b;
634 634
635 if (( ib-> model & d-> m_model ) == d-> m_model ) { 635 if (( ib-> model & d-> m_model ) == d-> m_model ) {
636 b. setKeycode ( ib-> code ); 636 b. setKeycode ( ib-> code );
637 b. setUserText ( qApp-> translate ( "Button", ib-> utext )); 637 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
638 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 638 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
639 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 639 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
640 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 640 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
641 641
642 d-> m_buttons. append ( b ); 642 d-> m_buttons. append ( b );
643 } 643 }
644 } 644 }
645 reloadButtonMapping ( ); 645 reloadButtonMapping ( );
646 646
647 if ( d-> m_qwsserver ) 647 if ( d-> m_qwsserver )
648 QWSServer::setKeyboardFilter ( this ); 648 QWSServer::setKeyboardFilter ( this );
649} 649}
650 650
651//#include <linux/h3600_ts.h> // including kernel headers is evil ... 651//#include <linux/h3600_ts.h> // including kernel headers is evil ...
652 652
653typedef struct { 653typedef struct {
654 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 654 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
655 unsigned char TotalTime; /* Units of 5 seconds */ 655 unsigned char TotalTime; /* Units of 5 seconds */
656 unsigned char OnTime; /* units of 100m/s */ 656 unsigned char OnTime; /* units of 100m/s */
657 unsigned char OffTime; /* units of 100m/s */ 657 unsigned char OffTime; /* units of 100m/s */
658} LED_IN; 658} LED_IN;
659 659
660typedef struct { 660typedef struct {
661 unsigned char mode; 661 unsigned char mode;
662 unsigned char pwr; 662 unsigned char pwr;
663 unsigned char brightness; 663 unsigned char brightness;
664} FLITE_IN; 664} FLITE_IN;
665 665
666#define LED_ON OD_IOW( 'f', 5, LED_IN ) 666#define LED_ON OD_IOW( 'f', 5, LED_IN )
667#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 667#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
668 668
669 669
670QValueList <OLed> iPAQ::ledList ( ) const 670QValueList <OLed> iPAQ::ledList ( ) const
671{ 671{
672 QValueList <OLed> vl; 672 QValueList <OLed> vl;
673 vl << Led_Power; 673 vl << Led_Power;
674 674
675 if ( d-> m_model == Model_iPAQ_H38xx ) 675 if ( d-> m_model == Model_iPAQ_H38xx )
676 vl << Led_BlueTooth; 676 vl << Led_BlueTooth;
677 return vl; 677 return vl;
678} 678}
679 679
680QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 680QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
681{ 681{
682 QValueList <OLedState> vl; 682 QValueList <OLedState> vl;
683 683
684 if ( l == Led_Power ) 684 if ( l == Led_Power )
685 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 685 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
686 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) 686 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx )
687 vl << Led_Off; // << Led_On << ??? 687 vl << Led_Off; // << Led_On << ???
688 688
689 return vl; 689 return vl;
690} 690}
691 691
692OLedState iPAQ::ledState ( OLed l ) const 692OLedState iPAQ::ledState ( OLed l ) const
693 { 693 {
694 switch ( l ) { 694 switch ( l ) {
695 case Led_Power: 695 case Led_Power:
696 return m_leds [0]; 696 return m_leds [0];
697 case Led_BlueTooth: 697 case Led_BlueTooth:
698 return m_leds [1]; 698 return m_leds [1];
699 default: 699 default:
700 return Led_Off; 700 return Led_Off;
701 } 701 }
@@ -938,129 +938,129 @@ void Zaurus::init ( )
938 938
939 QFile f ( "/proc/filesystems" ); 939 QFile f ( "/proc/filesystems" );
940 940
941 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 941 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
942 d-> m_vendorstr = "OpenZaurus Team"; 942 d-> m_vendorstr = "OpenZaurus Team";
943 d-> m_systemstr = "OpenZaurus"; 943 d-> m_systemstr = "OpenZaurus";
944 d-> m_system = System_OpenZaurus; 944 d-> m_system = System_OpenZaurus;
945 945
946 f. close ( ); 946 f. close ( );
947 947
948 f. setName ( "/etc/oz_version" ); 948 f. setName ( "/etc/oz_version" );
949 if ( f. open ( IO_ReadOnly )) { 949 if ( f. open ( IO_ReadOnly )) {
950 QTextStream ts ( &f ); 950 QTextStream ts ( &f );
951 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 951 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
952 f. close ( ); 952 f. close ( );
953 } 953 }
954 } 954 }
955 else { 955 else {
956 d-> m_systemstr = "Zaurus"; 956 d-> m_systemstr = "Zaurus";
957 d-> m_system = System_Zaurus; 957 d-> m_system = System_Zaurus;
958 } 958 }
959 959
960 f. setName ( "/proc/deviceinfo/product" ); 960 f. setName ( "/proc/deviceinfo/product" );
961 if ( f. open ( IO_ReadOnly ) ) { 961 if ( f. open ( IO_ReadOnly ) ) {
962 QTextStream ts ( &f ); 962 QTextStream ts ( &f );
963 QString model = ts. readLine ( ); 963 QString model = ts. readLine ( );
964 f. close ( ); 964 f. close ( );
965 965
966 d-> m_modelstr = QString("Zaurus ") + model; 966 d-> m_modelstr = QString("Zaurus ") + model;
967 if ( model == "SL-5500" ) 967 if ( model == "SL-5500" )
968 d-> m_model = Model_Zaurus_SL5500; 968 d-> m_model = Model_Zaurus_SL5500;
969 else if ( model == "SL-C700" ) 969 else if ( model == "SL-C700" )
970 d-> m_model = Model_Zaurus_SLC700; 970 d-> m_model = Model_Zaurus_SLC700;
971 else if ( model == "SL-A300" ) 971 else if ( model == "SL-A300" )
972 d-> m_model = Model_Zaurus_SLA300; 972 d-> m_model = Model_Zaurus_SLA300;
973 else if ( model == "SL-B600" || model == "SL-5600" ) 973 else if ( model == "SL-B600" || model == "SL-5600" )
974 d-> m_model = Model_Zaurus_SLB600; 974 d-> m_model = Model_Zaurus_SLB600;
975 else 975 else
976 d-> m_model = Model_Zaurus_SL5000; 976 d-> m_model = Model_Zaurus_SL5000;
977 } 977 }
978 else { 978 else {
979 d-> m_model = Model_Zaurus_SL5000; 979 d-> m_model = Model_Zaurus_SL5000;
980 d-> m_modelstr = "Zaurus (model unknown)"; 980 d-> m_modelstr = "Zaurus (model unknown)";
981 } 981 }
982 982
983 switch ( d-> m_model ) { 983 switch ( d-> m_model ) {
984 case Model_Zaurus_SLC700: 984 case Model_Zaurus_SLC700:
985 /* note for C700, we must check the display rotation 985 /* note for C700, we must check the display rotation
986 * sensor to set an appropriate value 986 * sensor to set an appropriate value
987 */ 987 */
988 case Model_Zaurus_SLA300: 988 case Model_Zaurus_SLA300:
989 case Model_Zaurus_SLB600: 989 case Model_Zaurus_SLB600:
990 case Model_Zaurus_SL5500: 990 case Model_Zaurus_SL5500:
991 case Model_Zaurus_SL5000: 991 case Model_Zaurus_SL5000:
992 default: 992 default:
993 d-> m_rotation = Rot270; 993 d-> m_rotation = Rot270;
994 break; 994 break;
995 } 995 }
996 996
997 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { 997 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) {
998 z_button *zb = z_buttons + i; 998 z_button *zb = z_buttons + i;
999 ODeviceButton b; 999 ODeviceButton b;
1000 1000
1001 b. setKeycode ( zb-> code ); 1001 b. setKeycode ( zb-> code );
1002 b. setUserText ( qApp-> translate ( "Button", zb-> utext )); 1002 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1003 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1003 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1004 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); 1004 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction ));
1005 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); 1005 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction ));
1006 1006
1007 d-> m_buttons. append ( b ); 1007 d-> m_buttons. append ( b );
1008 } 1008 }
1009 reloadButtonMapping ( ); 1009 reloadButtonMapping ( );
1010 1010
1011 m_leds [0] = Led_Off; 1011 m_leds [0] = Led_Off;
1012} 1012}
1013 1013
1014#include <unistd.h> 1014#include <unistd.h>
1015#include <fcntl.h> 1015#include <fcntl.h>
1016#include <sys/ioctl.h> 1016#include <sys/ioctl.h>
1017 1017
1018//#include <asm/sharp_char.h> // including kernel headers is evil ... 1018//#include <asm/sharp_char.h> // including kernel headers is evil ...
1019 1019
1020#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1020#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1021 1021
1022 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1022 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1023#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1023#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1024 1024
1025#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1025#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1026#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1026#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1027#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1027#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1028 1028
1029/* --- for SHARP_BUZZER device --- */ 1029/* --- for SHARP_BUZZER device --- */
1030 1030
1031 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1031 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1032//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1032//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1033 1033
1034#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1034#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1035#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1035#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1036#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1036#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1037#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1037#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1038#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1038#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1039 1039
1040//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1040//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1041//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1041//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1042 1042
1043//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1043//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1044//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1044//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1045//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1045//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1046//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1046//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1047//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1047//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1048//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1048//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1049//#define SHARP_PDA_APPSTART 9 /* application start */ 1049//#define SHARP_PDA_APPSTART 9 /* application start */
1050//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1050//#define SHARP_PDA_APPQUIT 10 /* application ends */
1051 1051
1052//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1052//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1053//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1053//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1054//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1054//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1055//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1055//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1056// 1056//
1057 1057
1058 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1058 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1059#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1059#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
1060 1060
1061typedef struct sharp_led_status { 1061typedef struct sharp_led_status {
1062 int which; /* select which LED status is wanted. */ 1062 int which; /* select which LED status is wanted. */
1063 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 1063 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
1064} sharp_led_status; 1064} sharp_led_status;
1065 1065
1066#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 1066#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */