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
@@ -52,481 +52,487 @@
52#include <opie2/okeyfilter.h> 52#include <opie2/okeyfilter.h>
53#include <opie2/oresource.h> 53#include <opie2/oresource.h>
54 54
55/* STD */ 55/* STD */
56#include <fcntl.h> 56#include <fcntl.h>
57#include <math.h> 57#include <math.h>
58#include <stdlib.h> 58#include <stdlib.h>
59#include <signal.h> 59#include <signal.h>
60#include <sys/ioctl.h> 60#include <sys/ioctl.h>
61#include <sys/time.h> 61#include <sys/time.h>
62#include <unistd.h> 62#include <unistd.h>
63#ifndef QT_NO_SOUND 63#ifndef QT_NO_SOUND
64#include <linux/soundcard.h> 64#include <linux/soundcard.h>
65#endif 65#endif
66 66
67namespace Opie { 67namespace Opie {
68namespace Core { 68namespace Core {
69 69
70static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; 70static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
71 71
72 72
73/* STATIC and common implementation */ 73/* STATIC and common implementation */
74/* EXPORT */ ODistribution distributions[] = { 74/* EXPORT */ ODistribution distributions[] = {
75 { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, 75 { System_Familiar, "FamiliarLinux", "/etc/familiar-version" },
76 { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, 76 { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" },
77 { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, 77 { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" },
78 { System_Unknown, "Linux", "/etc/issue" }, 78 { System_Unknown, "Linux", "/etc/issue" },
79}; 79};
80 80
81 81
82/* EXPORT */ bool isQWS(){ 82/* EXPORT */ bool isQWS(){
83 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; 83 return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
84} 84}
85 85
86/* EXPORT */ QCString makeChannel ( const char *str ){ 86/* EXPORT */ QCString makeChannel ( const char *str ){
87 if ( str && !::strchr ( str, '/' )) 87 if ( str && !::strchr ( str, '/' ))
88 return QCString ( "QPE/Application/" ) + str; 88 return QCString ( "QPE/Application/" ) + str;
89 else 89 else
90 return str; 90 return str;
91} 91}
92 92
93 93
94 94
95/* Now the default implementation of ODevice */ 95/* Now the default implementation of ODevice */
96 96
97struct default_button default_buttons [] = { 97struct default_button default_buttons [] = {
98 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 98 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
99 "devicebuttons/z_calendar", 99 "devicebuttons/z_calendar",
100 "datebook", "nextView()", 100 "datebook", "nextView()",
101 "today", "raise()" }, 101 "today", "raise()" },
102 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 102 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
103 "devicebuttons/z_contact", 103 "devicebuttons/z_contact",
104 "addressbook", "raise()", 104 "addressbook", "raise()",
105 "addressbook", "beamBusinessCard()" }, 105 "addressbook", "beamBusinessCard()" },
106 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 106 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
107 "devicebuttons/z_home", 107 "devicebuttons/z_home",
108 "QPE/Launcher", "home()", 108 "QPE/Launcher", "home()",
109 "buttonsettings", "raise()" }, 109 "buttonsettings", "raise()" },
110 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 110 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
111 "devicebuttons/z_menu", 111 "devicebuttons/z_menu",
112 "QPE/TaskBar", "toggleMenu()", 112 "QPE/TaskBar", "toggleMenu()",
113 "QPE/TaskBar", "toggleStartMenu()" }, 113 "QPE/TaskBar", "toggleStartMenu()" },
114 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 114 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
115 "devicebuttons/z_mail", 115 "devicebuttons/z_mail",
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 );
244 } 245 }
245 246
246 reloadButtonMapping(); 247 reloadButtonMapping();
247} 248}
248 249
249ODevice::~ODevice() 250ODevice::~ODevice()
250{ 251{
251// we leak m_devicebuttons and m_cpu_frequency 252// we leak m_devicebuttons and m_cpu_frequency
252// but it's a singleton and it is not so importantant 253// but it's a singleton and it is not so importantant
253// -zecke 254// -zecke
254 delete d; 255 delete d;
255} 256}
256 257
257/** 258/**
258* This method will try to suspend the device 259* This method will try to suspend the device
259* It only works if the user is the QWS Server and the apm application 260* It only works if the user is the QWS Server and the apm application
260* is installed. 261* is installed.
261* It tries to suspend and then waits some time cause some distributions 262* It tries to suspend and then waits some time cause some distributions
262* do have asynchronus apm implementations. 263* do have asynchronus apm implementations.
263* This method will either fail and return false or it'll suspend the 264* This method will either fail and return false or it'll suspend the
264* device and return once the device got woken up 265* device and return once the device got woken up
265* 266*
266* @return if the device got suspended 267* @return if the device got suspended
267*/ 268*/
268bool ODevice::suspend() 269bool ODevice::suspend()
269{ 270{
270 return false; // default implementation == unknown device or qvfb 271 return false; // default implementation == unknown device or qvfb
271} 272}
272 273
273/** 274/**
274* This sets the display on or off 275* This sets the display on or off
275*/ 276*/
276bool ODevice::setDisplayStatus( bool on ) 277bool ODevice::setDisplayStatus( bool on )
277{ 278{
278 qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on ); 279 qDebug( "ODevice::setDisplayStatus( %d ) - please override me.", on );
279 return false; // don't do anything for unknown models 280 return false; // don't do anything for unknown models
280} 281}
281 282
282/** 283/**
283* This sets the display brightness 284* This sets the display brightness
284* 285*
285* @param b The brightness to be set on a scale from 0 to 255 286* @param b The brightness to be set on a scale from 0 to 255
286* @return success or failure 287* @return success or failure
287*/ 288*/
288bool ODevice::setDisplayBrightness( int b ) 289bool ODevice::setDisplayBrightness( int b )
289{ 290{
290 qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b ); 291 qDebug( "ODevice::setDisplayBrightness( %d ) - please override me.", b );
291 return false; 292 return false;
292} 293}
293 294
294/** 295/**
295 * 296 *
296 * @returns the number of steppings on the brightness slider 297 * @returns the number of steppings on the brightness slider
297 * in the Light-'n-Power settings. Values smaller than zero and bigger 298 * in the Light-'n-Power settings. Values smaller than zero and bigger
298 * than 255 do not make sense. 299 * than 255 do not make sense.
299 * 300 *
300 * \sa QSlider::setLineStep 301 * \sa QSlider::setLineStep
301 * \sa QSlider::setPageStep 302 * \sa QSlider::setPageStep
302 */ 303 */
303int ODevice::displayBrightnessResolution() const 304int ODevice::displayBrightnessResolution() const
304{ 305{
305 qDebug( "ODevice::displayBrightnessResolution() - please override me." ); 306 qDebug( "ODevice::displayBrightnessResolution() - please override me." );
306 return 16; 307 return 16;
307} 308}
308 309
309/** 310/**
310* This sets the display contrast 311* This sets the display contrast
311* @param p The contrast to be set on a scale from 0 to 255 312* @param p The contrast to be set on a scale from 0 to 255
312* @returns success or failure 313* @returns success or failure
313*/ 314*/
314bool ODevice::setDisplayContrast( int p ) 315bool ODevice::setDisplayContrast( int p )
315{ 316{
316 qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p ); 317 qDebug( "ODevice::setDisplayContrast( %d ) - please override me.", p );
317 return false; 318 return false;
318} 319}
319 320
320/** 321/**
321* @returns the maximum value for the contrast settings slider 322* @returns the maximum value for the contrast settings slider
322* or 0 if the device doesn't support setting of a contrast 323* or 0 if the device doesn't support setting of a contrast
323*/ 324*/
324int ODevice::displayContrastResolution() const 325int ODevice::displayContrastResolution() const
325{ 326{
326 qDebug( "ODevice::displayBrightnessResolution() - please override me." ); 327 qDebug( "ODevice::displayBrightnessResolution() - please override me." );
327 return 0; 328 return 0;
328} 329}
329 330
330/** 331/**
331* This returns the vendor as string 332* This returns the vendor as string
332* @return Vendor as QString 333* @return Vendor as QString
333*/ 334*/
334QString ODevice::vendorString() const 335QString ODevice::vendorString() const
335{ 336{
336 return d->m_vendorstr; 337 return d->m_vendorstr;
337} 338}
338 339
339/** 340/**
340* This returns the vendor as one of the values of OVendor 341* This returns the vendor as one of the values of OVendor
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}
469 475
470/** 476/**
471* Set the state for a LED 477* Set the state for a LED
472* @param which Which OLed to use 478* @param which Which OLed to use
473* @param st The state to set 479* @param st The state to set
474* @return success or failure 480* @return success or failure
475*/ 481*/
476bool ODevice::setLedState ( OLed which, OLedState st ) 482bool ODevice::setLedState ( OLed which, OLedState st )
477{ 483{
478 Q_UNUSED( which ) 484 Q_UNUSED( which )
479 Q_UNUSED( st ) 485 Q_UNUSED( st )
480 return false; 486 return false;
481} 487}
482 488
483/** 489/**
484* @return if the device has a light sensor 490* @return if the device has a light sensor
485*/ 491*/
486bool ODevice::hasLightSensor() const 492bool ODevice::hasLightSensor() const
487{ 493{
488 return false; 494 return false;
489} 495}
490 496
491/** 497/**
492* @return a value from the light sensor 498* @return a value from the light sensor
493*/ 499*/
494int ODevice::readLightSensor() 500int ODevice::readLightSensor()
495{ 501{
496 return -1; 502 return -1;
497} 503}
498 504
499/** 505/**
500* @return the light sensor resolution 506* @return the light sensor resolution
501*/ 507*/
502int ODevice::lightSensorResolution() const 508int ODevice::lightSensorResolution() const
503{ 509{
504 return 0; 510 return 0;
505} 511}
506 512
507/** 513/**
508* @return if the device has a hinge sensor 514* @return if the device has a hinge sensor
509*/ 515*/
510bool ODevice::hasHingeSensor() const 516bool ODevice::hasHingeSensor() const
511{ 517{
512 return false; 518 return false;
513} 519}
514 520
515/** 521/**
516* @return a value from the hinge sensor 522* @return a value from the hinge sensor
517*/ 523*/
518OHingeStatus ODevice::readHingeSensor()const 524OHingeStatus ODevice::readHingeSensor()const
519{ 525{
520 return CASE_UNKNOWN; 526 return CASE_UNKNOWN;
521} 527}
522 528
523/** 529/**
524* @return a list with CPU frequencies supported by the hardware 530* @return a list with CPU frequencies supported by the hardware
525*/ 531*/
526const QStrList &ODevice::allowedCpuFrequencies() const 532const QStrList &ODevice::allowedCpuFrequencies() const
527{ 533{
528 return *d->m_cpu_frequencies; 534 return *d->m_cpu_frequencies;
529} 535}
530 536
531 537
532/** 538/**
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
@@ -111,270 +111,272 @@ enum OModel {
111 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), 111 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ),
112 112
113 Model_GenuineIntel = ( 7 << 24 ) 113 Model_GenuineIntel = ( 7 << 24 )
114 114
115}; 115};
116 116
117/** 117/**
118 * The vendor of the device 118 * The vendor of the device
119 */ 119 */
120enum OVendor { 120enum OVendor {
121 Vendor_Unknown, 121 Vendor_Unknown,
122 122
123 Vendor_HP, 123 Vendor_HP,
124 Vendor_Sharp, 124 Vendor_Sharp,
125 Vendor_SIEMENS, 125 Vendor_SIEMENS,
126 Vendor_MundN, 126 Vendor_MundN,
127 Vendor_GMate, 127 Vendor_GMate,
128 Vendor_MasterIA, 128 Vendor_MasterIA,
129 Vendor_GenuineIntel 129 Vendor_GenuineIntel
130}; 130};
131 131
132/** 132/**
133 * The System used 133 * The System used
134 */ 134 */
135enum OSystem { 135enum OSystem {
136 System_Unknown, 136 System_Unknown,
137 137
138 System_Familiar, 138 System_Familiar,
139 System_Zaurus, 139 System_Zaurus,
140 System_OpenZaurus, 140 System_OpenZaurus,
141 System_Linupy, 141 System_Linupy,
142 System_OpenEmbedded, 142 System_OpenEmbedded,
143 System_PC 143 System_PC
144}; 144};
145 145
146typedef struct { 146typedef struct {
147 OSystem system; 147 OSystem system;
148 char* sysstr; 148 char* sysstr;
149 char* sysvfile; 149 char* sysvfile;
150} ODistribution; 150} ODistribution;
151 151
152extern ODistribution distributions[]; 152extern ODistribution distributions[];
153 153
154 154
155enum OLedState { 155enum OLedState {
156 Led_Off, 156 Led_Off,
157 Led_On, 157 Led_On,
158 Led_BlinkSlow, 158 Led_BlinkSlow,
159 Led_BlinkFast 159 Led_BlinkFast
160}; 160};
161 161
162enum OLed { 162enum OLed {
163 Led_Mail, 163 Led_Mail,
164 Led_Power, 164 Led_Power,
165 Led_BlueTooth 165 Led_BlueTooth
166}; 166};
167 167
168enum OHardKey { 168enum OHardKey {
169 HardKey_Datebook = Qt::Key_F9, 169 HardKey_Datebook = Qt::Key_F9,
170 HardKey_Contacts = Qt::Key_F10, 170 HardKey_Contacts = Qt::Key_F10,
171 HardKey_Menu = Qt::Key_F11, 171 HardKey_Menu = Qt::Key_F11,
172 HardKey_Home = Qt::Key_F12, 172 HardKey_Home = Qt::Key_F12,
173 HardKey_Mail = Qt::Key_F13, 173 HardKey_Mail = Qt::Key_F13,
174 HardKey_Record = Qt::Key_F24, 174 HardKey_Record = Qt::Key_F24,
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
@@ -74,288 +74,299 @@ struct z_button z_buttons [] = {
74 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 74 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
75 "devicebuttons/z_menu", 75 "devicebuttons/z_menu",
76 "QPE/TaskBar", "toggleMenu()", 76 "QPE/TaskBar", "toggleMenu()",
77 "QPE/TaskBar", "toggleStartMenu()" }, 77 "QPE/TaskBar", "toggleStartMenu()" },
78 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 78 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
79 "devicebuttons/z_mail", 79 "devicebuttons/z_mail",
80 "opiemail", "raise()", 80 "opiemail", "raise()",
81 "opiemail", "newMail()" }, 81 "opiemail", "newMail()" },
82}; 82};
83 83
84struct z_button z_buttons_c700 [] = { 84struct z_button z_buttons_c700 [] = {
85 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 85 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
86 "devicebuttons/z_calendar", 86 "devicebuttons/z_calendar",
87 "datebook", "nextView()", 87 "datebook", "nextView()",
88 "today", "raise()" }, 88 "today", "raise()" },
89 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 89 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
90 "devicebuttons/z_contact", 90 "devicebuttons/z_contact",
91 "addressbook", "raise()", 91 "addressbook", "raise()",
92 "addressbook", "beamBusinessCard()" }, 92 "addressbook", "beamBusinessCard()" },
93 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 93 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
94 "devicebuttons/z_home", 94 "devicebuttons/z_home",
95 "QPE/Launcher", "home()", 95 "QPE/Launcher", "home()",
96 "buttonsettings", "raise()" }, 96 "buttonsettings", "raise()" },
97 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 97 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
98 "devicebuttons/z_menu", 98 "devicebuttons/z_menu",
99 "QPE/TaskBar", "toggleMenu()", 99 "QPE/TaskBar", "toggleMenu()",
100 "QPE/TaskBar", "toggleStartMenu()" }, 100 "QPE/TaskBar", "toggleStartMenu()" },
101 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 101 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
102 "devicebuttons/z_mail", 102 "devicebuttons/z_mail",
103 "opiemail", "raise()", 103 "opiemail", "raise()",
104 "opiemail", "newMail()" }, 104 "opiemail", "newMail()" },
105 105
106 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 106 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
107 "devicebuttons/z_hinge1", 107 "devicebuttons/z_hinge1",
108 "QPE/Rotation", "rotateDefault()",0}, 108 "QPE/Rotation", "rotateDefault()",0},
109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
110 "devicebuttons/z_hinge2", 110 "devicebuttons/z_hinge2",
111 "QPE/Rotation", "rotateDefault()",0}, 111 "QPE/Rotation", "rotateDefault()",0},
112 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 112 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
113 "devicebuttons/z_hinge3", 113 "devicebuttons/z_hinge3",
114 "QPE/Rotation", "rotateDefault()",0}, 114 "QPE/Rotation", "rotateDefault()",0},
115}; 115};
116 116
117// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 117// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
118// class up into individual classes. We would need three classes 118// class up into individual classes. We would need three classes
119// 119//
120// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 120// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
121// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 121// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
122// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) 122// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
123// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 123// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
124 124
125void Zaurus::init(const QString& cpu_info) 125void Zaurus::init(const QString& cpu_info)
126{ 126{
127 // Set the time to wait until the system is really suspended 127 // Set the time to wait until the system is really suspended
128 // the delta between apm --suspend and sleeping 128 // the delta between apm --suspend and sleeping
129 setAPMTimeOut( 15000 ); 129 setAPMTimeOut( 15000 );
130 130
131 // generic distribution code already scanned /etc/issue at that point - 131 // generic distribution code already scanned /etc/issue at that point -
132 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 132 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
133 if ( d->m_sysverstr.contains( "embedix", false ) ) 133 if ( d->m_sysverstr.contains( "embedix", false ) )
134 { 134 {
135 d->m_vendorstr = "Sharp"; 135 d->m_vendorstr = "Sharp";
136 d->m_vendor = Vendor_Sharp; 136 d->m_vendor = Vendor_Sharp;
137 d->m_systemstr = "Zaurus"; 137 d->m_systemstr = "Zaurus";
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 ) {
298 309
299 switch ( sound ){ 310 switch ( sound ){
300 case SHARP_BUZ_TOUCHSOUND: { 311 case SHARP_BUZ_TOUCHSOUND: {
301 static Sound touch_sound("touchsound"); 312 static Sound touch_sound("touchsound");
302 snd = &touch_sound; 313 snd = &touch_sound;
303 } 314 }
304 break; 315 break;
305 case SHARP_BUZ_KEYSOUND: { 316 case SHARP_BUZ_KEYSOUND: {
306 static Sound key_sound( "keysound" ); 317 static Sound key_sound( "keysound" );
307 snd = &key_sound; 318 snd = &key_sound;
308 } 319 }
309 break; 320 break;
310 case SHARP_BUZ_SCHEDULE_ALARM: 321 case SHARP_BUZ_SCHEDULE_ALARM:
311 default: { 322 default: {
312 static Sound alarm_sound("alarm"); 323 static Sound alarm_sound("alarm");
313 snd = &alarm_sound; 324 snd = &alarm_sound;
314 } 325 }
315 break; 326 break;
316 } 327 }
317 } 328 }
318 329
319 // If a soundname is defined, we expect that this device has 330 // If a soundname is defined, we expect that this device has
320 // sound capabilities.. Otherwise we expect to have the buzzer 331 // sound capabilities.. Otherwise we expect to have the buzzer
321 // device.. 332 // device..
322 if ( snd && snd->isFinished() ){ 333 if ( snd && snd->isFinished() ){
323 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 334 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
324 snd->play(); 335 snd->play();
325 } else if( !snd ) { 336 } else if( !snd ) {
326 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 337 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
327 338
328 if ( fd >= 0 ) { 339 if ( fd >= 0 ) {
329 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 340 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
330 ::close ( fd ); 341 ::close ( fd );
331 } 342 }
332 343
333 } 344 }
334#endif 345#endif
335} 346}
336 347
337 348
338void Zaurus::playAlarmSound() 349void Zaurus::playAlarmSound()
339{ 350{
340 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 351 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
341} 352}
342 353
343void Zaurus::playTouchSound() 354void Zaurus::playTouchSound()
344{ 355{
345 buzzer( SHARP_BUZ_TOUCHSOUND ); 356 buzzer( SHARP_BUZ_TOUCHSOUND );
346} 357}
347 358
348void Zaurus::playKeySound() 359void Zaurus::playKeySound()
349{ 360{
350 buzzer( SHARP_BUZ_KEYSOUND ); 361 buzzer( SHARP_BUZ_KEYSOUND );
351} 362}
352 363
353 364
354QValueList <OLed> Zaurus::ledList() const 365QValueList <OLed> Zaurus::ledList() const
355{ 366{
356 QValueList <OLed> vl; 367 QValueList <OLed> vl;
357 vl << Led_Mail; 368 vl << Led_Mail;
358 return vl; 369 return vl;
359} 370}
360 371
361QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 372QValueList <OLedState> Zaurus::ledStateList( OLed l ) const