summaryrefslogtreecommitdiff
path: root/libopie
authoreilers <eilers>2003-11-17 17:27:44 (UTC)
committer eilers <eilers>2003-11-17 17:27:44 (UTC)
commite8bba52dc9443d3aadcc2c221fa62ba37ea5c712 (patch) (side-by-side diff)
treeddd09027e169cecb392fb7d956f55631d5bf4ef7 /libopie
parent2e6030553ecc21845ebb9987dffd6c252760a94d (diff)
downloadopie-e8bba52dc9443d3aadcc2c221fa62ba37ea5c712.zip
opie-e8bba52dc9443d3aadcc2c221fa62ba37ea5c712.tar.gz
opie-e8bba52dc9443d3aadcc2c221fa62ba37ea5c712.tar.bz2
Merging the corgie-patches from Branch manually.. (no cvs -j would caused
a big mess .. ;) ) Changed the keysound handling for zaurus: Just all C7x0 and the 5600 will use the sounddevice.. All other will use the old /dev/sharp_buz device..
Diffstat (limited to 'libopie') (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index fef623a..58254a7 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1115,48 +1115,49 @@ void iPAQ::init ( )
else if ( d-> m_modelstr == "H3600" )
d-> m_model = Model_iPAQ_H36xx;
else if ( d-> m_modelstr == "H3700" )
d-> m_model = Model_iPAQ_H37xx;
else if ( d-> m_modelstr == "H3800" )
d-> m_model = Model_iPAQ_H38xx;
else if ( d-> m_modelstr == "H3900" )
d-> m_model = Model_iPAQ_H39xx;
else if ( d-> m_modelstr == "H5400" )
d-> m_model = Model_iPAQ_H5xxx;
else
d-> m_model = Model_Unknown;
f. close ( );
}
switch ( d-> m_model ) {
case Model_iPAQ_H31xx:
case Model_iPAQ_H38xx:
d-> m_rotation = Rot90;
break;
case Model_iPAQ_H36xx:
case Model_iPAQ_H37xx:
case Model_iPAQ_H39xx:
+
default:
d-> m_rotation = Rot270;
break;
case Model_iPAQ_H5xxx:
d-> m_rotation = Rot0;
}
f. setName ( "/etc/familiar-version" );
if ( f. open ( IO_ReadOnly )) {
d-> m_systemstr = "Familiar";
d-> m_system = System_Familiar;
QTextStream ts ( &f );
d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
f. close ( );
} else {
f. setName ( "/etc/oz_version" );
if ( f. open ( IO_ReadOnly )) {
d-> m_systemstr = "OpenEmbedded/iPaq";
d-> m_system = System_Familiar;
QTextStream ts ( &f );
@@ -1479,70 +1480,71 @@ int iPAQ::readLightSensor ( )
return val;
}
int iPAQ::lightSensorResolution ( ) const
{
return 256;
}
/**************************************************
*
* Zaurus
*
**************************************************/
// Check whether this device is the sharp zaurus..
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 kenrnels, we have too look closer.
+ // 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( );
if ( model == "Sharp-Collie"
|| model == "Collie"
|| model == "SHARP Corgi"
|| model == "SHARP Shepherd"
|| model == "SHARP Poodle"
+ || model == "SHARP Husky" )
)
is_zaurus = true;
}
return is_zaurus;
}
void Zaurus::init ( )
{
d-> m_vendorstr = "Sharp";
d-> m_vendor = Vendor_Sharp;
m_embedix = true; // Not openzaurus means: It has an embedix kernel !
// QFile f ( "/proc/filesystems" );
QString model;
// It isn't a good idea to check the system configuration to
// detect the distribution !
// Otherwise it may happen that any other distribution is detected as openzaurus, just
// because it uses a jffs2 filesystem..
// (eilers)
// if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
QFile f ("/etc/oz_version");
@@ -1571,105 +1573,108 @@ void Zaurus::init ( )
m_embedix = false;
f. close ( );
}
pclose(uname);
}
else {
d-> m_systemstr = "Zaurus";
d-> m_system = System_Zaurus;
}
f. setName ( "/proc/cpuinfo" );
if ( f. open ( IO_ReadOnly ) ) {
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( );
}
if ( model == "SHARP Corgi" ) {
- d-> m_model = Model_Zaurus_SLC700;
+ d-> m_model = Model_Zaurus_SLC7x0;
d-> m_modelstr = "Zaurus SL-C700";
} else if ( model == "SHARP Shepherd" ) {
- d-> m_model = Model_Zaurus_SLC700; // Do we need a special type for the C750 ? (eilers)
+ d-> m_model = Model_Zaurus_SLC7x0;
d-> m_modelstr = "Zaurus SL-C750";
+ } 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_SLC700:
+ 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.
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;
d-> m_buttons = new QValueList <ODeviceButton>;
struct z_button * pz_buttons;
int buttoncount;
switch ( d-> m_model ) {
- case Model_Zaurus_SLC700:
+ case Model_Zaurus_SLC7x0:
pz_buttons = z_buttons_c700;
buttoncount = ARRAY_SIZE(z_buttons_c700);
break;
default:
pz_buttons = z_buttons;
buttoncount = ARRAY_SIZE(z_buttons);
break;
}
for ( int i = 0; i < buttoncount; i++ ) {
struct z_button *zb = pz_buttons + i;
ODeviceButton b;
b. setKeycode ( zb-> code );
b. setUserText ( QObject::tr ( "Button", zb-> utext ));
b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
zb-> fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
zb-> fheldaction ));
d-> m_buttons-> append ( b );
}
@@ -1731,53 +1736,51 @@ typedef struct sharp_led_status {
int which; /* select which LED status is wanted. */
int status; /* set new led status if you call SHARP_LED_SETSTATUS */
} sharp_led_status;
#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
// #include <asm/sharp_apm.h> // including kernel headers is evil ...
#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
#define APM_EVT_POWER_BUTTON (1 << 0)
#define FL_IOCTL_STEP_CONTRAST 100
void Zaurus::buzzer ( int sound )
{
#ifndef QT_NO_SOUND
QString soundname;
- // Not all devices have real sound. But I expect
- // that Openzaurus now has a sound driver which
- // I will use instead the buzzer...
- if ( ( d->m_model == Model_Zaurus_SLC700 )
- || d->m_system == System_OpenZaurus ){
+ // Not all devices have real sound
+ if ( d->m_model == Model_Zaurus_SLC7x0
+ || d->m_model == Model_Zaurus_SLB600 ){
switch ( sound ){
case SHARP_BUZ_SCHEDULE_ALARM:
soundname = "alarm";
break;
case SHARP_BUZ_TOUCHSOUND:
soundname = "touchsound";
break;
case SHARP_BUZ_KEYSOUND:
soundname = "keysound";
break;
default:
soundname = "alarm";
}
}
// If a soundname is defined, we expect that this device has
// sound capabilities.. Otherwise we expect to have the buzzer
// device..
if ( !soundname.isEmpty() ){
int fd;
int vol;
bool vol_reset = false;