-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 | |||
@@ -249,21 +249,16 @@ void ODevice::initButtons() | |||
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. |
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 | |||
@@ -250,18 +250,16 @@ public: | |||
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 | ||
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 | |||
@@ -155,22 +155,16 @@ void GenuineIntel::playAlarmSound() | |||
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 |
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 | |||
@@ -42,18 +42,16 @@ namespace Internal { | |||
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; |
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 | |||
@@ -331,37 +331,16 @@ void iPAQ::playAlarmSound() | |||
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 ) |
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 | |||
@@ -42,18 +42,16 @@ namespace Internal { | |||
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; |
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 | |||
@@ -375,53 +375,16 @@ bool Zaurus::setLedState( OLed which, OLedState st ) | |||
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 | { |
@@ -535,19 +498,17 @@ bool Zaurus::suspend() | |||
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; |
@@ -561,18 +522,17 @@ Transformation Zaurus::rotation() const | |||
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; |
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 | |||
@@ -89,18 +89,16 @@ 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 | ||