summaryrefslogtreecommitdiff
authorschurig <schurig>2003-07-01 06:16:34 (UTC)
committer schurig <schurig>2003-07-01 06:16:34 (UTC)
commit1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f (patch) (unidiff)
tree8ef66a4ca29fa42ca6e337e1bfb578d575ca1e93
parent5f014b53c18138266bd45251babbc8658831ebd2 (diff)
downloadopie-1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f.zip
opie-1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f.tar.gz
opie-1b9ed2e0406d99aa7eaa5c72b5022a438cf5d03f.tar.bz2
silence some warnings
still trying to find out what d->m_rotation does exactly fake setSoftSuspend() working suspend() different /proc/sys/board entry for Brightness & Contrast
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp81
1 files changed, 28 insertions, 53 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 993aedf..62dc9d4 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -922,5 +922,6 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
922} 922}
923void ODevice::virtual_hook( int id, void* data ) { 923void ODevice::virtual_hook( int id, void* data ) {
924 924 Q_UNUSED(id);
925 Q_UNUSED(data);
925} 926}
926 927
@@ -1974,6 +1975,7 @@ void Ramses::init()
1974 d->m_model = Model_Ramses_MNCI; 1975 d->m_model = Model_Ramses_MNCI;
1975 1976
1976 d->m_rotation = Rot0; 1977 d->m_rotation = Rot180;
1977 d->m_holdtime = 1000; 1978 d->m_direction = CW;
1979 d->m_holdtime = 1000;
1978 1980
1979 f.setName("/etc/oz_version"); 1981 f.setName("/etc/oz_version");
@@ -2033,43 +2035,22 @@ void Ramses::timerEvent(QTimerEvent *)
2033bool Ramses::setSoftSuspend(bool soft) 2035bool Ramses::setSoftSuspend(bool soft)
2034{ 2036{
2035 qDebug("Ramses::setSoftSuspend(%d)", soft); 2037 Q_UNUSED(soft);
2036#if 0 2038 return true;
2037 bool res = false; 2039}
2038 int fd;
2039
2040 if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) ||
2041 ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) {
2042
2043 int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources
2044 2040
2045 if (sources >= 0) { 2041bool Ramses::suspend()
2046 if (soft) 2042{
2047 sources &= ~APM_EVT_POWER_BUTTON; 2043 //qDebug("Ramses::suspend()");
2048 else 2044 if ( !isQWS() ) // only qwsserver is allowed to suspend
2049 sources |= APM_EVT_POWER_BUTTON; 2045 return false;
2050 2046
2051 if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources 2047 bool res = false;
2052 res = true; 2048 int fd;
2053 else
2054 perror("APM_IOCGEVTSRC");
2055 }
2056 else
2057 perror("APM_IOCGEVTSRC");
2058 2049
2050 if ((fd = ::open("/proc/sys/pm/suspend", O_WRONLY)) >= 0) {
2051 res = ( ::write ( fd, "1", 1 ) != -1 );
2059 ::close(fd); 2052 ::close(fd);
2060 } 2053 }
2061 else 2054 return res;
2062 perror("/dev/apm_bios or /dev/misc/apm_bios");
2063
2064 return res;
2065#else
2066 return true;
2067#endif
2068}
2069
2070bool Ramses::suspend ( )
2071{
2072 qDebug("Ramses::suspend");
2073 return false;
2074} 2055}
2075 2056
@@ -2079,17 +2060,13 @@ bool Ramses::suspend ( )
2079bool Ramses::setDisplayStatus(bool on) 2060bool Ramses::setDisplayStatus(bool on)
2080{ 2061{
2081 qDebug("Ramses::setDisplayStatus(%d)", on); 2062 //qDebug("Ramses::setDisplayStatus(%d)", on);
2082#if 0
2083 bool res = false; 2063 bool res = false;
2084 int fd; 2064 int fd;
2085 2065
2086 if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { 2066 if ((fd = ::open ("/dev/fb/1", O_RDWR)) >= 0) {
2087 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); 2067 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0);
2088 ::close(fd); 2068 ::close(fd);
2089 } 2069 }
2090 return res; 2070 return res;
2091#else
2092 return true;
2093#endif
2094} 2071}
2095 2072
@@ -2100,5 +2077,5 @@ bool Ramses::setDisplayStatus(bool on)
2100bool Ramses::setDisplayBrightness(int bright) 2077bool Ramses::setDisplayBrightness(int bright)
2101{ 2078{
2102 qDebug("Ramses::setDisplayBrightness(%d)", bright); 2079 //qDebug("Ramses::setDisplayBrightness(%d)", bright);
2103 bool res = false; 2080 bool res = false;
2104 int fd; 2081 int fd;
@@ -2120,7 +2097,6 @@ bool Ramses::setDisplayBrightness(int bright)
2120 2097
2121 // scale backlight brightness to hardware 2098 // scale backlight brightness to hardware
2122 bright = 500-(bright * 500 / 255); 2099 if ((fd = ::open("/proc/sys/board/lcd_brightness", O_WRONLY)) >= 0) {
2123 if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { 2100 //qDebug(" %d -> pwm1", bright);
2124 qDebug(" %d -> pwm1", bright);
2125 char writeCommand[100]; 2101 char writeCommand[100];
2126 const int count = sprintf(writeCommand, "%d\n", bright); 2102 const int count = sprintf(writeCommand, "%d\n", bright);
@@ -2134,10 +2110,10 @@ bool Ramses::setDisplayBrightness(int bright)
2134int Ramses::displayBrightnessResolution() const 2110int Ramses::displayBrightnessResolution() const
2135{ 2111{
2136 return 32; 2112 return 256;
2137} 2113}
2138 2114
2139bool Ramses::setDisplayContrast(int contr) 2115bool Ramses::setDisplayContrast(int contr)
2140{ 2116{
2141 qDebug("Ramses::setDisplayContrast(%d)", contr); 2117 //qDebug("Ramses::setDisplayContrast(%d)", contr);
2142 bool res = false; 2118 bool res = false;
2143 int fd; 2119 int fd;
@@ -2149,8 +2125,7 @@ bool Ramses::setDisplayContrast(int contr)
2149 if (contr < 0) 2125 if (contr < 0)
2150 contr = 0; 2126 contr = 0;
2151 contr = 90 - (contr * 20 / 255);
2152 2127
2153 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { 2128 if ((fd = ::open("/proc/sys/board/lcd_contrast", O_WRONLY)) >= 0) {
2154 qDebug(" %d -> pwm0", contr); 2129 //qDebug(" %d -> pwm0", contr);
2155 char writeCommand[100]; 2130 char writeCommand[100];
2156 const int count = sprintf(writeCommand, "%d\n", contr); 2131 const int count = sprintf(writeCommand, "%d\n", contr);
@@ -2165,4 +2140,4 @@ bool Ramses::setDisplayContrast(int contr)
2165int Ramses::displayContrastResolution() const 2140int Ramses::displayContrastResolution() const
2166{ 2141{
2167 return 20; 2142 return 256;
2168} 2143}