author | chicken <chicken> | 2003-10-22 19:22:35 (UTC) |
---|---|---|
committer | chicken <chicken> | 2003-10-22 19:22:35 (UTC) |
commit | a61c014e1fb43e36aa7454ce4b3cb9a7a706c6fa (patch) (unidiff) | |
tree | ea7707de2b221b08ca274ff69555323568118c04 | |
parent | 3e9d8077999bd928b7103bd19f7b41f305c573d9 (diff) | |
download | opie-a61c014e1fb43e36aa7454ce4b3cb9a7a706c6fa.zip opie-a61c014e1fb43e36aa7454ce4b3cb9a7a706c6fa.tar.gz opie-a61c014e1fb43e36aa7454ce4b3cb9a7a706c6fa.tar.bz2 |
improved Jornada 56X support
-rw-r--r-- | libopie/odevice.cpp | 128 | ||||
-rw-r--r-- | libopie/odevice.h | 3 |
2 files changed, 130 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index aadd0bf..8624016 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -107,4 +107,16 @@ protected: | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | class Jornada : public ODevice { | ||
110 | protected: | ||
111 | virtual void init ( ); | ||
112 | virtual void initButtons ( ); | ||
113 | public: | ||
114 | virtual bool setSoftSuspend ( bool soft ); | ||
115 | virtual bool setDisplayBrightness ( int b ); | ||
116 | virtual int displayBrightnessResolution ( ) const; | ||
117 | static bool isJornada(); | ||
118 | |||
119 | }; | ||
120 | |||
109 | class Zaurus : public ODevice { | 121 | class Zaurus : public ODevice { |
110 | protected: | 122 | protected: |
@@ -434,4 +446,6 @@ ODevice *ODevice::inst ( ) | |||
434 | else if ( Yopy::isYopy() ) | 446 | else if ( Yopy::isYopy() ) |
435 | dev = new Yopy ( ); | 447 | dev = new Yopy ( ); |
448 | else if ( Jornada::isJornada() ) | ||
449 | dev = new Jornada ( ); | ||
436 | else | 450 | else |
437 | dev = new ODevice ( ); | 451 | dev = new ODevice ( ); |
@@ -984,5 +998,5 @@ bool Yopy::isYopy ( ) | |||
984 | int loc = line. find ( ":" ); | 998 | int loc = line. find ( ":" ); |
985 | if ( loc != -1 ) { | 999 | if ( loc != -1 ) { |
986 | QString model = | 1000 | QString model = |
987 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 1001 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
988 | return ( model == "Yopy" ); | 1002 | return ( model == "Yopy" ); |
@@ -2453,2 +2467,114 @@ int Ramses::displayContrastResolution() const | |||
2453 | return 20; | 2467 | return 20; |
2454 | } | 2468 | } |
2469 | |||
2470 | |||
2471 | /************************************************** | ||
2472 | * * | ||
2473 | * Jornada * | ||
2474 | * * | ||
2475 | **************************************************/ | ||
2476 | |||
2477 | |||
2478 | bool Jornada::isJornada ( ) | ||
2479 | { | ||
2480 | QFile f( "/proc/cpuinfo" ); | ||
2481 | if ( f. open ( IO_ReadOnly ) ) { | ||
2482 | QTextStream ts ( &f ); | ||
2483 | QString line; | ||
2484 | while( line = ts. readLine ( ) ) { | ||
2485 | if ( line. left ( 8 ) == "Hardware" ) { | ||
2486 | int loc = line. find ( ":" ); | ||
2487 | if ( loc != -1 ) { | ||
2488 | QString model = | ||
2489 | line. mid ( loc + 2 ). simplifyWhiteSpace( ); | ||
2490 | return ( model == "HP Jornada 56x" ); | ||
2491 | } | ||
2492 | } | ||
2493 | } | ||
2494 | } | ||
2495 | return false; | ||
2496 | } | ||
2497 | |||
2498 | void Jornada::init ( ) | ||
2499 | { | ||
2500 | d-> m_vendorstr = "HP"; | ||
2501 | d-> m_vendor = Vendor_HP; | ||
2502 | d-> m_modelstr = "Jornada 56x"; | ||
2503 | d-> m_model = Model_Jornada_56x; | ||
2504 | d-> m_systemstr = "Familiar"; | ||
2505 | d-> m_system = System_Familiar; | ||
2506 | d-> m_rotation = Rot0; | ||
2507 | } | ||
2508 | |||
2509 | void Jornada::initButtons ( ) | ||
2510 | { | ||
2511 | if ( d-> m_buttons ) | ||
2512 | return; | ||
2513 | |||
2514 | // Simulation uses iPAQ 3660 device buttons | ||
2515 | |||
2516 | qDebug ( "init Buttons" ); | ||
2517 | d-> m_buttons = new QValueList <ODeviceButton>; | ||
2518 | |||
2519 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | ||
2520 | i_button *ib = ipaq_buttons + i; | ||
2521 | ODeviceButton b; | ||
2522 | |||
2523 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | ||
2524 | b. setKeycode ( ib-> code ); | ||
2525 | b. setUserText ( QObject::tr ( "Button", ib-> utext )); | ||
2526 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | ||
2527 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | ||
2528 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | ||
2529 | d-> m_buttons-> append ( b ); | ||
2530 | } | ||
2531 | } | ||
2532 | reloadButtonMapping ( ); | ||
2533 | |||
2534 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | ||
2535 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | ||
2536 | } | ||
2537 | |||
2538 | int Jornada::displayBrightnessResolution ( ) const | ||
2539 | { | ||
2540 | } | ||
2541 | |||
2542 | bool Jornada::setDisplayBrightness ( int bright ) | ||
2543 | { | ||
2544 | bool res = false; | ||
2545 | int fd; | ||
2546 | |||
2547 | if ( bright > 255 ) | ||
2548 | bright = 255; | ||
2549 | if ( bright < 0 ) | ||
2550 | bright = 0; | ||
2551 | |||
2552 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | ||
2553 | FLITE_IN bl; | ||
2554 | bl. mode = 1; | ||
2555 | bl. pwr = bright ? 1 : 0; | ||
2556 | bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; | ||
2557 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | ||
2558 | ::close ( fd ); | ||
2559 | } | ||
2560 | return res; | ||
2561 | } | ||
2562 | |||
2563 | bool Jornada::setSoftSuspend ( bool soft ) | ||
2564 | { | ||
2565 | bool res = false; | ||
2566 | int fd; | ||
2567 | |||
2568 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | ||
2569 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | ||
2570 | res = true; | ||
2571 | else | ||
2572 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | ||
2573 | |||
2574 | ::close ( fd ); | ||
2575 | } | ||
2576 | else | ||
2577 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | ||
2578 | |||
2579 | return res; | ||
2580 | } | ||
diff --git a/libopie/odevice.h b/libopie/odevice.h index 2a5e494..35e3eff 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -52,4 +52,7 @@ enum OModel { | |||
52 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 52 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
53 | 53 | ||
54 | Model_Jornada = ( 6 << 24 ), | ||
55 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | ||
56 | |||
54 | Model_Zaurus = ( 2 << 24 ), | 57 | Model_Zaurus = ( 2 << 24 ), |
55 | 58 | ||