summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_ipaq.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp52
1 files changed, 25 insertions, 27 deletions
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
@@ -69,143 +69,141 @@ typedef struct {
unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
unsigned char TotalTime; /* Units of 5 seconds */
unsigned char OnTime; /* units of 100m/s */
unsigned char OffTime; /* units of 100m/s */
} LED_IN;
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 )
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_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
"devicebuttons/ipaq_calendar",
"datebook", "nextView()",
"today", "raise()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
"devicebuttons/ipaq_contact",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/ipaq_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
"devicebuttons/ipaq_mail",
"opiemail", "raise()",
"opiemail", "newMail()" },
{ 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 )) {
d->m_systemstr = "OpenEmbedded/iPaq";
d->m_system = System_Familiar;
QTextStream ts ( &f );
ts.setDevice ( &f );
d->m_sysverstr = ts. readLine();
f. close();
}
}
m_leds [0] = m_leds [1] = Led_Off;
m_power_timer = 0;
}
void iPAQ::initButtons()
{
if ( d->m_buttons )
return;
if ( isQWS( ) )
QWSServer::setKeyboardFilter ( this );
d->m_buttons = new QValueList <ODeviceButton>;
for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
i_button *ib = ipaq_buttons + i;
ODeviceButton b;
if (( ib->model & d->m_model ) == d->m_model ) {
b. setKeycode ( ib->code );
b. setUserText ( QObject::tr ( "Button", ib->utext ));
b. setPixmap ( Resource::loadPixmap ( ib->pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction ));