summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 71ed9e4..9373ef9 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1480,32 +1480,45 @@ int iPAQ::readLightSensor ( )
1480 1480
1481 return val; 1481 return val;
1482} 1482}
1483 1483
1484int iPAQ::lightSensorResolution ( ) const 1484int iPAQ::lightSensorResolution ( ) const
1485{ 1485{
1486 return 256; 1486 return 256;
1487} 1487}
1488 1488
1489/************************************************** 1489/**************************************************
1490 * 1490 *
1491 * Zaurus 1491 * Zaurus
1492 * 1492 *
1493 **************************************************/ 1493 **************************************************/
1494 1494
1495// Check whether this device is the sharp zaurus.. 1495// Check whether this device is the sharp zaurus..
1496// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
1497// class up into individual classes. We need three classes
1498//
1499// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
1500// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
1501// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860)
1502//
1503// Only question right now is: Do we really need to do it? Because as soon
1504// as the OpenZaurus kernel is ready, there will be a unified interface for all
1505// Zaurus models (concerning apm, backlight, buttons, etc.)
1506//
1507// Comments? - mickeyl.
1508
1496bool Zaurus::isZaurus() 1509bool Zaurus::isZaurus()
1497{ 1510{
1498 1511
1499 // If the special devices by embedix exist, it is quite simple: it is a Zaurus ! 1512 // If the special devices by embedix exist, it is quite simple: it is a Zaurus !
1500 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){ 1513 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){
1501 return true; 1514 return true;
1502 } 1515 }
1503 1516
1504 // On non-embedix kernels, we have to look closer. 1517 // On non-embedix kernels, we have to look closer.
1505 bool is_zaurus = false; 1518 bool is_zaurus = false;
1506 QFile f ( "/proc/cpuinfo" ); 1519 QFile f ( "/proc/cpuinfo" );
1507 if ( f. open ( IO_ReadOnly ) ) { 1520 if ( f. open ( IO_ReadOnly ) ) {
1508 QString model; 1521 QString model;
1509 QFile f ( "/proc/cpuinfo" ); 1522 QFile f ( "/proc/cpuinfo" );
1510 1523
1511 QTextStream ts ( &f ); 1524 QTextStream ts ( &f );
@@ -1610,32 +1623,33 @@ void Zaurus::init ( )
1610 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; 1623 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d";
1611 } else { 1624 } else {
1612 d-> m_model = Model_Zaurus_SL5500; 1625 d-> m_model = Model_Zaurus_SL5500;
1613 d-> m_modelstr = "Zaurus (Model unknown)"; 1626 d-> m_modelstr = "Zaurus (Model unknown)";
1614 } 1627 }
1615 1628
1616 bool flipstate = false; 1629 bool flipstate = false;
1617 switch ( d-> m_model ) { 1630 switch ( d-> m_model ) {
1618 case Model_Zaurus_SLA300: 1631 case Model_Zaurus_SLA300:
1619 d-> m_rotation = Rot0; 1632 d-> m_rotation = Rot0;
1620 break; 1633 break;
1621 case Model_Zaurus_SLC7x0: 1634 case Model_Zaurus_SLC7x0:
1622 // Note: need to 1) set flipstate based on physical screen orientation 1635 // Note: need to 1) set flipstate based on physical screen orientation
1623 // and 2) check to see if the user overrode the rotation direction 1636 // and 2) check to see if the user overrode the rotation direction
1624 // using appearance, and if so, remove that item from the Config to 1637 // using appearance, and if so, remove that item from the Config to
1625 // ensure the rotate applet flips us back to the previous state. 1638 // ensure the rotate applet flips us back to the previous state.
1639 // treke said he has patches for detecting the phys. so where are they, treke? -mickeyl.
1626 if ( flipstate ) { 1640 if ( flipstate ) {
1627 // 480x640 1641 // 480x640
1628 d-> m_rotation = Rot0; 1642 d-> m_rotation = Rot0;
1629 d-> m_direction = CW; 1643 d-> m_direction = CW;
1630 } else { 1644 } else {
1631 // 640x480 1645 // 640x480
1632 d-> m_rotation = Rot270; 1646 d-> m_rotation = Rot270;
1633 d-> m_direction = CCW; 1647 d-> m_direction = CCW;
1634 } 1648 }
1635 break; 1649 break;
1636 case Model_Zaurus_SLB600: 1650 case Model_Zaurus_SLB600:
1637 case Model_Zaurus_SL5500: 1651 case Model_Zaurus_SL5500:
1638 case Model_Zaurus_SL5000: 1652 case Model_Zaurus_SL5000:
1639 default: 1653 default:
1640 d-> m_rotation = Rot270; 1654 d-> m_rotation = Rot270;
1641 break; 1655 break;
@@ -1923,32 +1937,35 @@ bool Zaurus::setSoftSuspend ( bool soft )
1923 perror ( "APM_IOCGEVTSRC" ); 1937 perror ( "APM_IOCGEVTSRC" );
1924 } 1938 }
1925 else 1939 else
1926 perror ( "APM_IOCGEVTSRC" ); 1940 perror ( "APM_IOCGEVTSRC" );
1927 1941
1928 ::close ( fd ); 1942 ::close ( fd );
1929 } 1943 }
1930 else 1944 else
1931 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 1945 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
1932 1946
1933 return res; 1947 return res;
1934} 1948}
1935 1949
1936 1950
1937bool Zaurus::setDisplayBrightness ( int bright ) 1951bool Zaurus::setDisplayBrightness ( int bright )
1938{ 1952{
1953// FIXME The C7x0 have a proc-interface (/proc/drivers/corgi-bl) which
1954// is nice to use. Currently it exposes 16+1 levels. Implement this!
1955// (or wait for kergoth unifying the interfaces in the OpenZaurus kernel.)
1939 bool res = false; 1956 bool res = false;
1940 int fd; 1957 int fd;
1941 1958
1942 if ( bright > 255 ) 1959 if ( bright > 255 )
1943 bright = 255; 1960 bright = 255;
1944 if ( bright < 0 ) 1961 if ( bright < 0 )
1945 bright = 0; 1962 bright = 0;
1946 1963
1947 if (m_embedix) { 1964 if (m_embedix) {
1948 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 1965 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
1949 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 1966 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
1950 if ( bright && !bl ) 1967 if ( bright && !bl )
1951 bl = 1; 1968 bl = 1;
1952 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); 1969 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
1953 ::close ( fd ); 1970 ::close ( fd );
1954 } 1971 }