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 /libopie2/opiecore/device/odevice_zaurus.cpp | |
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
Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 61 |
1 files changed, 23 insertions, 38 deletions
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 | |||
@@ -117,3 +117,7 @@ struct z_button z_buttons_c700 [] = { | |||
117 | 117 | ||
118 | void Zaurus::init(const QString&) | 118 | void Zaurus::init(const QString& cpu_info) |
119 | { | ||
120 | // generic distribution code already scanned /etc/issue at that point - | ||
121 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | ||
122 | if ( d->m_sysverstr.contains( "embedix", false ) ) | ||
119 | { | 123 | { |
@@ -121,15 +125,8 @@ void Zaurus::init(const QString&) | |||
121 | d->m_vendor = Vendor_Sharp; | 125 | d->m_vendor = Vendor_Sharp; |
122 | m_embedix = true; // Not openzaurus means: It has an embedix kernel ! | 126 | d->m_systemstr = "Zaurus"; |
123 | 127 | d->m_system = System_Zaurus; | |
124 | // QFile f ( "/proc/filesystems" ); | 128 | m_embedix = true; |
125 | QString model; | 129 | } |
126 | 130 | else | |
127 | // It isn't a good idea to check the system configuration to | 131 | { |
128 | // detect the distribution ! | ||
129 | // Otherwise it may happen that any other distribution is detected as openzaurus, just | ||
130 | // because it uses a jffs2 filesystem.. | ||
131 | // (eilers) | ||
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"; |
@@ -137,12 +134,7 @@ void Zaurus::init(const QString&) | |||
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; |
@@ -160,19 +152,10 @@ void Zaurus::init(const QString&) | |||
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; | ||
170 | while( line = ts. readLine() ) { | ||
171 | if ( line. left ( 8 ) == "Hardware" ) | ||
172 | break; | ||
173 | } | ||
174 | int loc = line. find ( ":" ); | ||
175 | if ( loc != -1 ) | 157 | if ( loc != -1 ) |
176 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 158 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
177 | } | 159 | else |
160 | model = cpu_info; | ||
178 | 161 | ||
@@ -195,5 +178,7 @@ void Zaurus::init(const QString&) | |||
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; |