-rw-r--r-- | libopie/odevice.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 3edf8e7..fef623a 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1,154 +1,156 @@ | |||
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 | #ifndef QT_NO_SOUND | ||
26 | #include <linux/soundcard.h> | 27 | #include <linux/soundcard.h> |
28 | #endif | ||
27 | #include <math.h> | 29 | #include <math.h> |
28 | 30 | ||
29 | #include <qapplication.h> | 31 | #include <qapplication.h> |
30 | 32 | ||
31 | #include <qfile.h> | 33 | #include <qfile.h> |
32 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
33 | #include <qpe/sound.h> | 35 | #include <qpe/sound.h> |
34 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
36 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
37 | 39 | ||
38 | #include "odevice.h" | 40 | #include "odevice.h" |
39 | 41 | ||
40 | #include <qwindowsystem_qws.h> | 42 | #include <qwindowsystem_qws.h> |
41 | 43 | ||
42 | #ifndef ARRAY_SIZE | 44 | #ifndef ARRAY_SIZE |
43 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 45 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
44 | #endif | 46 | #endif |
45 | 47 | ||
46 | // _IO and friends are only defined in kernel headers ... | 48 | // _IO and friends are only defined in kernel headers ... |
47 | 49 | ||
48 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 50 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
49 | 51 | ||
50 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 52 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
51 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 53 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
52 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 54 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
53 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 55 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
54 | 56 | ||
55 | using namespace Opie; | 57 | using namespace Opie; |
56 | 58 | ||
57 | class ODeviceData { | 59 | class ODeviceData { |
58 | public: | 60 | public: |
59 | QString m_vendorstr; | 61 | QString m_vendorstr; |
60 | OVendor m_vendor; | 62 | OVendor m_vendor; |
61 | 63 | ||
62 | QString m_modelstr; | 64 | QString m_modelstr; |
63 | OModel m_model; | 65 | OModel m_model; |
64 | 66 | ||
65 | QString m_systemstr; | 67 | QString m_systemstr; |
66 | OSystem m_system; | 68 | OSystem m_system; |
67 | 69 | ||
68 | QString m_sysverstr; | 70 | QString m_sysverstr; |
69 | 71 | ||
70 | Transformation m_rotation; | 72 | Transformation m_rotation; |
71 | ODirection m_direction; | 73 | ODirection m_direction; |
72 | 74 | ||
73 | QValueList <ODeviceButton> *m_buttons; | 75 | QValueList <ODeviceButton> *m_buttons; |
74 | uint m_holdtime; | 76 | uint m_holdtime; |
75 | QStrList *m_cpu_frequencies; | 77 | QStrList *m_cpu_frequencies; |
76 | }; | 78 | }; |
77 | 79 | ||
78 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { | 80 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { |
79 | protected: | 81 | protected: |
80 | virtual void init ( ); | 82 | virtual void init ( ); |
81 | virtual void initButtons ( ); | 83 | virtual void initButtons ( ); |
82 | 84 | ||
83 | public: | 85 | public: |
84 | virtual bool setSoftSuspend ( bool soft ); | 86 | virtual bool setSoftSuspend ( bool soft ); |
85 | 87 | ||
86 | virtual bool setDisplayBrightness ( int b ); | 88 | virtual bool setDisplayBrightness ( int b ); |
87 | virtual int displayBrightnessResolution ( ) const; | 89 | virtual int displayBrightnessResolution ( ) const; |
88 | 90 | ||
89 | virtual void alarmSound ( ); | 91 | virtual void alarmSound ( ); |
90 | 92 | ||
91 | virtual QValueList <OLed> ledList ( ) const; | 93 | virtual QValueList <OLed> ledList ( ) const; |
92 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 94 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
93 | virtual OLedState ledState ( OLed led ) const; | 95 | virtual OLedState ledState ( OLed led ) const; |
94 | virtual bool setLedState ( OLed led, OLedState st ); | 96 | virtual bool setLedState ( OLed led, OLedState st ); |
95 | 97 | ||
96 | virtual bool hasLightSensor ( ) const; | 98 | virtual bool hasLightSensor ( ) const; |
97 | virtual int readLightSensor ( ); | 99 | virtual int readLightSensor ( ); |
98 | virtual int lightSensorResolution ( ) const; | 100 | virtual int lightSensorResolution ( ) const; |
99 | 101 | ||
100 | protected: | 102 | protected: |
101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 103 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
102 | virtual void timerEvent ( QTimerEvent *te ); | 104 | virtual void timerEvent ( QTimerEvent *te ); |
103 | 105 | ||
104 | int m_power_timer; | 106 | int m_power_timer; |
105 | 107 | ||
106 | OLedState m_leds [2]; | 108 | OLedState m_leds [2]; |
107 | }; | 109 | }; |
108 | 110 | ||
109 | class Jornada : public ODevice { | 111 | class Jornada : public ODevice { |
110 | protected: | 112 | protected: |
111 | virtual void init ( ); | 113 | virtual void init ( ); |
112 | //virtual void initButtons ( ); | 114 | //virtual void initButtons ( ); |
113 | public: | 115 | public: |
114 | virtual bool setSoftSuspend ( bool soft ); | 116 | virtual bool setSoftSuspend ( bool soft ); |
115 | virtual bool setDisplayBrightness ( int b ); | 117 | virtual bool setDisplayBrightness ( int b ); |
116 | virtual int displayBrightnessResolution ( ) const; | 118 | virtual int displayBrightnessResolution ( ) const; |
117 | static bool isJornada(); | 119 | static bool isJornada(); |
118 | 120 | ||
119 | }; | 121 | }; |
120 | 122 | ||
121 | class Zaurus : public ODevice { | 123 | class Zaurus : public ODevice { |
122 | protected: | 124 | protected: |
123 | virtual void init ( ); | 125 | virtual void init ( ); |
124 | virtual void initButtons ( ); | 126 | virtual void initButtons ( ); |
125 | 127 | ||
126 | public: | 128 | public: |
127 | virtual bool setSoftSuspend ( bool soft ); | 129 | virtual bool setSoftSuspend ( bool soft ); |
128 | 130 | ||
129 | virtual bool setDisplayBrightness ( int b ); | 131 | virtual bool setDisplayBrightness ( int b ); |
130 | virtual int displayBrightnessResolution ( ) const; | 132 | virtual int displayBrightnessResolution ( ) const; |
131 | 133 | ||
132 | virtual void alarmSound ( ); | 134 | virtual void alarmSound ( ); |
133 | virtual void keySound ( ); | 135 | virtual void keySound ( ); |
134 | virtual void touchSound ( ); | 136 | virtual void touchSound ( ); |
135 | 137 | ||
136 | virtual QValueList <OLed> ledList ( ) const; | 138 | virtual QValueList <OLed> ledList ( ) const; |
137 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 139 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
138 | virtual OLedState ledState ( OLed led ) const; | 140 | virtual OLedState ledState ( OLed led ) const; |
139 | virtual bool setLedState ( OLed led, OLedState st ); | 141 | virtual bool setLedState ( OLed led, OLedState st ); |
140 | 142 | ||
141 | static bool isZaurus(); | 143 | static bool isZaurus(); |
142 | 144 | ||
143 | protected: | 145 | protected: |
144 | virtual void buzzer ( int snd ); | 146 | virtual void buzzer ( int snd ); |
145 | 147 | ||
146 | OLedState m_leds [1]; | 148 | OLedState m_leds [1]; |
147 | bool m_embedix; | 149 | bool m_embedix; |
148 | }; | 150 | }; |
149 | 151 | ||
150 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { | 152 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { |
151 | protected: | 153 | protected: |
152 | virtual void init ( ); | 154 | virtual void init ( ); |
153 | virtual void initButtons ( ); | 155 | virtual void initButtons ( ); |
154 | 156 | ||