summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/device/odevice_zaurus.cpp
authormickeyl <mickeyl>2005-09-03 18:01:49 (UTC)
committer mickeyl <mickeyl>2005-09-03 18:01:49 (UTC)
commitde950b18690b8981a2bddaca68cbd5d48c71f689 (patch) (unidiff)
tree53e111efa326b6fbfb4e157c4c7d3776ea9af17b /libopie2/opiecore/device/odevice_zaurus.cpp
parented772cdd53070ccc61c87a3b0e96769a9f558f71 (diff)
downloadopie-de950b18690b8981a2bddaca68cbd5d48c71f689.zip
opie-de950b18690b8981a2bddaca68cbd5d48c71f689.tar.gz
opie-de950b18690b8981a2bddaca68cbd5d48c71f689.tar.bz2
fun with namespaces and moc... this patch fixes the hinge sensor on clamshell Zaurii
Diffstat (limited to 'libopie2/opiecore/device/odevice_zaurus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index a75f566..8a7e252 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -154,12 +154,13 @@ struct z_button z_buttons_6000 [] = {
154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
155// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100) 155// Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000, C1000, C3100)
156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
157 157
158void Zaurus::init(const QString& cpu_info) 158void Zaurus::init(const QString& cpu_info)
159{ 159{
160 qDebug( "Zaurus::init()" );
160 // Set the time to wait until the system is really suspended 161 // Set the time to wait until the system is really suspended
161 // the delta between apm --suspend and sleeping 162 // the delta between apm --suspend and sleeping
162 setAPMTimeOut( 15000 ); 163 setAPMTimeOut( 15000 );
163 164
164 // generic distribution code already scanned /etc/issue at that point - 165 // generic distribution code already scanned /etc/issue at that point -
165 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 166 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
@@ -256,12 +257,13 @@ void Zaurus::init(const QString& cpu_info)
256 d->m_rotation = Rot0; 257 d->m_rotation = Rot0;
257 break; 258 break;
258 case Model_Zaurus_SLC3100: // fallthrough 259 case Model_Zaurus_SLC3100: // fallthrough
259 case Model_Zaurus_SLC3000: // fallthrough 260 case Model_Zaurus_SLC3000: // fallthrough
260 case Model_Zaurus_SLC1000: // fallthrough 261 case Model_Zaurus_SLC1000: // fallthrough
261 case Model_Zaurus_SLC7x0: 262 case Model_Zaurus_SLC7x0:
263 initHingeSensor();
262 d->m_rotation = rotation(); 264 d->m_rotation = rotation();
263 d->m_direction = direction(); 265 d->m_direction = direction();
264 break; 266 break;
265 case Model_Zaurus_SLB600: // fallthrough 267 case Model_Zaurus_SLB600: // fallthrough
266 case Model_Zaurus_SL5000: // fallthrough 268 case Model_Zaurus_SL5000: // fallthrough
267 case Model_Zaurus_SL5500: // fallthrough 269 case Model_Zaurus_SL5500: // fallthrough
@@ -286,12 +288,13 @@ void Zaurus::init(const QString& cpu_info)
286 else 288 else
287 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 289 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
288} 290}
289 291
290void Zaurus::initButtons() 292void Zaurus::initButtons()
291{ 293{
294 qDebug( "Zaurus::initButtons()" );
292 if ( d->m_buttons ) 295 if ( d->m_buttons )
293 return; 296 return;
294 297
295 d->m_buttons = new QValueList <ODeviceButton>; 298 d->m_buttons = new QValueList <ODeviceButton>;
296 299
297 struct z_button * pz_buttons; 300 struct z_button * pz_buttons;
@@ -304,15 +307,14 @@ void Zaurus::initButtons()
304 break; 307 break;
305 case Model_Zaurus_SLC3100: // fallthrough 308 case Model_Zaurus_SLC3100: // fallthrough
306 case Model_Zaurus_SLC3000: // fallthrough 309 case Model_Zaurus_SLC3000: // fallthrough
307 case Model_Zaurus_SLC1000: // fallthrough 310 case Model_Zaurus_SLC1000: // fallthrough
308 case Model_Zaurus_SLC7x0: 311 case Model_Zaurus_SLC7x0:
309 if ( isQWS( ) ) 312 if ( isQWS( ) )
310 { // setup hinge sensor stuff 313 {
311 addPreHandler(this); 314 addPreHandler(this);
312 initHingeSensor();
313 } 315 }
314 pz_buttons = z_buttons_c700; 316 pz_buttons = z_buttons_c700;
315 buttoncount = ARRAY_SIZE(z_buttons_c700); 317 buttoncount = ARRAY_SIZE(z_buttons_c700);
316 break; 318 break;
317 default: 319 default:
318 pz_buttons = z_buttons; 320 pz_buttons = z_buttons;
@@ -598,12 +600,13 @@ Transformation Zaurus::rotation() const
598 case Model_Zaurus_SL5000: 600 case Model_Zaurus_SL5000:
599 default: 601 default:
600 rot = d->m_rotation; 602 rot = d->m_rotation;
601 break; 603 break;
602 } 604 }
603 605
606 qDebug( "Zaurus::rotation() - returning '%d'", rot );
604 return rot; 607 return rot;
605} 608}
606ODirection Zaurus::direction() const 609ODirection Zaurus::direction() const
607{ 610{
608 ODirection dir; 611 ODirection dir;
609 612
@@ -702,18 +705,20 @@ void Zaurus::initHingeSensor()
702{ 705{
703 if ( m_embedix ) return; 706 if ( m_embedix ) return;
704 707
705 m_hinge.setName( "/dev/input/event0" ); 708 m_hinge.setName( "/dev/input/event0" );
706 if ( !m_hinge.open( IO_ReadOnly ) ) 709 if ( !m_hinge.open( IO_ReadOnly ) )
707 { 710 {
708 qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) ); 711 qWarning( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) );
709 return; 712 return;
710 } 713 }
711 714
712 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this ); 715 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this );
713 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) ); 716 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) );
717
718 qDebug( "Zaurus::init() - Hinge Sensor Initialization successfully completed" );
714} 719}
715 720
716void Zaurus::hingeSensorTriggered() 721void Zaurus::hingeSensorTriggered()
717{ 722{
718 qDebug( "Zaurus::hingeSensorTriggered() - got event" ); 723 qDebug( "Zaurus::hingeSensorTriggered() - got event" );
719 struct input_event e; 724 struct input_event e;
@@ -726,12 +731,19 @@ void Zaurus::hingeSensorTriggered()
726 qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" ); 731 qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" );
727 QCopChannel::send( "QPE/Rotation", "rotateDefault()" ); 732 QCopChannel::send( "QPE/Rotation", "rotateDefault()" );
728 } 733 }
729 } 734 }
730} 735}
731 736
737void Zaurus::systemMessage( const QCString &msg, const QByteArray & )
738{
739 if ( msg == "deviceButtonMappingChanged()" ) {
740 reloadButtonMapping();
741 }
742}
743
732/* 744/*
733 * Take code from iPAQ device. 745 * Take code from iPAQ device.
734 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. 746 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
735 * I hope that is ok - Alwin 747 * I hope that is ok - Alwin
736 */ 748 */
737bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 749bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )