summaryrefslogtreecommitdiff
authorschurig <schurig>2004-09-09 09:08:36 (UTC)
committer schurig <schurig>2004-09-09 09:08:36 (UTC)
commit8df28401db620a01144ca45988837583f55e15c3 (patch) (unidiff)
tree7024a45504623a81abbf58c7ab0cae08d7870bd2
parent739d8dc8d4aed25e09d43805c802e9836240655b (diff)
downloadopie-8df28401db620a01144ca45988837583f55e15c3.zip
opie-8df28401db620a01144ca45988837583f55e15c3.tar.gz
opie-8df28401db620a01144ca45988837583f55e15c3.tar.bz2
support for devfs
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 280b0c5..2355621 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -274,97 +274,101 @@ bool ODevice::suspend()
274 return false; 274 return false;
275 275
276 bool res = false; 276 bool res = false;
277 ODevice::sendSuspendmsg(); 277 ODevice::sendSuspendmsg();
278 278
279 struct timeval tvs, tvn; 279 struct timeval tvs, tvn;
280 ::gettimeofday ( &tvs, 0 ); 280 ::gettimeofday ( &tvs, 0 );
281 281
282 ::sync(); // flush fs caches 282 ::sync(); // flush fs caches
283 res = ( ::system ( "apm --suspend" ) == 0 ); 283 res = ( ::system ( "apm --suspend" ) == 0 );
284 284
285 // This is needed because the iPAQ apm implementation is asynchronous and we 285 // This is needed because the iPAQ apm implementation is asynchronous and we
286 // can not be sure when exactly the device is really suspended 286 // can not be sure when exactly the device is really suspended
287 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 287 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
288 288
289 if ( res ) { 289 if ( res ) {
290 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 290 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
291 ::usleep ( 200 * 1000 ); 291 ::usleep ( 200 * 1000 );
292 ::gettimeofday ( &tvn, 0 ); 292 ::gettimeofday ( &tvn, 0 );
293 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 293 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
294 } 294 }
295 295
296 return res; 296 return res;
297} 297}
298 298
299//#include <linux/fb.h> better not rely on kernel headers in userspace ... 299//#include <linux/fb.h> better not rely on kernel headers in userspace ...
300 300
301#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 301#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
302 302
303/* VESA Blanking Levels */ 303/* VESA Blanking Levels */
304#define VESA_NO_BLANKING 0 304#define VESA_NO_BLANKING 0
305#define VESA_VSYNC_SUSPEND 1 305#define VESA_VSYNC_SUSPEND 1
306#define VESA_HSYNC_SUSPEND 2 306#define VESA_HSYNC_SUSPEND 2
307#define VESA_POWERDOWN 3 307#define VESA_POWERDOWN 3
308 308
309/** 309/**
310* This sets the display on or off 310* This sets the display on or off
311*/ 311*/
312bool ODevice::setDisplayStatus ( bool on ) 312bool ODevice::setDisplayStatus ( bool on )
313{ 313{
314 qDebug("ODevice::setDisplayStatus(%d)", on); 314 qDebug("ODevice::setDisplayStatus(%d)", on);
315 315
316 if ( d->m_model == Model_Unknown ) 316 if ( d->m_model == Model_Unknown )
317 return false; 317 return false;
318 318
319 bool res = false; 319 bool res = false;
320 int fd; 320 int fd;
321 321
322#ifdef QT_QWS_DEVFS
323 if (( fd = ::open ( "/dev/fb/0", O_RDWR )) >= 0 ) {
324#else
322 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 325 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
326#endif
323 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 327 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
324 ::close ( fd ); 328 ::close ( fd );
325 } 329 }
326 return res; 330 return res;
327} 331}
328 332
329/** 333/**
330* This sets the display brightness 334* This sets the display brightness
331* 335*
332* @param p The brightness to be set on a scale from 0 to 255 336* @param p The brightness to be set on a scale from 0 to 255
333* @return success or failure 337* @return success or failure
334*/ 338*/
335bool ODevice::setDisplayBrightness ( int p) 339bool ODevice::setDisplayBrightness ( int p)
336{ 340{
337 Q_UNUSED( p ) 341 Q_UNUSED( p )
338 return false; 342 return false;
339} 343}
340 344
341/** 345/**
342* @return returns the number of steppings on the brightness slider 346* @return returns the number of steppings on the brightness slider
343* in the Light-'n-Power settings. 347* in the Light-'n-Power settings.
344*/ 348*/
345int ODevice::displayBrightnessResolution() const 349int ODevice::displayBrightnessResolution() const
346{ 350{
347 return 16; 351 return 16;
348} 352}
349 353
350/** 354/**
351* This sets the display contrast 355* This sets the display contrast
352* @param p The contrast to be set on a scale from 0 to 255 356* @param p The contrast to be set on a scale from 0 to 255
353* @return success or failure 357* @return success or failure
354*/ 358*/
355bool ODevice::setDisplayContrast ( int p) 359bool ODevice::setDisplayContrast ( int p)
356{ 360{
357 Q_UNUSED( p ) 361 Q_UNUSED( p )
358 return false; 362 return false;
359} 363}
360 364
361/** 365/**
362* @return return the max value for the brightness settings slider 366* @return return the max value for the brightness settings slider
363* or 0 if the device doesn't support setting of a contrast 367* or 0 if the device doesn't support setting of a contrast
364*/ 368*/
365int ODevice::displayContrastResolution() const 369int ODevice::displayContrastResolution() const
366{ 370{
367 return 0; 371 return 0;
368} 372}
369 373
370/** 374/**