summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-01 18:13:29 (UTC)
committer zecke <zecke>2004-05-01 18:13:29 (UTC)
commit7a2cac7a65be07c1e82508e00c2d3d61e0823dc1 (patch) (side-by-side diff)
tree70381a30c784957b22d9e644272ac96a0fced5a4
parentec6a887d8abddbab085a0a3aecae5760ff85dbe8 (diff)
downloadopie-7a2cac7a65be07c1e82508e00c2d3d61e0823dc1.zip
opie-7a2cac7a65be07c1e82508e00c2d3d61e0823dc1.tar.gz
opie-7a2cac7a65be07c1e82508e00c2d3d61e0823dc1.tar.bz2
Pass on the Hardware line of proc/cpuinfo so we don't need to parse the file again..
only adjusted iPAQ backend to use it Beginning of hh22xx Linux2.6 support
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp6
-rw-r--r--libopie2/opiecore/device/odevice.h7
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp52
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.h2
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h2
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ramses.h2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.h2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h2
14 files changed, 44 insertions, 43 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 62a2e03..cef7f63 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -81,54 +81,56 @@ struct default_button default_buttons [] = {
"QPE/TaskBar", "toggleStartMenu()" },
{ Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
"devicebuttons/z_mail",
"opiemail", "raise()",
"opiemail", "newMail()" },
};
ODevice *ODevice::inst()
{
static ODevice *dev = 0;
// rewrite this to only use /proc/cpuinfo or so
+ QString cpu_info;
if ( !dev )
{
QFile f( PATH_PROC_CPUINFO );
if ( f.open( IO_ReadOnly ) )
{
QTextStream s( &f );
while ( !s.atEnd() )
{
QString line;
line = s.readLine();
if ( line.startsWith( "Hardware" ) )
{
qDebug( "ODevice() - found '%s'", (const char*) line );
+ cpu_info = line;
if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
else qWarning( "ODevice() - unknown hardware - using default." );
break;
}
}
}
else
{
qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO );
}
if ( !dev ) dev = new ODevice();
- dev->init();
+ dev->init(cpu_info);
}
return dev;
}
ODevice::ODevice()
{
d = new ODeviceData;
d->m_modelstr = "Unknown";
d->m_model = Model_Unknown;
d->m_vendorstr = "Unknown";
d->m_vendor = Vendor_Unknown;
@@ -141,25 +143,25 @@ ODevice::ODevice()
d->m_holdtime = 1000; // 1000ms
d->m_buttons = 0;
d->m_cpu_frequencies = new QStrList;
}
void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
{
if ( msg == "deviceButtonMappingChanged()" ) {
reloadButtonMapping();
}
}
-void ODevice::init()
+void ODevice::init(const QString&)
{
}
/**
* This method initialises the button mapping
*/
void ODevice::initButtons()
{
if ( d->m_buttons )
return;
qDebug ( "init Buttons" );
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 0ba58f0..aaebde3 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -51,25 +51,26 @@ enum OModel {
Model_Unknown, // = 0
Model_Series_Mask = 0xff000000,
Model_iPAQ = ( 1 << 24 ),
Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
- Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ),
+ Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ),
+ Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ),
Model_Jornada = ( 6 << 24 ),
Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
Model_Zaurus = ( 2 << 24 ),
Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ),
@@ -151,25 +152,25 @@ enum ODirection {
CW = 0,
CCW = 1,
Flip = 2,
};
enum OHingeStatus {
CASE_CLOSED = 3,
CASE_PORTRAIT = 2,
CASE_LANDSCAPE = 0,
CASE_UNKNOWN = 1,
};
-/* default button for qvfb or such
+/* default button for qvfb or such
* see odevice.cpp for details.
* hint: manage a user defined button for qvfb?
* alwin
*/
struct default_button {
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
@@ -186,25 +187,25 @@ struct default_button {
* @version 1.0
*/
class ODevice : public QObject
{
Q_OBJECT
private:
/* disable copy */
ODevice ( const ODevice & );
protected:
ODevice();
- virtual void init();
+ virtual void init(const QString&);
virtual void initButtons();
static void sendSuspendmsg();
ODeviceData *d;
public:
// sandman do we want to allow destructions? -zecke?
virtual ~ODevice();
static ODevice *inst();
// information
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 98e2ffa..efe35e7 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -105,71 +105,69 @@ struct i_button ipaq_buttons [] = {
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/ipaq_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
"devicebuttons/ipaq_record",
"QPE/VMemo", "toggleRecord()",
"sound", "raise()" },
};
-void iPAQ::init()
+void iPAQ::init(const QString& model)
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
- QFile f ( "/proc/hal/model" );
+ d->m_modelstr = model.mid(model.findRev('H'));
+
+ if ( d->m_modelstr == "H3100" )
+ d->m_model = Model_iPAQ_H31xx;
+ 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 if ( d->m_modelstr == "H2200" )
+ d->m_model = Model_iPAQ_H22xx;
+ else
+ d->m_model = Model_Unknown;
- if ( f. open ( IO_ReadOnly )) {
- QTextStream ts ( &f );
- d->m_modelstr = "H" + ts. readLine();
-
- if ( d->m_modelstr == "H3100" )
- d->m_model = Model_iPAQ_H31xx;
- 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_H5xxx:
+ case Model_iPAQ_H22xx:
+ d->m_rotation = Rot0;
+ 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" );
+ QFile f( "/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 )) {
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h
index 968f715..cc0b8ac 100644
--- a/libopie2/opiecore/device/odevice_ipaq.h
+++ b/libopie2/opiecore/device/odevice_ipaq.h
@@ -34,25 +34,25 @@
/* QT */
#include <qwindowsystem_qws.h>
namespace Opie {
namespace Core {
namespace Internal {
class iPAQ : public ODevice, public QWSServer::KeyboardFilter
{
protected:
- virtual void init();
+ virtual void init(const QString&);
virtual void initButtons();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool setDisplayBrightness( int b );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual QValueList <OLed> ledList() const;
virtual QValueList <OLedState> ledStateList( OLed led ) const;
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index eaa93ca..ad2f830 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -70,25 +70,25 @@ typedef struct {
typedef struct {
unsigned char mode;
unsigned char pwr;
unsigned char brightness;
} FLITE_IN;
#define LED_ON OD_IOW( 'f', 5, LED_IN )
#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
using namespace Opie::Core::Internal;
-void Jornada::init()
+void Jornada::init(const QString&)
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
d->m_modelstr = "Jornada 56x";
d->m_model = Model_Jornada_56x;
d->m_systemstr = "Familiar";
d->m_system = System_Familiar;
d->m_rotation = Rot0;
QFile f ( "/etc/familiar-version" );
f.setName ( "/etc/familiar-version" );
if ( f.open ( IO_ReadOnly )) {
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h
index e2e67af..fddfe34 100644
--- a/libopie2/opiecore/device/odevice_jornada.h
+++ b/libopie2/opiecore/device/odevice_jornada.h
@@ -30,24 +30,24 @@
#ifndef ODEVICE_JORNADA
#define ODEVICE_JORNADA
#include <opie2/odevice.h>
namespace Opie {
namespace Core {
namespace Internal {
class Jornada : public ODevice
{
protected:
- virtual void init();
+ virtual void init(const QString&);
public:
virtual bool setSoftSuspend ( bool soft );
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
};
}
}
}
#endif
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp
index 10b7b61..32467f1 100644
--- a/libopie2/opiecore/device/odevice_ramses.cpp
+++ b/libopie2/opiecore/device/odevice_ramses.cpp
@@ -60,25 +60,25 @@ struct r_button ramses_buttons [] = {
{ Model_Ramses_MNCI,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/z_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_Ramses_MNCI,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/ipaq_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
};
-void Ramses::init()
+void Ramses::init(const QString&)
{
d->m_vendorstr = "M und N";
d->m_vendor = Vendor_MundN;
QFile f("/proc/sys/board/ramses");
d->m_modelstr = "Ramses";
d->m_model = Model_Ramses_MNCI;
d->m_rotation = Rot0;
d->m_holdtime = 1000;
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h
index aea9e2a..3cf5e92 100644
--- a/libopie2/opiecore/device/odevice_ramses.h
+++ b/libopie2/opiecore/device/odevice_ramses.h
@@ -32,25 +32,25 @@
#include <opie2/odevice.h>
/* QT */
#include <qwindowsystem_qws.h>
namespace Opie {
namespace Core {
namespace Internal {
class Ramses : public ODevice, public QWSServer::KeyboardFilter
{
protected:
- virtual void init();
+ virtual void init(const QString&);
public:
virtual bool setSoftSuspend( bool soft );
virtual bool suspend();
virtual bool setDisplayStatus( bool on );
virtual bool setDisplayBrightness( int b );
virtual int displayBrightnessResolution() const;
virtual bool setDisplayContrast( int b );
virtual int displayContrastResolution() const;
protected:
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index e9481bb..6630763 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -103,25 +103,25 @@ struct s_button simpad_buttons [] = {
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
"devicebuttons/simpad_lower_upper",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
"devicebuttons/simpad_upper_lower",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
*/
};
-void SIMpad::init()
+void SIMpad::init(const QString&)
{
d->m_vendorstr = "SIEMENS";
d->m_vendor = Vendor_SIEMENS;
QFile f ( "/proc/hal/model" );
//TODO Implement model checking
//FIXME For now we assume an SL4
d->m_modelstr = "SL4";
d->m_model = Model_SIMpad_SL4;
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h
index 3d5acb5..0f4e66f 100644
--- a/libopie2/opiecore/device/odevice_simpad.h
+++ b/libopie2/opiecore/device/odevice_simpad.h
@@ -33,25 +33,25 @@
#include <opie2/odevice.h>
/* QT */
#include <qwindowsystem_qws.h>
namespace Opie {
namespace Core {
namespace Internal {
class SIMpad : public ODevice, public QWSServer::KeyboardFilter
{
protected:
- virtual void init();
+ virtual void init(const QString&);
virtual void initButtons();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool suspend();
virtual bool setDisplayStatus( bool on );
virtual bool setDisplayBrightness( int b );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index 4e9f227..493ed25 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -62,25 +62,25 @@ struct yopy_button yopy_buttons [] = {
"datebook", "nextView()",
"today", "raise()" },
{ Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ),
"devicebuttons/yopy_ok",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ),
"devicebuttons/yopy_end",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
};
-void Yopy::init()
+void Yopy::init(const QString&)
{
d->m_vendorstr = "G.Mate";
d->m_vendor = Vendor_GMate;
d->m_modelstr = "Yopy3700";
d->m_model = Model_Yopy_3700;
d->m_rotation = Rot0;
d->m_systemstr = "Linupy";
d->m_system = System_Linupy;
QFile f ( "/etc/issue" );
if ( f. open ( IO_ReadOnly ) )
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h
index 6e1db88..f6bf061 100644
--- a/libopie2/opiecore/device/odevice_yopy.h
+++ b/libopie2/opiecore/device/odevice_yopy.h
@@ -30,25 +30,25 @@ _;:,     .>    :=|. This program is free software; you can
#ifndef ODEVICE_YOPY
#define ODEVICE_YOPY
#include <opie2/odevice.h>
namespace Opie {
namespace Core {
namespace Internal {
class Yopy : public ODevice
{
protected:
- virtual void init();
+ virtual void init(const QString&);
virtual void initButtons();
public:
virtual bool suspend();
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
};
struct yopy_button
{
Qt::Key code;
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 1434e69..e8b813e 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -106,25 +106,25 @@ struct z_button z_buttons_c700 [] = {
// 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.
-void Zaurus::init()
+void Zaurus::init(const QString&)
{
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..
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index a0b1787..76a40d6 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -44,25 +44,25 @@
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
namespace Opie {
namespace Core {
namespace Internal {
class Zaurus : public ODevice
{
protected:
- virtual void init();
+ virtual void init(const QString&);
virtual void initButtons();
public:
virtual bool setSoftSuspend ( bool soft );
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
virtual void playAlarmSound();
virtual void playKeySound();
virtual void playTouchSound();