summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-06-26 12:27:37 (UTC)
committer mickeyl <mickeyl>2005-06-26 12:27:37 (UTC)
commitb4d2fa56d4b4608656f6b5cf3ff9375708395e91 (patch) (unidiff)
tree7b087a487929d9b0f9de67860b9fe123773239f0
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 (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
@@ -116,128 +116,129 @@ struct default_button default_buttons [] = {
116 "opiemail", "raise()", 116 "opiemail", "raise()",
117 "opiemail", "newMail()" }, 117 "opiemail", "newMail()" },
118}; 118};
119 119
120ODevice *ODevice::inst() 120ODevice *ODevice::inst()
121{ 121{
122 static ODevice *dev = 0; 122 static ODevice *dev = 0;
123 QString cpu_info; 123 QString cpu_info;
124 124
125 if ( !dev ) 125 if ( !dev )
126 { 126 {
127 QFile f( PATH_PROC_CPUINFO ); 127 QFile f( PATH_PROC_CPUINFO );
128 if ( f.open( IO_ReadOnly ) ) 128 if ( f.open( IO_ReadOnly ) )
129 { 129 {
130 QTextStream s( &f ); 130 QTextStream s( &f );
131 while ( !s.atEnd() ) 131 while ( !s.atEnd() )
132 { 132 {
133 QString line; 133 QString line;
134 line = s.readLine(); 134 line = s.readLine();
135 if ( line.startsWith( "Hardware" ) ) 135 if ( line.startsWith( "Hardware" ) )
136 { 136 {
137 qDebug( "ODevice() - found '%s'", (const char*) line ); 137 qDebug( "ODevice() - found '%s'", (const char*) line );
138 cpu_info = line; 138 cpu_info = line;
139 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus(); 139 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
140 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ(); 140 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
141 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad(); 141 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
142 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada(); 142 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
143 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses(); 143 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
144 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle(); 144 else if ( line.contains( "Tradesquare.NL", false ) ) dev = new Internal::Beagle();
145 else qWarning( "ODevice() - unknown hardware - using default." ); 145 else qWarning( "ODevice() - unknown hardware - using default." );
146 break; 146 break;
147 } else if ( line.startsWith( "vendor_id" ) ) { 147 } else if ( line.startsWith( "vendor_id" ) ) {
148 qDebug( "ODevice() - found '%s'", (const char*) line ); 148 qDebug( "ODevice() - found '%s'", (const char*) line );
149 cpu_info = line; 149 cpu_info = line;
150 if( line.contains( "genuineintel", false ) ) { 150 if( line.contains( "genuineintel", false ) ) {
151 dev = new Internal::GenuineIntel(); 151 dev = new Internal::GenuineIntel();
152 break; 152 break;
153 } 153 }
154 } 154 }
155 } 155 }
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 );
204 if ( f.open( IO_ReadOnly ) ) 205 if ( f.open( IO_ReadOnly ) )
205 { 206 {
206 QTextStream ts( &f ); 207 QTextStream ts( &f );
207 d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" ); 208 d->m_sysverstr = ts.readLine().replace( QRegExp( "\\\\." ), "" );
208 } 209 }
209 break; 210 break;
210 } 211 }
211 } 212 }
212} 213}
213 214
214void ODevice::systemMessage( const QCString &msg, const QByteArray & ) 215void ODevice::systemMessage( const QCString &msg, const QByteArray & )
215{ 216{
216 if ( msg == "deviceButtonMappingChanged()" ) { 217 if ( msg == "deviceButtonMappingChanged()" ) {
217 reloadButtonMapping(); 218 reloadButtonMapping();
218 } 219 }
219} 220}
220 221
221void ODevice::init(const QString&) 222void ODevice::init(const QString&)
222{ 223{
223} 224}
224 225
225/** 226/**
226* This method initialises the button mapping 227* This method initialises the button mapping
227*/ 228*/
228void ODevice::initButtons() 229void ODevice::initButtons()
229{ 230{
230 if ( d->m_buttons ) 231 if ( d->m_buttons )
231 return; 232 return;
232 233
233 qDebug ( "init Buttons" ); 234 qDebug ( "init Buttons" );
234 d->m_buttons = new QValueList <ODeviceButton>; 235 d->m_buttons = new QValueList <ODeviceButton>;
235 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) { 236 for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) {
236 default_button *db = default_buttons + i; 237 default_button *db = default_buttons + i;
237 ODeviceButton b; 238 ODeviceButton b;
238 b. setKeycode ( db->code ); 239 b. setKeycode ( db->code );
239 b. setUserText ( QObject::tr ( "Button", db->utext )); 240 b. setUserText ( QObject::tr ( "Button", db->utext ));
240 b. setPixmap ( OResource::loadPixmap ( db->pix )); 241 b. setPixmap ( OResource::loadPixmap ( db->pix ));
241 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction )); 242 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction ));
242 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction )); 243 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->fheldaction ));
243 d->m_buttons->append ( b ); 244 d->m_buttons->append ( b );
@@ -341,128 +342,133 @@ QString ODevice::vendorString() const
341* @return OVendor 342* @return OVendor
342*/ 343*/
343OVendor ODevice::vendor() const 344OVendor ODevice::vendor() const
344{ 345{
345 return d->m_vendor; 346 return d->m_vendor;
346} 347}
347 348
348/** 349/**
349* This returns the model as a string 350* This returns the model as a string
350* @return A string representing the model 351* @return A string representing the model
351*/ 352*/
352QString ODevice::modelString() const 353QString ODevice::modelString() const
353{ 354{
354 return d->m_modelstr; 355 return d->m_modelstr;
355} 356}
356 357
357/** 358/**
358* This does return the OModel used 359* This does return the OModel used
359*/ 360*/
360OModel ODevice::model() const 361OModel ODevice::model() const
361{ 362{
362 return d->m_model; 363 return d->m_model;
363} 364}
364 365
365/** 366/**
366* This does return the systen name 367* This does return the systen name
367*/ 368*/
368QString ODevice::systemString() const 369QString ODevice::systemString() const
369{ 370{
370 return d->m_systemstr; 371 return d->m_systemstr;
371} 372}
372 373
373/** 374/**
374* Return System as OSystem value 375* Return System as OSystem value
375*/ 376*/
376OSystem ODevice::system() const 377OSystem ODevice::system() const
377{ 378{
378 return d->m_system; 379 return d->m_system;
379} 380}
380 381
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
429} 435}
430 436
431/** 437/**
432* This plays a touch sound 438* This plays a touch sound
433*/ 439*/
434void ODevice::playTouchSound() 440void ODevice::playTouchSound()
435{ 441{
436#ifndef QT_NO_SOUND 442#ifndef QT_NO_SOUND
437 static Sound snd ( "touchsound" ); 443 static Sound snd ( "touchsound" );
438 444
439 if ( snd. isFinished()) 445 if ( snd. isFinished())
440 snd. play(); 446 snd. play();
441#endif 447#endif
442} 448}
443 449
444/** 450/**
445* This method will return a list of leds 451* This method will return a list of leds
446* available on this device 452* available on this device
447* @return a list of LEDs. 453* @return a list of LEDs.
448*/ 454*/
449QValueList <OLed> ODevice::ledList() const 455QValueList <OLed> ODevice::ledList() const
450{ 456{
451 return QValueList <OLed>(); 457 return QValueList <OLed>();
452} 458}
453 459
454/** 460/**
455* This does return the state of the LEDs 461* This does return the state of the LEDs
456*/ 462*/
457QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 463QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
458{ 464{
459 return QValueList <OLedState>(); 465 return QValueList <OLedState>();
460} 466}
461 467
462/** 468/**
463* @return the state for a given OLed 469* @return the state for a given OLed
464*/ 470*/
465OLedState ODevice::ledState ( OLed /*which*/ ) const 471OLedState ODevice::ledState ( OLed /*which*/ ) const
466{ 472{
467 return Led_Off; 473 return Led_Off;
468} 474}
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
@@ -175,206 +175,208 @@ enum OHardKey {
175 HardKey_Suspend = Qt::Key_F34, 175 HardKey_Suspend = Qt::Key_F34,
176 HardKey_Backlight = Qt::Key_F35, 176 HardKey_Backlight = Qt::Key_F35,
177 HardKey_Action = Qt::Key_F10, 177 HardKey_Action = Qt::Key_F10,
178 HardKey_OK = Qt::Key_F11, 178 HardKey_OK = Qt::Key_F11,
179 HardKey_End = Qt::Key_F12, 179 HardKey_End = Qt::Key_F12,
180}; 180};
181 181
182enum ODirection { 182enum ODirection {
183 CW = 0, 183 CW = 0,
184 CCW = 1, 184 CCW = 1,
185 Flip = 2, 185 Flip = 2,
186}; 186};
187 187
188enum OHingeStatus { 188enum OHingeStatus {
189 CASE_CLOSED = 3, 189 CASE_CLOSED = 3,
190 CASE_PORTRAIT = 2, 190 CASE_PORTRAIT = 2,
191 CASE_LANDSCAPE = 0, 191 CASE_LANDSCAPE = 0,
192 CASE_UNKNOWN = 1, 192 CASE_UNKNOWN = 1,
193}; 193};
194 194
195/* default button for qvfb or such 195/* default button for qvfb or such
196 * see odevice.cpp for details. 196 * see odevice.cpp for details.
197 * hint: manage a user defined button for qvfb? 197 * hint: manage a user defined button for qvfb?
198 * alwin 198 * alwin
199 */ 199 */
200struct default_button { 200struct default_button {
201 Qt::Key code; 201 Qt::Key code;
202 char *utext; 202 char *utext;
203 char *pix; 203 char *pix;
204 char *fpressedservice; 204 char *fpressedservice;
205 char *fpressedaction; 205 char *fpressedaction;
206 char *fheldservice; 206 char *fheldservice;
207 char *fheldaction; 207 char *fheldaction;
208}; 208};
209 209
210/** 210/**
211 * A singleton which gives informations about device specefic option 211 * A singleton which gives informations about device specefic option
212 * like the Hardware used, LEDs, the Base Distribution and 212 * like the Hardware used, LEDs, the Base Distribution and
213 * hardware key mappings. 213 * hardware key mappings.
214 * 214 *
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 );
283 283
284 virtual bool hasLightSensor() const; 284 virtual bool hasLightSensor() const;
285 virtual int readLightSensor(); 285 virtual int readLightSensor();
286 virtual int lightSensorResolution() const; 286 virtual int lightSensorResolution() const;
287 287
288 virtual bool hasHingeSensor() const; 288 virtual bool hasHingeSensor() const;
289 virtual OHingeStatus readHingeSensor()const; 289 virtual OHingeStatus readHingeSensor()const;
290 290
291 const QStrList &allowedCpuFrequencies() const; 291 const QStrList &allowedCpuFrequencies() const;
292 bool setCurrentCpuFrequency(uint index); 292 bool setCurrentCpuFrequency(uint index);
293 293
294 /** 294 /**
295 * Returns the available buttons on this device. The number and location 295 * Returns the available buttons on this device. The number and location
296 * of buttons will vary depending on the device. Button numbers will be assigned 296 * of buttons will vary depending on the device. Button numbers will be assigned
297 * by the device manufacturer and will be from most preferred button to least preffered 297 * by the device manufacturer and will be from most preferred button to least preffered
298 * button. Note that this list only contains "user mappable" buttons. 298 * button. Note that this list only contains "user mappable" buttons.
299 * 299 *
300 * @todo Make method const and take care of calling initButtons or make that const too 300 * @todo Make method const and take care of calling initButtons or make that const too
301 * 301 *
302 */ 302 */
303 const QValueList<ODeviceButton> &buttons(); 303 const QValueList<ODeviceButton> &buttons();
304 304
305 /** 305 /**
306 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 306 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
307 * returns 0L 307 * returns 0L
308 */ 308 */
309 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 309 const ODeviceButton *buttonForKeycode ( ushort keyCode );
310 310
311 /** 311 /**
312 * Reassigns the pressed action for \a button. To return to the factory 312 * Reassigns the pressed action for \a button. To return to the factory
313 * default pass an empty string as \a qcopMessage. 313 * default pass an empty string as \a qcopMessage.
314 */ 314 */
315 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 315 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
316 316
317 /** 317 /**
318 * Reassigns the held action for \a button. To return to the factory 318 * Reassigns the held action for \a button. To return to the factory
319 * default pass an empty string as \a qcopMessage. 319 * default pass an empty string as \a qcopMessage.
320 */ 320 */
321 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 321 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
322 322
323 /** 323 /**
324 * How long (in ms) you have to press a button for a "hold" action 324 * How long (in ms) you have to press a button for a "hold" action
325 */ 325 */
326 uint buttonHoldTime() const; 326 uint buttonHoldTime() const;
327 327
328signals: 328signals:
329 void buttonMappingChanged(); 329 void buttonMappingChanged();
330 330
331private slots: 331private slots:
332 void systemMessage ( const QCString &, const QByteArray & ); 332 void systemMessage ( const QCString &, const QByteArray & );
333 void playingStopped(); 333 void playingStopped();
334 334
335protected: 335protected:
336 void addPreHandler(QWSServer::KeyboardFilter*aFilter); 336 void addPreHandler(QWSServer::KeyboardFilter*aFilter);
337 void remPreHandler(QWSServer::KeyboardFilter*aFilter); 337 void remPreHandler(QWSServer::KeyboardFilter*aFilter);
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
@@ -138,160 +138,171 @@ void Zaurus::init(const QString& cpu_info)
138 d->m_system = System_Zaurus; 138 d->m_system = System_Zaurus;
139 m_embedix = true; 139 m_embedix = true;
140 } 140 }
141 else 141 else
142 { 142 {
143 d->m_vendorstr = "OpenZaurus Team"; 143 d->m_vendorstr = "OpenZaurus Team";
144 d->m_systemstr = "OpenZaurus"; 144 d->m_systemstr = "OpenZaurus";
145 d->m_system = System_OpenZaurus; 145 d->m_system = System_OpenZaurus;
146 // sysver already gathered 146 // sysver already gathered
147 147
148 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one 148 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one
149 FILE *uname = popen("uname -r", "r"); 149 FILE *uname = popen("uname -r", "r");
150 QFile f; 150 QFile f;
151 QString line; 151 QString line;
152 if ( f.open(IO_ReadOnly, uname) ) { 152 if ( f.open(IO_ReadOnly, uname) ) {
153 QTextStream ts ( &f ); 153 QTextStream ts ( &f );
154 line = ts.readLine(); 154 line = ts.readLine();
155 m_embedix = line.startsWith( "2.4." ); 155 m_embedix = line.startsWith( "2.4." );
156 f.close(); 156 f.close();
157 } 157 }
158 pclose(uname); 158 pclose(uname);
159 } 159 }
160 160
161 // check the Zaurus model 161 // check the Zaurus model
162 QString model; 162 QString model;
163 int loc = cpu_info.find( ":" ); 163 int loc = cpu_info.find( ":" );
164 if ( loc != -1 ) 164 if ( loc != -1 )
165 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 165 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
166 else 166 else
167 model = cpu_info; 167 model = cpu_info;
168 168
169 if ( model == "SHARP Corgi" ) { 169 if ( model == "SHARP Corgi" ) {
170 d->m_model = Model_Zaurus_SLC7x0; 170 d->m_model = Model_Zaurus_SLC7x0;
171 d->m_modelstr = "Zaurus SL-C700"; 171 d->m_modelstr = "Zaurus SL-C700";
172 } else if ( model == "SHARP Shepherd" ) { 172 } else if ( model == "SHARP Shepherd" ) {
173 d->m_model = Model_Zaurus_SLC7x0; 173 d->m_model = Model_Zaurus_SLC7x0;
174 d->m_modelstr = "Zaurus SL-C750"; 174 d->m_modelstr = "Zaurus SL-C750";
175 } else if ( model == "SHARP Husky" ) { 175 } else if ( model == "SHARP Husky" ) {
176 d->m_model = Model_Zaurus_SLC7x0; 176 d->m_model = Model_Zaurus_SLC7x0;
177 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 177 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
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
258 } 269 }
259 pz_buttons = z_buttons_c700; 270 pz_buttons = z_buttons_c700;
260 buttoncount = ARRAY_SIZE(z_buttons_c700); 271 buttoncount = ARRAY_SIZE(z_buttons_c700);
261 break; 272 break;
262 default: 273 default:
263 pz_buttons = z_buttons; 274 pz_buttons = z_buttons;
264 buttoncount = ARRAY_SIZE(z_buttons); 275 buttoncount = ARRAY_SIZE(z_buttons);
265 break; 276 break;
266 } 277 }
267 278
268 for ( int i = 0; i < buttoncount; i++ ) { 279 for ( int i = 0; i < buttoncount; i++ ) {
269 struct z_button *zb = pz_buttons + i; 280 struct z_button *zb = pz_buttons + i;
270 ODeviceButton b; 281 ODeviceButton b;
271 282
272 b.setKeycode( zb->code ); 283 b.setKeycode( zb->code );
273 b.setUserText( QObject::tr( "Button", zb->utext )); 284 b.setUserText( QObject::tr( "Button", zb->utext ));
274 b.setPixmap( OResource::loadPixmap( zb->pix )); 285 b.setPixmap( OResource::loadPixmap( zb->pix ));
275 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 286 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
276 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 287 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
277 d->m_buttons->append( b ); 288 d->m_buttons->append( b );
278 } 289 }
279 290
280 reloadButtonMapping(); 291 reloadButtonMapping();
281} 292}
282 293
283 294
284 295
285typedef struct sharp_led_status { 296typedef struct sharp_led_status {
286 int which; /* select which LED status is wanted. */ 297 int which; /* select which LED status is wanted. */
287 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 298 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
288} sharp_led_status; 299} sharp_led_status;
289 300
290void Zaurus::buzzer( int sound ) 301void Zaurus::buzzer( int sound )
291{ 302{
292#ifndef QT_NO_SOUND 303#ifndef QT_NO_SOUND
293 Sound *snd = 0; 304 Sound *snd = 0;
294 305
295 // All devices except SL5500 have a DSP device 306 // All devices except SL5500 have a DSP device
296 if ( d->m_model != Model_Zaurus_SL5000 307 if ( d->m_model != Model_Zaurus_SL5000
297 && d->m_model != Model_Zaurus_SL5500 ) { 308 && d->m_model != Model_Zaurus_SL5500 ) {