summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2005-10-06 18:58:40 (UTC)
committer zecke <zecke>2005-10-06 18:58:40 (UTC)
commit0bad2116a1ceed19956b94889cb034781f35146d (patch) (unidiff)
treea1131b9e026cdf5533c4da6a7f49fcbb139b4e09 /libopie2
parent31777172abf127e00594790e4365dfad8772b100 (diff)
downloadopie-0bad2116a1ceed19956b94889cb034781f35146d.zip
opie-0bad2116a1ceed19956b94889cb034781f35146d.tar.gz
opie-0bad2116a1ceed19956b94889cb034781f35146d.tar.bz2
ODevice patch from #1701 gor hp1940
-Allocate device number -Some implementation
Diffstat (limited to 'libopie2') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h1
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 492c97b..c70d2af 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -48,48 +48,49 @@ class Sound;
48 48
49namespace Opie{ 49namespace Opie{
50namespace Core{ 50namespace Core{
51 51
52class ODeviceData; 52class ODeviceData;
53/** 53/**
54 * The available devices 54 * The available devices
55 */ 55 */
56enum OModel { 56enum OModel {
57 Model_Unknown, // = 0 57 Model_Unknown, // = 0
58 58
59 Model_Series_Mask = 0xffff0000, 59 Model_Series_Mask = 0xffff0000,
60 60
61 Model_iPAQ = ( 1 << 16 ), 61 Model_iPAQ = ( 1 << 16 ),
62 62
63 Model_iPAQ_All = ( Model_iPAQ | 0xffff ), 63 Model_iPAQ_All = ( Model_iPAQ | 0xffff ),
64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ), 64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ),
65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ), 65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ),
66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ), 66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ),
67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ), 67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ),
68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ), 68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ),
69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ), 69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ),
70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ), 70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ),
71 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ), 71 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ),
72 Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ),
72 73
73 Model_Jornada = ( 6 << 16 ), 74 Model_Jornada = ( 6 << 16 ),
74 Model_Jornada_56x = ( Model_Jornada | 0x0001 ), 75 Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
75 Model_Jornada_720 = ( Model_Jornada | 0x0002 ), 76 Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
76 77
77 Model_Zaurus = ( 2 << 16 ), 78 Model_Zaurus = ( 2 << 16 ),
78 79
79 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), 80 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
80 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), 81 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
81 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), 82 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
82 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), 83 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
83 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), 84 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
84 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), 85 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
85 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), 86 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
86 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), 87 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
87 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ), 88 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
88 89
89 Model_SIMpad = ( 3 << 16 ), 90 Model_SIMpad = ( 3 << 16 ),
90 91
91 Model_SIMpad_All = ( Model_SIMpad | 0xffff ), 92 Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
92 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), 93 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
93 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), 94 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
94 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), 95 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
95 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), 96 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 3cc6cec..52da2d9 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -130,59 +130,62 @@ struct i_button ipaq_buttons [] = {
130 130
131void iPAQ::init(const QString& model) 131void iPAQ::init(const QString& model)
132{ 132{
133 d->m_vendorstr = "HP"; 133 d->m_vendorstr = "HP";
134 d->m_vendor = Vendor_HP; 134 d->m_vendor = Vendor_HP;
135 135
136 d->m_modelstr = model.mid(model.findRev('H')); 136 d->m_modelstr = model.mid(model.findRev('H'));
137 137
138 if ( d->m_modelstr == "H3100" ) 138 if ( d->m_modelstr == "H3100" )
139 d->m_model = Model_iPAQ_H31xx; 139 d->m_model = Model_iPAQ_H31xx;
140 else if ( d->m_modelstr == "H3600" ) 140 else if ( d->m_modelstr == "H3600" )
141 d->m_model = Model_iPAQ_H36xx; 141 d->m_model = Model_iPAQ_H36xx;
142 else if ( d->m_modelstr == "H3700" ) 142 else if ( d->m_modelstr == "H3700" )
143 d->m_model = Model_iPAQ_H37xx; 143 d->m_model = Model_iPAQ_H37xx;
144 else if ( d->m_modelstr == "H3800" ) 144 else if ( d->m_modelstr == "H3800" )
145 d->m_model = Model_iPAQ_H38xx; 145 d->m_model = Model_iPAQ_H38xx;
146 else if ( d->m_modelstr == "H3900" ) 146 else if ( d->m_modelstr == "H3900" )
147 d->m_model = Model_iPAQ_H39xx; 147 d->m_model = Model_iPAQ_H39xx;
148 else if ( d->m_modelstr == "H5400" ) 148 else if ( d->m_modelstr == "H5400" )
149 d->m_model = Model_iPAQ_H5xxx; 149 d->m_model = Model_iPAQ_H5xxx;
150 else if ( d->m_modelstr == "H2200" ) 150 else if ( d->m_modelstr == "H2200" )
151 d->m_model = Model_iPAQ_H22xx; 151 d->m_model = Model_iPAQ_H22xx;
152 else if ( d->m_modelstr == "H1910" ) 152 else if ( d->m_modelstr == "H1910" )
153 d->m_model = Model_iPAQ_H191x; 153 d->m_model = Model_iPAQ_H191x;
154 else if ( d->m_modelstr == "H1940" )
155 d->m_model = Model_iPAQ_H1940;
154 else 156 else
155 d->m_model = Model_Unknown; 157 d->m_model = Model_Unknown;
156 158
157 switch ( d->m_model ) { 159 switch ( d->m_model ) {
158 case Model_iPAQ_H31xx: 160 case Model_iPAQ_H31xx:
159 case Model_iPAQ_H38xx: 161 case Model_iPAQ_H38xx:
160 d->m_rotation = Rot90; 162 d->m_rotation = Rot90;
161 break; 163 break;
162 case Model_iPAQ_H5xxx: 164 case Model_iPAQ_H5xxx:
163 case Model_iPAQ_H22xx: 165 case Model_iPAQ_H22xx:
164 case Model_iPAQ_H191x: 166 case Model_iPAQ_H191x:
167 case Model_iPAQ_H1940:
165 d->m_rotation = Rot0; 168 d->m_rotation = Rot0;
166 break; 169 break;
167 case Model_iPAQ_H36xx: 170 case Model_iPAQ_H36xx:
168 case Model_iPAQ_H37xx: 171 case Model_iPAQ_H37xx:
169 case Model_iPAQ_H39xx: 172 case Model_iPAQ_H39xx:
170 default: 173 default:
171 d->m_rotation = Rot270; 174 d->m_rotation = Rot270;
172 break; 175 break;
173 176
174 } 177 }
175 178
176 m_leds [0] = m_leds [1] = Led_Off; 179 m_leds [0] = m_leds [1] = Led_Off;
177 180
178 m_power_timer = 0; 181 m_power_timer = 0;
179 182
180} 183}
181 184
182void iPAQ::initButtons() 185void iPAQ::initButtons()
183{ 186{
184 if ( d->m_buttons ) 187 if ( d->m_buttons )
185 return; 188 return;
186 189
187 if ( isQWS( ) ) { 190 if ( isQWS( ) ) {
188 addPreHandler(this); 191 addPreHandler(this);
@@ -279,49 +282,50 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
279 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 282 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
280 case HardKey_Menu: { 283 case HardKey_Menu: {
281 if (( d->m_model == Model_iPAQ_H38xx ) || 284 if (( d->m_model == Model_iPAQ_H38xx ) ||
282 ( d->m_model == Model_iPAQ_H39xx ) || 285 ( d->m_model == Model_iPAQ_H39xx ) ||
283 ( d->m_model == Model_iPAQ_H5xxx)) { 286 ( d->m_model == Model_iPAQ_H5xxx)) {
284 newkeycode = HardKey_Mail; 287 newkeycode = HardKey_Mail;
285 } 288 }
286 break; 289 break;
287 } 290 }
288 291
289 // Rotate cursor keys 180 or 270 292 // Rotate cursor keys 180 or 270
290 case Key_Left : 293 case Key_Left :
291 case Key_Right: 294 case Key_Right:
292 case Key_Up : 295 case Key_Up :
293 case Key_Down : { 296 case Key_Down : {
294 if (( d->m_model == Model_iPAQ_H31xx ) || 297 if (( d->m_model == Model_iPAQ_H31xx ) ||
295 ( d->m_model == Model_iPAQ_H38xx )) { 298 ( d->m_model == Model_iPAQ_H38xx )) {
296 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 299 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
297 } 300 }
298 // Rotate the cursor keys by 270 301 // Rotate the cursor keys by 270
299 // keycode - Key_Left = position of the button starting from left clockwise 302 // keycode - Key_Left = position of the button starting from left clockwise
300 // add the rotation to it and modolo. No we've the original offset 303 // add the rotation to it and modolo. No we've the original offset
301 // add the offset to the Key_Left key 304 // add the offset to the Key_Left key
302 if (( d->m_model == Model_iPAQ_H5xxx ) || 305 if (( d->m_model == Model_iPAQ_H5xxx ) ||
303 ( d->m_model == Model_iPAQ_H191x )) 306 ( d->m_model == Model_iPAQ_H191x ) ||
307 ( d->m_model == Model_iPAQ_H1940 ))
304 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 308 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
305 break; 309 break;
306 } 310 }
307 311
308 // map Power Button short/long press to F34/F35 312 // map Power Button short/long press to F34/F35
309 case Key_SysReq: { 313 case Key_SysReq: {
310 if ( isPress ) { 314 if ( isPress ) {
311 if ( m_power_timer ) 315 if ( m_power_timer )
312 killTimer ( m_power_timer ); 316 killTimer ( m_power_timer );
313 m_power_timer = startTimer ( 500 ); 317 m_power_timer = startTimer ( 500 );
314 } 318 }
315 else if ( m_power_timer ) { 319 else if ( m_power_timer ) {
316 killTimer ( m_power_timer ); 320 killTimer ( m_power_timer );
317 m_power_timer = 0; 321 m_power_timer = 0;
318 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 322 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
319 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); 323 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
320 } 324 }
321 newkeycode = Key_unknown; 325 newkeycode = Key_unknown;
322 break; 326 break;
323 } 327 }
324 } 328 }
325 329
326 if ( newkeycode != keycode ) { 330 if ( newkeycode != keycode ) {
327 if ( newkeycode != Key_unknown ) 331 if ( newkeycode != Key_unknown )
@@ -381,48 +385,50 @@ bool iPAQ::setDisplayBrightness ( int bright )
381 bl. pwr = bright ? 1 : 0; 385 bl. pwr = bright ? 1 : 0;
382 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 386 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
383 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 387 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
384 ::close ( fd ); 388 ::close ( fd );
385 } 389 }
386 } 390 }
387 return res; 391 return res;
388} 392}
389 393
390int iPAQ::displayBrightnessResolution() const 394int iPAQ::displayBrightnessResolution() const
391{ 395{
392 switch ( model()) { 396 switch ( model()) {
393 case Model_iPAQ_H31xx: 397 case Model_iPAQ_H31xx:
394 case Model_iPAQ_H36xx: 398 case Model_iPAQ_H36xx:
395 case Model_iPAQ_H37xx: 399 case Model_iPAQ_H37xx:
396 return 128; // really 256, but >128 could damage the LCD 400 return 128; // really 256, but >128 could damage the LCD
397 401
398 case Model_iPAQ_H38xx: 402 case Model_iPAQ_H38xx:
399 case Model_iPAQ_H39xx: 403 case Model_iPAQ_H39xx:
400 return 64; 404 return 64;
401 case Model_iPAQ_H5xxx: 405 case Model_iPAQ_H5xxx:
402 return 255; 406 return 255;
403 case Model_iPAQ_H191x: 407 case Model_iPAQ_H191x:
404 return 183; 408 return 183;
409 case Model_iPAQ_H191x:
410 return 44;
405 default: 411 default:
406 return 2; 412 return 2;
407 } 413 }
408} 414}
409 415
410bool iPAQ::setDisplayStatus ( bool on ) 416bool iPAQ::setDisplayStatus ( bool on )
411{ 417{
412 bool res = false; 418 bool res = false;
413 419
414 QString cmdline; 420 QString cmdline;
415 421
416 if ( model() == Model_iPAQ_H191x ) { 422 if ( model() == Model_iPAQ_H191x ) {
417 cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); 423 cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/pxafb/power; echo %2 > /sys/class/backlight/pxafb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" );
418 } else { 424 } else {
419 return OAbstractMobileDevice::setDisplayStatus(on); 425 return OAbstractMobileDevice::setDisplayStatus(on);
420 } 426 }
421 427
422 res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); 428 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
423 429
424 return res; 430 return res;
425} 431}
426 432
427bool iPAQ::hasLightSensor() const 433bool iPAQ::hasLightSensor() const
428{ 434{