summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 8624016..13b4330 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -2251,330 +2251,341 @@ bool SIMpad::setDisplayBrightness ( int bright )
2251 return res; 2251 return res;
2252} 2252}
2253 2253
2254 2254
2255int SIMpad::displayBrightnessResolution ( ) const 2255int SIMpad::displayBrightnessResolution ( ) const
2256{ 2256{
2257 return 255; // All SIMpad models share the same display 2257 return 255; // All SIMpad models share the same display
2258} 2258}
2259 2259
2260/************************************************** 2260/**************************************************
2261 * 2261 *
2262 * Ramses 2262 * Ramses
2263 * 2263 *
2264 **************************************************/ 2264 **************************************************/
2265 2265
2266void Ramses::init() 2266void Ramses::init()
2267{ 2267{
2268 d->m_vendorstr = "M und N"; 2268 d->m_vendorstr = "M und N";
2269 d->m_vendor = Vendor_MundN; 2269 d->m_vendor = Vendor_MundN;
2270 2270
2271 QFile f("/proc/sys/board/ramses"); 2271 QFile f("/proc/sys/board/ramses");
2272 2272
2273 d->m_modelstr = "Ramses"; 2273 d->m_modelstr = "Ramses";
2274 d->m_model = Model_Ramses_MNCI; 2274 d->m_model = Model_Ramses_MNCI;
2275 2275
2276 d->m_rotation = Rot0; 2276 d->m_rotation = Rot0;
2277 d->m_holdtime = 1000; 2277 d->m_holdtime = 1000;
2278 2278
2279 f.setName("/etc/oz_version"); 2279 f.setName("/etc/oz_version");
2280 2280
2281 if (f.open(IO_ReadOnly)) { 2281 if (f.open(IO_ReadOnly)) {
2282 d->m_systemstr = "OpenEmbedded/Ramses"; 2282 d->m_systemstr = "OpenEmbedded/Ramses";
2283 d->m_system = System_OpenZaurus; 2283 d->m_system = System_OpenZaurus;
2284 2284
2285 QTextStream ts(&f); 2285 QTextStream ts(&f);
2286 ts.setDevice(&f); 2286 ts.setDevice(&f);
2287 d->m_sysverstr = ts.readLine(); 2287 d->m_sysverstr = ts.readLine();
2288 f.close(); 2288 f.close();
2289 } 2289 }
2290 2290
2291 m_power_timer = 0; 2291 m_power_timer = 0;
2292 2292
2293#ifdef QT_QWS_ALLOW_OVERCLOCK 2293#ifdef QT_QWS_ALLOW_OVERCLOCK
2294#warning *** Overclocking enabled - this may fry your hardware - you have been warned *** 2294#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
2295#define OC(x...) x 2295#define OC(x...) x
2296#else 2296#else
2297#define OC(x...) 2297#define OC(x...)
2298#endif 2298#endif
2299 2299
2300 2300
2301 // This table is true for a Intel XScale PXA 255 2301 // This table is true for a Intel XScale PXA 255
2302 2302
2303 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 2303 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50
2304 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem 2304 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem
2305 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 2305 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99
2306 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem 2306 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem
2307 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 2307 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99
2308 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem 2308 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem
2309 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 2309 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99
2310 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 2310 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196
2311 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus 2311 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
2312 2312
2313} 2313}
2314 2314
2315bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) 2315bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat)
2316{ 2316{
2317 Q_UNUSED( keycode ); 2317 Q_UNUSED( keycode );
2318 Q_UNUSED( modifiers ); 2318 Q_UNUSED( modifiers );
2319 Q_UNUSED( isPress ); 2319 Q_UNUSED( isPress );
2320 Q_UNUSED( autoRepeat ); 2320 Q_UNUSED( autoRepeat );
2321 return false; 2321 return false;
2322} 2322}
2323 2323
2324void Ramses::timerEvent(QTimerEvent *) 2324void Ramses::timerEvent(QTimerEvent *)
2325{ 2325{
2326 killTimer(m_power_timer); 2326 killTimer(m_power_timer);
2327 m_power_timer = 0; 2327 m_power_timer = 0;
2328 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); 2328 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false);
2329 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); 2329 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false);
2330} 2330}
2331 2331
2332 2332
2333bool Ramses::setSoftSuspend(bool soft) 2333bool Ramses::setSoftSuspend(bool soft)
2334{ 2334{
2335 qDebug("Ramses::setSoftSuspend(%d)", soft); 2335 qDebug("Ramses::setSoftSuspend(%d)", soft);
2336#if 0 2336#if 0
2337 bool res = false; 2337 bool res = false;
2338 int fd; 2338 int fd;
2339 2339
2340 if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || 2340 if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) ||
2341 ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { 2341 ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) {
2342 2342
2343 int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources 2343 int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources
2344 2344
2345 if (sources >= 0) { 2345 if (sources >= 0) {
2346 if (soft) 2346 if (soft)
2347 sources &= ~APM_EVT_POWER_BUTTON; 2347 sources &= ~APM_EVT_POWER_BUTTON;
2348 else 2348 else
2349 sources |= APM_EVT_POWER_BUTTON; 2349 sources |= APM_EVT_POWER_BUTTON;
2350 2350
2351 if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources 2351 if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources
2352 res = true; 2352 res = true;
2353 else 2353 else
2354 perror("APM_IOCGEVTSRC"); 2354 perror("APM_IOCGEVTSRC");
2355 } 2355 }
2356 else 2356 else
2357 perror("APM_IOCGEVTSRC"); 2357 perror("APM_IOCGEVTSRC");
2358 2358
2359 ::close(fd); 2359 ::close(fd);
2360 } 2360 }
2361 else 2361 else
2362 perror("/dev/apm_bios or /dev/misc/apm_bios"); 2362 perror("/dev/apm_bios or /dev/misc/apm_bios");
2363 2363
2364 return res; 2364 return res;
2365#else 2365#else
2366 return true; 2366 return true;
2367#endif 2367#endif
2368} 2368}
2369 2369
2370bool Ramses::suspend ( ) 2370bool Ramses::suspend ( )
2371{ 2371{
2372 qDebug("Ramses::suspend"); 2372 qDebug("Ramses::suspend");
2373 return false; 2373 return false;
2374} 2374}
2375 2375
2376/** 2376/**
2377 * This sets the display on or off 2377 * This sets the display on or off
2378 */ 2378 */
2379bool Ramses::setDisplayStatus(bool on) 2379bool Ramses::setDisplayStatus(bool on)
2380{ 2380{
2381 qDebug("Ramses::setDisplayStatus(%d)", on); 2381 qDebug("Ramses::setDisplayStatus(%d)", on);
2382#if 0 2382#if 0
2383 bool res = false; 2383 bool res = false;
2384 int fd; 2384 int fd;
2385 2385
2386 if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { 2386 if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) {
2387 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); 2387 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0);
2388 ::close(fd); 2388 ::close(fd);
2389 } 2389 }
2390 return res; 2390 return res;
2391#else 2391#else
2392 return true; 2392 return true;
2393#endif 2393#endif
2394} 2394}
2395 2395
2396 2396
2397/* 2397/*
2398 * We get something between 0..255 into us 2398 * We get something between 0..255 into us
2399*/ 2399*/
2400bool Ramses::setDisplayBrightness(int bright) 2400bool Ramses::setDisplayBrightness(int bright)
2401{ 2401{
2402 qDebug("Ramses::setDisplayBrightness(%d)", bright); 2402 qDebug("Ramses::setDisplayBrightness(%d)", bright);
2403 bool res = false; 2403 bool res = false;
2404 int fd; 2404 int fd;
2405 2405
2406 // pwm1 brighness: 20 steps 500..0 (dunkel->hell) 2406 // pwm1 brighness: 20 steps 500..0 (dunkel->hell)
2407 2407
2408 if (bright > 255 ) 2408 if (bright > 255 )
2409 bright = 255; 2409 bright = 255;
2410 if (bright < 0) 2410 if (bright < 0)
2411 bright = 0; 2411 bright = 0;
2412 2412
2413 // Turn backlight completely off 2413 // Turn backlight completely off
2414 if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { 2414 if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) {
2415 char writeCommand[10]; 2415 char writeCommand[10];
2416 const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); 2416 const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0);
2417 res = (::write(fd, writeCommand, count) != -1); 2417 res = (::write(fd, writeCommand, count) != -1);
2418 ::close(fd); 2418 ::close(fd);
2419 } 2419 }
2420 2420
2421 // scale backlight brightness to hardware 2421 // scale backlight brightness to hardware
2422 bright = 500-(bright * 500 / 255); 2422 bright = 500-(bright * 500 / 255);
2423 if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { 2423 if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) {
2424 qDebug(" %d -> pwm1", bright); 2424 qDebug(" %d -> pwm1", bright);
2425 char writeCommand[100]; 2425 char writeCommand[100];
2426 const int count = sprintf(writeCommand, "%d\n", bright); 2426 const int count = sprintf(writeCommand, "%d\n", bright);
2427 res = (::write(fd, writeCommand, count) != -1); 2427 res = (::write(fd, writeCommand, count) != -1);
2428 ::close(fd); 2428 ::close(fd);
2429 } 2429 }
2430 return res; 2430 return res;
2431} 2431}
2432 2432
2433 2433
2434int Ramses::displayBrightnessResolution() const 2434int Ramses::displayBrightnessResolution() const
2435{ 2435{
2436 return 32; 2436 return 32;
2437} 2437}
2438 2438
2439bool Ramses::setDisplayContrast(int contr) 2439bool Ramses::setDisplayContrast(int contr)
2440{ 2440{
2441 qDebug("Ramses::setDisplayContrast(%d)", contr); 2441 qDebug("Ramses::setDisplayContrast(%d)", contr);
2442 bool res = false; 2442 bool res = false;
2443 int fd; 2443 int fd;
2444 2444
2445 // pwm0 contrast: 20 steps 79..90 (dunkel->hell) 2445 // pwm0 contrast: 20 steps 79..90 (dunkel->hell)
2446 2446
2447 if (contr > 255 ) 2447 if (contr > 255 )
2448 contr = 255; 2448 contr = 255;
2449 if (contr < 0) 2449 if (contr < 0)
2450 contr = 0; 2450 contr = 0;
2451 contr = 90 - (contr * 20 / 255); 2451 contr = 90 - (contr * 20 / 255);
2452 2452
2453 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { 2453 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) {
2454 qDebug(" %d -> pwm0", contr); 2454 qDebug(" %d -> pwm0", contr);
2455 char writeCommand[100]; 2455 char writeCommand[100];
2456 const int count = sprintf(writeCommand, "%d\n", contr); 2456 const int count = sprintf(writeCommand, "%d\n", contr);
2457 res = (::write(fd, writeCommand, count) != -1); 2457 res = (::write(fd, writeCommand, count) != -1);
2458 res = true; 2458 res = true;
2459 ::close(fd); 2459 ::close(fd);
2460 } 2460 }
2461 return res; 2461 return res;
2462} 2462}
2463 2463
2464 2464
2465int Ramses::displayContrastResolution() const 2465int Ramses::displayContrastResolution() const
2466{ 2466{
2467 return 20; 2467 return 20;
2468} 2468}
2469 2469
2470 2470
2471/************************************************** 2471/**************************************************
2472 * * 2472 * *
2473 * Jornada * 2473 * Jornada *
2474 * * 2474 * *
2475 **************************************************/ 2475 **************************************************/
2476 2476
2477 2477
2478bool Jornada::isJornada ( ) 2478bool Jornada::isJornada ( )
2479{ 2479{
2480 QFile f( "/proc/cpuinfo" ); 2480 QFile f( "/proc/cpuinfo" );
2481 if ( f. open ( IO_ReadOnly ) ) { 2481 if ( f. open ( IO_ReadOnly ) ) {
2482 QTextStream ts ( &f ); 2482 QTextStream ts ( &f );
2483 QString line; 2483 QString line;
2484 while( line = ts. readLine ( ) ) { 2484 while( line = ts. readLine ( ) ) {
2485 if ( line. left ( 8 ) == "Hardware" ) { 2485 if ( line. left ( 8 ) == "Hardware" ) {
2486 int loc = line. find ( ":" ); 2486 int loc = line. find ( ":" );
2487 if ( loc != -1 ) { 2487 if ( loc != -1 ) {
2488 QString model = 2488 QString model =
2489 line. mid ( loc + 2 ). simplifyWhiteSpace( ); 2489 line. mid ( loc + 2 ). simplifyWhiteSpace( );
2490 return ( model == "HP Jornada 56x" ); 2490 return ( model == "HP Jornada 56x" );
2491 } 2491 }
2492 } 2492 }
2493 } 2493 }
2494 } 2494 }
2495 return false; 2495 return false;
2496} 2496}
2497 2497
2498void Jornada::init ( ) 2498void Jornada::init ( )
2499{ 2499{
2500 d-> m_vendorstr = "HP"; 2500 d-> m_vendorstr = "HP";
2501 d-> m_vendor = Vendor_HP; 2501 d-> m_vendor = Vendor_HP;
2502 d-> m_modelstr = "Jornada 56x"; 2502 d-> m_modelstr = "Jornada 56x";
2503 d-> m_model = Model_Jornada_56x; 2503 d-> m_model = Model_Jornada_56x;
2504 d-> m_systemstr = "Familiar"; 2504 d-> m_systemstr = "Familiar";
2505 d-> m_system = System_Familiar; 2505 d-> m_system = System_Familiar;
2506 d-> m_rotation = Rot0; 2506 d-> m_rotation = Rot0;
2507
2508 QFile f ( "/etc/familiar-version" );
2509 f. setName ( "/etc/familiar-version" );
2510 if ( f. open ( IO_ReadOnly )) {
2511
2512 QTextStream ts ( &f );
2513 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
2514
2515 f. close ( );
2516 }
2507} 2517}
2508 2518
2519
2509void Jornada::initButtons ( ) 2520void Jornada::initButtons ( )
2510{ 2521{
2511 if ( d-> m_buttons ) 2522 if ( d-> m_buttons )
2512 return; 2523 return;
2513 2524
2514 // Simulation uses iPAQ 3660 device buttons 2525 // Simulation uses iPAQ 3660 device buttons
2515 2526
2516 qDebug ( "init Buttons" ); 2527 qDebug ( "init Buttons" );
2517 d-> m_buttons = new QValueList <ODeviceButton>; 2528 d-> m_buttons = new QValueList <ODeviceButton>;
2518 2529
2519 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 2530 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
2520 i_button *ib = ipaq_buttons + i; 2531 i_button *ib = ipaq_buttons + i;
2521 ODeviceButton b; 2532 ODeviceButton b;
2522 2533
2523 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 2534 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
2524 b. setKeycode ( ib-> code ); 2535 b. setKeycode ( ib-> code );
2525 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 2536 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
2526 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 2537 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
2527 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 2538 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
2528 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 2539 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
2529 d-> m_buttons-> append ( b ); 2540 d-> m_buttons-> append ( b );
2530 } 2541 }
2531 } 2542 }
2532 reloadButtonMapping ( ); 2543 reloadButtonMapping ( );
2533 2544
2534 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2545 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2535 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2546 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
2536} 2547}
2537 2548
2538int Jornada::displayBrightnessResolution ( ) const 2549int Jornada::displayBrightnessResolution ( ) const
2539{ 2550{
2540} 2551}
2541 2552
2542bool Jornada::setDisplayBrightness ( int bright ) 2553bool Jornada::setDisplayBrightness ( int bright )
2543{ 2554{
2544 bool res = false; 2555 bool res = false;
2545 int fd; 2556 int fd;
2546 2557
2547 if ( bright > 255 ) 2558 if ( bright > 255 )
2548 bright = 255; 2559 bright = 255;
2549 if ( bright < 0 ) 2560 if ( bright < 0 )
2550 bright = 0; 2561 bright = 0;
2551 2562
2552 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 2563 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
2553 FLITE_IN bl; 2564 FLITE_IN bl;
2554 bl. mode = 1; 2565 bl. mode = 1;
2555 bl. pwr = bright ? 1 : 0; 2566 bl. pwr = bright ? 1 : 0;
2556 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 2567 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
2557 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 2568 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
2558 ::close ( fd ); 2569 ::close ( fd );
2559 } 2570 }
2560 return res; 2571 return res;
2561} 2572}
2562 2573
2563bool Jornada::setSoftSuspend ( bool soft ) 2574bool Jornada::setSoftSuspend ( bool soft )
2564{ 2575{
2565 bool res = false; 2576 bool res = false;
2566 int fd; 2577 int fd;
2567 2578
2568 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 2579 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
2569 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 2580 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
2570 res = true; 2581 res = true;
2571 else 2582 else
2572 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 2583 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
2573 2584
2574 ::close ( fd ); 2585 ::close ( fd );
2575 } 2586 }
2576 else 2587 else
2577 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 2588 ::perror ( "/proc/sys/ts/suspend_button_mode" );
2578 2589
2579 return res; 2590 return res;
2580} 2591}