author | zecke <zecke> | 2005-02-17 23:52:46 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-17 23:52:46 (UTC) |
commit | 9bf35a9978c8a9e8b9c2100abf9137ffefc73e17 (patch) (unidiff) | |
tree | f251c1697f2ed091d8f55eca7aa1b8f4a85c7889 /libopie2 | |
parent | 87cbafeb59d0505b631be811bd96fb1d0b1df1f7 (diff) | |
download | opie-9bf35a9978c8a9e8b9c2100abf9137ffefc73e17.zip opie-9bf35a9978c8a9e8b9c2100abf9137ffefc73e17.tar.gz opie-9bf35a9978c8a9e8b9c2100abf9137ffefc73e17.tar.bz2 |
Add OAbstractMobileDevice with implementations for suspend and setDisplayStatus
Switch our implementations over to this partial implementation of ODevice
-rw-r--r-- | libopie2/opiecore/device/device.pro | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 14 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | 119 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_abstractmobiledevice.h | 64 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_beagle.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 21 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.h | 5 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 36 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 5 |
14 files changed, 204 insertions, 84 deletions
diff --git a/libopie2/opiecore/device/device.pro b/libopie2/opiecore/device/device.pro index 9a409e1..08bd4e1 100644 --- a/libopie2/opiecore/device/device.pro +++ b/libopie2/opiecore/device/device.pro | |||
@@ -1,22 +1,24 @@ | |||
1 | HEADERS += device/odevice.h \ | 1 | HEADERS += device/odevice.h \ |
2 | device/odevicebutton.h \ | 2 | device/odevicebutton.h \ |
3 | device/odevice_abstractmobiledevice.h \ | ||
3 | device/odevice_beagle.h \ | 4 | device/odevice_beagle.h \ |
4 | device/odevice_ipaq.h \ | 5 | device/odevice_ipaq.h \ |
5 | device/odevice_jornada.h \ | 6 | device/odevice_jornada.h \ |
6 | device/odevice_ramses.h \ | 7 | device/odevice_ramses.h \ |
7 | device/odevice_simpad.h \ | 8 | device/odevice_simpad.h \ |
8 | device/odevice_zaurus.h \ | 9 | device/odevice_zaurus.h \ |
9 | device/odevice_genuineintel.h \ | 10 | device/odevice_genuineintel.h \ |
10 | device/odevice_yopy.h | 11 | device/odevice_yopy.h |
11 | 12 | ||
12 | SOURCES += device/odevice.cpp \ | 13 | SOURCES += device/odevice.cpp \ |
13 | device/odevicebutton.cpp \ | 14 | device/odevicebutton.cpp \ |
15 | device/odevice_abstractmobiledevice.cpp \ | ||
14 | device/odevice_beagle.cpp \ | 16 | device/odevice_beagle.cpp \ |
15 | device/odevice_ipaq.cpp \ | 17 | device/odevice_ipaq.cpp \ |
16 | device/odevice_jornada.cpp\ | 18 | device/odevice_jornada.cpp\ |
17 | device/odevice_ramses.cpp \ | 19 | device/odevice_ramses.cpp \ |
18 | device/odevice_simpad.cpp \ | 20 | device/odevice_simpad.cpp \ |
19 | device/odevice_zaurus.cpp \ | 21 | device/odevice_zaurus.cpp \ |
20 | device/odevice_genuineintel.cpp \ | 22 | device/odevice_genuineintel.cpp \ |
21 | device/odevice_yopy.cpp | 23 | device/odevice_yopy.cpp |
22 | 24 | ||
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 2c5190c..ed705a6 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -209,126 +209,112 @@ ODevice::ODevice() | |||
209 | break; | 209 | break; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) | 214 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
215 | { | 215 | { |
216 | if ( msg == "deviceButtonMappingChanged()" ) { | 216 | if ( msg == "deviceButtonMappingChanged()" ) { |
217 | reloadButtonMapping(); | 217 | reloadButtonMapping(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | void ODevice::init(const QString&) | 221 | void ODevice::init(const QString&) |
222 | { | 222 | { |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * This method initialises the button mapping | 226 | * This method initialises the button mapping |
227 | */ | 227 | */ |
228 | void ODevice::initButtons() | 228 | void ODevice::initButtons() |
229 | { | 229 | { |
230 | if ( d->m_buttons ) | 230 | if ( d->m_buttons ) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | qDebug ( "init Buttons" ); | 233 | qDebug ( "init Buttons" ); |
234 | d->m_buttons = new QValueList <ODeviceButton>; | 234 | d->m_buttons = new QValueList <ODeviceButton>; |
235 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { | 235 | for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { |
236 | default_button *db = default_buttons + i; | 236 | default_button *db = default_buttons + i; |
237 | ODeviceButton b; | 237 | ODeviceButton b; |
238 | b. setKeycode ( db->code ); | 238 | b. setKeycode ( db->code ); |
239 | b. setUserText ( QObject::tr ( "Button", db->utext )); | 239 | b. setUserText ( QObject::tr ( "Button", db->utext )); |
240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); | 240 | b. setPixmap ( Resource::loadPixmap ( db->pix )); |
241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); | 241 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); |
242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); | 242 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); |
243 | d->m_buttons->append ( b ); | 243 | d->m_buttons->append ( b ); |
244 | } | 244 | } |
245 | 245 | ||
246 | reloadButtonMapping(); | 246 | reloadButtonMapping(); |
247 | } | 247 | } |
248 | 248 | ||
249 | ODevice::~ODevice() | 249 | ODevice::~ODevice() |
250 | { | 250 | { |
251 | // we leak m_devicebuttons and m_cpu_frequency | 251 | // we leak m_devicebuttons and m_cpu_frequency |
252 | // but it's a singleton and it is not so importantant | 252 | // but it's a singleton and it is not so importantant |
253 | // -zecke | 253 | // -zecke |
254 | delete d; | 254 | delete d; |
255 | } | 255 | } |
256 | 256 | ||
257 | //#include <linux/apm_bios.h> | ||
258 | |||
259 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | ||
260 | |||
261 | /** | 257 | /** |
262 | * This method will try to suspend the device | 258 | * This method will try to suspend the device |
263 | * It only works if the user is the QWS Server and the apm application | 259 | * It only works if the user is the QWS Server and the apm application |
264 | * is installed. | 260 | * is installed. |
265 | * It tries to suspend and then waits some time cause some distributions | 261 | * It tries to suspend and then waits some time cause some distributions |
266 | * do have asynchronus apm implementations. | 262 | * do have asynchronus apm implementations. |
267 | * This method will either fail and return false or it'll suspend the | 263 | * This method will either fail and return false or it'll suspend the |
268 | * device and return once the device got woken up | 264 | * device and return once the device got woken up |
269 | * | 265 | * |
270 | * @return if the device got suspended | 266 | * @return if the device got suspended |
271 | */ | 267 | */ |
272 | bool ODevice::suspend() | 268 | bool ODevice::suspend() |
273 | { | 269 | { |
274 | return false; // default implementation == unknown device or qvfb | 270 | return false; // default implementation == unknown device or qvfb |
275 | } | 271 | } |
276 | 272 | ||
277 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | ||
278 | |||
279 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | ||
280 | |||
281 | /* VESA Blanking Levels */ | ||
282 | #define VESA_NO_BLANKING 0 | ||
283 | #define VESA_VSYNC_SUSPEND 1 | ||
284 | #define VESA_HSYNC_SUSPEND 2 | ||
285 | #define VESA_POWERDOWN 3 | ||
286 | |||
287 | /** | 273 | /** |
288 | * This sets the display on or off | 274 | * This sets the display on or off |
289 | */ | 275 | */ |
290 | bool ODevice::setDisplayStatus( bool on ) | 276 | bool ODevice::setDisplayStatus( bool on ) |
291 | { | 277 | { |
292 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); | 278 | qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); |
293 | return false; // don't do anything for unknown models | 279 | return false; // don't do anything for unknown models |
294 | } | 280 | } |
295 | 281 | ||
296 | /** | 282 | /** |
297 | * This sets the display brightness | 283 | * This sets the display brightness |
298 | * | 284 | * |
299 | * @param b The brightness to be set on a scale from 0 to 255 | 285 | * @param b The brightness to be set on a scale from 0 to 255 |
300 | * @return success or failure | 286 | * @return success or failure |
301 | */ | 287 | */ |
302 | bool ODevice::setDisplayBrightness( int b ) | 288 | bool ODevice::setDisplayBrightness( int b ) |
303 | { | 289 | { |
304 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); | 290 | qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); |
305 | return false; | 291 | return false; |
306 | } | 292 | } |
307 | 293 | ||
308 | /** | 294 | /** |
309 | * | 295 | * |
310 | * @returns the number of steppings on the brightness slider | 296 | * @returns the number of steppings on the brightness slider |
311 | * in the Light-'n-Power settings. Values smaller than zero and bigger | 297 | * in the Light-'n-Power settings. Values smaller than zero and bigger |
312 | * than 255 do not make sense. | 298 | * than 255 do not make sense. |
313 | * | 299 | * |
314 | * \sa QSlider::setLineStep | 300 | * \sa QSlider::setLineStep |
315 | * \sa QSlider::setPageStep | 301 | * \sa QSlider::setPageStep |
316 | */ | 302 | */ |
317 | int ODevice::displayBrightnessResolution() const | 303 | int ODevice::displayBrightnessResolution() const |
318 | { | 304 | { |
319 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); | 305 | qDebug( "ODevice::displayBrightnessResolution() - please override me." ); |
320 | return 16; | 306 | return 16; |
321 | } | 307 | } |
322 | 308 | ||
323 | /** | 309 | /** |
324 | * This sets the display contrast | 310 | * This sets the display contrast |
325 | * @param p The contrast to be set on a scale from 0 to 255 | 311 | * @param p The contrast to be set on a scale from 0 to 255 |
326 | * @returns success or failure | 312 | * @returns success or failure |
327 | */ | 313 | */ |
328 | bool ODevice::setDisplayContrast( int p ) | 314 | bool ODevice::setDisplayContrast( int p ) |
329 | { | 315 | { |
330 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); | 316 | qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); |
331 | return false; | 317 | return false; |
332 | } | 318 | } |
333 | 319 | ||
334 | /** | 320 | /** |
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp new file mode 100644 index 0000000..f3f6af5 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.cpp | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> | ||
4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> | ||
5 | Copyright (C) 2002, 2003 Robert Griebl <sandman@handhelds.org> | ||
6 | |||
7 | |||
8 | =. | ||
9 | .=l. | ||
10 | .>+-= | ||
11 | _;:, .> :=|. This program is free software; you can | ||
12 | .> <`_, > . <= redistribute it and/or modify it under | ||
13 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
14 | .="- .-=="i, .._ License as published by the Free Software | ||
15 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
16 | ._= =} : or (at your option) any later version. | ||
17 | .%`+i> _;_. | ||
18 | .i_,=:_. -<s. This program is distributed in the hope that | ||
19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
20 | : .. .:, . . . without even the implied warranty of | ||
21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
23 | ..}^=.= = ; Library General Public License for more | ||
24 | ++= -. .` .: details. | ||
25 | : = ...= . :.=- | ||
26 | -. .:....=;==+<; You should have received a copy of the GNU | ||
27 | -_. . . )=. = Library General Public License along with | ||
28 | -- :-=` this library; see the file COPYING.LIB. | ||
29 | If not, write to the Free Software Foundation, | ||
30 | Inc., 59 Temple Place - Suite 330, | ||
31 | Boston, MA 02111-1307, USA. | ||
32 | */ | ||
33 | |||
34 | #include "odevice_abstractmobiledevice.h" | ||
35 | |||
36 | #include <sys/time.h> | ||
37 | #include <sys/ioctl.h> | ||
38 | |||
39 | #include <time.h> | ||
40 | #include <fcntl.h> | ||
41 | #include <unistd.h> | ||
42 | #include <stdlib.h> | ||
43 | |||
44 | namespace Opie { | ||
45 | namespace Core { | ||
46 | OAbstractMobileDevice::OAbstractMobileDevice() | ||
47 | : m_timeOut( 1500 ) | ||
48 | {} | ||
49 | |||
50 | /** | ||
51 | * @short Time to wait for the asynchronos APM implementation to suspend | ||
52 | * | ||
53 | * Milli Seconds to wait before returning from the suspend method. | ||
54 | * This is needed due asynchrnonus implementations of the APM bios. | ||
55 | * | ||
56 | */ | ||
57 | void OAbstractMobileDevice::setAPMTimeOut( int time ) { | ||
58 | m_timeOut = time; | ||
59 | } | ||
60 | |||
61 | |||
62 | bool OAbstractMobileDevice::suspend() { | ||
63 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
64 | return false; | ||
65 | |||
66 | bool res = false; | ||
67 | ODevice::sendSuspendmsg(); | ||
68 | |||
69 | struct timeval tvs, tvn; | ||
70 | ::gettimeofday ( &tvs, 0 ); | ||
71 | |||
72 | ::sync(); // flush fs caches | ||
73 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
74 | |||
75 | // This is needed because some apm implementations are asynchronous and we | ||
76 | // can not be sure when exactly the device is really suspended | ||
77 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | ||
78 | |||
79 | if ( res ) { | ||
80 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | ||
81 | ::usleep ( 200 * 1000 ); | ||
82 | ::gettimeofday ( &tvn, 0 ); | ||
83 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); | ||
84 | } | ||
85 | |||
86 | return res; | ||
87 | } | ||
88 | |||
89 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | ||
90 | |||
91 | // _IO and friends are only defined in kernel headers ... | ||
92 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | ||
93 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | ||
94 | |||
95 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | ||
96 | |||
97 | /* VESA Blanking Levels */ | ||
98 | #define VESA_NO_BLANKING 0 | ||
99 | #define VESA_VSYNC_SUSPEND 1 | ||
100 | #define VESA_HSYNC_SUSPEND 2 | ||
101 | #define VESA_POWERDOWN 3 | ||
102 | |||
103 | bool OAbstractMobileDevice::setDisplayStatus ( bool on ) { | ||
104 | bool res = false; | ||
105 | int fd; | ||
106 | |||
107 | #ifdef QT_QWS_DEVFS | ||
108 | if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) { | ||
109 | #else | ||
110 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | ||
111 | #endif | ||
112 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | ||
113 | ::close ( fd ); | ||
114 | } | ||
115 | |||
116 | return res; | ||
117 | } | ||
118 | } | ||
119 | } | ||
diff --git a/libopie2/opiecore/device/odevice_abstractmobiledevice.h b/libopie2/opiecore/device/odevice_abstractmobiledevice.h new file mode 100644 index 0000000..9467e82 --- a/dev/null +++ b/libopie2/opiecore/device/odevice_abstractmobiledevice.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) 2004, 2005 Holger Hans Peter Freyther <freyther@handhelds.org> | ||
4 | Copyright (C) 2004, 2005 Michael 'mickey' Lauer <mickeyl@handhelds.org> | ||
5 | |||
6 | |||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | */ | ||
32 | |||
33 | #ifndef OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE | ||
34 | #define OPIE_CORE_DEVICE_ABSTRACT_MOBILE_DEVICE | ||
35 | |||
36 | #include "odevice.h" | ||
37 | |||
38 | namespace Opie { | ||
39 | namespace Core { | ||
40 | /** | ||
41 | * @short Common Implementations for Linux Handheld Devices | ||
42 | * | ||
43 | * Abstract Class with implementation for suspending using | ||
44 | * asynchrnonus apm implementations and displaystatus using | ||
45 | * the Linux Frame Buffer API | ||
46 | * | ||
47 | */ | ||
48 | class OAbstractMobileDevice : public ODevice { | ||
49 | Q_OBJECT | ||
50 | protected: | ||
51 | OAbstractMobileDevice(); | ||
52 | void setAPMTimeOut( int time ); | ||
53 | public: | ||
54 | virtual bool suspend(); | ||
55 | virtual bool setDisplayStatus(bool); | ||
56 | |||
57 | private: | ||
58 | int m_timeOut; | ||
59 | }; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | |||
64 | #endif | ||
diff --git a/libopie2/opiecore/device/odevice_beagle.h b/libopie2/opiecore/device/odevice_beagle.h index 17b040c..697d689 100644 --- a/libopie2/opiecore/device/odevice_beagle.h +++ b/libopie2/opiecore/device/odevice_beagle.h | |||
@@ -1,61 +1,61 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2004 The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2004 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OPIE_CORE_DEVICE_BEAGLE_H | 30 | #ifndef OPIE_CORE_DEVICE_BEAGLE_H |
31 | #define OPIE_CORE_DEVICE_BEAGLE_H | 31 | #define OPIE_CORE_DEVICE_BEAGLE_H |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | namespace Core { | 36 | namespace Core { |
37 | namespace Internal { | 37 | namespace Internal { |
38 | class Beagle : public ODevice { | 38 | class Beagle : public OAbstractMobileDevice { |
39 | public: | 39 | public: |
40 | Beagle(); | 40 | Beagle(); |
41 | ~Beagle(); | 41 | ~Beagle(); |
42 | 42 | ||
43 | //@{ | 43 | //@{ |
44 | void init( const QString& init ); | 44 | void init( const QString& init ); |
45 | void initButtons(); | 45 | void initButtons(); |
46 | //@} | 46 | //@} |
47 | 47 | ||
48 | 48 | ||
49 | //@{ | 49 | //@{ |
50 | bool setDisplayStatus( bool on ); | 50 | bool setDisplayStatus( bool on ); |
51 | int displayBrightnessResolution()const; | 51 | int displayBrightnessResolution()const; |
52 | bool setDisplayBrightness( int brightness ); | 52 | bool setDisplayBrightness( int brightness ); |
53 | //@} | 53 | //@} |
54 | 54 | ||
55 | }; | 55 | }; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | #endif | 61 | #endif |
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h index b1dac74..1889467 100644 --- a/libopie2/opiecore/device/odevice_ipaq.h +++ b/libopie2/opiecore/device/odevice_ipaq.h | |||
@@ -1,88 +1,88 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_IPAQ | 30 | #ifndef ODEVICE_IPAQ |
31 | #define ODEVICE_IPAQ | 31 | #define ODEVICE_IPAQ |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | namespace Opie { | 38 | namespace Opie { |
39 | namespace Core { | 39 | namespace Core { |
40 | namespace Internal { | 40 | namespace Internal { |
41 | 41 | ||
42 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter | 42 | class iPAQ : public OAbstractMobileDevice, public QWSServer::KeyboardFilter |
43 | { | 43 | { |
44 | 44 | ||
45 | protected: | 45 | protected: |
46 | virtual void init(const QString&); | 46 | virtual void init(const QString&); |
47 | virtual void initButtons(); | 47 | virtual void initButtons(); |
48 | 48 | ||
49 | public: | 49 | public: |
50 | virtual bool setDisplayBrightness( int b ); | 50 | virtual bool setDisplayBrightness( int b ); |
51 | virtual int displayBrightnessResolution() const; | 51 | virtual int displayBrightnessResolution() const; |
52 | 52 | ||
53 | virtual void playAlarmSound(); | 53 | virtual void playAlarmSound(); |
54 | 54 | ||
55 | virtual QValueList <OLed> ledList() const; | 55 | virtual QValueList <OLed> ledList() const; |
56 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | 56 | virtual QValueList <OLedState> ledStateList( OLed led ) const; |
57 | virtual OLedState ledState( OLed led ) const; | 57 | virtual OLedState ledState( OLed led ) const; |
58 | virtual bool setLedState( OLed led, OLedState st ); | 58 | virtual bool setLedState( OLed led, OLedState st ); |
59 | 59 | ||
60 | virtual bool hasLightSensor() const; | 60 | virtual bool hasLightSensor() const; |
61 | virtual int readLightSensor(); | 61 | virtual int readLightSensor(); |
62 | virtual int lightSensorResolution() const; | 62 | virtual int lightSensorResolution() const; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 65 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
66 | virtual void timerEvent( QTimerEvent *te ); | 66 | virtual void timerEvent( QTimerEvent *te ); |
67 | 67 | ||
68 | int m_power_timer; | 68 | int m_power_timer; |
69 | 69 | ||
70 | OLedState m_leds [2]; | 70 | OLedState m_leds [2]; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | struct i_button { | 73 | struct i_button { |
74 | uint model; | 74 | uint model; |
75 | Qt::Key code; | 75 | Qt::Key code; |
76 | char *utext; | 76 | char *utext; |
77 | char *pix; | 77 | char *pix; |
78 | char *fpressedservice; | 78 | char *fpressedservice; |
79 | char *fpressedaction; | 79 | char *fpressedaction; |
80 | char *fheldservice; | 80 | char *fheldservice; |
81 | char *fheldaction; | 81 | char *fheldaction; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | } | 84 | } |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | #endif | 88 | #endif |
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 8141f1c..5f95e42 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -125,80 +125,59 @@ void Jornada::initButtons() | |||
125 | 125 | ||
126 | d->m_buttons = new QValueList <ODeviceButton>; | 126 | d->m_buttons = new QValueList <ODeviceButton>; |
127 | 127 | ||
128 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { | 128 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { |
129 | j_button *ib = jornada56x_buttons + i; | 129 | j_button *ib = jornada56x_buttons + i; |
130 | ODeviceButton b; | 130 | ODeviceButton b; |
131 | 131 | ||
132 | if (( ib->model & d->m_model ) == d->m_model ) { | 132 | if (( ib->model & d->m_model ) == d->m_model ) { |
133 | b. setKeycode ( ib->code ); | 133 | b. setKeycode ( ib->code ); |
134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
138 | 138 | ||
139 | d->m_buttons->append ( b ); | 139 | d->m_buttons->append ( b ); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | reloadButtonMapping(); | 142 | reloadButtonMapping(); |
143 | } | 143 | } |
144 | 144 | ||
145 | int Jornada::displayBrightnessResolution() const | 145 | int Jornada::displayBrightnessResolution() const |
146 | { | 146 | { |
147 | return 255; | 147 | return 255; |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | bool Jornada::setDisplayBrightness( int bright ) | 151 | bool Jornada::setDisplayBrightness( int bright ) |
152 | { | 152 | { |
153 | bool res = false; | 153 | bool res = false; |
154 | 154 | ||
155 | if ( bright > 255 ) | 155 | if ( bright > 255 ) |
156 | bright = 255; | 156 | bright = 255; |
157 | if ( bright < 0 ) | 157 | if ( bright < 0 ) |
158 | bright = 0; | 158 | bright = 0; |
159 | 159 | ||
160 | QString cmdline; | 160 | QString cmdline; |
161 | 161 | ||
162 | if ( !bright ) | 162 | if ( !bright ) |
163 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 163 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
164 | else | 164 | else |
165 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); | 165 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); |
166 | 166 | ||
167 | res = ( ::system( (const char*) cmdline ) == 0 ); | 167 | res = ( ::system( (const char*) cmdline ) == 0 ); |
168 | 168 | ||
169 | return res; | 169 | return res; |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | bool Jornada::suspend( ) | ||
174 | { | ||
175 | qDebug("ODevice::suspend"); | ||
176 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
177 | return false; | ||
178 | |||
179 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | ||
180 | return false; | ||
181 | |||
182 | bool res = false; | ||
183 | ODevice::sendSuspendmsg(); | ||
184 | |||
185 | struct timeval tvs; | ||
186 | ::gettimeofday ( &tvs, 0 ); | ||
187 | |||
188 | ::sync(); // flush fs caches | ||
189 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
190 | |||
191 | return res; | ||
192 | } | ||
193 | |||
194 | bool Jornada::setDisplayStatus ( bool on ) | 173 | bool Jornada::setDisplayStatus ( bool on ) |
195 | { | 174 | { |
196 | bool res = false; | 175 | bool res = false; |
197 | 176 | ||
198 | QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 177 | QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
199 | 178 | ||
200 | res = ( ::system( (const char*) cmdline ) == 0 ); | 179 | res = ( ::system( (const char*) cmdline ) == 0 ); |
201 | 180 | ||
202 | return res; | 181 | return res; |
203 | } | 182 | } |
204 | 183 | ||
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h index b17fa8b..480efff 100644 --- a/libopie2/opiecore/device/odevice_jornada.h +++ b/libopie2/opiecore/device/odevice_jornada.h | |||
@@ -1,67 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_JORNADA | 30 | #ifndef ODEVICE_JORNADA |
31 | #define ODEVICE_JORNADA | 31 | #define ODEVICE_JORNADA |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | namespace Core { | 36 | namespace Core { |
37 | namespace Internal { | 37 | namespace Internal { |
38 | class Jornada : public ODevice | 38 | class Jornada : public OAbstractMobileDevice |
39 | { | 39 | { |
40 | 40 | ||
41 | protected: | 41 | protected: |
42 | virtual void init(const QString&); | 42 | virtual void init(const QString&); |
43 | virtual void initButtons(); | 43 | virtual void initButtons(); |
44 | 44 | ||
45 | public: | 45 | public: |
46 | virtual bool suspend ( ); | ||
47 | virtual bool setDisplayBrightness ( int b ); | 46 | virtual bool setDisplayBrightness ( int b ); |
48 | virtual bool setDisplayStatus ( bool on); | 47 | virtual bool setDisplayStatus ( bool on); |
49 | virtual int displayBrightnessResolution() const; | 48 | virtual int displayBrightnessResolution() const; |
50 | }; | 49 | }; |
51 | 50 | ||
52 | struct j_button { | 51 | struct j_button { |
53 | uint model; | 52 | uint model; |
54 | Qt::Key code; | 53 | Qt::Key code; |
55 | char *utext; | 54 | char *utext; |
56 | char *pix; | 55 | char *pix; |
57 | char *fpressedservice; | 56 | char *fpressedservice; |
58 | char *fpressedaction; | 57 | char *fpressedaction; |
59 | char *fheldservice; | 58 | char *fheldservice; |
60 | char *fheldaction; | 59 | char *fheldaction; |
61 | }; | 60 | }; |
62 | 61 | ||
63 | } | 62 | } |
64 | } | 63 | } |
65 | } | 64 | } |
66 | #endif | 65 | #endif |
67 | 66 | ||
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h index bbd3862..50963dc 100644 --- a/libopie2/opiecore/device/odevice_ramses.h +++ b/libopie2/opiecore/device/odevice_ramses.h | |||
@@ -1,69 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_RAMSES | 30 | #ifndef ODEVICE_RAMSES |
31 | #define ODEVICE_RAMSES | 31 | #define ODEVICE_RAMSES |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qwindowsystem_qws.h> | 35 | #include <qwindowsystem_qws.h> |
36 | 36 | ||
37 | 37 | ||
38 | #ifndef OD_IOC | 38 | #ifndef OD_IOC |
39 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 39 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
40 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 40 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
41 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 41 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
42 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 42 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
43 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 43 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | namespace Opie { | 48 | namespace Opie { |
49 | namespace Core { | 49 | namespace Core { |
50 | namespace Internal { | 50 | namespace Internal { |
51 | 51 | ||
52 | class Ramses : public ODevice | 52 | class Ramses : public ODevice |
53 | { | 53 | { |
54 | protected: | 54 | protected: |
55 | virtual void init(const QString&); | 55 | virtual void init(const QString&); |
56 | 56 | ||
57 | public: | 57 | public: |
58 | virtual bool suspend(); | 58 | virtual bool suspend(); |
59 | 59 | ||
60 | virtual bool setDisplayBrightness( int b ); | 60 | virtual bool setDisplayBrightness( int b ); |
61 | virtual int displayBrightnessResolution() const; | 61 | virtual int displayBrightnessResolution() const; |
62 | virtual void playAlarmSound(); | 62 | virtual void playAlarmSound(); |
63 | }; | 63 | }; |
64 | 64 | ||
65 | } | 65 | } |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | #endif | 69 | #endif |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index d6c2c80..550da5e 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -287,97 +287,97 @@ OLedState SIMpad::ledState ( OLed l ) const | |||
287 | case Led_Power: | 287 | case Led_Power: |
288 | return m_leds [0]; | 288 | return m_leds [0]; |
289 | //case Led_Mail: | 289 | //case Led_Mail: |
290 | // return m_leds [1]; | 290 | // return m_leds [1]; |
291 | default: | 291 | default: |
292 | return Led_Off; | 292 | return Led_Off; |
293 | } | 293 | } |
294 | } | 294 | } |
295 | 295 | ||
296 | bool SIMpad::setLedState ( OLed l, OLedState st ) | 296 | bool SIMpad::setLedState ( OLed l, OLedState st ) |
297 | { | 297 | { |
298 | if ( l == Led_Power ) { | 298 | if ( l == Led_Power ) { |
299 | m_leds [0] = st; | 299 | m_leds [0] = st; |
300 | setCS3Bit(st == Led_On, SIMPAD_LED2_ON); | 300 | setCS3Bit(st == Led_On, SIMPAD_LED2_ON); |
301 | return true; | 301 | return true; |
302 | } | 302 | } |
303 | 303 | ||
304 | return false; | 304 | return false; |
305 | } | 305 | } |
306 | 306 | ||
307 | void SIMpad::timerEvent ( QTimerEvent * ) | 307 | void SIMpad::timerEvent ( QTimerEvent * ) |
308 | { | 308 | { |
309 | killTimer ( m_power_timer ); | 309 | killTimer ( m_power_timer ); |
310 | m_power_timer = 0; | 310 | m_power_timer = 0; |
311 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 311 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
312 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 312 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
313 | } | 313 | } |
314 | 314 | ||
315 | 315 | ||
316 | void SIMpad::playAlarmSound() | 316 | void SIMpad::playAlarmSound() |
317 | { | 317 | { |
318 | #ifndef QT_NO_SOUND | 318 | #ifndef QT_NO_SOUND |
319 | static Sound snd ( "alarm" ); | 319 | static Sound snd ( "alarm" ); |
320 | if(!snd.isFinished()) | 320 | if(!snd.isFinished()) |
321 | return; | 321 | return; |
322 | 322 | ||
323 | /* save as the Sound is static! */ | 323 | /* save as the Sound is static! */ |
324 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); | 324 | changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); |
325 | snd. play(); | 325 | snd. play(); |
326 | #endif | 326 | #endif |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm | 330 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm |
331 | { | 331 | { |
332 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 332 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
333 | return false; | 333 | return false; |
334 | 334 | ||
335 | bool res = ODevice::suspend(); | 335 | bool res = OAbstractMobileDevice::suspend(); |
336 | 336 | ||
337 | /* | 337 | /* |
338 | * restore the screen content if we really | 338 | * restore the screen content if we really |
339 | * supended the device | 339 | * supended the device |
340 | */ | 340 | */ |
341 | if ( res ) | 341 | if ( res ) |
342 | updateAllWidgets(); | 342 | updateAllWidgets(); |
343 | 343 | ||
344 | return res; | 344 | return res; |
345 | } | 345 | } |
346 | 346 | ||
347 | bool SIMpad::setDisplayStatus ( bool on ) | 347 | bool SIMpad::setDisplayStatus ( bool on ) |
348 | { | 348 | { |
349 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); | 349 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); |
350 | 350 | ||
351 | return setCS3Bit(on, SIMPAD_DISPLAY_ON); | 351 | return setCS3Bit(on, SIMPAD_DISPLAY_ON); |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | bool SIMpad::setDisplayBrightness ( int bright ) | 355 | bool SIMpad::setDisplayBrightness ( int bright ) |
356 | { | 356 | { |
357 | qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); | 357 | qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); |
358 | bool res = false; | 358 | bool res = false; |
359 | int fd; | 359 | int fd; |
360 | 360 | ||
361 | if ( bright > 255 ) | 361 | if ( bright > 255 ) |
362 | bright = 255; | 362 | bright = 255; |
363 | if ( bright < 1 ) | 363 | if ( bright < 1 ) |
364 | bright = 0; | 364 | bright = 0; |
365 | 365 | ||
366 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { | 366 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { |
367 | QCString str = QFile::encodeName( QString::number(bright)); | 367 | QCString str = QFile::encodeName( QString::number(bright)); |
368 | res = ( ::write(fd, str, str.length()) != -1 ); | 368 | res = ( ::write(fd, str, str.length()) != -1 ); |
369 | ::close ( fd ); | 369 | ::close ( fd ); |
370 | } | 370 | } |
371 | return res; | 371 | return res; |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
375 | int SIMpad::displayBrightnessResolution() const | 375 | int SIMpad::displayBrightnessResolution() const |
376 | { | 376 | { |
377 | return 255; // All SIMpad models share the same display | 377 | return 255; // All SIMpad models share the same display |
378 | } | 378 | } |
379 | 379 | ||
380 | 380 | ||
381 | /* | 381 | /* |
382 | * The MQ200 DRAM content is lost during suspend | 382 | * The MQ200 DRAM content is lost during suspend |
383 | * so we will just repaint every widget on resume | 383 | * so we will just repaint every widget on resume |
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index 41b94d1..1276603 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h | |||
@@ -1,75 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003, 2004 The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) 2003, 2004 The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_SIMPAD | 30 | #ifndef ODEVICE_SIMPAD |
31 | #define ODEVICE_SIMPAD | 31 | #define ODEVICE_SIMPAD |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | namespace Opie { | 38 | namespace Opie { |
39 | namespace Core { | 39 | namespace Core { |
40 | namespace Internal { | 40 | namespace Internal { |
41 | 41 | ||
42 | class SIMpad : public ODevice | 42 | class SIMpad : public OAbstractMobileDevice |
43 | { | 43 | { |
44 | protected: | 44 | protected: |
45 | virtual void init(const QString&); | 45 | virtual void init(const QString&); |
46 | virtual void initButtons(); | 46 | virtual void initButtons(); |
47 | 47 | ||
48 | public: | 48 | public: |
49 | virtual bool suspend(); | 49 | virtual bool suspend(); |
50 | 50 | ||
51 | virtual bool setDisplayStatus( bool on ); | 51 | virtual bool setDisplayStatus( bool on ); |
52 | virtual bool setDisplayBrightness( int b ); | 52 | virtual bool setDisplayBrightness( int b ); |
53 | virtual int displayBrightnessResolution() const; | 53 | virtual int displayBrightnessResolution() const; |
54 | 54 | ||
55 | virtual void playAlarmSound(); | 55 | virtual void playAlarmSound(); |
56 | 56 | ||
57 | virtual QValueList <OLed> ledList() const; | 57 | virtual QValueList <OLed> ledList() const; |
58 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | 58 | virtual QValueList <OLedState> ledStateList( OLed led ) const; |
59 | virtual OLedState ledState( OLed led ) const; | 59 | virtual OLedState ledState( OLed led ) const; |
60 | virtual bool setLedState( OLed led, OLedState st ); | 60 | virtual bool setLedState( OLed led, OLedState st ); |
61 | 61 | ||
62 | protected: | 62 | protected: |
63 | virtual void timerEvent( QTimerEvent *te ); | 63 | virtual void timerEvent( QTimerEvent *te ); |
64 | 64 | ||
65 | int m_power_timer; | 65 | int m_power_timer; |
66 | 66 | ||
67 | OLedState m_leds [2]; | 67 | OLedState m_leds [2]; |
68 | private: | 68 | private: |
69 | static void updateAllWidgets(); | 69 | static void updateAllWidgets(); |
70 | }; | 70 | }; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | #endif | 75 | #endif |
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h index f6bf061..02a19c9 100644 --- a/libopie2/opiecore/device/odevice_yopy.h +++ b/libopie2/opiecore/device/odevice_yopy.h | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_YOPY | 30 | #ifndef ODEVICE_YOPY |
31 | #define ODEVICE_YOPY | 31 | #define ODEVICE_YOPY |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | namespace Opie { | 35 | namespace Opie { |
36 | namespace Core { | 36 | namespace Core { |
37 | namespace Internal { | 37 | namespace Internal { |
38 | class Yopy : public ODevice | 38 | class Yopy : public OAbstractMobileDevice |
39 | { | 39 | { |
40 | protected: | 40 | protected: |
41 | 41 | ||
42 | virtual void init(const QString&); | 42 | virtual void init(const QString&); |
43 | virtual void initButtons(); | 43 | virtual void initButtons(); |
44 | 44 | ||
45 | public: | 45 | public: |
46 | virtual bool suspend(); | 46 | virtual bool suspend(); |
47 | 47 | ||
48 | virtual bool setDisplayBrightness ( int b ); | 48 | virtual bool setDisplayBrightness ( int b ); |
49 | virtual int displayBrightnessResolution() const; | 49 | virtual int displayBrightnessResolution() const; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct yopy_button | 52 | struct yopy_button |
53 | { | 53 | { |
54 | Qt::Key code; | 54 | Qt::Key code; |
55 | char *utext; | 55 | char *utext; |
56 | char *pix; | 56 | char *pix; |
57 | char *fpressedservice; | 57 | char *fpressedservice; |
58 | char *fpressedaction; | 58 | char *fpressedaction; |
59 | char *fheldservice; | 59 | char *fheldservice; |
60 | char *fheldaction; | 60 | char *fheldaction; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | } | 63 | } |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | #endif | 67 | #endif |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 82e127e..67dfa41 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -87,96 +87,100 @@ struct z_button z_buttons_c700 [] = { | |||
87 | "today", "raise()" }, | 87 | "today", "raise()" }, |
88 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 88 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
89 | "devicebuttons/z_contact", | 89 | "devicebuttons/z_contact", |
90 | "addressbook", "raise()", | 90 | "addressbook", "raise()", |
91 | "addressbook", "beamBusinessCard()" }, | 91 | "addressbook", "beamBusinessCard()" }, |
92 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 92 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
93 | "devicebuttons/z_home", | 93 | "devicebuttons/z_home", |
94 | "QPE/Launcher", "home()", | 94 | "QPE/Launcher", "home()", |
95 | "buttonsettings", "raise()" }, | 95 | "buttonsettings", "raise()" }, |
96 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 96 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
97 | "devicebuttons/z_menu", | 97 | "devicebuttons/z_menu", |
98 | "QPE/TaskBar", "toggleMenu()", | 98 | "QPE/TaskBar", "toggleMenu()", |
99 | "QPE/TaskBar", "toggleStartMenu()" }, | 99 | "QPE/TaskBar", "toggleStartMenu()" }, |
100 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 100 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
101 | "devicebuttons/z_mail", | 101 | "devicebuttons/z_mail", |
102 | "opiemail", "raise()", | 102 | "opiemail", "raise()", |
103 | "opiemail", "newMail()" }, | 103 | "opiemail", "newMail()" }, |
104 | 104 | ||
105 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), | 105 | { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), |
106 | "devicebuttons/z_hinge1", | 106 | "devicebuttons/z_hinge1", |
107 | "QPE/Rotation", "rotateDefault()", | 107 | "QPE/Rotation", "rotateDefault()", |
108 | "QPE/Rotation", "rotateDefault()" }, | 108 | "QPE/Rotation", "rotateDefault()" }, |
109 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), | 109 | { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), |
110 | "devicebuttons/z_hinge2", | 110 | "devicebuttons/z_hinge2", |
111 | "QPE/Rotation", "rotateDefault()", | 111 | "QPE/Rotation", "rotateDefault()", |
112 | "QPE/Rotation", "rotateDefault()" }, | 112 | "QPE/Rotation", "rotateDefault()" }, |
113 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), | 113 | { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), |
114 | "devicebuttons/z_hinge3", | 114 | "devicebuttons/z_hinge3", |
115 | "QPE/Rotation", "rotateDefault()", | 115 | "QPE/Rotation", "rotateDefault()", |
116 | "QPE/Rotation", "rotateDefault()" }, | 116 | "QPE/Rotation", "rotateDefault()" }, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 119 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
120 | // class up into individual classes. We need three classes | 120 | // class up into individual classes. We need three classes |
121 | // | 121 | // |
122 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 122 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
123 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 123 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
124 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) | 124 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) |
125 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) | 125 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) |
126 | // | 126 | // |
127 | // Only question right now is: Do we really need to do it? Because as soon | 127 | // Only question right now is: Do we really need to do it? Because as soon |
128 | // as the OpenZaurus kernel is ready, there will be a unified interface for all | 128 | // as the OpenZaurus kernel is ready, there will be a unified interface for all |
129 | // Zaurus models (concerning apm, backlight, buttons, etc.) | 129 | // Zaurus models (concerning apm, backlight, buttons, etc.) |
130 | // | 130 | // |
131 | // Comments? - mickeyl. | 131 | // Comments? - mickeyl. |
132 | 132 | ||
133 | void Zaurus::init(const QString& cpu_info) | 133 | void Zaurus::init(const QString& cpu_info) |
134 | { | 134 | { |
135 | // Set the time to wait until the system is realy suspended | ||
136 | // the delta between apm --suspend and sleeping | ||
137 | setAPMTimeOut( 15000 ); | ||
138 | |||
135 | // generic distribution code already scanned /etc/issue at that point - | 139 | // generic distribution code already scanned /etc/issue at that point - |
136 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 140 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
137 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 141 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
138 | { | 142 | { |
139 | d->m_vendorstr = "Sharp"; | 143 | d->m_vendorstr = "Sharp"; |
140 | d->m_vendor = Vendor_Sharp; | 144 | d->m_vendor = Vendor_Sharp; |
141 | d->m_systemstr = "Zaurus"; | 145 | d->m_systemstr = "Zaurus"; |
142 | d->m_system = System_Zaurus; | 146 | d->m_system = System_Zaurus; |
143 | m_embedix = true; | 147 | m_embedix = true; |
144 | } | 148 | } |
145 | else | 149 | else |
146 | { | 150 | { |
147 | d->m_vendorstr = "OpenZaurus Team"; | 151 | d->m_vendorstr = "OpenZaurus Team"; |
148 | d->m_systemstr = "OpenZaurus"; | 152 | d->m_systemstr = "OpenZaurus"; |
149 | d->m_system = System_OpenZaurus; | 153 | d->m_system = System_OpenZaurus; |
150 | // sysver already gathered | 154 | // sysver already gathered |
151 | 155 | ||
152 | // OpenZaurus sometimes uses the embedix kernel, check if this is one | 156 | // OpenZaurus sometimes uses the embedix kernel, check if this is one |
153 | FILE *uname = popen("uname -r", "r"); | 157 | FILE *uname = popen("uname -r", "r"); |
154 | QFile f; | 158 | QFile f; |
155 | QString line; | 159 | QString line; |
156 | if ( f.open(IO_ReadOnly, uname) ) { | 160 | if ( f.open(IO_ReadOnly, uname) ) { |
157 | QTextStream ts ( &f ); | 161 | QTextStream ts ( &f ); |
158 | line = ts. readLine(); | 162 | line = ts. readLine(); |
159 | int loc = line. find ( "embedix" ); | 163 | int loc = line. find ( "embedix" ); |
160 | if ( loc != -1 ) | 164 | if ( loc != -1 ) |
161 | m_embedix = true; | 165 | m_embedix = true; |
162 | else | 166 | else |
163 | m_embedix = false; | 167 | m_embedix = false; |
164 | f.close(); | 168 | f.close(); |
165 | } | 169 | } |
166 | pclose(uname); | 170 | pclose(uname); |
167 | } | 171 | } |
168 | 172 | ||
169 | // check the Zaurus model | 173 | // check the Zaurus model |
170 | QString model; | 174 | QString model; |
171 | int loc = cpu_info.find( ":" ); | 175 | int loc = cpu_info.find( ":" ); |
172 | if ( loc != -1 ) | 176 | if ( loc != -1 ) |
173 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 177 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
174 | else | 178 | else |
175 | model = cpu_info; | 179 | model = cpu_info; |
176 | 180 | ||
177 | if ( model == "SHARP Corgi" ) { | 181 | if ( model == "SHARP Corgi" ) { |
178 | d->m_model = Model_Zaurus_SLC7x0; | 182 | d->m_model = Model_Zaurus_SLC7x0; |
179 | d->m_modelstr = "Zaurus SL-C700"; | 183 | d->m_modelstr = "Zaurus SL-C700"; |
180 | } else if ( model == "SHARP Shepherd" ) { | 184 | } else if ( model == "SHARP Shepherd" ) { |
181 | d->m_model = Model_Zaurus_SLC7x0; | 185 | d->m_model = Model_Zaurus_SLC7x0; |
182 | d->m_modelstr = "Zaurus SL-C750"; | 186 | d->m_modelstr = "Zaurus SL-C750"; |
@@ -437,128 +441,96 @@ bool Zaurus::setDisplayBrightness( int bright ) | |||
437 | if ( fd ) | 441 | if ( fd ) |
438 | { | 442 | { |
439 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); | 443 | res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); |
440 | ::close( fd ); | 444 | ::close( fd ); |
441 | } | 445 | } |
442 | } | 446 | } |
443 | else | 447 | else |
444 | { | 448 | { |
445 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); | 449 | int fd = ::open( "/sys/class/backlight/corgi-bl/brightness", O_WRONLY|O_NONBLOCK ); |
446 | if ( fd ) | 450 | if ( fd ) |
447 | { | 451 | { |
448 | char buf[100]; | 452 | char buf[100]; |
449 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 453 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
450 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 454 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
451 | ::close( fd ); | 455 | ::close( fd ); |
452 | } | 456 | } |
453 | } | 457 | } |
454 | return res; | 458 | return res; |
455 | } | 459 | } |
456 | 460 | ||
457 | bool Zaurus::setDisplayStatus( bool on ) | 461 | bool Zaurus::setDisplayStatus( bool on ) |
458 | { | 462 | { |
459 | bool res = false; | 463 | bool res = false; |
460 | if ( m_embedix ) | 464 | if ( m_embedix ) |
461 | { | 465 | { |
462 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); | 466 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); |
463 | if ( fd ) | 467 | if ( fd ) |
464 | { | 468 | { |
465 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; | 469 | int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; |
466 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); | 470 | res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); |
467 | ::close ( fd ); | 471 | ::close ( fd ); |
468 | } | 472 | } |
469 | } | 473 | } |
470 | else | 474 | else |
471 | { | 475 | { |
472 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); | 476 | int fd = ::open( "/sys/class/backlight/corgi-bl/power", O_WRONLY|O_NONBLOCK ); |
473 | if ( fd ) | 477 | if ( fd ) |
474 | { | 478 | { |
475 | char buf[10]; | 479 | char buf[10]; |
476 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 480 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
477 | buf[1] = '\0'; | 481 | buf[1] = '\0'; |
478 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 482 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
479 | ::close( fd ); | 483 | ::close( fd ); |
480 | } | 484 | } |
481 | } | 485 | } |
482 | return res; | 486 | return res; |
483 | } | 487 | } |
484 | 488 | ||
485 | bool Zaurus::suspend() | ||
486 | { | ||
487 | qDebug("ODevice::suspend"); | ||
488 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | ||
489 | return false; | ||
490 | |||
491 | if ( d->m_model == Model_Unknown ) // better don't suspend on unknown devices | ||
492 | return false; | ||
493 | |||
494 | bool res = false; | ||
495 | ODevice::sendSuspendmsg(); | ||
496 | |||
497 | struct timeval tvs, tvn; | ||
498 | ::gettimeofday ( &tvs, 0 ); | ||
499 | |||
500 | ::sync(); // flush fs caches | ||
501 | res = ( ::system ( "apm --suspend" ) == 0 ); | ||
502 | |||
503 | // This is needed because the apm implementation is asynchronous and we | ||
504 | // can not be sure when exactly the device is really suspended | ||
505 | if ( res ) { | ||
506 | do { // Yes, wait 15 seconds. This APM sucks big time. | ||
507 | ::usleep ( 200 * 1000 ); | ||
508 | ::gettimeofday ( &tvn, 0 ); | ||
509 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); | ||
510 | } | ||
511 | |||
512 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); | ||
513 | return res; | ||
514 | } | ||
515 | |||
516 | |||
517 | Transformation Zaurus::rotation() const | 489 | Transformation Zaurus::rotation() const |
518 | { | 490 | { |
519 | qDebug( "Zaurus::rotation()" ); | 491 | qDebug( "Zaurus::rotation()" ); |
520 | Transformation rot; | 492 | Transformation rot; |
521 | 493 | ||
522 | switch ( d->m_model ) { | 494 | switch ( d->m_model ) { |
523 | case Model_Zaurus_SLC3000: // fallthrough | 495 | case Model_Zaurus_SLC3000: // fallthrough |
524 | case Model_Zaurus_SLC7x0: | 496 | case Model_Zaurus_SLC7x0: |
525 | { | 497 | { |
526 | OHingeStatus hs = readHingeSensor(); | 498 | OHingeStatus hs = readHingeSensor(); |
527 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); | 499 | qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); |
528 | 500 | ||
529 | if ( m_embedix ) | 501 | if ( m_embedix ) |
530 | { | 502 | { |
531 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 503 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
532 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 504 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
533 | else rot = Rot270; | 505 | else rot = Rot270; |
534 | } | 506 | } |
535 | else | 507 | else |
536 | { | 508 | { |
537 | if ( hs == CASE_PORTRAIT ) rot = Rot90; | 509 | if ( hs == CASE_PORTRAIT ) rot = Rot90; |
538 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 510 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
539 | else rot = Rot0; | 511 | else rot = Rot0; |
540 | } | 512 | } |
541 | } | 513 | } |
542 | break; | 514 | break; |
543 | case Model_Zaurus_SL6000: | 515 | case Model_Zaurus_SL6000: |
544 | case Model_Zaurus_SLB600: | 516 | case Model_Zaurus_SLB600: |
545 | case Model_Zaurus_SLA300: | 517 | case Model_Zaurus_SLA300: |
546 | case Model_Zaurus_SL5500: | 518 | case Model_Zaurus_SL5500: |
547 | case Model_Zaurus_SL5000: | 519 | case Model_Zaurus_SL5000: |
548 | default: | 520 | default: |
549 | rot = d->m_rotation; | 521 | rot = d->m_rotation; |
550 | break; | 522 | break; |
551 | } | 523 | } |
552 | 524 | ||
553 | return rot; | 525 | return rot; |
554 | } | 526 | } |
555 | ODirection Zaurus::direction() const | 527 | ODirection Zaurus::direction() const |
556 | { | 528 | { |
557 | ODirection dir; | 529 | ODirection dir; |
558 | 530 | ||
559 | switch ( d->m_model ) { | 531 | switch ( d->m_model ) { |
560 | case Model_Zaurus_SLC3000: // fallthrough | 532 | case Model_Zaurus_SLC3000: // fallthrough |
561 | case Model_Zaurus_SLC7x0: { | 533 | case Model_Zaurus_SLC7x0: { |
562 | OHingeStatus hs = readHingeSensor(); | 534 | OHingeStatus hs = readHingeSensor(); |
563 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 535 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
564 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 536 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 80593ce..6e6ca46 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -1,140 +1,139 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 4 | =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_ZAURUS | 30 | #ifndef ODEVICE_ZAURUS |
31 | #define ODEVICE_ZAURUS | 31 | #define ODEVICE_ZAURUS |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include "odevice_abstractmobiledevice.h" |
34 | 34 | ||
35 | #ifndef ARRAY_SIZE | 35 | #ifndef ARRAY_SIZE |
36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | // _IO and friends are only defined in kernel headers ... | 39 | // _IO and friends are only defined in kernel headers ... |
40 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 40 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
41 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 41 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
42 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 42 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
43 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 43 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
44 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 44 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
45 | 45 | ||
46 | // Audio | 46 | // Audio |
47 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 47 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
48 | 48 | ||
49 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 49 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
50 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 50 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
51 | 51 | ||
52 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 52 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
53 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 53 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
54 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 54 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
55 | 55 | ||
56 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 56 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
57 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 57 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
58 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 58 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
59 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 59 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
60 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 60 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
61 | 61 | ||
62 | // LED | 62 | // LED |
63 | #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 63 | #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
64 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 64 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
65 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 65 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
66 | 66 | ||
67 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 67 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
68 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 68 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
69 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 69 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
70 | 70 | ||
71 | // Rotation and Power Management | 71 | // Rotation and Power Management |
72 | #define SHARP_IOCTL_GET_ROTATION 0x413c | 72 | #define SHARP_IOCTL_GET_ROTATION 0x413c |
73 | 73 | ||
74 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 74 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
75 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 75 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
76 | #define APM_EVT_POWER_BUTTON (1 << 0) | 76 | #define APM_EVT_POWER_BUTTON (1 << 0) |
77 | 77 | ||
78 | // Brightness Embedix | 78 | // Brightness Embedix |
79 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" | 79 | #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" |
80 | #define SHARP_FL_IOCTL_ON 1 | 80 | #define SHARP_FL_IOCTL_ON 1 |
81 | #define SHARP_FL_IOCTL_OFF 2 | 81 | #define SHARP_FL_IOCTL_OFF 2 |
82 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 | 82 | #define SHARP_FL_IOCTL_STEP_CONTRAST 100 |
83 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 | 83 | #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 |
84 | #define SHARP_FL_IOCTL_GET_STEP 102 | 84 | #define SHARP_FL_IOCTL_GET_STEP 102 |
85 | 85 | ||
86 | // Vesa Standard | 86 | // Vesa Standard |
87 | #define FB_BLANK_UNBLANK 0 | 87 | #define FB_BLANK_UNBLANK 0 |
88 | #define FB_BLANK_POWERDOWN 4 | 88 | #define FB_BLANK_POWERDOWN 4 |
89 | 89 | ||
90 | namespace Opie { | 90 | namespace Opie { |
91 | namespace Core { | 91 | namespace Core { |
92 | namespace Internal { | 92 | namespace Internal { |
93 | 93 | ||
94 | class Zaurus : public ODevice | 94 | class Zaurus : public OAbstractMobileDevice |
95 | { | 95 | { |
96 | protected: | 96 | protected: |
97 | virtual void init(const QString&); | 97 | virtual void init(const QString&); |
98 | virtual void initButtons(); | 98 | virtual void initButtons(); |
99 | 99 | ||
100 | public: | 100 | public: |
101 | virtual bool setDisplayBrightness( int b ); | 101 | virtual bool setDisplayBrightness( int b ); |
102 | virtual bool setDisplayStatus( bool on ); | 102 | virtual bool setDisplayStatus( bool on ); |
103 | virtual int displayBrightnessResolution() const; | 103 | virtual int displayBrightnessResolution() const; |
104 | 104 | ||
105 | virtual void playAlarmSound(); | 105 | virtual void playAlarmSound(); |
106 | virtual void playKeySound(); | 106 | virtual void playKeySound(); |
107 | virtual void playTouchSound(); | 107 | virtual void playTouchSound(); |
108 | 108 | ||
109 | virtual QValueList <OLed> ledList() const; | 109 | virtual QValueList <OLed> ledList() const; |
110 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 110 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
111 | virtual OLedState ledState( OLed led ) const; | 111 | virtual OLedState ledState( OLed led ) const; |
112 | virtual bool setLedState( OLed led, OLedState st ); | 112 | virtual bool setLedState( OLed led, OLedState st ); |
113 | 113 | ||
114 | virtual bool hasHingeSensor() const; | 114 | virtual bool hasHingeSensor() const; |
115 | virtual OHingeStatus readHingeSensor() const; | 115 | virtual OHingeStatus readHingeSensor() const; |
116 | 116 | ||
117 | virtual bool suspend(); | ||
118 | virtual Transformation rotation() const; | 117 | virtual Transformation rotation() const; |
119 | virtual ODirection direction() const; | 118 | virtual ODirection direction() const; |
120 | 119 | ||
121 | protected: | 120 | protected: |
122 | virtual void buzzer( int snd ); | 121 | virtual void buzzer( int snd ); |
123 | 122 | ||
124 | OLedState m_leds[1]; | 123 | OLedState m_leds[1]; |
125 | bool m_embedix; | 124 | bool m_embedix; |
126 | }; | 125 | }; |
127 | 126 | ||
128 | struct z_button { | 127 | struct z_button { |
129 | Qt::Key code; | 128 | Qt::Key code; |
130 | char *utext; | 129 | char *utext; |
131 | char *pix; | 130 | char *pix; |
132 | char *fpressedservice; | 131 | char *fpressedservice; |
133 | char *fpressedaction; | 132 | char *fpressedaction; |
134 | char *fheldservice; | 133 | char *fheldservice; |
135 | char *fheldaction; | 134 | char *fheldaction; |
136 | }; | 135 | }; |
137 | } | 136 | } |
138 | } | 137 | } |
139 | } | 138 | } |
140 | #endif | 139 | #endif |