summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2005-06-26 12:27:37 (UTC)
committer mickeyl <mickeyl>2005-06-26 12:27:37 (UTC)
commitb4d2fa56d4b4608656f6b5cf3ff9375708395e91 (patch) (unidiff)
tree7b087a487929d9b0f9de67860b9fe123773239f0 /libopie2
parent53f924947144ddbb3e15d3bd1ddc877073c7ec7f (diff)
downloadopie-b4d2fa56d4b4608656f6b5cf3ff9375708395e91.zip
opie-b4d2fa56d4b4608656f6b5cf3ff9375708395e91.tar.gz
opie-b4d2fa56d4b4608656f6b5cf3ff9375708395e91.tar.bz2
ODevice now features a method to gather the preferred qte driver.
The default driver is "Transformed". C7x0 Zaurus devices use "W100" from now on.
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp6
-rw-r--r--libopie2/opiecore/device/odevice.h6
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp17
3 files changed, 24 insertions, 5 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 5e91d8b..56f305f 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -156,48 +156,49 @@ ODevice *ODevice::inst()
156 } 156 }
157 else 157 else
158 { 158 {
159 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); 159 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO );
160 } 160 }
161 if ( !dev ) dev = new ODevice(); 161 if ( !dev ) dev = new ODevice();
162 dev->init(cpu_info); 162 dev->init(cpu_info);
163 } 163 }
164 return dev; 164 return dev;
165} 165}
166 166
167ODevice::ODevice() 167ODevice::ODevice()
168{ 168{
169 d = new ODeviceData; 169 d = new ODeviceData;
170 170
171 d->m_modelstr = "Unknown"; 171 d->m_modelstr = "Unknown";
172 d->m_model = Model_Unknown; 172 d->m_model = Model_Unknown;
173 d->m_vendorstr = "Unknown"; 173 d->m_vendorstr = "Unknown";
174 d->m_vendor = Vendor_Unknown; 174 d->m_vendor = Vendor_Unknown;
175 d->m_systemstr = "Unknown"; 175 d->m_systemstr = "Unknown";
176 d->m_system = System_Unknown; 176 d->m_system = System_Unknown;
177 d->m_sysverstr = "0.0"; 177 d->m_sysverstr = "0.0";
178 d->m_rotation = Rot0; 178 d->m_rotation = Rot0;
179 d->m_direction = CW; 179 d->m_direction = CW;
180 d->m_qteDriver = "Transformed";
180 181
181 d->m_holdtime = 1000; // 1000ms 182 d->m_holdtime = 1000; // 1000ms
182 d->m_buttons = 0; 183 d->m_buttons = 0;
183 d->m_cpu_frequencies = new QStrList; 184 d->m_cpu_frequencies = new QStrList;
184 185
185 186
186 /* mixer */ 187 /* mixer */
187 d->m_sound = d->m_vol = d->m_mixer = -1; 188 d->m_sound = d->m_vol = d->m_mixer = -1;
188 189
189 /* System QCopChannel created */ 190 /* System QCopChannel created */
190 d->m_initializedButtonQcop = false; 191 d->m_initializedButtonQcop = false;
191 192
192 // New distribution detection code first checks for legacy distributions, 193 // New distribution detection code first checks for legacy distributions,
193 // identified by /etc/familiar-version or /etc/oz_version. 194 // identified by /etc/familiar-version or /etc/oz_version.
194 // Then check for OpenEmbedded and lastly, read /etc/issue 195 // Then check for OpenEmbedded and lastly, read /etc/issue
195 196
196 for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i ) 197 for ( unsigned int i = 0; i < sizeof(distributions)/sizeof(ODistribution); ++i )
197 { 198 {
198 if ( QFile::exists( distributions[i].sysvfile ) ) 199 if ( QFile::exists( distributions[i].sysvfile ) )
199 { 200 {
200 d->m_systemstr = distributions[i].sysstr; 201 d->m_systemstr = distributions[i].sysstr;
201 d->m_system = distributions[i].system; 202 d->m_system = distributions[i].system;
202 d->m_sysverstr = "<Unknown>"; 203 d->m_sysverstr = "<Unknown>";
203 QFile f( distributions[i].sysvfile ); 204 QFile f( distributions[i].sysvfile );
@@ -381,48 +382,53 @@ OSystem ODevice::system() const
381/** 382/**
382* @return the version string of the base system 383* @return the version string of the base system
383*/ 384*/
384QString ODevice::systemVersionString() const 385QString ODevice::systemVersionString() const
385{ 386{
386 return d->m_sysverstr; 387 return d->m_sysverstr;
387} 388}
388 389
389/** 390/**
390* @return the current Transformation 391* @return the current Transformation
391*/ 392*/
392Transformation ODevice::rotation() const 393Transformation ODevice::rotation() const
393{ 394{
394 return d->m_rotation; 395 return d->m_rotation;
395} 396}
396 397
397/** 398/**
398* @return the current rotation direction 399* @return the current rotation direction
399*/ 400*/
400ODirection ODevice::direction() const 401ODirection ODevice::direction() const
401{ 402{
402 return d->m_direction; 403 return d->m_direction;
403} 404}
404 405
406QString ODevice::qteDriver() const
407{
408 return d->m_qteDriver;
409}
410
405/** 411/**
406* This plays an alarm sound 412* This plays an alarm sound
407*/ 413*/
408void ODevice::playAlarmSound() 414void ODevice::playAlarmSound()
409{ 415{
410#ifndef QT_NO_SOUND 416#ifndef QT_NO_SOUND
411 static Sound snd ( "alarm" ); 417 static Sound snd ( "alarm" );
412 418
413 if ( snd. isFinished()) 419 if ( snd. isFinished())
414 snd. play(); 420 snd. play();
415#endif 421#endif
416} 422}
417 423
418/** 424/**
419* This plays a key sound 425* This plays a key sound
420*/ 426*/
421void ODevice::playKeySound() 427void ODevice::playKeySound()
422{ 428{
423#ifndef QT_NO_SOUND 429#ifndef QT_NO_SOUND
424 static Sound snd ( "keysound" ); 430 static Sound snd ( "keysound" );
425 431
426 if ( snd. isFinished()) 432 if ( snd. isFinished())
427 snd. play(); 433 snd. play();
428#endif 434#endif
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 5db43ff..b8478b9 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -215,68 +215,68 @@ struct default_button {
215 * @short A small class for device specefic options 215 * @short A small class for device specefic options
216 * @see QObject 216 * @see QObject
217 * @author Robert Griebl 217 * @author Robert Griebl
218 * @version 1.0 218 * @version 1.0
219 */ 219 */
220class ODevice : public QObject 220class ODevice : public QObject
221{ 221{
222 Q_OBJECT 222 Q_OBJECT
223 223
224private: 224private:
225 /* disable copy */ 225 /* disable copy */
226 ODevice ( const ODevice & ); 226 ODevice ( const ODevice & );
227 227
228protected: 228protected:
229 ODevice(); 229 ODevice();
230 virtual void init(const QString&); 230 virtual void init(const QString&);
231 virtual void initButtons(); 231 virtual void initButtons();
232 static void sendSuspendmsg(); 232 static void sendSuspendmsg();
233 233
234 ODeviceData *d; 234 ODeviceData *d;
235 235
236public: 236public:
237 // sandman do we want to allow destructions? -zecke? 237 // sandman do we want to allow destructions? -zecke?
238 virtual ~ODevice(); 238 virtual ~ODevice();
239
240 static ODevice *inst(); 239 static ODevice *inst();
241 240
242 // information 241 // information
243
244 QString modelString() const; 242 QString modelString() const;
245 OModel model() const; 243 OModel model() const;
246 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } 244 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
247 245
248 QString vendorString() const; 246 QString vendorString() const;
249 OVendor vendor() const; 247 OVendor vendor() const;
250 248
251 QString systemString() const; 249 QString systemString() const;
252 OSystem system() const; 250 OSystem system() const;
253 251
254 QString systemVersionString() const; 252 QString systemVersionString() const;
255 253
256 virtual Transformation rotation() const; 254 virtual Transformation rotation() const;
257 virtual ODirection direction() const; 255 virtual ODirection direction() const;
258 256
257 QString qteDriver() const;
258
259 // system 259 // system
260 virtual bool suspend(); 260 virtual bool suspend();
261 261
262 virtual bool setDisplayStatus ( bool on ); 262 virtual bool setDisplayStatus ( bool on );
263 virtual bool setDisplayBrightness ( int brightness ); 263 virtual bool setDisplayBrightness ( int brightness );
264 virtual int displayBrightnessResolution() const; 264 virtual int displayBrightnessResolution() const;
265 virtual bool setDisplayContrast ( int contrast ); 265 virtual bool setDisplayContrast ( int contrast );
266 virtual int displayContrastResolution() const; 266 virtual int displayContrastResolution() const;
267 267
268 // don't add new virtual methods, use this: 268 // don't add new virtual methods, use this:
269 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 269 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
270 // and in your subclass do overwrite 270 // and in your subclass do overwrite
271 // protected virtual int virtual_hook(int, void *) 271 // protected virtual int virtual_hook(int, void *)
272 // which is defined below 272 // which is defined below
273 273
274 // input / output 274 // input / output
275 virtual void playAlarmSound(); 275 virtual void playAlarmSound();
276 virtual void playKeySound(); 276 virtual void playKeySound();
277 virtual void playTouchSound(); 277 virtual void playTouchSound();
278 278
279 virtual QValueList <OLed> ledList() const; 279 virtual QValueList <OLed> ledList() const;
280 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 280 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
281 virtual OLedState ledState ( OLed led ) const; 281 virtual OLedState ledState ( OLed led ) const;
282 virtual bool setLedState ( OLed led, OLedState st ); 282 virtual bool setLedState ( OLed led, OLedState st );
@@ -338,43 +338,45 @@ protected:
338 void reloadButtonMapping(); 338 void reloadButtonMapping();
339 void changeMixerForAlarm( int mixer, const char* file, Sound *snd); 339 void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
340 340
341 /* ugly virtual hook */ 341 /* ugly virtual hook */
342 virtual void virtual_hook( int id, void* data ); 342 virtual void virtual_hook( int id, void* data );
343}; 343};
344 344
345class ODeviceData { 345class ODeviceData {
346 346
347 public: 347 public:
348 QString m_vendorstr; 348 QString m_vendorstr;
349 OVendor m_vendor; 349 OVendor m_vendor;
350 350
351 QString m_modelstr; 351 QString m_modelstr;
352 OModel m_model; 352 OModel m_model;
353 353
354 QString m_systemstr; 354 QString m_systemstr;
355 OSystem m_system; 355 OSystem m_system;
356 356
357 QString m_sysverstr; 357 QString m_sysverstr;
358 358
359 Transformation m_rotation; 359 Transformation m_rotation;
360 ODirection m_direction; 360 ODirection m_direction;
361 361
362 QString m_qteDriver;
363
362 QValueList <ODeviceButton> *m_buttons; 364 QValueList <ODeviceButton> *m_buttons;
363 uint m_holdtime; 365 uint m_holdtime;
364 QStrList *m_cpu_frequencies; 366 QStrList *m_cpu_frequencies;
365 bool m_initializedButtonQcop : 1; 367 bool m_initializedButtonQcop : 1;
366 368
367 /* values for changeMixerForAlarm */ 369 /* values for changeMixerForAlarm */
368 int m_sound, m_vol, m_mixer; 370 int m_sound, m_vol, m_mixer;
369}; 371};
370 372
371extern bool isQWS(); 373extern bool isQWS();
372extern QCString makeChannel ( const char *str ); 374extern QCString makeChannel ( const char *str );
373} 375}
374} 376}
375 377
376 378
377 379
378 380
379#endif 381#endif
380 382
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 21d2342..0c421e3 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -178,80 +178,91 @@ void Zaurus::init(const QString& cpu_info)
178 } else if ( model == "SHARP Boxer" ) { 178 } else if ( model == "SHARP Boxer" ) {
179 d->m_model = Model_Zaurus_SLC7x0; 179 d->m_model = Model_Zaurus_SLC7x0;
180 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 180 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
181 } else if ( model == "SHARP Poodle" ) { 181 } else if ( model == "SHARP Poodle" ) {
182 d->m_model = Model_Zaurus_SLB600; 182 d->m_model = Model_Zaurus_SLB600;
183 d->m_modelstr = "Zaurus SL-B500 or SL-5600"; 183 d->m_modelstr = "Zaurus SL-B500 or SL-5600";
184 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 184 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
185 d->m_model = Model_Zaurus_SL5500; 185 d->m_model = Model_Zaurus_SL5500;
186 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 186 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
187 } else if ( model == "SHARP Tosa" ) { 187 } else if ( model == "SHARP Tosa" ) {
188 d->m_model = Model_Zaurus_SL6000; 188 d->m_model = Model_Zaurus_SL6000;
189 d->m_modelstr = "Zaurus SL-6000"; 189 d->m_modelstr = "Zaurus SL-6000";
190 } else if ( model == "SHARP Spitz" ) { 190 } else if ( model == "SHARP Spitz" ) {
191 d->m_model = Model_Zaurus_SLC3000; 191 d->m_model = Model_Zaurus_SLC3000;
192 d->m_modelstr = "Zaurus SL-C3000"; 192 d->m_modelstr = "Zaurus SL-C3000";
193 } else if ( model == "SHARP Akita" ) { 193 } else if ( model == "SHARP Akita" ) {
194 d->m_model = Model_Zaurus_SLC1000; 194 d->m_model = Model_Zaurus_SLC1000;
195 d->m_modelstr = "Zaurus SL-C1000"; 195 d->m_modelstr = "Zaurus SL-C1000";
196 } else { 196 } else {
197 d->m_model = Model_Zaurus_SL5500; 197 d->m_model = Model_Zaurus_SL5500;
198 d->m_modelstr = "Unknown Zaurus"; 198 d->m_modelstr = "Unknown Zaurus";
199 } 199 }
200 200
201 // set path to backlight device in kernel 2.6 201 // set path to backlight device in kernel 2.6
202 switch ( d->m_model ) { 202 switch ( d->m_model )
203 {
203 case Model_Zaurus_SLB600: // fallthrough 204 case Model_Zaurus_SLB600: // fallthrough
204 case Model_Zaurus_SL5500: 205 case Model_Zaurus_SL5500:
205 m_backlightdev = "/sys/class/backlight/locomo-backlight/"; 206 m_backlightdev = "/sys/class/backlight/locomo-backlight/";
206 break; 207 break;
207 case Model_Zaurus_SL6000: 208 case Model_Zaurus_SL6000:
208 m_backlightdev = "/sys/class/backlight/tosa-bl/"; 209 m_backlightdev = "/sys/class/backlight/tosa-bl/";
209 break; 210 break;
210 default: 211 default:
211 m_backlightdev = "/sys/class/backlight/corgi-bl/"; 212 m_backlightdev = "/sys/class/backlight/corgi-bl/";
212 break;
213 } 213 }
214 214
215 // set initial rotation 215 // set initial rotation
216 switch( d->m_model ) { 216 switch( d->m_model )
217 {
217 case Model_Zaurus_SL6000: // fallthrough 218 case Model_Zaurus_SL6000: // fallthrough
218 case Model_Zaurus_SLA300: 219 case Model_Zaurus_SLA300:
219 d->m_rotation = Rot0; 220 d->m_rotation = Rot0;
220 break; 221 break;
221 case Model_Zaurus_SLC3000: // fallthrough 222 case Model_Zaurus_SLC3000: // fallthrough
222 case Model_Zaurus_SLC1000: // fallthrough 223 case Model_Zaurus_SLC1000: // fallthrough
223 case Model_Zaurus_SLC7x0: 224 case Model_Zaurus_SLC7x0:
224 d->m_rotation = rotation(); 225 d->m_rotation = rotation();
225 d->m_direction = direction(); 226 d->m_direction = direction();
226 break; 227 break;
227 case Model_Zaurus_SLB600: // fallthrough 228 case Model_Zaurus_SLB600: // fallthrough
228 case Model_Zaurus_SL5000: // fallthrough 229 case Model_Zaurus_SL5000: // fallthrough
229 case Model_Zaurus_SL5500: // fallthrough 230 case Model_Zaurus_SL5500: // fallthrough
230 default: 231 default:
231 d->m_rotation = Rot270; 232 d->m_rotation = Rot270;
233 }
234
235 // set default qte driver
236 switch( d->m_model )
237 {
238 case Model_Zaurus_SLC7x0:
239 d->m_qteDriver = "W100";
232 break; 240 break;
241 default:
242 d->m_qteDriver = "Transformed";
233 } 243 }
244
234 m_leds[0] = Led_Off; 245 m_leds[0] = Led_Off;
235 246
236 if ( m_embedix ) 247 if ( m_embedix )
237 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); 248 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
238 else 249 else
239 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 250 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
240} 251}
241 252
242void Zaurus::initButtons() 253void Zaurus::initButtons()
243{ 254{
244 if ( d->m_buttons ) 255 if ( d->m_buttons )
245 return; 256 return;
246 257
247 258
248 d->m_buttons = new QValueList <ODeviceButton>; 259 d->m_buttons = new QValueList <ODeviceButton>;
249 260
250 struct z_button * pz_buttons; 261 struct z_button * pz_buttons;
251 int buttoncount; 262 int buttoncount;
252 switch ( d->m_model ) { 263 switch ( d->m_model ) {
253 case Model_Zaurus_SLC3000: // fallthrough 264 case Model_Zaurus_SLC3000: // fallthrough
254 case Model_Zaurus_SLC1000: // fallthrough 265 case Model_Zaurus_SLC1000: // fallthrough
255 case Model_Zaurus_SLC7x0: 266 case Model_Zaurus_SLC7x0:
256 if ( isQWS( ) ) { 267 if ( isQWS( ) ) {
257 addPreHandler(this); // hinge-sensor-handler 268 addPreHandler(this); // hinge-sensor-handler