-rw-r--r-- | libopie/odevice.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 6e3f114..9871e80 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -29,28 +29,30 @@ | |||
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpe/sound.h> | 33 | #include <qpe/sound.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | 36 | ||
37 | #include "odevice.h" | 37 | #include "odevice.h" |
38 | 38 | ||
39 | // _IO and friends are only defined in kernel headers ... | 39 | // _IO and friends are only defined in kernel headers ... |
40 | 40 | ||
41 | #define OD_IO(type,area,number,args) (( type << 30 ) | ( area << 8 ) | ( number ) | ( sizeof( args ) << 16 )) | 41 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
42 | #define OD_IOW(area,number,args) OD_IO(1,area,number,args) | 42 | |
43 | #define OD_IOR(area,number,args) OD_IO(2,area,number,args) | 43 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
44 | #define OD_IORW(area,number,args) OD_IO(3,area,number,args) | 44 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
45 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | ||
46 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | ||
45 | 47 | ||
46 | 48 | ||
47 | class ODeviceData { | 49 | class ODeviceData { |
48 | public: | 50 | public: |
49 | QString m_vendorstr; | 51 | QString m_vendorstr; |
50 | OVendor m_vendor; | 52 | OVendor m_vendor; |
51 | 53 | ||
52 | QString m_modelstr; | 54 | QString m_modelstr; |
53 | OModel m_model; | 55 | OModel m_model; |
54 | 56 | ||
55 | QString m_systemstr; | 57 | QString m_systemstr; |
56 | OSystem m_system; | 58 | OSystem m_system; |
@@ -147,25 +149,25 @@ void ODevice::init ( ) | |||
147 | ODevice::~ODevice ( ) | 149 | ODevice::~ODevice ( ) |
148 | { | 150 | { |
149 | delete d; | 151 | delete d; |
150 | } | 152 | } |
151 | 153 | ||
152 | bool ODevice::setPowerButtonHandler ( ODevice::PowerButtonHandler ) | 154 | bool ODevice::setPowerButtonHandler ( ODevice::PowerButtonHandler ) |
153 | { | 155 | { |
154 | return false; | 156 | return false; |
155 | } | 157 | } |
156 | 158 | ||
157 | //#include <linux/apm_bios.h> | 159 | //#include <linux/apm_bios.h> |
158 | 160 | ||
159 | #define APM_IOC_SUSPEND OD_IO( 0, 'A', 2, 0 ) | 161 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
160 | 162 | ||
161 | 163 | ||
162 | bool ODevice::suspend ( ) | 164 | bool ODevice::suspend ( ) |
163 | { | 165 | { |
164 | if ( d-> m_model == OMODEL_Unknown ) // better don't suspend in qvfb / on unkown devices | 166 | if ( d-> m_model == OMODEL_Unknown ) // better don't suspend in qvfb / on unkown devices |
165 | return false; | 167 | return false; |
166 | 168 | ||
167 | int fd; | 169 | int fd; |
168 | bool res = false; | 170 | bool res = false; |
169 | 171 | ||
170 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | 172 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || |
171 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | 173 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { |
@@ -189,25 +191,25 @@ bool ODevice::suspend ( ) | |||
189 | ::kill ( -::getpid ( ), SIGCONT ); // continue everything in our process group | 191 | ::kill ( -::getpid ( ), SIGCONT ); // continue everything in our process group |
190 | } | 192 | } |
191 | 193 | ||
192 | ::close ( fd ); | 194 | ::close ( fd ); |
193 | ::signal ( SIGTSTP, SIG_DFL ); | 195 | ::signal ( SIGTSTP, SIG_DFL ); |
194 | } | 196 | } |
195 | 197 | ||
196 | return res; | 198 | return res; |
197 | } | 199 | } |
198 | 200 | ||
199 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 201 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
200 | 202 | ||
201 | #define FBIOBLANK OD_IO( 0, 'F', 0x11, 0 ) // 0x4611 | 203 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
202 | 204 | ||
203 | /* VESA Blanking Levels */ | 205 | /* VESA Blanking Levels */ |
204 | #define VESA_NO_BLANKING 0 | 206 | #define VESA_NO_BLANKING 0 |
205 | #define VESA_VSYNC_SUSPEND 1 | 207 | #define VESA_VSYNC_SUSPEND 1 |
206 | #define VESA_HSYNC_SUSPEND 2 | 208 | #define VESA_HSYNC_SUSPEND 2 |
207 | #define VESA_POWERDOWN 3 | 209 | #define VESA_POWERDOWN 3 |
208 | 210 | ||
209 | 211 | ||
210 | bool ODevice::setDisplayStatus ( bool on ) | 212 | bool ODevice::setDisplayStatus ( bool on ) |
211 | { | 213 | { |
212 | if ( d-> m_model == OMODEL_Unknown ) | 214 | if ( d-> m_model == OMODEL_Unknown ) |
213 | return false; | 215 | return false; |