summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp63
-rw-r--r--libopie2/opiecore/device/odevice.h64
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp25
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp13
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp12
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp65
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp11
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp61
8 files changed, 133 insertions, 181 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index cef7f63..5b73e59 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -1,26 +1,26 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Opie Team <opie-devel@handhelds.org>
+                 This file is part of the Opie Project
+              Copyright (C) The Opie Team <opie-devel@handhelds.org>
=.
.=l.
- .>+-=
-_;:, .> :=|. This program is free software; you can
-.> <`_, > . <= redistribute it and/or modify it under
-:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
-.="- .-=="i, .._ License as published by the Free Software
-- . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.= = ; Library General Public License for more
-++= -. .` .: details.
-: = ...= . :.=-
--. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
@@ -144,4 +144,25 @@ ODevice::ODevice()
d->m_buttons = 0;
d->m_cpu_frequencies = new QStrList;
+
+ // New distribution detection code first checks for legacy distributions,
+ // identified by /etc/familiar-version or /etc/oz_version.
+ // Then check for OpenEmbedded and lastly, read /etc/issue
+
+ for ( unsigned int i = 0; i < sizeof distributions; ++i )
+ {
+ if ( QFile::exists( distributions[i].sysvfile ) )
+ {
+ d->m_systemstr = distributions[i].sysstr;
+ d->m_system = distributions[i].system;
+ d->m_sysverstr = "<Unknown>";
+ QFile f( distributions[i].sysvfile );
+ if ( f.open( IO_ReadOnly ) )
+ {
+ QTextStream ts( &f );
+ d->m_sysverstr = ts.readLine();
+ }
+ break;
+ }
+ }
}
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index aaebde3..474d792 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,26 +1,26 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Opie Team <opie-devel@handhelds.org>
+                 This file is part of the Opie Project
+              Copyright (C) The Opie Team <opie-devel@handhelds.org>
=.
.=l.
- .>+-=
-_;:, .> :=|. This program is free software; you can
-.> <`_, > . <= redistribute it and/or modify it under
-:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
-.="- .-=="i, .._ License as published by the Free Software
-- . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.= = ; Library General Public License for more
-++= -. .` .: details.
-: = ...= . :.=-
--. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
@@ -95,4 +95,9 @@ enum OModel {
Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
+ Model_Beagle = ( 6 << 24 ),
+
+ Model_Beagle_All = ( Model_Beagle | 0xffffff ),
+ Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ),
+
};
@@ -108,4 +113,5 @@ enum OVendor {
Vendor_MundN,
Vendor_GMate,
+ Vendor_MasterIA,
};
@@ -120,4 +126,20 @@ enum OSystem {
System_OpenZaurus,
System_Linupy,
+ System_OpenEmbedded,
+};
+
+typedef struct {
+ OSystem system;
+ char* sysstr;
+ char* sysvfile;
+} ODistribution;
+
+static ODistribution distributions[] =
+{
+ { System_Familiar, "FamiliarLinux", "/etc/familiar-version" },
+ { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" },
+ { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" },
+ { System_Unknown, "Linux", "/etc/issue" },
+
};
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index efe35e7..16c0538 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -139,6 +139,4 @@ void iPAQ::init(const QString& model)
d->m_model = Model_Unknown;
-
-
switch ( d->m_model ) {
case Model_iPAQ_H31xx:
@@ -159,27 +157,4 @@ void iPAQ::init(const QString& model)
}
- 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;
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index 1f69326..5d32901 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -115,17 +115,6 @@ void Jornada::init(const QString&)
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 )) {
-
- QTextStream ts ( &f );
- d->m_sysverstr = ts.readLine().mid( 10 );
-
- f. close();
- }
+ //Distribution detecting code is now in base class
}
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp
index 32467f1..7db2af1 100644
--- a/libopie2/opiecore/device/odevice_ramses.cpp
+++ b/libopie2/opiecore/device/odevice_ramses.cpp
@@ -83,15 +83,5 @@ void Ramses::init(const QString&)
d->m_holdtime = 1000;
- f.setName("/etc/oz_version");
-
- if (f.open(IO_ReadOnly)) {
- d->m_systemstr = "OpenEmbedded/Ramses";
- d->m_system = System_OpenZaurus;
-
- QTextStream ts(&f);
- ts.setDevice(&f);
- d->m_sysverstr = ts.readLine();
- f.close();
- }
+ // Distribution detection code now in the base class
m_power_timer = 0;
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 6630763..6d4624b 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -1,26 +1,26 @@
/*
- This file is part of the Opie Project
- Copyright (C) The Opie Team <opie-devel@handhelds.org>
+                 This file is part of the Opie Project
+              Copyright (C) The Opie Team <opie-devel@handhelds.org>
=.
.=l.
- .>+-=
-_;:, .> :=|. This program is free software; you can
-.> <`_, > . <= redistribute it and/or modify it under
-:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
-.="- .-=="i, .._ License as published by the Free Software
-- . .-<_> .<> Foundation; either version 2 of the License,
- ._= =} : or (at your option) any later version.
- .%`+i> _;_.
- .i_,=:_. -<s. This program is distributed in the hope that
- + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
- : .. .:, . . . without even the implied warranty of
- =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
- _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.= = ; Library General Public License for more
-++= -. .` .: details.
-: = ...= . :.=-
--. .:....=;==+<; You should have received a copy of the GNU
- -_. . . )=. = Library General Public License along with
- -- :-=` this library; see the file COPYING.LIB.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
@@ -135,26 +135,5 @@ void SIMpad::init(const QString&)
}
- 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/SIMpad";
- d->m_system = System_OpenZaurus;
-
- QTextStream ts ( &f );
- ts.setDevice ( &f );
- d->m_sysverstr = ts. readLine();
- f. close();
- }
- }
+ //Distribution detecting code is now in base class
m_leds [0] = m_leds [1] = Led_Off;
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index 493ed25..223aa76 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -79,16 +79,7 @@ void Yopy::init(const QString&)
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 ) )
- {
- QTextStream ts ( &f );
- ts.readLine();
- d->m_sysverstr = ts. readLine();
- f. close();
- }
+ // Distribution detection code now in the base class
}
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index e8b813e..6ac3157 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -116,34 +116,26 @@ struct z_button z_buttons_c700 [] = {
// Comments? - mickeyl.
-void Zaurus::init(const QString&)
+void Zaurus::init(const QString& cpu_info)
+{
+ // generic distribution code already scanned /etc/issue at that point -
+ // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
+ if ( d->m_sysverstr.contains( "embedix", false ) )
{
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");
- if ( f.exists() ){
+ d->m_systemstr = "Zaurus";
+ d->m_system = System_Zaurus;
+ m_embedix = true;
+ }
+ else
+ {
d->m_vendorstr = "OpenZaurus Team";
d->m_systemstr = "OpenZaurus";
d->m_system = System_OpenZaurus;
+ // sysver already gathered
- if ( f. open ( IO_ReadOnly )) {
- QTextStream ts ( &f );
- d->m_sysverstr = ts. readLine();//. mid ( 10 );
- f. close();
- }
-
- // Openzaurus sometimes uses the embedix kernel!
- // => Check whether this is an embedix kernel
+ // Openzaurus sometimes uses the embedix kernel, check if this is one
FILE *uname = popen("uname -r", "r");
+ QFile f;
QString line;
if ( f.open(IO_ReadOnly, uname) ) {
@@ -159,21 +151,12 @@ void Zaurus::init(const QString&)
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 ( ":" );
+ // check the Zaurus model
+ QString model;
+ int loc = cpu_info.find( ":" );
if ( loc != -1 )
- model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
- }
+ model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
+ else
+ model = cpu_info;
if ( model == "SHARP Corgi" ) {
@@ -194,7 +177,9 @@ void Zaurus::init(const QString&)
} else {
d->m_model = Model_Zaurus_SL5500;
- d->m_modelstr = "Zaurus (Model unknown)";
+ d->m_modelstr = "Unkown Zaurus";
}
+ // set initial rotation
+
bool flipstate = false;
switch ( d->m_model ) {