Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 69 |
1 files changed, 27 insertions, 42 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 | |||
@@ -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: |