author | mickeyl <mickeyl> | 2004-06-12 16:54:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-06-12 16:54:50 (UTC) |
commit | b1235df3628d178891eeefed630a22da46b25952 (patch) (unidiff) | |
tree | c88a3cb04adcc9fe214ff08e3c0b96b21e3c4f0a | |
parent | 7a62e8e3601ee98f5f06261c361fe8132334cd56 (diff) | |
download | opie-b1235df3628d178891eeefed630a22da46b25952.zip opie-b1235df3628d178891eeefed630a22da46b25952.tar.gz opie-b1235df3628d178891eeefed630a22da46b25952.tar.bz2 |
- refactor the distribution detection code
- add detection of OpenEmbedded and generic linux distributions
- simplify the zaurus model detection code
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 65 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 64 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 25 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 19 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ramses.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 65 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.cpp | 11 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 69 |
8 files changed, 141 insertions, 189 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,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_ipaq.h" | 30 | #include "odevice_ipaq.h" |
@@ -140,15 +140,36 @@ ODevice::ODevice() | |||
140 | d->m_rotation = Rot0; | 140 | d->m_rotation = Rot0; |
141 | d->m_direction = CW; | 141 | d->m_direction = CW; |
142 | 142 | ||
143 | d->m_holdtime = 1000; // 1000ms | 143 | d->m_holdtime = 1000; // 1000ms |
144 | d->m_buttons = 0; | 144 | d->m_buttons = 0; |
145 | d->m_cpu_frequencies = new QStrList; | 145 | d->m_cpu_frequencies = new QStrList; |
146 | |||
147 | // New distribution detection code first checks for legacy distributions, | ||
148 | // identified by /etc/familiar-version or /etc/oz_version. | ||
149 | // Then check for OpenEmbedded and lastly, read /etc/issue | ||
150 | |||
151 | for ( unsigned int i = 0; i < sizeof distributions; ++i ) | ||
152 | { | ||
153 | if ( QFile::exists( distributions[i].sysvfile ) ) | ||
154 | { | ||
155 | d->m_systemstr = distributions[i].sysstr; | ||
156 | d->m_system = distributions[i].system; | ||
157 | d->m_sysverstr = "<Unknown>"; | ||
158 | QFile f( distributions[i].sysvfile ); | ||
159 | if ( f.open( IO_ReadOnly ) ) | ||
160 | { | ||
161 | QTextStream ts( &f ); | ||
162 | d->m_sysverstr = ts.readLine(); | ||
163 | } | ||
164 | break; | ||
165 | } | ||
166 | } | ||
146 | } | 167 | } |
147 | 168 | ||
148 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 169 | void ODevice::systemMessage( const QCString &msg, const QByteArray & ) |
149 | { | 170 | { |
150 | if ( msg == "deviceButtonMappingChanged()" ) { | 171 | if ( msg == "deviceButtonMappingChanged()" ) { |
151 | reloadButtonMapping(); | 172 | reloadButtonMapping(); |
152 | } | 173 | } |
153 | } | 174 | } |
154 | 175 | ||
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,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
@@ -91,12 +91,17 @@ enum OModel { | |||
91 | 91 | ||
92 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 92 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
93 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 93 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
94 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 94 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
95 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 95 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
96 | 96 | ||
97 | Model_Beagle = ( 6 << 24 ), | ||
98 | |||
99 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), | ||
100 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), | ||
101 | |||
97 | }; | 102 | }; |
98 | 103 | ||
99 | /** | 104 | /** |
100 | * The vendor of the device | 105 | * The vendor of the device |
101 | */ | 106 | */ |
102 | enum OVendor { | 107 | enum OVendor { |
@@ -104,24 +109,41 @@ enum OVendor { | |||
104 | 109 | ||
105 | Vendor_HP, | 110 | Vendor_HP, |
106 | Vendor_Sharp, | 111 | Vendor_Sharp, |
107 | Vendor_SIEMENS, | 112 | Vendor_SIEMENS, |
108 | Vendor_MundN, | 113 | Vendor_MundN, |
109 | Vendor_GMate, | 114 | Vendor_GMate, |
115 | Vendor_MasterIA, | ||
110 | }; | 116 | }; |
111 | 117 | ||
112 | /** | 118 | /** |
113 | * The System used | 119 | * The System used |
114 | */ | 120 | */ |
115 | enum OSystem { | 121 | enum OSystem { |
116 | System_Unknown, | 122 | System_Unknown, |
117 | 123 | ||
118 | System_Familiar, | 124 | System_Familiar, |
119 | System_Zaurus, | 125 | System_Zaurus, |
120 | System_OpenZaurus, | 126 | System_OpenZaurus, |
121 | System_Linupy, | 127 | System_Linupy, |
128 | System_OpenEmbedded, | ||
129 | }; | ||
130 | |||
131 | typedef struct { | ||
132 | OSystem system; | ||
133 | char* sysstr; | ||
134 | char* sysvfile; | ||
135 | } ODistribution; | ||
136 | |||
137 | static ODistribution distributions[] = | ||
138 | { | ||
139 | { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, | ||
140 | { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, | ||
141 | { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, | ||
142 | { System_Unknown, "Linux", "/etc/issue" }, | ||
143 | |||
122 | }; | 144 | }; |
123 | 145 | ||
124 | enum OLedState { | 146 | enum OLedState { |
125 | Led_Off, | 147 | Led_Off, |
126 | Led_On, | 148 | Led_On, |
127 | Led_BlinkSlow, | 149 | Led_BlinkSlow, |
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 | |||
@@ -135,14 +135,12 @@ void iPAQ::init(const QString& model) | |||
135 | d->m_model = Model_iPAQ_H5xxx; | 135 | d->m_model = Model_iPAQ_H5xxx; |
136 | else if ( d->m_modelstr == "H2200" ) | 136 | else if ( d->m_modelstr == "H2200" ) |
137 | d->m_model = Model_iPAQ_H22xx; | 137 | d->m_model = Model_iPAQ_H22xx; |
138 | else | 138 | else |
139 | d->m_model = Model_Unknown; | 139 | d->m_model = Model_Unknown; |
140 | 140 | ||
141 | |||
142 | |||
143 | switch ( d->m_model ) { | 141 | switch ( d->m_model ) { |
144 | case Model_iPAQ_H31xx: | 142 | case Model_iPAQ_H31xx: |
145 | case Model_iPAQ_H38xx: | 143 | case Model_iPAQ_H38xx: |
146 | d->m_rotation = Rot90; | 144 | d->m_rotation = Rot90; |
147 | break; | 145 | break; |
148 | case Model_iPAQ_H5xxx: | 146 | case Model_iPAQ_H5xxx: |
@@ -155,35 +153,12 @@ void iPAQ::init(const QString& model) | |||
155 | default: | 153 | default: |
156 | d->m_rotation = Rot270; | 154 | d->m_rotation = Rot270; |
157 | break; | 155 | break; |
158 | 156 | ||
159 | } | 157 | } |
160 | 158 | ||
161 | QFile f( "/etc/familiar-version" ); | ||
162 | if ( f. open ( IO_ReadOnly )) { | ||
163 | d->m_systemstr = "Familiar"; | ||
164 | d->m_system = System_Familiar; | ||
165 | |||
166 | QTextStream ts ( &f ); | ||
167 | d->m_sysverstr = ts. readLine(). mid ( 10 ); | ||
168 | |||
169 | f. close(); | ||
170 | } else { | ||
171 | f. setName ( "/etc/oz_version" ); | ||
172 | |||
173 | if ( f. open ( IO_ReadOnly )) { | ||
174 | d->m_systemstr = "OpenEmbedded/iPaq"; | ||
175 | d->m_system = System_Familiar; | ||
176 | |||
177 | QTextStream ts ( &f ); | ||
178 | ts.setDevice ( &f ); | ||
179 | d->m_sysverstr = ts. readLine(); | ||
180 | f. close(); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | m_leds [0] = m_leds [1] = Led_Off; | 159 | m_leds [0] = m_leds [1] = Led_Off; |
185 | 160 | ||
186 | m_power_timer = 0; | 161 | m_power_timer = 0; |
187 | 162 | ||
188 | } | 163 | } |
189 | 164 | ||
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 | |||
@@ -111,25 +111,14 @@ struct j_button jornada56x_buttons [] = { | |||
111 | void Jornada::init(const QString&) | 111 | void Jornada::init(const QString&) |
112 | { | 112 | { |
113 | d->m_vendorstr = "HP"; | 113 | d->m_vendorstr = "HP"; |
114 | d->m_vendor = Vendor_HP; | 114 | d->m_vendor = Vendor_HP; |
115 | d->m_modelstr = "Jornada 56x"; | 115 | d->m_modelstr = "Jornada 56x"; |
116 | d->m_model = Model_Jornada_56x; | 116 | d->m_model = Model_Jornada_56x; |
117 | d->m_systemstr = "Familiar"; | ||
118 | d->m_system = System_Familiar; | ||
119 | d->m_rotation = Rot0; | 117 | d->m_rotation = Rot0; |
120 | 118 | //Distribution detecting code is now in base class | |
121 | QFile f ( "/etc/familiar-version" ); | ||
122 | f.setName ( "/etc/familiar-version" ); | ||
123 | if ( f.open ( IO_ReadOnly )) { | ||
124 | |||
125 | QTextStream ts ( &f ); | ||
126 | d->m_sysverstr = ts.readLine().mid( 10 ); | ||
127 | |||
128 | f. close(); | ||
129 | } | ||
130 | } | 119 | } |
131 | 120 | ||
132 | void Jornada::initButtons() | 121 | void Jornada::initButtons() |
133 | { | 122 | { |
134 | if ( d->m_buttons ) | 123 | if ( d->m_buttons ) |
135 | return; | 124 | return; |
@@ -175,15 +164,15 @@ bool Jornada::setDisplayBrightness( int bright ) | |||
175 | 164 | ||
176 | int value = 255 - bright; | 165 | int value = 255 - bright; |
177 | if ( !bright ) | 166 | if ( !bright ) |
178 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 167 | cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); |
179 | else | 168 | else |
180 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); | 169 | cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", value ); |
181 | 170 | ||
182 | res = ( ::system( (const char*) cmdline ) == 0 ); | 171 | res = ( ::system( (const char*) cmdline ) == 0 ); |
183 | 172 | ||
184 | return res; | 173 | return res; |
185 | } | 174 | } |
186 | 175 | ||
187 | 176 | ||
188 | bool Jornada::suspend( ) | 177 | bool Jornada::suspend( ) |
189 | { | 178 | { |
@@ -206,13 +195,13 @@ bool Jornada::suspend( ) | |||
206 | return res; | 195 | return res; |
207 | } | 196 | } |
208 | 197 | ||
209 | bool Jornada::setDisplayStatus ( bool on ) | 198 | bool Jornada::setDisplayStatus ( bool on ) |
210 | { | 199 | { |
211 | bool res = false; | 200 | bool res = false; |
212 | 201 | ||
213 | QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "0" : "4", on? "0" : "4" ); | 202 | QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "0" : "4", on? "0" : "4" ); |
214 | 203 | ||
215 | res = ( ::system( (const char*) cmdline ) == 0 ); | 204 | res = ( ::system( (const char*) cmdline ) == 0 ); |
216 | 205 | ||
217 | return res; | 206 | return res; |
218 | } | 207 | } |
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 | |||
@@ -79,23 +79,13 @@ void Ramses::init(const QString&) | |||
79 | d->m_modelstr = "Ramses"; | 79 | d->m_modelstr = "Ramses"; |
80 | d->m_model = Model_Ramses_MNCI; | 80 | d->m_model = Model_Ramses_MNCI; |
81 | 81 | ||
82 | d->m_rotation = Rot0; | 82 | d->m_rotation = Rot0; |
83 | d->m_holdtime = 1000; | 83 | d->m_holdtime = 1000; |
84 | 84 | ||
85 | f.setName("/etc/oz_version"); | 85 | // Distribution detection code now in the base class |
86 | |||
87 | if (f.open(IO_ReadOnly)) { | ||
88 | d->m_systemstr = "OpenEmbedded/Ramses"; | ||
89 | d->m_system = System_OpenZaurus; | ||
90 | |||
91 | QTextStream ts(&f); | ||
92 | ts.setDevice(&f); | ||
93 | d->m_sysverstr = ts.readLine(); | ||
94 | f.close(); | ||
95 | } | ||
96 | 86 | ||
97 | m_power_timer = 0; | 87 | m_power_timer = 0; |
98 | 88 | ||
99 | #ifdef QT_QWS_ALLOW_OVERCLOCK | 89 | #ifdef QT_QWS_ALLOW_OVERCLOCK |
100 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** | 90 | #warning *** Overclocking enabled - this may fry your hardware - you have been warned *** |
101 | #define OC(x...) x | 91 | #define OC(x...) x |
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,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_simpad.h" | 30 | #include "odevice_simpad.h" |
@@ -131,34 +131,13 @@ void SIMpad::init(const QString&) | |||
131 | d->m_direction = CCW; | 131 | d->m_direction = CCW; |
132 | d->m_holdtime = 1000; // 1000ms | 132 | d->m_holdtime = 1000; // 1000ms |
133 | 133 | ||
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | 136 | ||
137 | f. setName ( "/etc/familiar-version" ); | 137 | //Distribution detecting code is now in base class |
138 | if ( f. open ( IO_ReadOnly )) { | ||
139 | d->m_systemstr = "Familiar"; | ||
140 | d->m_system = System_Familiar; | ||
141 | |||
142 | QTextStream ts ( &f ); | ||
143 | d->m_sysverstr = ts. readLine(). mid ( 10 ); | ||
144 | |||
145 | f. close(); | ||
146 | } else { | ||
147 | f. setName ( "/etc/oz_version" ); | ||
148 | |||
149 | if ( f. open ( IO_ReadOnly )) { | ||
150 | d->m_systemstr = "OpenEmbedded/SIMpad"; | ||
151 | d->m_system = System_OpenZaurus; | ||
152 | |||
153 | QTextStream ts ( &f ); | ||
154 | ts.setDevice ( &f ); | ||
155 | d->m_sysverstr = ts. readLine(); | ||
156 | f. close(); | ||
157 | } | ||
158 | } | ||
159 | 138 | ||
160 | m_leds [0] = m_leds [1] = Led_Off; | 139 | m_leds [0] = m_leds [1] = Led_Off; |
161 | 140 | ||
162 | m_power_timer = 0; | 141 | m_power_timer = 0; |
163 | 142 | ||
164 | } | 143 | } |
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 | |||
@@ -75,24 +75,15 @@ void Yopy::init(const QString&) | |||
75 | { | 75 | { |
76 | d->m_vendorstr = "G.Mate"; | 76 | d->m_vendorstr = "G.Mate"; |
77 | d->m_vendor = Vendor_GMate; | 77 | d->m_vendor = Vendor_GMate; |
78 | d->m_modelstr = "Yopy3700"; | 78 | d->m_modelstr = "Yopy3700"; |
79 | d->m_model = Model_Yopy_3700; | 79 | d->m_model = Model_Yopy_3700; |
80 | d->m_rotation = Rot0; | 80 | d->m_rotation = Rot0; |
81 | |||
82 | d->m_systemstr = "Linupy"; | 81 | d->m_systemstr = "Linupy"; |
83 | d->m_system = System_Linupy; | 82 | d->m_system = System_Linupy; |
84 | 83 | // Distribution detection code now in the base class | |
85 | QFile f ( "/etc/issue" ); | ||
86 | if ( f. open ( IO_ReadOnly ) ) | ||
87 | { | ||
88 | QTextStream ts ( &f ); | ||
89 | ts.readLine(); | ||
90 | d->m_sysverstr = ts. readLine(); | ||
91 | f. close(); | ||
92 | } | ||
93 | } | 84 | } |
94 | 85 | ||
95 | 86 | ||
96 | void Yopy::initButtons() | 87 | void Yopy::initButtons() |
97 | { | 88 | { |
98 | if ( d->m_buttons ) | 89 | if ( d->m_buttons ) |
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 | |||
@@ -112,72 +112,55 @@ struct z_button z_buttons_c700 [] = { | |||
112 | // Only question right now is: Do we really need to do it? Because as soon | 112 | // Only question right now is: Do we really need to do it? Because as soon |
113 | // as the OpenZaurus kernel is ready, there will be a unified interface for all | 113 | // as the OpenZaurus kernel is ready, there will be a unified interface for all |
114 | // Zaurus models (concerning apm, backlight, buttons, etc.) | 114 | // Zaurus models (concerning apm, backlight, buttons, etc.) |
115 | // | 115 | // |
116 | // Comments? - mickeyl. | 116 | // Comments? - mickeyl. |
117 | 117 | ||
118 | void Zaurus::init(const QString&) | 118 | void Zaurus::init(const QString& cpu_info) |
119 | { | 119 | { |
120 | d->m_vendorstr = "Sharp"; | 120 | // generic distribution code already scanned /etc/issue at that point - |
121 | d->m_vendor = Vendor_Sharp; | 121 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
122 | m_embedix = true; // Not openzaurus means: It has an embedix kernel ! | 122 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
123 | 123 | { | |
124 | // QFile f ( "/proc/filesystems" ); | 124 | d->m_vendorstr = "Sharp"; |
125 | QString model; | 125 | d->m_vendor = Vendor_Sharp; |
126 | 126 | d->m_systemstr = "Zaurus"; | |
127 | // It isn't a good idea to check the system configuration to | 127 | d->m_system = System_Zaurus; |
128 | // detect the distribution ! | 128 | m_embedix = true; |
129 | // Otherwise it may happen that any other distribution is detected as openzaurus, just | 129 | } |
130 | // because it uses a jffs2 filesystem.. | 130 | else |
131 | // (eilers) | 131 | { |
132 | // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read(). find ( "\tjffs2\n" ) >= 0 )) { | ||
133 | QFile f ("/etc/oz_version"); | ||
134 | if ( f.exists() ){ | ||
135 | d->m_vendorstr = "OpenZaurus Team"; | 132 | d->m_vendorstr = "OpenZaurus Team"; |
136 | d->m_systemstr = "OpenZaurus"; | 133 | d->m_systemstr = "OpenZaurus"; |
137 | d->m_system = System_OpenZaurus; | 134 | d->m_system = System_OpenZaurus; |
135 | // sysver already gathered | ||
138 | 136 | ||
139 | if ( f. open ( IO_ReadOnly )) { | 137 | // Openzaurus sometimes uses the embedix kernel, check if this is one |
140 | QTextStream ts ( &f ); | ||
141 | d->m_sysverstr = ts. readLine();//. mid ( 10 ); | ||
142 | f. close(); | ||
143 | } | ||
144 | |||
145 | // Openzaurus sometimes uses the embedix kernel! | ||
146 | // => Check whether this is an embedix kernel | ||
147 | FILE *uname = popen("uname -r", "r"); | 138 | FILE *uname = popen("uname -r", "r"); |
139 | QFile f; | ||
148 | QString line; | 140 | QString line; |
149 | if ( f.open(IO_ReadOnly, uname) ) { | 141 | if ( f.open(IO_ReadOnly, uname) ) { |
150 | QTextStream ts ( &f ); | 142 | QTextStream ts ( &f ); |
151 | line = ts. readLine(); | 143 | line = ts. readLine(); |
152 | int loc = line. find ( "embedix" ); | 144 | int loc = line. find ( "embedix" ); |
153 | if ( loc != -1 ) | 145 | if ( loc != -1 ) |
154 | m_embedix = true; | 146 | m_embedix = true; |
155 | else | 147 | else |
156 | m_embedix = false; | 148 | m_embedix = false; |
157 | f. close(); | 149 | f.close(); |
158 | } | 150 | } |
159 | pclose(uname); | 151 | pclose(uname); |
160 | } | 152 | } |
161 | else { | ||
162 | d->m_systemstr = "Zaurus"; | ||
163 | d->m_system = System_Zaurus; | ||
164 | } | ||
165 | 153 | ||
166 | f. setName ( "/proc/cpuinfo" ); | 154 | // check the Zaurus model |
167 | if ( f. open ( IO_ReadOnly ) ) { | 155 | QString model; |
168 | QTextStream ts ( &f ); | 156 | int loc = cpu_info.find( ":" ); |
169 | QString line; | 157 | if ( loc != -1 ) |
170 | while( line = ts. readLine() ) { | 158 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
171 | if ( line. left ( 8 ) == "Hardware" ) | 159 | else |
172 | break; | 160 | model = cpu_info; |
173 | } | ||
174 | int loc = line. find ( ":" ); | ||
175 | if ( loc != -1 ) | ||
176 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); | ||
177 | } | ||
178 | 161 | ||
179 | if ( model == "SHARP Corgi" ) { | 162 | if ( model == "SHARP Corgi" ) { |
180 | d->m_model = Model_Zaurus_SLC7x0; | 163 | d->m_model = Model_Zaurus_SLC7x0; |
181 | d->m_modelstr = "Zaurus SL-C700"; | 164 | d->m_modelstr = "Zaurus SL-C700"; |
182 | } else if ( model == "SHARP Shepherd" ) { | 165 | } else if ( model == "SHARP Shepherd" ) { |
183 | d->m_model = Model_Zaurus_SLC7x0; | 166 | d->m_model = Model_Zaurus_SLC7x0; |
@@ -190,15 +173,17 @@ void Zaurus::init(const QString&) | |||
190 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 173 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
191 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 174 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
192 | d->m_model = Model_Zaurus_SL5500; | 175 | d->m_model = Model_Zaurus_SL5500; |
193 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 176 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
194 | } else { | 177 | } else { |
195 | d->m_model = Model_Zaurus_SL5500; | 178 | d->m_model = Model_Zaurus_SL5500; |
196 | d->m_modelstr = "Zaurus (Model unknown)"; | 179 | d->m_modelstr = "Unkown Zaurus"; |
197 | } | 180 | } |
198 | 181 | ||
182 | // set initial rotation | ||
183 | |||
199 | bool flipstate = false; | 184 | bool flipstate = false; |
200 | switch ( d->m_model ) { | 185 | switch ( d->m_model ) { |
201 | case Model_Zaurus_SLA300: | 186 | case Model_Zaurus_SLA300: |
202 | d->m_rotation = Rot0; | 187 | d->m_rotation = Rot0; |
203 | break; | 188 | break; |
204 | case Model_Zaurus_SLC7x0: | 189 | case Model_Zaurus_SLC7x0: |