summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp12
-rw-r--r--libopie/odevice.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9f64fc0..4c49c4f 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -65,48 +65,49 @@ public:
65 65
66 QString m_sysverstr; 66 QString m_sysverstr;
67}; 67};
68 68
69 69
70class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter { 70class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter {
71protected: 71protected:
72 virtual void init ( ); 72 virtual void init ( );
73 73
74public: 74public:
75 virtual bool setSoftSuspend ( bool soft ); 75 virtual bool setSoftSuspend ( bool soft );
76 76
77 virtual bool setDisplayBrightness ( int b ); 77 virtual bool setDisplayBrightness ( int b );
78 virtual int displayBrightnessResolution ( ) const; 78 virtual int displayBrightnessResolution ( ) const;
79 79
80 virtual void alarmSound ( ); 80 virtual void alarmSound ( );
81 81
82 virtual QValueList <OLed> ledList ( ) const; 82 virtual QValueList <OLed> ledList ( ) const;
83 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 83 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
84 virtual OLedState ledState ( OLed led ) const; 84 virtual OLedState ledState ( OLed led ) const;
85 virtual bool setLedState ( OLed led, OLedState st ); 85 virtual bool setLedState ( OLed led, OLedState st );
86 86
87 virtual bool hasLightSensor ( ) const; 87 virtual bool hasLightSensor ( ) const;
88 virtual int readLightSensor ( ); 88 virtual int readLightSensor ( );
89 virtual int lightSensorResolution ( ) const;
89 90
90 //virtual QValueList <int> keyList ( ) const; 91 //virtual QValueList <int> keyList ( ) const;
91 92
92protected: 93protected:
93 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 94 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
94 virtual void timerEvent ( QTimerEvent *te ); 95 virtual void timerEvent ( QTimerEvent *te );
95 96
96 int m_power_timer; 97 int m_power_timer;
97 98
98 OLedState m_leds [2]; 99 OLedState m_leds [2];
99}; 100};
100 101
101class Zaurus : public ODevice { 102class Zaurus : public ODevice {
102protected: 103protected:
103 virtual void init ( ); 104 virtual void init ( );
104 105
105 public: 106 public:
106 virtual bool setSoftSuspend ( bool soft ); 107 virtual bool setSoftSuspend ( bool soft );
107 108
108 virtual bool setDisplayBrightness ( int b ); 109 virtual bool setDisplayBrightness ( int b );
109 virtual int displayBrightnessResolution ( ) const; 110 virtual int displayBrightnessResolution ( ) const;
110 111
111 virtual void alarmSound ( ); 112 virtual void alarmSound ( );
112 virtual void keySound ( ); 113 virtual void keySound ( );
@@ -348,48 +349,52 @@ QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
348{ 349{
349 return QValueList <OLedState> ( ); 350 return QValueList <OLedState> ( );
350} 351}
351 352
352OLedState ODevice::ledState ( OLed /*which*/ ) const 353OLedState ODevice::ledState ( OLed /*which*/ ) const
353{ 354{
354 return Led_Off; 355 return Led_Off;
355} 356}
356 357
357bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) 358bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ )
358{ 359{
359 return false; 360 return false;
360} 361}
361 362
362bool ODevice::hasLightSensor ( ) const 363bool ODevice::hasLightSensor ( ) const
363{ 364{
364 return false; 365 return false;
365} 366}
366 367
367int ODevice::readLightSensor ( ) 368int ODevice::readLightSensor ( )
368{ 369{
369 return -1; 370 return -1;
370} 371}
371 372
373int ODevice::lightSensorResolution ( ) const
374{
375 return 0;
376}
372 377
373//QValueList <int> ODevice::keyList ( ) const 378//QValueList <int> ODevice::keyList ( ) const
374//{ 379//{
375 //return QValueList <int> ( ); 380 //return QValueList <int> ( );
376//} 381//}
377 382
378 383
379 384
380/************************************************** 385/**************************************************
381 * 386 *
382 * iPAQ 387 * iPAQ
383 * 388 *
384 **************************************************/ 389 **************************************************/
385 390
386void iPAQ::init ( ) 391void iPAQ::init ( )
387{ 392{
388 d-> m_vendorstr = "HP"; 393 d-> m_vendorstr = "HP";
389 d-> m_vendor = Vendor_HP; 394 d-> m_vendor = Vendor_HP;
390 395
391 QFile f ( "/proc/hal/model" ); 396 QFile f ( "/proc/hal/model" );
392 397
393 if ( f. open ( IO_ReadOnly )) { 398 if ( f. open ( IO_ReadOnly )) {
394 QTextStream ts ( &f ); 399 QTextStream ts ( &f );
395 400
@@ -661,73 +666,76 @@ bool iPAQ::setDisplayBrightness ( int bright )
661 bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic 666 bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
662 //bright = ( bright + 1 ) / 2; 667 //bright = ( bright + 1 ) / 2;
663 668
664 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 669 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
665 FLITE_IN bl; 670 FLITE_IN bl;
666 bl. mode = 1; 671 bl. mode = 1;
667 bl. pwr = bright ? 1 : 0; 672 bl. pwr = bright ? 1 : 0;
668 bl. brightness = bright; 673 bl. brightness = bright;
669 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 674 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
670 ::close ( fd ); 675 ::close ( fd );
671 } 676 }
672 return res; 677 return res;
673} 678}
674 679
675int iPAQ::displayBrightnessResolution ( ) const 680int iPAQ::displayBrightnessResolution ( ) const
676{ 681{
677 return 256; // really 128, but logarithmic control is smoother this way 682 return 256; // really 128, but logarithmic control is smoother this way
678} 683}
679 684
680 685
681bool iPAQ::hasLightSensor ( ) const 686bool iPAQ::hasLightSensor ( ) const
682{ 687{
683 return true; 688 return true;
684} 689}
685#include <errno.h> 690
686#include <string.h>
687int iPAQ::readLightSensor ( ) 691int iPAQ::readLightSensor ( )
688{ 692{
689 int fd; 693 int fd;
690 int val = -1; 694 int val = -1;
691 695
692 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 696 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
693 char buffer [8]; 697 char buffer [8];
694 698
695 if ( ::read ( fd, buffer, 5 ) == 5 ) { 699 if ( ::read ( fd, buffer, 5 ) == 5 ) {
696 char *endptr; 700 char *endptr;
697 701
698 buffer [4] = 0; 702 buffer [4] = 0;
699 val = ::strtol ( buffer + 2, &endptr, 16 ); 703 val = ::strtol ( buffer + 2, &endptr, 16 );
700 704
701 if ( *endptr != 0 ) 705 if ( *endptr != 0 )
702 val = -1; 706 val = -1;
703 } 707 }
704 ::close ( fd ); 708 ::close ( fd );
705 } 709 }
706 710
707 return val; 711 return val;
708} 712}
709 713
714int iPAQ::lightSensorResolution ( ) const
715{
716 return 256;
717}
710 718
711/************************************************** 719/**************************************************
712 * 720 *
713 * Zaurus 721 * Zaurus
714 * 722 *
715 **************************************************/ 723 **************************************************/
716 724
717 725
718 726
719void Zaurus::init ( ) 727void Zaurus::init ( )
720{ 728{
721 d-> m_modelstr = "Zaurus SL5000"; 729 d-> m_modelstr = "Zaurus SL5000";
722 d-> m_model = Model_Zaurus_SL5000; 730 d-> m_model = Model_Zaurus_SL5000;
723 d-> m_vendorstr = "Sharp"; 731 d-> m_vendorstr = "Sharp";
724 d-> m_vendor = Vendor_Sharp; 732 d-> m_vendor = Vendor_Sharp;
725 733
726 QFile f ( "/proc/filesystems" ); 734 QFile f ( "/proc/filesystems" );
727 735
728 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 736 if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
729 d-> m_systemstr = "OpenZaurus"; 737 d-> m_systemstr = "OpenZaurus";
730 d-> m_system = System_OpenZaurus; 738 d-> m_system = System_OpenZaurus;
731 739
732 f. close ( ); 740 f. close ( );
733 741
diff --git a/libopie/odevice.h b/libopie/odevice.h
index be2a9c7..e07b91c 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -114,32 +114,33 @@ public:
114 QString systemVersionString ( ) const; 114 QString systemVersionString ( ) const;
115 115
116 // system 116 // system
117 117
118 virtual bool setSoftSuspend ( bool on ); 118 virtual bool setSoftSuspend ( bool on );
119 virtual bool suspend ( ); 119 virtual bool suspend ( );
120 120
121 virtual bool setDisplayStatus ( bool on ); 121 virtual bool setDisplayStatus ( bool on );
122 virtual bool setDisplayBrightness ( int brightness ); 122 virtual bool setDisplayBrightness ( int brightness );
123 virtual int displayBrightnessResolution ( ) const; 123 virtual int displayBrightnessResolution ( ) const;
124 124
125// input / output 125// input / output
126 126
127 virtual void alarmSound ( ); 127 virtual void alarmSound ( );
128 virtual void keySound ( ); 128 virtual void keySound ( );
129 virtual void touchSound ( ); 129 virtual void touchSound ( );
130 130
131 virtual QValueList <OLed> ledList ( ) const; 131 virtual QValueList <OLed> ledList ( ) const;
132 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 132 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
133 virtual OLedState ledState ( OLed led ) const; 133 virtual OLedState ledState ( OLed led ) const;
134 virtual bool setLedState ( OLed led, OLedState st ); 134 virtual bool setLedState ( OLed led, OLedState st );
135 135
136 virtual bool hasLightSensor ( ) const; 136 virtual bool hasLightSensor ( ) const;
137 virtual int readLightSensor ( ); 137 virtual int readLightSensor ( );
138 virtual int lightSensorResolution ( ) const;
138 139
139 //virtual QValueList <int> keyList ( ) const; 140 //virtual QValueList <int> keyList ( ) const;
140}; 141};
141 142
142} 143}
143 144
144#endif 145#endif
145 146