author | schurig <schurig> | 2003-06-06 07:43:08 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-06 07:43:08 (UTC) |
commit | e7d5436f3379f45d9c165a2826b1f4ae5adaeea4 (patch) (unidiff) | |
tree | c05f10f573167fd2a0289715a6e7272cfa45fad4 | |
parent | 4f987e0199430d04a4ac86007f0a79c631c2e611 (diff) | |
download | opie-e7d5436f3379f45d9c165a2826b1f4ae5adaeea4.zip opie-e7d5436f3379f45d9c165a2826b1f4ae5adaeea4.tar.gz opie-e7d5436f3379f45d9c165a2826b1f4ae5adaeea4.tar.bz2 |
ramses stuff
better doc-strings setDisplayBrightness(), setDisplayContrast() and their
...Resolution() friends
-rw-r--r-- | libopie/odevice.cpp | 12 | ||||
-rw-r--r-- | libopie/odevice.h | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 160568b..f808960 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -527,82 +527,86 @@ bool ODevice::suspend ( ) | |||
527 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 527 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
528 | 528 | ||
529 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 529 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
530 | 530 | ||
531 | /* VESA Blanking Levels */ | 531 | /* VESA Blanking Levels */ |
532 | #define VESA_NO_BLANKING 0 | 532 | #define VESA_NO_BLANKING 0 |
533 | #define VESA_VSYNC_SUSPEND 1 | 533 | #define VESA_VSYNC_SUSPEND 1 |
534 | #define VESA_HSYNC_SUSPEND 2 | 534 | #define VESA_HSYNC_SUSPEND 2 |
535 | #define VESA_POWERDOWN 3 | 535 | #define VESA_POWERDOWN 3 |
536 | 536 | ||
537 | /** | 537 | /** |
538 | * This sets the display on or off | 538 | * This sets the display on or off |
539 | */ | 539 | */ |
540 | bool ODevice::setDisplayStatus ( bool on ) | 540 | bool ODevice::setDisplayStatus ( bool on ) |
541 | { | 541 | { |
542 | qDebug("ODevice::setDisplayStatus(%d)", on); | 542 | qDebug("ODevice::setDisplayStatus(%d)", on); |
543 | 543 | ||
544 | if ( d-> m_model == Model_Unknown ) | 544 | if ( d-> m_model == Model_Unknown ) |
545 | return false; | 545 | return false; |
546 | 546 | ||
547 | bool res = false; | 547 | bool res = false; |
548 | int fd; | 548 | int fd; |
549 | 549 | ||
550 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 550 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
551 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 551 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
552 | ::close ( fd ); | 552 | ::close ( fd ); |
553 | } | 553 | } |
554 | return res; | 554 | return res; |
555 | } | 555 | } |
556 | 556 | ||
557 | /** | 557 | /** |
558 | * This sets the display brightness | 558 | * This sets the display brightness |
559 | * | ||
560 | * @param p The brightness to be set on a scale from 0 to 255 | ||
559 | * @return success or failure | 561 | * @return success or failure |
560 | */ | 562 | */ |
561 | bool ODevice::setDisplayBrightness ( int p) | 563 | bool ODevice::setDisplayBrightness ( int p) |
562 | { | 564 | { |
563 | Q_UNUSED( p ) | 565 | Q_UNUSED( p ) |
564 | return false; | 566 | return false; |
565 | } | 567 | } |
566 | 568 | ||
567 | /** | 569 | /** |
568 | * @return return the max value for the brightness settings slider | 570 | * @return returns the number of steppings on the brightness slider |
571 | * in the Light-'n-Power settings. | ||
569 | */ | 572 | */ |
570 | int ODevice::displayBrightnessResolution ( ) const | 573 | int ODevice::displayBrightnessResolution ( ) const |
571 | { | 574 | { |
572 | return 16; | 575 | return 16; |
573 | } | 576 | } |
574 | 577 | ||
575 | /** | 578 | /** |
576 | * This sets the display contrast | 579 | * This sets the display contrast |
580 | * @param p The contrast to be set on a scale from 0 to 255 | ||
577 | * @return success or failure | 581 | * @return success or failure |
578 | */ | 582 | */ |
579 | bool ODevice::setDisplayContrast ( int p) | 583 | bool ODevice::setDisplayContrast ( int p) |
580 | { | 584 | { |
581 | Q_UNUSED( p ) | 585 | Q_UNUSED( p ) |
582 | return false; | 586 | return false; |
583 | } | 587 | } |
584 | 588 | ||
585 | /** | 589 | /** |
586 | * @return return the max value for the brightness settings slider | 590 | * @return return the max value for the brightness settings slider |
587 | * or 0 if the device doesn't support setting of a contrast | 591 | * or 0 if the device doesn't support setting of a contrast |
588 | */ | 592 | */ |
589 | int ODevice::displayContrastResolution ( ) const | 593 | int ODevice::displayContrastResolution ( ) const |
590 | { | 594 | { |
591 | return 0; | 595 | return 0; |
592 | } | 596 | } |
593 | 597 | ||
594 | /** | 598 | /** |
595 | * This returns the vendor as string | 599 | * This returns the vendor as string |
596 | * @return Vendor as QString | 600 | * @return Vendor as QString |
597 | */ | 601 | */ |
598 | QString ODevice::vendorString ( ) const | 602 | QString ODevice::vendorString ( ) const |
599 | { | 603 | { |
600 | return d-> m_vendorstr; | 604 | return d-> m_vendorstr; |
601 | } | 605 | } |
602 | 606 | ||
603 | /** | 607 | /** |
604 | * This returns the vendor as one of the values of OVendor | 608 | * This returns the vendor as one of the values of OVendor |
605 | * @return OVendor | 609 | * @return OVendor |
606 | */ | 610 | */ |
607 | OVendor ODevice::vendor ( ) const | 611 | OVendor ODevice::vendor ( ) const |
608 | { | 612 | { |
@@ -2041,58 +2045,58 @@ bool Ramses::setDisplayBrightness(int bright) | |||
2041 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) | 2045 | // pwm1 brighness: 20 steps 500..0 (dunkel->hell) |
2042 | 2046 | ||
2043 | if (bright > 255 ) | 2047 | if (bright > 255 ) |
2044 | bright = 255; | 2048 | bright = 255; |
2045 | if (bright < 0) | 2049 | if (bright < 0) |
2046 | bright = 0; | 2050 | bright = 0; |
2047 | bright = 500-(bright * 500 / 255); | 2051 | bright = 500-(bright * 500 / 255); |
2048 | 2052 | ||
2049 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { | 2053 | if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { |
2050 | qDebug(" %d -> pwm1", bright); | 2054 | qDebug(" %d -> pwm1", bright); |
2051 | char writeCommand[100]; | 2055 | char writeCommand[100]; |
2052 | const int count = sprintf(writeCommand, "%d\n", bright); | 2056 | const int count = sprintf(writeCommand, "%d\n", bright); |
2053 | res = (::write(fd, writeCommand, count) != -1); | 2057 | res = (::write(fd, writeCommand, count) != -1); |
2054 | ::close(fd); | 2058 | ::close(fd); |
2055 | } else { | 2059 | } else { |
2056 | qWarning("no write"); | 2060 | qWarning("no write"); |
2057 | } | 2061 | } |
2058 | return res; | 2062 | return res; |
2059 | } | 2063 | } |
2060 | 2064 | ||
2061 | 2065 | ||
2062 | int Ramses::displayBrightnessResolution() const | 2066 | int Ramses::displayBrightnessResolution() const |
2063 | { | 2067 | { |
2064 | return 32; | 2068 | return 32; |
2065 | } | 2069 | } |
2066 | 2070 | ||
2067 | bool Ramses::setDisplayContrast(int contr) | 2071 | bool Ramses::setDisplayContrast(int contr) |
2068 | { | 2072 | { |
2069 | qDebug("Ramses::setDisplayContrast(%d)", contr); | 2073 | qDebug("Ramses::setDisplayContrast(%d)", contr); |
2070 | bool res = false; | 2074 | bool res = false; |
2071 | int fd; | 2075 | int fd; |
2072 | 2076 | ||
2073 | // pwm0 contrast: 35 steps 65..100 (dunkel->hell) | 2077 | // pwm0 contrast: 20 steps 79..90 (dunkel->hell) |
2074 | 2078 | ||
2075 | if (contr > 255 ) | 2079 | if (contr > 255 ) |
2076 | contr = 255; | 2080 | contr = 255; |
2077 | if (contr < 0) | 2081 | if (contr < 0) |
2078 | contr = 0; | 2082 | contr = 0; |
2079 | contr = 65 + (contr * 350 / 255); | 2083 | contr = 90 - (contr * 20 / 255); |
2080 | 2084 | ||
2081 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { | 2085 | if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { |
2082 | qDebug(" %d -> pwm0", contr); | 2086 | qDebug(" %d -> pwm0", contr); |
2083 | char writeCommand[100]; | 2087 | char writeCommand[100]; |
2084 | const int count = sprintf(writeCommand, "%d\n", contr); | 2088 | const int count = sprintf(writeCommand, "%d\n", contr); |
2085 | res = (::write(fd, writeCommand, count) != -1); | 2089 | res = (::write(fd, writeCommand, count) != -1); |
2086 | res = true; | 2090 | res = true; |
2087 | ::close(fd); | 2091 | ::close(fd); |
2088 | } else { | 2092 | } else { |
2089 | qWarning("no write"); | 2093 | qWarning("no write"); |
2090 | } | 2094 | } |
2091 | return res; | 2095 | return res; |
2092 | } | 2096 | } |
2093 | 2097 | ||
2094 | 2098 | ||
2095 | int Ramses::displayContrastResolution() const | 2099 | int Ramses::displayContrastResolution() const |
2096 | { | 2100 | { |
2097 | return 32; | 2101 | return 20; |
2098 | } | 2102 | } |
diff --git a/libopie/odevice.h b/libopie/odevice.h index 6c4830e..0974e8d 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -100,65 +100,64 @@ enum OLedState { | |||
100 | Led_BlinkSlow, | 100 | Led_BlinkSlow, |
101 | Led_BlinkFast | 101 | Led_BlinkFast |
102 | }; | 102 | }; |
103 | 103 | ||
104 | enum OLed { | 104 | enum OLed { |
105 | Led_Mail, | 105 | Led_Mail, |
106 | Led_Power, | 106 | Led_Power, |
107 | Led_BlueTooth | 107 | Led_BlueTooth |
108 | }; | 108 | }; |
109 | 109 | ||
110 | enum OHardKey { | 110 | enum OHardKey { |
111 | HardKey_Datebook = Qt::Key_F9, | 111 | HardKey_Datebook = Qt::Key_F9, |
112 | HardKey_Contacts = Qt::Key_F10, | 112 | HardKey_Contacts = Qt::Key_F10, |
113 | HardKey_Menu = Qt::Key_F11, | 113 | HardKey_Menu = Qt::Key_F11, |
114 | HardKey_Home = Qt::Key_F12, | 114 | HardKey_Home = Qt::Key_F12, |
115 | HardKey_Mail = Qt::Key_F13, | 115 | HardKey_Mail = Qt::Key_F13, |
116 | HardKey_Record = Qt::Key_F24, | 116 | HardKey_Record = Qt::Key_F24, |
117 | HardKey_Suspend = Qt::Key_F34, | 117 | HardKey_Suspend = Qt::Key_F34, |
118 | HardKey_Backlight = Qt::Key_F35, | 118 | HardKey_Backlight = Qt::Key_F35, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | enum ODirection { | 121 | enum ODirection { |
122 | CW = 0, | 122 | CW = 0, |
123 | CCW = 1, | 123 | CCW = 1, |
124 | Flip = 2, | 124 | Flip = 2, |
125 | }; | 125 | }; |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * A singleton which gives informations about device specefic option | 128 | * A singleton which gives informations about device specefic option |
129 | * like the Hardware used, LEDs, the Base Distribution and | 129 | * like the Hardware used, LEDs, the Base Distribution and |
130 | * hardware key mappings. | 130 | * hardware key mappings. |
131 | * | 131 | * |
132 | * | ||
133 | * @short A small class for device specefic options | 132 | * @short A small class for device specefic options |
134 | * @see QObject | 133 | * @see QObject |
135 | * @author Robert Griebl | 134 | * @author Robert Griebl |
136 | * @version 1.0 | 135 | * @version 1.0 |
137 | */ | 136 | */ |
138 | class ODevice : public QObject { | 137 | class ODevice : public QObject { |
139 | Q_OBJECT | 138 | Q_OBJECT |
140 | 139 | ||
141 | private: | 140 | private: |
142 | /* disable copy */ | 141 | /* disable copy */ |
143 | ODevice ( const ODevice & ); | 142 | ODevice ( const ODevice & ); |
144 | 143 | ||
145 | protected: | 144 | protected: |
146 | ODevice ( ); | 145 | ODevice ( ); |
147 | virtual void init ( ); | 146 | virtual void init ( ); |
148 | virtual void initButtons ( ); | 147 | virtual void initButtons ( ); |
149 | 148 | ||
150 | ODeviceData *d; | 149 | ODeviceData *d; |
151 | 150 | ||
152 | public: | 151 | public: |
153 | // sandman do we want to allow destructions? -zecke? | 152 | // sandman do we want to allow destructions? -zecke? |
154 | virtual ~ODevice ( ); | 153 | virtual ~ODevice ( ); |
155 | 154 | ||
156 | 155 | ||
157 | static ODevice *inst ( ); | 156 | static ODevice *inst ( ); |
158 | 157 | ||
159 | // information | 158 | // information |
160 | 159 | ||
161 | QString modelString ( ) const; | 160 | QString modelString ( ) const; |
162 | OModel model ( ) const; | 161 | OModel model ( ) const; |
163 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | 162 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } |
164 | 163 | ||