summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-12-05 21:24:53 (UTC)
committer mickeyl <mickeyl>2003-12-05 21:24:53 (UTC)
commit650d6e3ec023759f1c6566d7562857d8dd0e8028 (patch) (side-by-side diff)
treeb028807a522b553aa4cfae8bdb6fa174f9a7fe2b
parent978b8c98ba1e206dd683b2f1f0a743b8d2ce290f (diff)
downloadopie-650d6e3ec023759f1c6566d7562857d8dd0e8028.zip
opie-650d6e3ec023759f1c6566d7562857d8dd0e8028.tar.gz
opie-650d6e3ec023759f1c6566d7562857d8dd0e8028.tar.bz2
add some comments to Zaurus class
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
@@ -1472,48 +1472,61 @@ int iPAQ::readLightSensor ( )
buffer [4] = 0;
val = ::strtol ( buffer + 2, &endptr, 16 );
if ( *endptr != 0 )
val = -1;
}
::close ( fd );
}
return val;
}
int iPAQ::lightSensorResolution ( ) const
{
return 256;
}
/**************************************************
*
* Zaurus
*
**************************************************/
// Check whether this device is the sharp zaurus..
+// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
+// class up into individual classes. We need three classes
+//
+// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
+// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
+// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860)
+//
+// Only question right now is: Do we really need to do it? Because as soon
+// as the OpenZaurus kernel is ready, there will be a unified interface for all
+// Zaurus models (concerning apm, backlight, buttons, etc.)
+//
+// Comments? - mickeyl.
+
bool Zaurus::isZaurus()
{
// If the special devices by embedix exist, it is quite simple: it is a Zaurus !
if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){
return true;
}
// On non-embedix kernels, we have to look closer.
bool is_zaurus = false;
QFile f ( "/proc/cpuinfo" );
if ( f. open ( IO_ReadOnly ) ) {
QString model;
QFile f ( "/proc/cpuinfo" );
QTextStream ts ( &f );
QString line;
while( line = ts. readLine ( ) ) {
if ( line. left ( 8 ) == "Hardware" )
break;
}
int loc = line. find ( ":" );
if ( loc != -1 )
model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
@@ -1602,48 +1615,49 @@ void Zaurus::init ( )
} else if ( model == "SHARP Husky" ) {
d-> m_model = Model_Zaurus_SLC7x0;
d-> m_modelstr = "Zaurus SL-C760";
} else if ( model == "SHARP Poodle" ) {
d-> m_model = Model_Zaurus_SLB600;
d-> m_modelstr = "Zaurus SL-B500 or SL-5600";
} else if ( model == "Sharp-Collie" || model == "Collie" ) {
d-> m_model = Model_Zaurus_SL5500;
d-> m_modelstr = "Zaurus SL-5500 or SL-5000d";
} else {
d-> m_model = Model_Zaurus_SL5500;
d-> m_modelstr = "Zaurus (Model unknown)";
}
bool flipstate = false;
switch ( d-> m_model ) {
case Model_Zaurus_SLA300:
d-> m_rotation = Rot0;
break;
case Model_Zaurus_SLC7x0:
// Note: need to 1) set flipstate based on physical screen orientation
// and 2) check to see if the user overrode the rotation direction
// using appearance, and if so, remove that item from the Config to
// ensure the rotate applet flips us back to the previous state.
+ // treke said he has patches for detecting the phys. so where are they, treke? -mickeyl.
if ( flipstate ) {
// 480x640
d-> m_rotation = Rot0;
d-> m_direction = CW;
} else {
// 640x480
d-> m_rotation = Rot270;
d-> m_direction = CCW;
}
break;
case Model_Zaurus_SLB600:
case Model_Zaurus_SL5500:
case Model_Zaurus_SL5000:
default:
d-> m_rotation = Rot270;
break;
}
m_leds [0] = Led_Off;
}
void Zaurus::initButtons ( )
{
if ( d-> m_buttons )
return;
@@ -1915,48 +1929,51 @@ bool Zaurus::setSoftSuspend ( bool soft )
if ( soft )
sources &= ~APM_EVT_POWER_BUTTON;
else
sources |= APM_EVT_POWER_BUTTON;
if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
res = true;
else
perror ( "APM_IOCGEVTSRC" );
}
else
perror ( "APM_IOCGEVTSRC" );
::close ( fd );
}
else
perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
return res;
}
bool Zaurus::setDisplayBrightness ( int bright )
{
+// FIXME The C7x0 have a proc-interface (/proc/drivers/corgi-bl) which
+// is nice to use. Currently it exposes 16+1 levels. Implement this!
+// (or wait for kergoth unifying the interfaces in the OpenZaurus kernel.)
bool res = false;
int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
if (m_embedix) {
if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
if ( bright && !bl )
bl = 1;
res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
::close ( fd );
}
} else {
#define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */
if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) {
res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 );
::close ( fd );
}
}
return res;