summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2005-08-23 12:25:35 (UTC)
committer mickeyl <mickeyl>2005-08-23 12:25:35 (UTC)
commit95210ac41729a4c264e830963cdae3a4cdd218fb (patch) (unidiff)
treec73284a5aebdeb2f56d11cec6ecda80e9b41cec8 /libopie2
parentd6e8e6bf49bb176ec54efed5eb0d012098f056d7 (diff)
downloadopie-95210ac41729a4c264e830963cdae3a4cdd218fb.zip
opie-95210ac41729a4c264e830963cdae3a4cdd218fb.tar.gz
opie-95210ac41729a4c264e830963cdae3a4cdd218fb.tar.bz2
add support for the Sharp SL-C3100 "Borzoi"
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h1
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp16
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h2
3 files changed, 15 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 76cf97d..0eed1c9 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -75,24 +75,25 @@ enum OModel {
75 Model_Jornada_720 = ( Model_Jornada | 0x0002 ), 75 Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
76 76
77 Model_Zaurus = ( 2 << 16 ), 77 Model_Zaurus = ( 2 << 16 ),
78 78
79 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ), 79 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
80 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ), 80 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
81 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ), 81 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
82 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ), 82 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
83 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ), 83 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
84 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ), 84 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
85 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ), 85 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
86 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ), 86 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
87 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
87 88
88 Model_SIMpad = ( 3 << 16 ), 89 Model_SIMpad = ( 3 << 16 ),
89 90
90 Model_SIMpad_All = ( Model_SIMpad | 0xffff ), 91 Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
91 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ), 92 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
92 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ), 93 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
93 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ), 94 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
94 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ), 95 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
95 96
96 Model_Ramses = ( 4 << 16 ), 97 Model_Ramses = ( 4 << 16 ),
97 98
98 Model_Ramses_All = ( Model_Ramses | 0xffff ), 99 Model_Ramses_All = ( Model_Ramses | 0xffff ),
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index b7f3104..4a80a7e 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -1,16 +1,16 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
4 =. 4 =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; version 2 of the License. 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : 12     ._= =}       :
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
@@ -215,24 +215,27 @@ void Zaurus::init(const QString& cpu_info)
215 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 215 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
216 d->m_model = Model_Zaurus_SL5500; 216 d->m_model = Model_Zaurus_SL5500;
217 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 217 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
218 } else if ( model == "SHARP Tosa" ) { 218 } else if ( model == "SHARP Tosa" ) {
219 d->m_model = Model_Zaurus_SL6000; 219 d->m_model = Model_Zaurus_SL6000;
220 d->m_modelstr = "Zaurus SL-6000"; 220 d->m_modelstr = "Zaurus SL-6000";
221 } else if ( model == "SHARP Spitz" ) { 221 } else if ( model == "SHARP Spitz" ) {
222 d->m_model = Model_Zaurus_SLC3000; 222 d->m_model = Model_Zaurus_SLC3000;
223 d->m_modelstr = "Zaurus SL-C3000"; 223 d->m_modelstr = "Zaurus SL-C3000";
224 } else if ( model == "SHARP Akita" ) { 224 } else if ( model == "SHARP Akita" ) {
225 d->m_model = Model_Zaurus_SLC1000; 225 d->m_model = Model_Zaurus_SLC1000;
226 d->m_modelstr = "Zaurus SL-C1000"; 226 d->m_modelstr = "Zaurus SL-C1000";
227 } else if ( model == "SHARP Borzoi" ) {
228 d->m_model = Model_Zaurus_SLC3100;
229 d->m_modelstr = "Zaurus SL-C3100";
227 } else { 230 } else {
228 d->m_model = Model_Zaurus_SL5500; 231 d->m_model = Model_Zaurus_SL5500;
229 d->m_modelstr = "Unknown Zaurus"; 232 d->m_modelstr = "Unknown Zaurus";
230 } 233 }
231 234
232 // set path to backlight device in kernel 2.6 235 // set path to backlight device in kernel 2.6
233 switch ( d->m_model ) 236 switch ( d->m_model )
234 { 237 {
235 case Model_Zaurus_SLB600: // fallthrough 238 case Model_Zaurus_SLB600: // fallthrough
236 case Model_Zaurus_SL5500: 239 case Model_Zaurus_SL5500:
237 m_backlightdev = "/sys/class/backlight/locomo-backlight/"; 240 m_backlightdev = "/sys/class/backlight/locomo-backlight/";
238 break; 241 break;
@@ -241,24 +244,25 @@ void Zaurus::init(const QString& cpu_info)
241 break; 244 break;
242 default: 245 default:
243 m_backlightdev = "/sys/class/backlight/corgi-bl/"; 246 m_backlightdev = "/sys/class/backlight/corgi-bl/";
244 } 247 }
245 248
246 // set initial rotation 249 // set initial rotation
247 switch( d->m_model ) 250 switch( d->m_model )
248 { 251 {
249 case Model_Zaurus_SL6000: // fallthrough 252 case Model_Zaurus_SL6000: // fallthrough
250 case Model_Zaurus_SLA300: 253 case Model_Zaurus_SLA300:
251 d->m_rotation = Rot0; 254 d->m_rotation = Rot0;
252 break; 255 break;
256 case Model_Zaurus_SLC3100: // fallthrough
253 case Model_Zaurus_SLC3000: // fallthrough 257 case Model_Zaurus_SLC3000: // fallthrough
254 case Model_Zaurus_SLC1000: // fallthrough 258 case Model_Zaurus_SLC1000: // fallthrough
255 case Model_Zaurus_SLC7x0: 259 case Model_Zaurus_SLC7x0:
256 d->m_rotation = rotation(); 260 d->m_rotation = rotation();
257 d->m_direction = direction(); 261 d->m_direction = direction();
258 break; 262 break;
259 case Model_Zaurus_SLB600: // fallthrough 263 case Model_Zaurus_SLB600: // fallthrough
260 case Model_Zaurus_SL5000: // fallthrough 264 case Model_Zaurus_SL5000: // fallthrough
261 case Model_Zaurus_SL5500: // fallthrough 265 case Model_Zaurus_SL5500: // fallthrough
262 default: 266 default:
263 d->m_rotation = Rot270; 267 d->m_rotation = Rot270;
264 } 268 }
@@ -287,24 +291,25 @@ void Zaurus::initButtons()
287 return; 291 return;
288 292
289 d->m_buttons = new QValueList <ODeviceButton>; 293 d->m_buttons = new QValueList <ODeviceButton>;
290 294
291 struct z_button * pz_buttons; 295 struct z_button * pz_buttons;
292 int buttoncount; 296 int buttoncount;
293 switch ( d->m_model ) 297 switch ( d->m_model )
294 { 298 {
295 case Model_Zaurus_SL6000: 299 case Model_Zaurus_SL6000:
296 pz_buttons = z_buttons_6000; 300 pz_buttons = z_buttons_6000;
297 buttoncount = ARRAY_SIZE(z_buttons_6000); 301 buttoncount = ARRAY_SIZE(z_buttons_6000);
298 break; 302 break;
303 case Model_Zaurus_SLC3100: // fallthrough
299 case Model_Zaurus_SLC3000: // fallthrough 304 case Model_Zaurus_SLC3000: // fallthrough
300 case Model_Zaurus_SLC1000: // fallthrough 305 case Model_Zaurus_SLC1000: // fallthrough
301 case Model_Zaurus_SLC7x0: 306 case Model_Zaurus_SLC7x0:
302 if ( isQWS( ) ) { 307 if ( isQWS( ) ) {
303 addPreHandler(this); // hinge-sensor-handler 308 addPreHandler(this); // hinge-sensor-handler
304 } 309 }
305 pz_buttons = z_buttons_c700; 310 pz_buttons = z_buttons_c700;
306 buttoncount = ARRAY_SIZE(z_buttons_c700); 311 buttoncount = ARRAY_SIZE(z_buttons_c700);
307 break; 312 break;
308 default: 313 default:
309 pz_buttons = z_buttons; 314 pz_buttons = z_buttons;
310 buttoncount = ARRAY_SIZE(z_buttons); 315 buttoncount = ARRAY_SIZE(z_buttons);
@@ -540,24 +545,25 @@ bool Zaurus::setDisplayStatus( bool on )
540 ::close( fd ); 545 ::close( fd );
541 } 546 }
542 } 547 }
543 return res; 548 return res;
544} 549}
545 550
546Transformation Zaurus::rotation() const 551Transformation Zaurus::rotation() const
547{ 552{
548 qDebug( "Zaurus::rotation()" ); 553 qDebug( "Zaurus::rotation()" );
549 Transformation rot; 554 Transformation rot;
550 555
551 switch ( d->m_model ) { 556 switch ( d->m_model ) {
557 case Model_Zaurus_SLC3100: // fallthrough
552 case Model_Zaurus_SLC3000: // fallthrough 558 case Model_Zaurus_SLC3000: // fallthrough
553 case Model_Zaurus_SLC1000: 559 case Model_Zaurus_SLC1000:
554 { 560 {
555 OHingeStatus hs = readHingeSensor(); 561 OHingeStatus hs = readHingeSensor();
556 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); 562 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
557 if ( hs == CASE_PORTRAIT ) rot = Rot0; 563 if ( hs == CASE_PORTRAIT ) rot = Rot0;
558 else if ( hs == CASE_UNKNOWN ) rot = Rot270; 564 else if ( hs == CASE_UNKNOWN ) rot = Rot270;
559 else rot = Rot270; 565 else rot = Rot270;
560 } 566 }
561 break; 567 break;
562 568
563 // SLC7x0 needs a special case here, because we were able to set the W100 569 // SLC7x0 needs a special case here, because we were able to set the W100
@@ -589,48 +595,52 @@ Transformation Zaurus::rotation() const
589 default: 595 default:
590 rot = d->m_rotation; 596 rot = d->m_rotation;
591 break; 597 break;
592 } 598 }
593 599
594 return rot; 600 return rot;
595} 601}
596ODirection Zaurus::direction() const 602ODirection Zaurus::direction() const
597{ 603{
598 ODirection dir; 604 ODirection dir;
599 605
600 switch ( d->m_model ) { 606 switch ( d->m_model ) {
607 case Model_Zaurus_SLC3100: // fallthrough
601 case Model_Zaurus_SLC3000: // fallthrough 608 case Model_Zaurus_SLC3000: // fallthrough
602 case Model_Zaurus_SLC1000: // fallthrough 609 case Model_Zaurus_SLC1000: // fallthrough
603 case Model_Zaurus_SLC7x0: { 610 case Model_Zaurus_SLC7x0: {
604 OHingeStatus hs = readHingeSensor(); 611 OHingeStatus hs = readHingeSensor();
605 if ( hs == CASE_PORTRAIT ) dir = CCW; 612 if ( hs == CASE_PORTRAIT ) dir = CCW;
606 else if ( hs == CASE_UNKNOWN ) dir = CCW; 613 else if ( hs == CASE_UNKNOWN ) dir = CCW;
607 else dir = CW; 614 else dir = CW;
608 } 615 }
609 break; 616 break;
610 case Model_Zaurus_SL6000: 617 case Model_Zaurus_SL6000:
611 case Model_Zaurus_SLA300: 618 case Model_Zaurus_SLA300:
612 case Model_Zaurus_SLB600: 619 case Model_Zaurus_SLB600:
613 case Model_Zaurus_SL5500: 620 case Model_Zaurus_SL5500:
614 case Model_Zaurus_SL5000: 621 case Model_Zaurus_SL5000:
615 default: dir = d->m_direction; 622 default: dir = d->m_direction;
616 break; 623 break;
617 } 624 }
618 return dir; 625 return dir;
619 626
620} 627}
621 628
622bool Zaurus::hasHingeSensor() const 629bool Zaurus::hasHingeSensor() const
623{ 630{
624 return d->m_model == Model_Zaurus_SLC7x0 || d->m_model == Model_Zaurus_SLC3000 || d->m_model == Model_Zaurus_SLC1000; 631 return d->m_model == Model_Zaurus_SLC7x0 ||
632 d->m_model == Model_Zaurus_SLC3100 ||
633 d->m_model == Model_Zaurus_SLC3000 ||
634 d->m_model == Model_Zaurus_SLC1000;
625} 635}
626 636
627OHingeStatus Zaurus::readHingeSensor() const 637OHingeStatus Zaurus::readHingeSensor() const
628{ 638{
629 if (m_embedix) 639 if (m_embedix)
630 { 640 {
631 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 641 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
632 if (handle == -1) 642 if (handle == -1)
633 { 643 {
634 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror 644 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
635 return CASE_UNKNOWN; 645 return CASE_UNKNOWN;
636 } 646 }
@@ -662,25 +672,25 @@ OHingeStatus Zaurus::readHingeSensor() const
662 } 672 }
663} 673}
664 674
665/* 675/*
666 * Take code from iPAQ device. 676 * Take code from iPAQ device.
667 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. 677 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
668 * I hope that is ok - Alwin 678 * I hope that is ok - Alwin
669 */ 679 */
670bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 680bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
671{ 681{
672 int newkeycode = keycode; 682 int newkeycode = keycode;
673 683
674 if (d->m_model != Model_Zaurus_SLC7x0 && d->m_model != Model_Zaurus_SLC3000 && d->m_model != Model_Zaurus_SLC1000) return false; 684 if ( !hasHingeSensor() ) return false;
675 685
676 /* map cursor keys depending on the hinge status */ 686 /* map cursor keys depending on the hinge status */
677 switch ( keycode ) { 687 switch ( keycode ) {
678 // Rotate cursor keys 688 // Rotate cursor keys
679 case Key_Left : 689 case Key_Left :
680 case Key_Right: 690 case Key_Right:
681 case Key_Up : 691 case Key_Up :
682 case Key_Down : 692 case Key_Down :
683 { 693 {
684 if (rotation()==Rot90) { 694 if (rotation()==Rot90) {
685 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 695 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
686 } 696 }
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 4314aff..677e29f 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -1,16 +1,16 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
4 =. 4 =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; version 2 of the License. 11 - .   .-<_>     .<> Foundation; version 2 of the License.
12     ._= =}       : 12     ._= =}       :
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of