author | chicken <chicken> | 2003-11-02 20:12:26 (UTC) |
---|---|---|
committer | chicken <chicken> | 2003-11-02 20:12:26 (UTC) |
commit | 559f4034cd483845b107aa7180f56e701c1444e6 (patch) (unidiff) | |
tree | ce5ed970a0cb49429b39d72173953adb24280a4e | |
parent | 1b73bc0cb5c1d6fe7363d7bf30d8ca1a467e3e8d (diff) | |
download | opie-559f4034cd483845b107aa7180f56e701c1444e6.zip opie-559f4034cd483845b107aa7180f56e701c1444e6.tar.gz opie-559f4034cd483845b107aa7180f56e701c1444e6.tar.bz2 |
add iPAQ H5xxx support
-rw-r--r-- | libopie/odevice.cpp | 27 | ||||
-rw-r--r-- | libopie/odevice.h | 1 |
2 files changed, 18 insertions, 10 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 13b4330..3edf8e7 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -64,97 +64,97 @@ public: | |||
64 | 64 | ||
65 | QString m_systemstr; | 65 | QString m_systemstr; |
66 | OSystem m_system; | 66 | OSystem m_system; |
67 | 67 | ||
68 | QString m_sysverstr; | 68 | QString m_sysverstr; |
69 | 69 | ||
70 | Transformation m_rotation; | 70 | Transformation m_rotation; |
71 | ODirection m_direction; | 71 | ODirection m_direction; |
72 | 72 | ||
73 | QValueList <ODeviceButton> *m_buttons; | 73 | QValueList <ODeviceButton> *m_buttons; |
74 | uint m_holdtime; | 74 | uint m_holdtime; |
75 | QStrList *m_cpu_frequencies; | 75 | QStrList *m_cpu_frequencies; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { | 78 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter { |
79 | protected: | 79 | protected: |
80 | virtual void init ( ); | 80 | virtual void init ( ); |
81 | virtual void initButtons ( ); | 81 | virtual void initButtons ( ); |
82 | 82 | ||
83 | public: | 83 | public: |
84 | virtual bool setSoftSuspend ( bool soft ); | 84 | virtual bool setSoftSuspend ( bool soft ); |
85 | 85 | ||
86 | virtual bool setDisplayBrightness ( int b ); | 86 | virtual bool setDisplayBrightness ( int b ); |
87 | virtual int displayBrightnessResolution ( ) const; | 87 | virtual int displayBrightnessResolution ( ) const; |
88 | 88 | ||
89 | virtual void alarmSound ( ); | 89 | virtual void alarmSound ( ); |
90 | 90 | ||
91 | virtual QValueList <OLed> ledList ( ) const; | 91 | virtual QValueList <OLed> ledList ( ) const; |
92 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 92 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
93 | virtual OLedState ledState ( OLed led ) const; | 93 | virtual OLedState ledState ( OLed led ) const; |
94 | virtual bool setLedState ( OLed led, OLedState st ); | 94 | virtual bool setLedState ( OLed led, OLedState st ); |
95 | 95 | ||
96 | virtual bool hasLightSensor ( ) const; | 96 | virtual bool hasLightSensor ( ) const; |
97 | virtual int readLightSensor ( ); | 97 | virtual int readLightSensor ( ); |
98 | virtual int lightSensorResolution ( ) const; | 98 | virtual int lightSensorResolution ( ) const; |
99 | 99 | ||
100 | protected: | 100 | protected: |
101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 101 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
102 | virtual void timerEvent ( QTimerEvent *te ); | 102 | virtual void timerEvent ( QTimerEvent *te ); |
103 | 103 | ||
104 | int m_power_timer; | 104 | int m_power_timer; |
105 | 105 | ||
106 | OLedState m_leds [2]; | 106 | OLedState m_leds [2]; |
107 | }; | 107 | }; |
108 | 108 | ||
109 | class Jornada : public ODevice { | 109 | class Jornada : public ODevice { |
110 | protected: | 110 | protected: |
111 | virtual void init ( ); | 111 | virtual void init ( ); |
112 | virtual void initButtons ( ); | 112 | //virtual void initButtons ( ); |
113 | public: | 113 | public: |
114 | virtual bool setSoftSuspend ( bool soft ); | 114 | virtual bool setSoftSuspend ( bool soft ); |
115 | virtual bool setDisplayBrightness ( int b ); | 115 | virtual bool setDisplayBrightness ( int b ); |
116 | virtual int displayBrightnessResolution ( ) const; | 116 | virtual int displayBrightnessResolution ( ) const; |
117 | static bool isJornada(); | 117 | static bool isJornada(); |
118 | 118 | ||
119 | }; | 119 | }; |
120 | 120 | ||
121 | class Zaurus : public ODevice { | 121 | class Zaurus : public ODevice { |
122 | protected: | 122 | protected: |
123 | virtual void init ( ); | 123 | virtual void init ( ); |
124 | virtual void initButtons ( ); | 124 | virtual void initButtons ( ); |
125 | 125 | ||
126 | public: | 126 | public: |
127 | virtual bool setSoftSuspend ( bool soft ); | 127 | virtual bool setSoftSuspend ( bool soft ); |
128 | 128 | ||
129 | virtual bool setDisplayBrightness ( int b ); | 129 | virtual bool setDisplayBrightness ( int b ); |
130 | virtual int displayBrightnessResolution ( ) const; | 130 | virtual int displayBrightnessResolution ( ) const; |
131 | 131 | ||
132 | virtual void alarmSound ( ); | 132 | virtual void alarmSound ( ); |
133 | virtual void keySound ( ); | 133 | virtual void keySound ( ); |
134 | virtual void touchSound ( ); | 134 | virtual void touchSound ( ); |
135 | 135 | ||
136 | virtual QValueList <OLed> ledList ( ) const; | 136 | virtual QValueList <OLed> ledList ( ) const; |
137 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 137 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
138 | virtual OLedState ledState ( OLed led ) const; | 138 | virtual OLedState ledState ( OLed led ) const; |
139 | virtual bool setLedState ( OLed led, OLedState st ); | 139 | virtual bool setLedState ( OLed led, OLedState st ); |
140 | 140 | ||
141 | static bool isZaurus(); | 141 | static bool isZaurus(); |
142 | 142 | ||
143 | protected: | 143 | protected: |
144 | virtual void buzzer ( int snd ); | 144 | virtual void buzzer ( int snd ); |
145 | 145 | ||
146 | OLedState m_leds [1]; | 146 | OLedState m_leds [1]; |
147 | bool m_embedix; | 147 | bool m_embedix; |
148 | }; | 148 | }; |
149 | 149 | ||
150 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { | 150 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter { |
151 | protected: | 151 | protected: |
152 | virtual void init ( ); | 152 | virtual void init ( ); |
153 | virtual void initButtons ( ); | 153 | virtual void initButtons ( ); |
154 | 154 | ||
155 | public: | 155 | public: |
156 | virtual bool setSoftSuspend ( bool soft ); | 156 | virtual bool setSoftSuspend ( bool soft ); |
157 | virtual bool suspend(); | 157 | virtual bool suspend(); |
158 | 158 | ||
159 | virtual bool setDisplayStatus( bool on ); | 159 | virtual bool setDisplayStatus( bool on ); |
160 | virtual bool setDisplayBrightness ( int b ); | 160 | virtual bool setDisplayBrightness ( int b ); |
@@ -162,122 +162,122 @@ public: | |||
162 | 162 | ||
163 | virtual void alarmSound ( ); | 163 | virtual void alarmSound ( ); |
164 | 164 | ||
165 | virtual QValueList <OLed> ledList ( ) const; | 165 | virtual QValueList <OLed> ledList ( ) const; |
166 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 166 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
167 | virtual OLedState ledState ( OLed led ) const; | 167 | virtual OLedState ledState ( OLed led ) const; |
168 | virtual bool setLedState ( OLed led, OLedState st ); | 168 | virtual bool setLedState ( OLed led, OLedState st ); |
169 | 169 | ||
170 | protected: | 170 | protected: |
171 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 171 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
172 | virtual void timerEvent ( QTimerEvent *te ); | 172 | virtual void timerEvent ( QTimerEvent *te ); |
173 | 173 | ||
174 | int m_power_timer; | 174 | int m_power_timer; |
175 | 175 | ||
176 | OLedState m_leds [1]; //FIXME check if really only one | 176 | OLedState m_leds [1]; //FIXME check if really only one |
177 | }; | 177 | }; |
178 | 178 | ||
179 | class Ramses : public ODevice, public QWSServer::KeyboardFilter { | 179 | class Ramses : public ODevice, public QWSServer::KeyboardFilter { |
180 | protected: | 180 | protected: |
181 | virtual void init ( ); | 181 | virtual void init ( ); |
182 | 182 | ||
183 | public: | 183 | public: |
184 | virtual bool setSoftSuspend ( bool soft ); | 184 | virtual bool setSoftSuspend ( bool soft ); |
185 | virtual bool suspend ( ); | 185 | virtual bool suspend ( ); |
186 | 186 | ||
187 | virtual bool setDisplayStatus( bool on ); | 187 | virtual bool setDisplayStatus( bool on ); |
188 | virtual bool setDisplayBrightness ( int b ); | 188 | virtual bool setDisplayBrightness ( int b ); |
189 | virtual int displayBrightnessResolution ( ) const; | 189 | virtual int displayBrightnessResolution ( ) const; |
190 | virtual bool setDisplayContrast ( int b ); | 190 | virtual bool setDisplayContrast ( int b ); |
191 | virtual int displayContrastResolution ( ) const; | 191 | virtual int displayContrastResolution ( ) const; |
192 | 192 | ||
193 | protected: | 193 | protected: |
194 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 194 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
195 | virtual void timerEvent ( QTimerEvent *te ); | 195 | virtual void timerEvent ( QTimerEvent *te ); |
196 | 196 | ||
197 | int m_power_timer; | 197 | int m_power_timer; |
198 | }; | 198 | }; |
199 | 199 | ||
200 | struct i_button { | 200 | struct i_button { |
201 | uint model; | 201 | uint model; |
202 | Qt::Key code; | 202 | Qt::Key code; |
203 | char *utext; | 203 | char *utext; |
204 | char *pix; | 204 | char *pix; |
205 | char *fpressedservice; | 205 | char *fpressedservice; |
206 | char *fpressedaction; | 206 | char *fpressedaction; |
207 | char *fheldservice; | 207 | char *fheldservice; |
208 | char *fheldaction; | 208 | char *fheldaction; |
209 | } ipaq_buttons [] = { | 209 | } ipaq_buttons [] = { |
210 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 210 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
211 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 211 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
212 | "devicebuttons/ipaq_calendar", | 212 | "devicebuttons/ipaq_calendar", |
213 | "datebook", "nextView()", | 213 | "datebook", "nextView()", |
214 | "today", "raise()" }, | 214 | "today", "raise()" }, |
215 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 215 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
216 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 216 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
217 | "devicebuttons/ipaq_contact", | 217 | "devicebuttons/ipaq_contact", |
218 | "addressbook", "raise()", | 218 | "addressbook", "raise()", |
219 | "addressbook", "beamBusinessCard()" }, | 219 | "addressbook", "beamBusinessCard()" }, |
220 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 220 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
221 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 221 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
222 | "devicebuttons/ipaq_menu", | 222 | "devicebuttons/ipaq_menu", |
223 | "QPE/TaskBar", "toggleMenu()", | 223 | "QPE/TaskBar", "toggleMenu()", |
224 | "QPE/TaskBar", "toggleStartMenu()" }, | 224 | "QPE/TaskBar", "toggleStartMenu()" }, |
225 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 225 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
226 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 226 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
227 | "devicebuttons/ipaq_mail", | 227 | "devicebuttons/ipaq_mail", |
228 | "mail", "raise()", | 228 | "mail", "raise()", |
229 | "mail", "newMail()" }, | 229 | "mail", "newMail()" }, |
230 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 230 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
231 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 231 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
232 | "devicebuttons/ipaq_home", | 232 | "devicebuttons/ipaq_home", |
233 | "QPE/Launcher", "home()", | 233 | "QPE/Launcher", "home()", |
234 | "buttonsettings", "raise()" }, | 234 | "buttonsettings", "raise()" }, |
235 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 235 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
236 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 236 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
237 | "devicebuttons/ipaq_record", | 237 | "devicebuttons/ipaq_record", |
238 | "QPE/VMemo", "toggleRecord()", | 238 | "QPE/VMemo", "toggleRecord()", |
239 | "sound", "raise()" }, | 239 | "sound", "raise()" }, |
240 | }; | 240 | }; |
241 | 241 | ||
242 | struct z_button { | 242 | struct z_button { |
243 | Qt::Key code; | 243 | Qt::Key code; |
244 | char *utext; | 244 | char *utext; |
245 | char *pix; | 245 | char *pix; |
246 | char *fpressedservice; | 246 | char *fpressedservice; |
247 | char *fpressedaction; | 247 | char *fpressedaction; |
248 | char *fheldservice; | 248 | char *fheldservice; |
249 | char *fheldaction; | 249 | char *fheldaction; |
250 | } z_buttons [] = { | 250 | } z_buttons [] = { |
251 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 251 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
252 | "devicebuttons/z_calendar", | 252 | "devicebuttons/z_calendar", |
253 | "datebook", "nextView()", | 253 | "datebook", "nextView()", |
254 | "today", "raise()" }, | 254 | "today", "raise()" }, |
255 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 255 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
256 | "devicebuttons/z_contact", | 256 | "devicebuttons/z_contact", |
257 | "addressbook", "raise()", | 257 | "addressbook", "raise()", |
258 | "addressbook", "beamBusinessCard()" }, | 258 | "addressbook", "beamBusinessCard()" }, |
259 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 259 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
260 | "devicebuttons/z_home", | 260 | "devicebuttons/z_home", |
261 | "QPE/Launcher", "home()", | 261 | "QPE/Launcher", "home()", |
262 | "buttonsettings", "raise()" }, | 262 | "buttonsettings", "raise()" }, |
263 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 263 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
264 | "devicebuttons/z_menu", | 264 | "devicebuttons/z_menu", |
265 | "QPE/TaskBar", "toggleMenu()", | 265 | "QPE/TaskBar", "toggleMenu()", |
266 | "QPE/TaskBar", "toggleStartMenu()" }, | 266 | "QPE/TaskBar", "toggleStartMenu()" }, |
267 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 267 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
268 | "devicebuttons/z_mail", | 268 | "devicebuttons/z_mail", |
269 | "mail", "raise()", | 269 | "mail", "raise()", |
270 | "mail", "newMail()" }, | 270 | "mail", "newMail()" }, |
271 | }; | 271 | }; |
272 | 272 | ||
273 | struct z_button z_buttons_c700 [] = { | 273 | struct z_button z_buttons_c700 [] = { |
274 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 274 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
275 | "devicebuttons/z_calendar", | 275 | "devicebuttons/z_calendar", |
276 | "datebook", "nextView()", | 276 | "datebook", "nextView()", |
277 | "today", "raise()" }, | 277 | "today", "raise()" }, |
278 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 278 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
279 | "devicebuttons/z_contact", | 279 | "devicebuttons/z_contact", |
280 | "addressbook", "raise()", | 280 | "addressbook", "raise()", |
281 | "addressbook", "beamBusinessCard()" }, | 281 | "addressbook", "beamBusinessCard()" }, |
282 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 282 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
283 | "devicebuttons/z_home", | 283 | "devicebuttons/z_home", |
@@ -1073,114 +1073,118 @@ bool Yopy::setDisplayBrightness(int bright) | |||
1073 | if ( QFile::exists("/proc/sys/pm/light") ) { | 1073 | if ( QFile::exists("/proc/sys/pm/light") ) { |
1074 | int fd = ::open("/proc/sys/pm/light", O_WRONLY); | 1074 | int fd = ::open("/proc/sys/pm/light", O_WRONLY); |
1075 | if (fd >= 0 ) { | 1075 | if (fd >= 0 ) { |
1076 | if (bright) | 1076 | if (bright) |
1077 | ::write(fd, "1\n", 2); | 1077 | ::write(fd, "1\n", 2); |
1078 | else | 1078 | else |
1079 | ::write(fd, "0\n", 2); | 1079 | ::write(fd, "0\n", 2); |
1080 | ::close(fd); | 1080 | ::close(fd); |
1081 | return true; | 1081 | return true; |
1082 | } | 1082 | } |
1083 | } | 1083 | } |
1084 | #endif | 1084 | #endif |
1085 | return false; | 1085 | return false; |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | int Yopy::displayBrightnessResolution() const | 1088 | int Yopy::displayBrightnessResolution() const |
1089 | { | 1089 | { |
1090 | return 2; | 1090 | return 2; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | /************************************************** | 1093 | /************************************************** |
1094 | * | 1094 | * |
1095 | * iPAQ | 1095 | * iPAQ |
1096 | * | 1096 | * |
1097 | **************************************************/ | 1097 | **************************************************/ |
1098 | 1098 | ||
1099 | void iPAQ::init ( ) | 1099 | void iPAQ::init ( ) |
1100 | { | 1100 | { |
1101 | d-> m_vendorstr = "HP"; | 1101 | d-> m_vendorstr = "HP"; |
1102 | d-> m_vendor = Vendor_HP; | 1102 | d-> m_vendor = Vendor_HP; |
1103 | 1103 | ||
1104 | QFile f ( "/proc/hal/model" ); | 1104 | QFile f ( "/proc/hal/model" ); |
1105 | 1105 | ||
1106 | if ( f. open ( IO_ReadOnly )) { | 1106 | if ( f. open ( IO_ReadOnly )) { |
1107 | QTextStream ts ( &f ); | 1107 | QTextStream ts ( &f ); |
1108 | 1108 | ||
1109 | d-> m_modelstr = "H" + ts. readLine ( ); | 1109 | d-> m_modelstr = "H" + ts. readLine ( ); |
1110 | 1110 | ||
1111 | if ( d-> m_modelstr == "H3100" ) | 1111 | if ( d-> m_modelstr == "H3100" ) |
1112 | d-> m_model = Model_iPAQ_H31xx; | 1112 | d-> m_model = Model_iPAQ_H31xx; |
1113 | else if ( d-> m_modelstr == "H3600" ) | 1113 | else if ( d-> m_modelstr == "H3600" ) |
1114 | d-> m_model = Model_iPAQ_H36xx; | 1114 | d-> m_model = Model_iPAQ_H36xx; |
1115 | else if ( d-> m_modelstr == "H3700" ) | 1115 | else if ( d-> m_modelstr == "H3700" ) |
1116 | d-> m_model = Model_iPAQ_H37xx; | 1116 | d-> m_model = Model_iPAQ_H37xx; |
1117 | else if ( d-> m_modelstr == "H3800" ) | 1117 | else if ( d-> m_modelstr == "H3800" ) |
1118 | d-> m_model = Model_iPAQ_H38xx; | 1118 | d-> m_model = Model_iPAQ_H38xx; |
1119 | else if ( d-> m_modelstr == "H3900" ) | 1119 | else if ( d-> m_modelstr == "H3900" ) |
1120 | d-> m_model = Model_iPAQ_H39xx; | 1120 | d-> m_model = Model_iPAQ_H39xx; |
1121 | else if ( d-> m_modelstr == "H5400" ) | ||
1122 | d-> m_model = Model_iPAQ_H5xxx; | ||
1121 | else | 1123 | else |
1122 | d-> m_model = Model_Unknown; | 1124 | d-> m_model = Model_Unknown; |
1123 | 1125 | ||
1124 | f. close ( ); | 1126 | f. close ( ); |
1125 | } | 1127 | } |
1126 | 1128 | ||
1127 | switch ( d-> m_model ) { | 1129 | switch ( d-> m_model ) { |
1128 | case Model_iPAQ_H31xx: | 1130 | case Model_iPAQ_H31xx: |
1129 | case Model_iPAQ_H38xx: | 1131 | case Model_iPAQ_H38xx: |
1130 | d-> m_rotation = Rot90; | 1132 | d-> m_rotation = Rot90; |
1131 | break; | 1133 | break; |
1132 | case Model_iPAQ_H36xx: | 1134 | case Model_iPAQ_H36xx: |
1133 | case Model_iPAQ_H37xx: | 1135 | case Model_iPAQ_H37xx: |
1134 | case Model_iPAQ_H39xx: | 1136 | case Model_iPAQ_H39xx: |
1135 | default: | 1137 | default: |
1136 | d-> m_rotation = Rot270; | 1138 | d-> m_rotation = Rot270; |
1137 | break; | 1139 | break; |
1138 | } | 1140 | case Model_iPAQ_H5xxx: |
1141 | d-> m_rotation = Rot0; | ||
1142 | } | ||
1139 | 1143 | ||
1140 | f. setName ( "/etc/familiar-version" ); | 1144 | f. setName ( "/etc/familiar-version" ); |
1141 | if ( f. open ( IO_ReadOnly )) { | 1145 | if ( f. open ( IO_ReadOnly )) { |
1142 | d-> m_systemstr = "Familiar"; | 1146 | d-> m_systemstr = "Familiar"; |
1143 | d-> m_system = System_Familiar; | 1147 | d-> m_system = System_Familiar; |
1144 | 1148 | ||
1145 | QTextStream ts ( &f ); | 1149 | QTextStream ts ( &f ); |
1146 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 1150 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
1147 | 1151 | ||
1148 | f. close ( ); | 1152 | f. close ( ); |
1149 | } else { | 1153 | } else { |
1150 | f. setName ( "/etc/oz_version" ); | 1154 | f. setName ( "/etc/oz_version" ); |
1151 | 1155 | ||
1152 | if ( f. open ( IO_ReadOnly )) { | 1156 | if ( f. open ( IO_ReadOnly )) { |
1153 | d-> m_systemstr = "OpenEmbedded/iPaq"; | 1157 | d-> m_systemstr = "OpenEmbedded/iPaq"; |
1154 | d-> m_system = System_Familiar; | 1158 | d-> m_system = System_Familiar; |
1155 | 1159 | ||
1156 | QTextStream ts ( &f ); | 1160 | QTextStream ts ( &f ); |
1157 | ts.setDevice ( &f ); | 1161 | ts.setDevice ( &f ); |
1158 | d-> m_sysverstr = ts. readLine ( ); | 1162 | d-> m_sysverstr = ts. readLine ( ); |
1159 | f. close ( ); | 1163 | f. close ( ); |
1160 | } | 1164 | } |
1161 | } | 1165 | } |
1162 | 1166 | ||
1163 | 1167 | ||
1164 | 1168 | ||
1165 | 1169 | ||
1166 | 1170 | ||
1167 | m_leds [0] = m_leds [1] = Led_Off; | 1171 | m_leds [0] = m_leds [1] = Led_Off; |
1168 | 1172 | ||
1169 | m_power_timer = 0; | 1173 | m_power_timer = 0; |
1170 | 1174 | ||
1171 | } | 1175 | } |
1172 | 1176 | ||
1173 | void iPAQ::initButtons ( ) | 1177 | void iPAQ::initButtons ( ) |
1174 | { | 1178 | { |
1175 | if ( d-> m_buttons ) | 1179 | if ( d-> m_buttons ) |
1176 | return; | 1180 | return; |
1177 | 1181 | ||
1178 | if ( isQWS( ) ) | 1182 | if ( isQWS( ) ) |
1179 | QWSServer::setKeyboardFilter ( this ); | 1183 | QWSServer::setKeyboardFilter ( this ); |
1180 | 1184 | ||
1181 | d-> m_buttons = new QValueList <ODeviceButton>; | 1185 | d-> m_buttons = new QValueList <ODeviceButton>; |
1182 | 1186 | ||
1183 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 1187 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
1184 | i_button *ib = ipaq_buttons + i; | 1188 | i_button *ib = ipaq_buttons + i; |
1185 | ODeviceButton b; | 1189 | ODeviceButton b; |
1186 | 1190 | ||
@@ -1247,97 +1251,98 @@ OLedState iPAQ::ledState ( OLed l ) const | |||
1247 | switch ( l ) { | 1251 | switch ( l ) { |
1248 | case Led_Power: | 1252 | case Led_Power: |
1249 | return m_leds [0]; | 1253 | return m_leds [0]; |
1250 | case Led_BlueTooth: | 1254 | case Led_BlueTooth: |
1251 | return m_leds [1]; | 1255 | return m_leds [1]; |
1252 | default: | 1256 | default: |
1253 | return Led_Off; | 1257 | return Led_Off; |
1254 | } | 1258 | } |
1255 | } | 1259 | } |
1256 | 1260 | ||
1257 | bool iPAQ::setLedState ( OLed l, OLedState st ) | 1261 | bool iPAQ::setLedState ( OLed l, OLedState st ) |
1258 | { | 1262 | { |
1259 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); | 1263 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); |
1260 | 1264 | ||
1261 | if ( l == Led_Power ) { | 1265 | if ( l == Led_Power ) { |
1262 | if ( fd >= 0 ) { | 1266 | if ( fd >= 0 ) { |
1263 | LED_IN leds; | 1267 | LED_IN leds; |
1264 | ::memset ( &leds, 0, sizeof( leds )); | 1268 | ::memset ( &leds, 0, sizeof( leds )); |
1265 | leds. TotalTime = 0; | 1269 | leds. TotalTime = 0; |
1266 | leds. OnTime = 0; | 1270 | leds. OnTime = 0; |
1267 | leds. OffTime = 1; | 1271 | leds. OffTime = 1; |
1268 | leds. OffOnBlink = 2; | 1272 | leds. OffOnBlink = 2; |
1269 | 1273 | ||
1270 | switch ( st ) { | 1274 | switch ( st ) { |
1271 | case Led_Off : leds. OffOnBlink = 0; break; | 1275 | case Led_Off : leds. OffOnBlink = 0; break; |
1272 | case Led_On : leds. OffOnBlink = 1; break; | 1276 | case Led_On : leds. OffOnBlink = 1; break; |
1273 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 1277 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
1274 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 1278 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
1275 | } | 1279 | } |
1276 | 1280 | ||
1277 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 1281 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
1278 | m_leds [0] = st; | 1282 | m_leds [0] = st; |
1279 | return true; | 1283 | return true; |
1280 | } | 1284 | } |
1281 | } | 1285 | } |
1282 | } | 1286 | } |
1283 | return false; | 1287 | return false; |
1284 | } | 1288 | } |
1285 | 1289 | ||
1286 | 1290 | ||
1287 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 1291 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
1288 | { | 1292 | { |
1289 | int newkeycode = keycode; | 1293 | int newkeycode = keycode; |
1290 | 1294 | ||
1291 | switch ( keycode ) { | 1295 | switch ( keycode ) { |
1292 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 1296 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
1293 | case HardKey_Menu: { | 1297 | case HardKey_Menu: { |
1294 | if (( d-> m_model == Model_iPAQ_H38xx ) || | 1298 | if (( d-> m_model == Model_iPAQ_H38xx ) || |
1295 | ( d-> m_model == Model_iPAQ_H39xx )) { | 1299 | ( d-> m_model == Model_iPAQ_H39xx ) || |
1300 | ( d-> m_model == Model_iPAQ_H5xxx)) { | ||
1296 | newkeycode = HardKey_Mail; | 1301 | newkeycode = HardKey_Mail; |
1297 | } | 1302 | } |
1298 | break; | 1303 | break; |
1299 | } | 1304 | } |
1300 | 1305 | ||
1301 | // Rotate cursor keys 180° | 1306 | // Rotate cursor keys 180° |
1302 | case Key_Left : | 1307 | case Key_Left : |
1303 | case Key_Right: | 1308 | case Key_Right: |
1304 | case Key_Up : | 1309 | case Key_Up : |
1305 | case Key_Down : { | 1310 | case Key_Down : { |
1306 | if (( d-> m_model == Model_iPAQ_H31xx ) || | 1311 | if (( d-> m_model == Model_iPAQ_H31xx ) || |
1307 | ( d-> m_model == Model_iPAQ_H38xx )) { | 1312 | ( d-> m_model == Model_iPAQ_H38xx )) { |
1308 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 1313 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
1309 | } | 1314 | } |
1310 | break; | 1315 | break; |
1311 | } | 1316 | } |
1312 | 1317 | ||
1313 | // map Power Button short/long press to F34/F35 | 1318 | // map Power Button short/long press to F34/F35 |
1314 | case Key_SysReq: { | 1319 | case Key_SysReq: { |
1315 | if ( isPress ) { | 1320 | if ( isPress ) { |
1316 | if ( m_power_timer ) | 1321 | if ( m_power_timer ) |
1317 | killTimer ( m_power_timer ); | 1322 | killTimer ( m_power_timer ); |
1318 | m_power_timer = startTimer ( 500 ); | 1323 | m_power_timer = startTimer ( 500 ); |
1319 | } | 1324 | } |
1320 | else if ( m_power_timer ) { | 1325 | else if ( m_power_timer ) { |
1321 | killTimer ( m_power_timer ); | 1326 | killTimer ( m_power_timer ); |
1322 | m_power_timer = 0; | 1327 | m_power_timer = 0; |
1323 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 1328 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
1324 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 1329 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
1325 | } | 1330 | } |
1326 | newkeycode = Key_unknown; | 1331 | newkeycode = Key_unknown; |
1327 | break; | 1332 | break; |
1328 | } | 1333 | } |
1329 | } | 1334 | } |
1330 | 1335 | ||
1331 | if ( newkeycode != keycode ) { | 1336 | if ( newkeycode != keycode ) { |
1332 | if ( newkeycode != Key_unknown ) | 1337 | if ( newkeycode != Key_unknown ) |
1333 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 1338 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
1334 | return true; | 1339 | return true; |
1335 | } | 1340 | } |
1336 | else | 1341 | else |
1337 | return false; | 1342 | return false; |
1338 | } | 1343 | } |
1339 | 1344 | ||
1340 | void iPAQ::timerEvent ( QTimerEvent * ) | 1345 | void iPAQ::timerEvent ( QTimerEvent * ) |
1341 | { | 1346 | { |
1342 | killTimer ( m_power_timer ); | 1347 | killTimer ( m_power_timer ); |
1343 | m_power_timer = 0; | 1348 | m_power_timer = 0; |
@@ -1391,96 +1396,98 @@ bool iPAQ::setSoftSuspend ( bool soft ) | |||
1391 | 1396 | ||
1392 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 1397 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
1393 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 1398 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
1394 | res = true; | 1399 | res = true; |
1395 | else | 1400 | else |
1396 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 1401 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
1397 | 1402 | ||
1398 | ::close ( fd ); | 1403 | ::close ( fd ); |
1399 | } | 1404 | } |
1400 | else | 1405 | else |
1401 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 1406 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
1402 | 1407 | ||
1403 | return res; | 1408 | return res; |
1404 | } | 1409 | } |
1405 | 1410 | ||
1406 | 1411 | ||
1407 | bool iPAQ::setDisplayBrightness ( int bright ) | 1412 | bool iPAQ::setDisplayBrightness ( int bright ) |
1408 | { | 1413 | { |
1409 | bool res = false; | 1414 | bool res = false; |
1410 | int fd; | 1415 | int fd; |
1411 | 1416 | ||
1412 | if ( bright > 255 ) | 1417 | if ( bright > 255 ) |
1413 | bright = 255; | 1418 | bright = 255; |
1414 | if ( bright < 0 ) | 1419 | if ( bright < 0 ) |
1415 | bright = 0; | 1420 | bright = 0; |
1416 | 1421 | ||
1417 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 1422 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
1418 | FLITE_IN bl; | 1423 | FLITE_IN bl; |
1419 | bl. mode = 1; | 1424 | bl. mode = 1; |
1420 | bl. pwr = bright ? 1 : 0; | 1425 | bl. pwr = bright ? 1 : 0; |
1421 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 1426 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
1422 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 1427 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
1423 | ::close ( fd ); | 1428 | ::close ( fd ); |
1424 | } | 1429 | } |
1425 | return res; | 1430 | return res; |
1426 | } | 1431 | } |
1427 | 1432 | ||
1428 | int iPAQ::displayBrightnessResolution ( ) const | 1433 | int iPAQ::displayBrightnessResolution ( ) const |
1429 | { | 1434 | { |
1430 | switch ( model ( )) { | 1435 | switch ( model ( )) { |
1431 | case Model_iPAQ_H31xx: | 1436 | case Model_iPAQ_H31xx: |
1432 | case Model_iPAQ_H36xx: | 1437 | case Model_iPAQ_H36xx: |
1433 | case Model_iPAQ_H37xx: | 1438 | case Model_iPAQ_H37xx: |
1434 | return 128; // really 256, but >128 could damage the LCD | 1439 | return 128; // really 256, but >128 could damage the LCD |
1435 | 1440 | ||
1436 | case Model_iPAQ_H38xx: | 1441 | case Model_iPAQ_H38xx: |
1437 | case Model_iPAQ_H39xx: | 1442 | case Model_iPAQ_H39xx: |
1438 | return 64; | 1443 | return 64; |
1444 | case Model_iPAQ_H5xxx: | ||
1445 | return 255; | ||
1439 | 1446 | ||
1440 | default: | 1447 | default: |
1441 | return 2; | 1448 | return 2; |
1442 | } | 1449 | } |
1443 | } | 1450 | } |
1444 | 1451 | ||
1445 | 1452 | ||
1446 | bool iPAQ::hasLightSensor ( ) const | 1453 | bool iPAQ::hasLightSensor ( ) const |
1447 | { | 1454 | { |
1448 | return true; | 1455 | return true; |
1449 | } | 1456 | } |
1450 | 1457 | ||
1451 | int iPAQ::readLightSensor ( ) | 1458 | int iPAQ::readLightSensor ( ) |
1452 | { | 1459 | { |
1453 | int fd; | 1460 | int fd; |
1454 | int val = -1; | 1461 | int val = -1; |
1455 | 1462 | ||
1456 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 1463 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
1457 | char buffer [8]; | 1464 | char buffer [8]; |
1458 | 1465 | ||
1459 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 1466 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
1460 | char *endptr; | 1467 | char *endptr; |
1461 | 1468 | ||
1462 | buffer [4] = 0; | 1469 | buffer [4] = 0; |
1463 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 1470 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
1464 | 1471 | ||
1465 | if ( *endptr != 0 ) | 1472 | if ( *endptr != 0 ) |
1466 | val = -1; | 1473 | val = -1; |
1467 | } | 1474 | } |
1468 | ::close ( fd ); | 1475 | ::close ( fd ); |
1469 | } | 1476 | } |
1470 | 1477 | ||
1471 | return val; | 1478 | return val; |
1472 | } | 1479 | } |
1473 | 1480 | ||
1474 | int iPAQ::lightSensorResolution ( ) const | 1481 | int iPAQ::lightSensorResolution ( ) const |
1475 | { | 1482 | { |
1476 | return 256; | 1483 | return 256; |
1477 | } | 1484 | } |
1478 | 1485 | ||
1479 | /************************************************** | 1486 | /************************************************** |
1480 | * | 1487 | * |
1481 | * Zaurus | 1488 | * Zaurus |
1482 | * | 1489 | * |
1483 | **************************************************/ | 1490 | **************************************************/ |
1484 | 1491 | ||
1485 | // Check whether this device is the sharp zaurus.. | 1492 | // Check whether this device is the sharp zaurus.. |
1486 | bool Zaurus::isZaurus() | 1493 | bool Zaurus::isZaurus() |
@@ -2471,121 +2478,121 @@ int Ramses::displayContrastResolution() const | |||
2471 | /************************************************** | 2478 | /************************************************** |
2472 | * * | 2479 | * * |
2473 | * Jornada * | 2480 | * Jornada * |
2474 | * * | 2481 | * * |
2475 | **************************************************/ | 2482 | **************************************************/ |
2476 | 2483 | ||
2477 | 2484 | ||
2478 | bool Jornada::isJornada ( ) | 2485 | bool Jornada::isJornada ( ) |
2479 | { | 2486 | { |
2480 | QFile f( "/proc/cpuinfo" ); | 2487 | QFile f( "/proc/cpuinfo" ); |
2481 | if ( f. open ( IO_ReadOnly ) ) { | 2488 | if ( f. open ( IO_ReadOnly ) ) { |
2482 | QTextStream ts ( &f ); | 2489 | QTextStream ts ( &f ); |
2483 | QString line; | 2490 | QString line; |
2484 | while( line = ts. readLine ( ) ) { | 2491 | while( line = ts. readLine ( ) ) { |
2485 | if ( line. left ( 8 ) == "Hardware" ) { | 2492 | if ( line. left ( 8 ) == "Hardware" ) { |
2486 | int loc = line. find ( ":" ); | 2493 | int loc = line. find ( ":" ); |
2487 | if ( loc != -1 ) { | 2494 | if ( loc != -1 ) { |
2488 | QString model = | 2495 | QString model = |
2489 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 2496 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
2490 | return ( model == "HP Jornada 56x" ); | 2497 | return ( model == "HP Jornada 56x" ); |
2491 | } | 2498 | } |
2492 | } | 2499 | } |
2493 | } | 2500 | } |
2494 | } | 2501 | } |
2495 | return false; | 2502 | return false; |
2496 | } | 2503 | } |
2497 | 2504 | ||
2498 | void Jornada::init ( ) | 2505 | void Jornada::init ( ) |
2499 | { | 2506 | { |
2500 | d-> m_vendorstr = "HP"; | 2507 | d-> m_vendorstr = "HP"; |
2501 | d-> m_vendor = Vendor_HP; | 2508 | d-> m_vendor = Vendor_HP; |
2502 | d-> m_modelstr = "Jornada 56x"; | 2509 | d-> m_modelstr = "Jornada 56x"; |
2503 | d-> m_model = Model_Jornada_56x; | 2510 | d-> m_model = Model_Jornada_56x; |
2504 | d-> m_systemstr = "Familiar"; | 2511 | d-> m_systemstr = "Familiar"; |
2505 | d-> m_system = System_Familiar; | 2512 | d-> m_system = System_Familiar; |
2506 | d-> m_rotation = Rot0; | 2513 | d-> m_rotation = Rot0; |
2507 | 2514 | ||
2508 | QFile f ( "/etc/familiar-version" ); | 2515 | QFile f ( "/etc/familiar-version" ); |
2509 | f. setName ( "/etc/familiar-version" ); | 2516 | f. setName ( "/etc/familiar-version" ); |
2510 | if ( f. open ( IO_ReadOnly )) { | 2517 | if ( f. open ( IO_ReadOnly )) { |
2511 | 2518 | ||
2512 | QTextStream ts ( &f ); | 2519 | QTextStream ts ( &f ); |
2513 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 2520 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
2514 | 2521 | ||
2515 | f. close ( ); | 2522 | f. close ( ); |
2516 | } | 2523 | } |
2517 | } | 2524 | } |
2518 | 2525 | ||
2519 | 2526 | #if 0 | |
2520 | void Jornada::initButtons ( ) | 2527 | void Jornada::initButtons ( ) |
2521 | { | 2528 | { |
2522 | if ( d-> m_buttons ) | 2529 | if ( d-> m_buttons ) |
2523 | return; | 2530 | return; |
2524 | 2531 | ||
2525 | // Simulation uses iPAQ 3660 device buttons | 2532 | // Simulation uses iPAQ 3660 device buttons |
2526 | 2533 | ||
2527 | qDebug ( "init Buttons" ); | 2534 | qDebug ( "init Buttons" ); |
2528 | d-> m_buttons = new QValueList <ODeviceButton>; | 2535 | d-> m_buttons = new QValueList <ODeviceButton>; |
2529 | 2536 | ||
2530 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 2537 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
2531 | i_button *ib = ipaq_buttons + i; | 2538 | i_button *ib = ipaq_buttons + i; |
2532 | ODeviceButton b; | 2539 | ODeviceButton b; |
2533 | 2540 | ||
2534 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 2541 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
2535 | b. setKeycode ( ib-> code ); | 2542 | b. setKeycode ( ib-> code ); |
2536 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | 2543 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); |
2537 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 2544 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
2538 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 2545 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
2539 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 2546 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
2540 | d-> m_buttons-> append ( b ); | 2547 | d-> m_buttons-> append ( b ); |
2541 | } | 2548 | } |
2542 | } | 2549 | } |
2543 | reloadButtonMapping ( ); | 2550 | reloadButtonMapping ( ); |
2544 | 2551 | ||
2545 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 2552 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
2546 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 2553 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
2547 | } | 2554 | } |
2548 | 2555 | #endif | |
2549 | int Jornada::displayBrightnessResolution ( ) const | 2556 | int Jornada::displayBrightnessResolution ( ) const |
2550 | { | 2557 | { |
2551 | } | 2558 | } |
2552 | 2559 | ||
2553 | bool Jornada::setDisplayBrightness ( int bright ) | 2560 | bool Jornada::setDisplayBrightness ( int bright ) |
2554 | { | 2561 | { |
2555 | bool res = false; | 2562 | bool res = false; |
2556 | int fd; | 2563 | int fd; |
2557 | 2564 | ||
2558 | if ( bright > 255 ) | 2565 | if ( bright > 255 ) |
2559 | bright = 255; | 2566 | bright = 255; |
2560 | if ( bright < 0 ) | 2567 | if ( bright < 0 ) |
2561 | bright = 0; | 2568 | bright = 0; |
2562 | 2569 | ||
2563 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 2570 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
2564 | FLITE_IN bl; | 2571 | FLITE_IN bl; |
2565 | bl. mode = 1; | 2572 | bl. mode = 1; |
2566 | bl. pwr = bright ? 1 : 0; | 2573 | bl. pwr = bright ? 1 : 0; |
2567 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | 2574 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; |
2568 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 2575 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
2569 | ::close ( fd ); | 2576 | ::close ( fd ); |
2570 | } | 2577 | } |
2571 | return res; | 2578 | return res; |
2572 | } | 2579 | } |
2573 | 2580 | ||
2574 | bool Jornada::setSoftSuspend ( bool soft ) | 2581 | bool Jornada::setSoftSuspend ( bool soft ) |
2575 | { | 2582 | { |
2576 | bool res = false; | 2583 | bool res = false; |
2577 | int fd; | 2584 | int fd; |
2578 | 2585 | ||
2579 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 2586 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
2580 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 2587 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
2581 | res = true; | 2588 | res = true; |
2582 | else | 2589 | else |
2583 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 2590 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
2584 | 2591 | ||
2585 | ::close ( fd ); | 2592 | ::close ( fd ); |
2586 | } | 2593 | } |
2587 | else | 2594 | else |
2588 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 2595 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
2589 | 2596 | ||
2590 | return res; | 2597 | return res; |
2591 | } | 2598 | } |
diff --git a/libopie/odevice.h b/libopie/odevice.h index 35e3eff..46f1614 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -5,96 +5,97 @@ | |||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _LIBOPIE_ODEVICE_H_ | 21 | #ifndef _LIBOPIE_ODEVICE_H_ |
22 | #define _LIBOPIE_ODEVICE_H_ | 22 | #define _LIBOPIE_ODEVICE_H_ |
23 | 23 | ||
24 | #include <qobject.h> | 24 | #include <qobject.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qnamespace.h> | 26 | #include <qnamespace.h> |
27 | #include <qstrlist.h> | 27 | #include <qstrlist.h> |
28 | 28 | ||
29 | #include <opie/odevicebutton.h> | 29 | #include <opie/odevicebutton.h> |
30 | 30 | ||
31 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 31 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
32 | 32 | ||
33 | class ODeviceData; | 33 | class ODeviceData; |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * The available devices | 38 | * The available devices |
39 | */ | 39 | */ |
40 | enum OModel { | 40 | enum OModel { |
41 | Model_Unknown, // = 0 | 41 | Model_Unknown, // = 0 |
42 | 42 | ||
43 | Model_Series_Mask = 0xff000000, | 43 | Model_Series_Mask = 0xff000000, |
44 | 44 | ||
45 | Model_iPAQ = ( 1 << 24 ), | 45 | Model_iPAQ = ( 1 << 24 ), |
46 | 46 | ||
47 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 47 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
48 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 48 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
49 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 49 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
50 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 50 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
51 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 51 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
52 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 52 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
53 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ), | ||
53 | 54 | ||
54 | Model_Jornada = ( 6 << 24 ), | 55 | Model_Jornada = ( 6 << 24 ), |
55 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 56 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
56 | 57 | ||
57 | Model_Zaurus = ( 2 << 24 ), | 58 | Model_Zaurus = ( 2 << 24 ), |
58 | 59 | ||
59 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 60 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
60 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 61 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
61 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 62 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
62 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 63 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
63 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), | 64 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), |
64 | 65 | ||
65 | Model_SIMpad = ( 3 << 24 ), | 66 | Model_SIMpad = ( 3 << 24 ), |
66 | 67 | ||
67 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 68 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
68 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 69 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
69 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 70 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
70 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 71 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
71 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 72 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
72 | 73 | ||
73 | Model_Ramses = ( 4 << 24 ), | 74 | Model_Ramses = ( 4 << 24 ), |
74 | 75 | ||
75 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 76 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
76 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 77 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
77 | 78 | ||
78 | Model_Yopy = ( 5 << 24 ), | 79 | Model_Yopy = ( 5 << 24 ), |
79 | 80 | ||
80 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 81 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
81 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 82 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
82 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 83 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
83 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 84 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
84 | 85 | ||
85 | }; | 86 | }; |
86 | 87 | ||
87 | /** | 88 | /** |
88 | * The vendor of the device | 89 | * The vendor of the device |
89 | */ | 90 | */ |
90 | enum OVendor { | 91 | enum OVendor { |
91 | Vendor_Unknown, | 92 | Vendor_Unknown, |
92 | 93 | ||
93 | Vendor_HP, | 94 | Vendor_HP, |
94 | Vendor_Sharp, | 95 | Vendor_Sharp, |
95 | Vendor_SIEMENS, | 96 | Vendor_SIEMENS, |
96 | Vendor_MundN, | 97 | Vendor_MundN, |
97 | Vendor_GMate, | 98 | Vendor_GMate, |
98 | }; | 99 | }; |
99 | 100 | ||
100 | /** | 101 | /** |