author | mickeyl <mickeyl> | 2005-01-23 21:35:29 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-23 21:35:29 (UTC) |
commit | dd410f1eb69e68f04cf26b6d3e6bca88f0987f71 (patch) (unidiff) | |
tree | 0f2b59bae4c326011783e9cdea0754e180ae0e27 /libopie2 | |
parent | 78e658cecc7521cf3932f5eb44d3f551d73f3181 (diff) | |
download | opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.zip opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.tar.gz opie-dd410f1eb69e68f04cf26b6d3e6bca88f0987f71.tar.bz2 |
remove setSoftSuspend() from ODevice. this is a left-over from the old days
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_genuineintel.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 21 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 44 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 2 |
8 files changed, 2 insertions, 82 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index a824392..3d69614 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -233,53 +233,48 @@ void ODevice::initButtons() | |||
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 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | ||
258 | { | ||
259 | return false; | ||
260 | } | ||
261 | |||
262 | //#include <linux/apm_bios.h> | 257 | //#include <linux/apm_bios.h> |
263 | 258 | ||
264 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 259 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
265 | 260 | ||
266 | /** | 261 | /** |
267 | * This method will try to suspend the device | 262 | * This method will try to suspend the device |
268 | * It only works if the user is the QWS Server and the apm application | 263 | * It only works if the user is the QWS Server and the apm application |
269 | * is installed. | 264 | * is installed. |
270 | * It tries to suspend and then waits some time cause some distributions | 265 | * It tries to suspend and then waits some time cause some distributions |
271 | * do have asynchronus apm implementations. | 266 | * do have asynchronus apm implementations. |
272 | * This method will either fail and return false or it'll suspend the | 267 | * This method will either fail and return false or it'll suspend the |
273 | * device and return once the device got woken up | 268 | * device and return once the device got woken up |
274 | * | 269 | * |
275 | * @return if the device got suspended | 270 | * @return if the device got suspended |
276 | */ | 271 | */ |
277 | bool ODevice::suspend() | 272 | bool ODevice::suspend() |
278 | { | 273 | { |
279 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 274 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
280 | return false; | 275 | return false; |
281 | 276 | ||
282 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 277 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
283 | return false; | 278 | return false; |
284 | 279 | ||
285 | bool res = false; | 280 | bool res = false; |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index bbc32fa..96a41fc 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -234,50 +234,48 @@ protected: | |||
234 | public: | 234 | public: |
235 | // sandman do we want to allow destructions? -zecke? | 235 | // sandman do we want to allow destructions? -zecke? |
236 | virtual ~ODevice(); | 236 | virtual ~ODevice(); |
237 | 237 | ||
238 | static ODevice *inst(); | 238 | static ODevice *inst(); |
239 | 239 | ||
240 | // information | 240 | // information |
241 | 241 | ||
242 | QString modelString() const; | 242 | QString modelString() const; |
243 | OModel model() const; | 243 | OModel model() const; |
244 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } | 244 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } |
245 | 245 | ||
246 | QString vendorString() const; | 246 | QString vendorString() const; |
247 | OVendor vendor() const; | 247 | OVendor vendor() const; |
248 | 248 | ||
249 | QString systemString() const; | 249 | QString systemString() const; |
250 | OSystem system() const; | 250 | OSystem system() const; |
251 | 251 | ||
252 | QString systemVersionString() const; | 252 | QString systemVersionString() const; |
253 | 253 | ||
254 | virtual Transformation rotation() const; | 254 | virtual Transformation rotation() const; |
255 | virtual ODirection direction() const; | 255 | virtual ODirection direction() const; |
256 | 256 | ||
257 | // system | 257 | // system |
258 | |||
259 | virtual bool setSoftSuspend ( bool on ); | ||
260 | virtual bool suspend(); | 258 | virtual bool suspend(); |
261 | 259 | ||
262 | virtual bool setDisplayStatus ( bool on ); | 260 | virtual bool setDisplayStatus ( bool on ); |
263 | virtual bool setDisplayBrightness ( int brightness ); | 261 | virtual bool setDisplayBrightness ( int brightness ); |
264 | virtual int displayBrightnessResolution() const; | 262 | virtual int displayBrightnessResolution() const; |
265 | virtual bool setDisplayContrast ( int contrast ); | 263 | virtual bool setDisplayContrast ( int contrast ); |
266 | virtual int displayContrastResolution() const; | 264 | virtual int displayContrastResolution() const; |
267 | 265 | ||
268 | // don't add new virtual methods, use this: | 266 | // don't add new virtual methods, use this: |
269 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 267 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
270 | // and in your subclass do overwrite | 268 | // and in your subclass do overwrite |
271 | // protected virtual int virtual_hook(int, void *) | 269 | // protected virtual int virtual_hook(int, void *) |
272 | // which is defined below | 270 | // which is defined below |
273 | 271 | ||
274 | // input / output | 272 | // input / output |
275 | virtual void playAlarmSound(); | 273 | virtual void playAlarmSound(); |
276 | virtual void playKeySound(); | 274 | virtual void playKeySound(); |
277 | virtual void playTouchSound(); | 275 | virtual void playTouchSound(); |
278 | 276 | ||
279 | virtual QValueList <OLed> ledList() const; | 277 | virtual QValueList <OLed> ledList() const; |
280 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 278 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
281 | virtual OLedState ledState ( OLed led ) const; | 279 | virtual OLedState ledState ( OLed led ) const; |
282 | virtual bool setLedState ( OLed led, OLedState st ); | 280 | virtual bool setLedState ( OLed led, OLedState st ); |
283 | 281 | ||
diff --git a/libopie2/opiecore/device/odevice_genuineintel.cpp b/libopie2/opiecore/device/odevice_genuineintel.cpp index 61ba052..1584249 100644 --- a/libopie2/opiecore/device/odevice_genuineintel.cpp +++ b/libopie2/opiecore/device/odevice_genuineintel.cpp | |||
@@ -139,54 +139,48 @@ OLedState GenuineIntel::ledState ( OLed ) const | |||
139 | bool GenuineIntel::setLedState ( OLed , OLedState ) | 139 | bool GenuineIntel::setLedState ( OLed , OLedState ) |
140 | { | 140 | { |
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | bool GenuineIntel::filter ( int /*unicode*/, int , int , bool , bool ) | 145 | bool GenuineIntel::filter ( int /*unicode*/, int , int , bool , bool ) |
146 | { | 146 | { |
147 | return false; | 147 | return false; |
148 | } | 148 | } |
149 | 149 | ||
150 | void GenuineIntel::playAlarmSound() | 150 | void GenuineIntel::playAlarmSound() |
151 | { | 151 | { |
152 | #ifndef QT_NO_SOUND | 152 | #ifndef QT_NO_SOUND |
153 | static Sound snd ( "alarm" ); | 153 | static Sound snd ( "alarm" ); |
154 | if(!snd.isFinished()) | 154 | if(!snd.isFinished()) |
155 | return; | 155 | return; |
156 | 156 | ||
157 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | 157 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); |
158 | snd. play(); | 158 | snd. play(); |
159 | #endif | 159 | #endif |
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | bool GenuineIntel::setSoftSuspend ( bool ) | ||
164 | { | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | |||
169 | bool GenuineIntel::setDisplayBrightness ( int ) | 163 | bool GenuineIntel::setDisplayBrightness ( int ) |
170 | { | 164 | { |
171 | return false; | 165 | return false; |
172 | } | 166 | } |
173 | 167 | ||
174 | int GenuineIntel::displayBrightnessResolution() const | 168 | int GenuineIntel::displayBrightnessResolution() const |
175 | { | 169 | { |
176 | return 1; // perhaps to avoid division by zero | 170 | return 1; // perhaps to avoid division by zero |
177 | } | 171 | } |
178 | 172 | ||
179 | 173 | ||
180 | bool GenuineIntel::hasLightSensor() const | 174 | bool GenuineIntel::hasLightSensor() const |
181 | { | 175 | { |
182 | return false; | 176 | return false; |
183 | } | 177 | } |
184 | 178 | ||
185 | int GenuineIntel::readLightSensor() | 179 | int GenuineIntel::readLightSensor() |
186 | { | 180 | { |
187 | return 0; | 181 | return 0; |
188 | } | 182 | } |
189 | 183 | ||
190 | int GenuineIntel::lightSensorResolution() const | 184 | int GenuineIntel::lightSensorResolution() const |
191 | { | 185 | { |
192 | return 1; // see above | 186 | return 1; // see above |
diff --git a/libopie2/opiecore/device/odevice_genuineintel.h b/libopie2/opiecore/device/odevice_genuineintel.h index 52c5fc6..69316af 100644 --- a/libopie2/opiecore/device/odevice_genuineintel.h +++ b/libopie2/opiecore/device/odevice_genuineintel.h | |||
@@ -26,50 +26,48 @@ | |||
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_GENUINEINTEL | 30 | #ifndef ODEVICE_GENUINEINTEL |
31 | #define ODEVICE_GENUINEINTEL | 31 | #define ODEVICE_GENUINEINTEL |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice.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 GenuineIntel : public ODevice, public QWSServer::KeyboardFilter | 42 | class GenuineIntel : public ODevice, 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 setSoftSuspend( bool soft ); | ||
51 | |||
52 | virtual bool setDisplayBrightness( int b ); | 50 | virtual bool setDisplayBrightness( int b ); |
53 | virtual int displayBrightnessResolution() const; | 51 | virtual int displayBrightnessResolution() const; |
54 | 52 | ||
55 | virtual void playAlarmSound(); | 53 | virtual void playAlarmSound(); |
56 | 54 | ||
57 | virtual QValueList <OLed> ledList() const; | 55 | virtual QValueList <OLed> ledList() const; |
58 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | 56 | virtual QValueList <OLedState> ledStateList( OLed led ) const; |
59 | virtual OLedState ledState( OLed led ) const; | 57 | virtual OLedState ledState( OLed led ) const; |
60 | virtual bool setLedState( OLed led, OLedState st ); | 58 | virtual bool setLedState( OLed led, OLedState st ); |
61 | 59 | ||
62 | virtual bool hasLightSensor() const; | 60 | virtual bool hasLightSensor() const; |
63 | virtual int readLightSensor(); | 61 | virtual int readLightSensor(); |
64 | virtual int lightSensorResolution() const; | 62 | virtual int lightSensorResolution() const; |
65 | protected: | 63 | protected: |
66 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 64 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
67 | 65 | ||
68 | }; | 66 | }; |
69 | 67 | ||
70 | struct gi_button { | 68 | struct gi_button { |
71 | Qt::Key code; | 69 | Qt::Key code; |
72 | char *utext; | 70 | char *utext; |
73 | char *pix; | 71 | char *pix; |
74 | char *fpressedservice; | 72 | char *fpressedservice; |
75 | char *fpressedaction; | 73 | char *fpressedaction; |
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 9e01a0c..2ce38a9 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -315,69 +315,48 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
315 | return false; | 315 | return false; |
316 | } | 316 | } |
317 | 317 | ||
318 | void iPAQ::timerEvent ( QTimerEvent * ) | 318 | void iPAQ::timerEvent ( QTimerEvent * ) |
319 | { | 319 | { |
320 | killTimer ( m_power_timer ); | 320 | killTimer ( m_power_timer ); |
321 | m_power_timer = 0; | 321 | m_power_timer = 0; |
322 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 322 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
323 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 323 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | void iPAQ::playAlarmSound() | 327 | void iPAQ::playAlarmSound() |
328 | { | 328 | { |
329 | #ifndef QT_NO_SOUND | 329 | #ifndef QT_NO_SOUND |
330 | static Sound snd ( "alarm" ); | 330 | static Sound snd ( "alarm" ); |
331 | if(!snd.isFinished()) | 331 | if(!snd.isFinished()) |
332 | return; | 332 | return; |
333 | 333 | ||
334 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); | 334 | changeMixerForAlarm(0, "/dev/sound/mixer", &snd ); |
335 | snd. play(); | 335 | snd. play(); |
336 | #endif | 336 | #endif |
337 | } | 337 | } |
338 | 338 | ||
339 | |||
340 | bool iPAQ::setSoftSuspend ( bool soft ) | ||
341 | { | ||
342 | bool res = false; | ||
343 | int fd; | ||
344 | |||
345 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | ||
346 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | ||
347 | res = true; | ||
348 | else | ||
349 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | ||
350 | |||
351 | ::close ( fd ); | ||
352 | } | ||
353 | else | ||
354 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | ||
355 | |||
356 | return res; | ||
357 | } | ||
358 | |||
359 | |||
360 | bool iPAQ::setDisplayBrightness ( int bright ) | 339 | bool iPAQ::setDisplayBrightness ( int bright ) |
361 | { | 340 | { |
362 | bool res = false; | 341 | bool res = false; |
363 | int fd; | 342 | int fd; |
364 | 343 | ||
365 | if ( bright > 255 ) | 344 | if ( bright > 255 ) |
366 | bright = 255; | 345 | bright = 255; |
367 | if ( bright < 0 ) | 346 | if ( bright < 0 ) |
368 | bright = 0; | 347 | bright = 0; |
369 | 348 | ||
370 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 349 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
371 | FLITE_IN bl; | 350 | FLITE_IN bl; |
372 | bl. mode = 1; | 351 | bl. mode = 1; |
373 | bl. pwr = bright ? 1 : 0; | 352 | bl. pwr = bright ? 1 : 0; |
374 | bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; | 353 | bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; |
375 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 354 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
376 | ::close ( fd ); | 355 | ::close ( fd ); |
377 | } | 356 | } |
378 | return res; | 357 | return res; |
379 | } | 358 | } |
380 | 359 | ||
381 | int iPAQ::displayBrightnessResolution() const | 360 | int iPAQ::displayBrightnessResolution() const |
382 | { | 361 | { |
383 | switch ( model()) { | 362 | switch ( model()) { |
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h index cc0b8ac..b1dac74 100644 --- a/libopie2/opiecore/device/odevice_ipaq.h +++ b/libopie2/opiecore/device/odevice_ipaq.h | |||
@@ -26,50 +26,48 @@ | |||
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.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 ODevice, 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 setSoftSuspend( bool soft ); | ||
51 | |||
52 | virtual bool setDisplayBrightness( int b ); | 50 | virtual bool setDisplayBrightness( int b ); |
53 | virtual int displayBrightnessResolution() const; | 51 | virtual int displayBrightnessResolution() const; |
54 | 52 | ||
55 | virtual void playAlarmSound(); | 53 | virtual void playAlarmSound(); |
56 | 54 | ||
57 | virtual QValueList <OLed> ledList() const; | 55 | virtual QValueList <OLed> ledList() const; |
58 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | 56 | virtual QValueList <OLedState> ledStateList( OLed led ) const; |
59 | virtual OLedState ledState( OLed led ) const; | 57 | virtual OLedState ledState( OLed led ) const; |
60 | virtual bool setLedState( OLed led, OLedState st ); | 58 | virtual bool setLedState( OLed led, OLedState st ); |
61 | 59 | ||
62 | virtual bool hasLightSensor() const; | 60 | virtual bool hasLightSensor() const; |
63 | virtual int readLightSensor(); | 61 | virtual int readLightSensor(); |
64 | virtual int lightSensorResolution() const; | 62 | virtual int lightSensorResolution() const; |
65 | 63 | ||
66 | protected: | 64 | protected: |
67 | 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 ); |
68 | virtual void timerEvent( QTimerEvent *te ); | 66 | virtual void timerEvent( QTimerEvent *te ); |
69 | 67 | ||
70 | int m_power_timer; | 68 | int m_power_timer; |
71 | 69 | ||
72 | OLedState m_leds [2]; | 70 | OLedState m_leds [2]; |
73 | }; | 71 | }; |
74 | 72 | ||
75 | struct i_button { | 73 | struct i_button { |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index b22ee70..cbc7a24 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -359,85 +359,48 @@ bool Zaurus::setLedState( OLed which, OLedState st ) | |||
359 | 359 | ||
360 | if ( which == Led_Mail ) { | 360 | if ( which == Led_Mail ) { |
361 | if ( fd >= 0 ) { | 361 | if ( fd >= 0 ) { |
362 | struct sharp_led_status leds; | 362 | struct sharp_led_status leds; |
363 | ::memset ( &leds, 0, sizeof( leds )); | 363 | ::memset ( &leds, 0, sizeof( leds )); |
364 | leds. which = SHARP_LED_MAIL_EXISTS; | 364 | leds. which = SHARP_LED_MAIL_EXISTS; |
365 | bool ok = true; | 365 | bool ok = true; |
366 | 366 | ||
367 | switch ( st ) { | 367 | switch ( st ) { |
368 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; | 368 | case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; |
369 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; | 369 | case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; |
370 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; | 370 | case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; |
371 | default : ok = false; | 371 | default : ok = false; |
372 | } | 372 | } |
373 | 373 | ||
374 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { | 374 | if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { |
375 | m_leds [0] = st; | 375 | m_leds [0] = st; |
376 | return true; | 376 | return true; |
377 | } | 377 | } |
378 | } | 378 | } |
379 | } | 379 | } |
380 | return false; | 380 | return false; |
381 | } | 381 | } |
382 | 382 | ||
383 | bool Zaurus::setSoftSuspend ( bool soft ) | ||
384 | { | ||
385 | if (!m_embedix) { | ||
386 | /* non-Embedix kernels dont have kernel autosuspend */ | ||
387 | return ODevice::setSoftSuspend( soft ); | ||
388 | } | ||
389 | |||
390 | bool res = false; | ||
391 | int fd; | ||
392 | |||
393 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | ||
394 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | ||
395 | |||
396 | int sources = ::ioctl( fd, APM_IOCGEVTSRC, 0 ); // get current event sources | ||
397 | |||
398 | if ( sources >= 0 ) { | ||
399 | if ( soft ) | ||
400 | sources &= ~APM_EVT_POWER_BUTTON; | ||
401 | else | ||
402 | sources |= APM_EVT_POWER_BUTTON; | ||
403 | |||
404 | if ( ::ioctl( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources | ||
405 | res = true; | ||
406 | else | ||
407 | perror ( "APM_IOCGEVTSRC" ); | ||
408 | } | ||
409 | else | ||
410 | perror ( "APM_IOCGEVTSRC" ); | ||
411 | |||
412 | ::close( fd ); | ||
413 | } | ||
414 | else | ||
415 | perror( "/dev/apm_bios or /dev/misc/apm_bios" ); | ||
416 | |||
417 | return res; | ||
418 | } | ||
419 | |||
420 | int Zaurus::displayBrightnessResolution() const | 383 | int Zaurus::displayBrightnessResolution() const |
421 | { | 384 | { |
422 | int res = 1; | 385 | int res = 1; |
423 | if (m_embedix) | 386 | if (m_embedix) |
424 | { | 387 | { |
425 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); | 388 | int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); |
426 | if ( fd ) | 389 | if ( fd ) |
427 | { | 390 | { |
428 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); | 391 | int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); |
429 | ::close( fd ); | 392 | ::close( fd ); |
430 | return value ? value : res; | 393 | return value ? value : res; |
431 | } | 394 | } |
432 | } | 395 | } |
433 | else | 396 | else |
434 | { | 397 | { |
435 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); | 398 | int fd = ::open( "/sys/class/backlight/corgi-bl/max_brightness", O_RDONLY|O_NONBLOCK ); |
436 | if ( fd ) | 399 | if ( fd ) |
437 | { | 400 | { |
438 | char buf[100]; | 401 | char buf[100]; |
439 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); | 402 | if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); |
440 | ::close( fd ); | 403 | ::close( fd ); |
441 | } | 404 | } |
442 | } | 405 | } |
443 | return res; | 406 | return res; |
@@ -519,76 +482,73 @@ bool Zaurus::suspend() | |||
519 | 482 | ||
520 | struct timeval tvs, tvn; | 483 | struct timeval tvs, tvn; |
521 | ::gettimeofday ( &tvs, 0 ); | 484 | ::gettimeofday ( &tvs, 0 ); |
522 | 485 | ||
523 | ::sync(); // flush fs caches | 486 | ::sync(); // flush fs caches |
524 | res = ( ::system ( "apm --suspend" ) == 0 ); | 487 | res = ( ::system ( "apm --suspend" ) == 0 ); |
525 | 488 | ||
526 | // This is needed because the apm implementation is asynchronous and we | 489 | // This is needed because the apm implementation is asynchronous and we |
527 | // can not be sure when exactly the device is really suspended | 490 | // can not be sure when exactly the device is really suspended |
528 | if ( res ) { | 491 | if ( res ) { |
529 | do { // Yes, wait 15 seconds. This APM sucks big time. | 492 | do { // Yes, wait 15 seconds. This APM sucks big time. |
530 | ::usleep ( 200 * 1000 ); | 493 | ::usleep ( 200 * 1000 ); |
531 | ::gettimeofday ( &tvn, 0 ); | 494 | ::gettimeofday ( &tvn, 0 ); |
532 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); | 495 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); |
533 | } | 496 | } |
534 | 497 | ||
535 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); | 498 | QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); |
536 | return res; | 499 | return res; |
537 | } | 500 | } |
538 | 501 | ||
539 | 502 | ||
540 | Transformation Zaurus::rotation() const | 503 | Transformation Zaurus::rotation() const |
541 | { | 504 | { |
542 | Transformation rot; | 505 | Transformation rot; |
543 | int handle = 0; | 506 | |
544 | int retval = 0; | ||
545 | |||
546 | switch ( d->m_model ) { | 507 | switch ( d->m_model ) { |
547 | case Model_Zaurus_SLC3000: // fallthrough | 508 | case Model_Zaurus_SLC3000: // fallthrough |
548 | case Model_Zaurus_SLC7x0: | 509 | case Model_Zaurus_SLC7x0: |
549 | OHingeStatus hs = readHingeSensor(); | 510 | OHingeStatus hs = readHingeSensor(); |
550 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 511 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
551 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; | 512 | else if ( hs == CASE_UNKNOWN ) rot = Rot0; |
552 | else rot = Rot270; | 513 | else rot = Rot270; |
553 | break; | 514 | break; |
554 | case Model_Zaurus_SL6000: | 515 | case Model_Zaurus_SL6000: |
555 | case Model_Zaurus_SLB600: | 516 | case Model_Zaurus_SLB600: |
556 | case Model_Zaurus_SLA300: | 517 | case Model_Zaurus_SLA300: |
557 | case Model_Zaurus_SL5500: | 518 | case Model_Zaurus_SL5500: |
558 | case Model_Zaurus_SL5000: | 519 | case Model_Zaurus_SL5000: |
559 | default: | 520 | default: |
560 | rot = d->m_rotation; | 521 | rot = d->m_rotation; |
561 | break; | 522 | break; |
562 | } | 523 | } |
563 | 524 | ||
564 | return rot; | 525 | return rot; |
565 | } | 526 | } |
566 | ODirection Zaurus::direction() const | 527 | ODirection Zaurus::direction() const |
567 | { | 528 | { |
568 | ODirection dir; | 529 | ODirection dir; |
569 | int handle = 0; | 530 | |
570 | int retval = 0; | ||
571 | switch ( d->m_model ) { | 531 | switch ( d->m_model ) { |
572 | case Model_Zaurus_SLC3000: // fallthrough | 532 | case Model_Zaurus_SLC3000: // fallthrough |
573 | case Model_Zaurus_SLC7x0: | 533 | case Model_Zaurus_SLC7x0: |
574 | OHingeStatus hs = readHingeSensor(); | 534 | OHingeStatus hs = readHingeSensor(); |
575 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 535 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
576 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 536 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
577 | else dir = CW; | 537 | else dir = CW; |
578 | break; | 538 | break; |
579 | case Model_Zaurus_SL6000: | 539 | case Model_Zaurus_SL6000: |
580 | case Model_Zaurus_SLA300: | 540 | case Model_Zaurus_SLA300: |
581 | case Model_Zaurus_SLB600: | 541 | case Model_Zaurus_SLB600: |
582 | case Model_Zaurus_SL5500: | 542 | case Model_Zaurus_SL5500: |
583 | case Model_Zaurus_SL5000: | 543 | case Model_Zaurus_SL5000: |
584 | default: dir = d->m_direction; | 544 | default: dir = d->m_direction; |
585 | break; | 545 | break; |
586 | } | 546 | } |
587 | return dir; | 547 | return dir; |
588 | 548 | ||
589 | } | 549 | } |
590 | 550 | ||
591 | bool Zaurus::hasHingeSensor() const | 551 | bool Zaurus::hasHingeSensor() const |
592 | { | 552 | { |
593 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; | 553 | return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000; |
594 | } | 554 | } |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index c763798..04e73c4 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -73,50 +73,48 @@ | |||
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 | 78 | // Brightness |
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 | namespace Opie { | 86 | namespace Opie { |
87 | namespace Core { | 87 | namespace Core { |
88 | namespace Internal { | 88 | namespace Internal { |
89 | 89 | ||
90 | class Zaurus : public ODevice | 90 | class Zaurus : public ODevice |
91 | { | 91 | { |
92 | protected: | 92 | protected: |
93 | virtual void init(const QString&); | 93 | virtual void init(const QString&); |
94 | virtual void initButtons(); | 94 | virtual void initButtons(); |
95 | 95 | ||
96 | public: | 96 | public: |
97 | virtual bool setSoftSuspend( bool soft ); | ||
98 | |||
99 | virtual bool setDisplayBrightness( int b ); | 97 | virtual bool setDisplayBrightness( int b ); |
100 | virtual bool setDisplayStatus( bool on ); | 98 | virtual bool setDisplayStatus( bool on ); |
101 | virtual int displayBrightnessResolution() const; | 99 | virtual int displayBrightnessResolution() const; |
102 | 100 | ||
103 | virtual void playAlarmSound(); | 101 | virtual void playAlarmSound(); |
104 | virtual void playKeySound(); | 102 | virtual void playKeySound(); |
105 | virtual void playTouchSound(); | 103 | virtual void playTouchSound(); |
106 | 104 | ||
107 | virtual QValueList <OLed> ledList() const; | 105 | virtual QValueList <OLed> ledList() const; |
108 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 106 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
109 | virtual OLedState ledState( OLed led ) const; | 107 | virtual OLedState ledState( OLed led ) const; |
110 | virtual bool setLedState( OLed led, OLedState st ); | 108 | virtual bool setLedState( OLed led, OLedState st ); |
111 | 109 | ||
112 | virtual bool hasHingeSensor() const; | 110 | virtual bool hasHingeSensor() const; |
113 | virtual OHingeStatus readHingeSensor() const; | 111 | virtual OHingeStatus readHingeSensor() const; |
114 | 112 | ||
115 | virtual bool suspend(); | 113 | virtual bool suspend(); |
116 | virtual Transformation rotation() const; | 114 | virtual Transformation rotation() const; |
117 | virtual ODirection direction() const; | 115 | virtual ODirection direction() const; |
118 | 116 | ||
119 | protected: | 117 | protected: |
120 | virtual void buzzer( int snd ); | 118 | virtual void buzzer( int snd ); |
121 | 119 | ||
122 | OLedState m_leds[1]; | 120 | OLedState m_leds[1]; |