summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp8
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp73
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h6
-rw-r--r--libopie2/opiecore/linux/oinputsystem.cpp38
-rw-r--r--libopie2/opiecore/linux/oinputsystem.h11
-rw-r--r--libopie2/opiecore/linux/oinputsystemenums.h405
-rw-r--r--libopie2/opiecore/linux_input.h25
-rw-r--r--libopie2/opiecore/oinputsystemenums.h13
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp1
10 files changed, 165 insertions, 416 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fc81f0..38b65c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,48 +41,49 @@
41 * n.a. - always show volume and wireless applet popups inside visible screen (deller) 41 * n.a. - always show volume and wireless applet popups inside visible screen (deller)
42 * n.a. - scale O-Menu-Applets appropriately (mickeyl) 42 * n.a. - scale O-Menu-Applets appropriately (mickeyl)
43 * n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) 43 * n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
44 * n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl) 44 * n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl)
45 * n.a. - scale BluezApplet appropriately and use larger icons (mickeyl) 45 * n.a. - scale BluezApplet appropriately and use larger icons (mickeyl)
46 * n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) 46 * n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
47 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) 47 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl)
48 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw) 48 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw)
49 * n.a. - remove hardcoded font size from netsystemtime (hrw) 49 * n.a. - remove hardcoded font size from netsystemtime (hrw)
50 * n.a. - remove hardcoded font size from checkbook graphs (hrw) 50 * n.a. - remove hardcoded font size from checkbook graphs (hrw)
51 * n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw) 51 * n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw)
52 52
53 53
54 Internal 54 Internal
55 -------- 55 --------
56 * Make BluezApplet use OTaskbarApplet (mickeyl) 56 * Make BluezApplet use OTaskbarApplet (mickeyl)
57 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl) 57 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl)
58 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl) 58 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl)
59 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) 59 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl)
60 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) 60 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl)
61 * libopienet: Miscellaneous API cleanups (mickeyl) 61 * libopienet: Miscellaneous API cleanups (mickeyl)
62 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl) 62 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl)
63 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl) 63 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl)
64 * libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl) 64 * libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl)
65 * libopiecore: Add support for the new Linux Inputsystem Switches type [necessary for auto rotation in 2.6.13] (mickeyl)
65 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl) 66 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl)
66 * Fix / Optimize number of scanned directories (ljp) 67 * Fix / Optimize number of scanned directories (ljp)
67 68
68 2005-03-25Opie 1.2.0 69 2005-03-25Opie 1.2.0
69 70
70 Fixed Bugs 71 Fixed Bugs
71 ---------- 72 ----------
72 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) 73 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw)
73 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) 74 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin)
74 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) 75 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke)
75 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) 76 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw)
76 * n.a.- make qpeglobal.h include qglobal.h (zecke) 77 * n.a.- make qpeglobal.h include qglobal.h (zecke)
77 78
78 2005-03-20Opie 1.2.0-rc1 79 2005-03-20Opie 1.2.0-rc1
79 80
80 81
81 New Features 82 New Features
82 ------------ 83 ------------
83 * Launcher: Support a static background pixmap (mickeyl) 84 * Launcher: Support a static background pixmap (mickeyl)
84 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) 85 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
85 * PackageManager supports the 'lists_dir' ipkg configuration option (drw) 86 * PackageManager supports the 'lists_dir' ipkg configuration option (drw)
86 * Added hi-res inline images for large resolution devices (drw) 87 * Added hi-res inline images for large resolution devices (drw)
87 * Improved launcher icons for consistency (ar) 88 * Improved launcher icons for consistency (ar)
88 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) 89 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin)
diff --git a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp
index 6c95048..b49df99 100644
--- a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp
+++ b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp
@@ -42,79 +42,83 @@ using namespace Opie::Core;
42int main( int argc, char** argv ) 42int main( int argc, char** argv )
43{ 43{
44 OInputSystem* sys = OInputSystem::instance(); 44 OInputSystem* sys = OInputSystem::instance();
45 OInputSystem::DeviceIterator it = sys->iterator(); 45 OInputSystem::DeviceIterator it = sys->iterator();
46 46
47 OInputDevice* dev = 0; 47 OInputDevice* dev = 0;
48 48
49 while ( it.current() ) 49 while ( it.current() )
50 { 50 {
51 odebug << "DEMO: OInputSystem contains OInputDevice '" << it.current()->name() << "'" << oendl; 51 odebug << "DEMO: OInputSystem contains OInputDevice '" << it.current()->name() << "'" << oendl;
52 52
53 dev = it.current(); 53 dev = it.current();
54 54
55 QString features; 55 QString features;
56 features += QString( "\nSynchronous: " ); 56 features += QString( "\nSynchronous: " );
57 if ( dev->hasFeature( OInputDevice::Synchronous ) ) features += "[ x ]"; else features += "[ ]"; 57 if ( dev->hasFeature( OInputDevice::Synchronous ) ) features += "[ x ]"; else features += "[ ]";
58 features += QString( "\nKeys or Buttons: " ); 58 features += QString( "\nKeys or Buttons: " );
59 if ( dev->hasFeature( OInputDevice::Keys ) ) features += "[ x ]"; else features += "[ ]"; 59 if ( dev->hasFeature( OInputDevice::Keys ) ) features += "[ x ]"; else features += "[ ]";
60 features += QString( "\nRelative Axes: " ); 60 features += QString( "\nRelative Axes: " );
61 if ( dev->hasFeature( OInputDevice::Relative ) ) features += "[ x ]"; else features += "[ ]"; 61 if ( dev->hasFeature( OInputDevice::Relative ) ) features += "[ x ]"; else features += "[ ]";
62 features += QString( "\nAbsolute Axes: " ); 62 features += QString( "\nAbsolute Axes: " );
63 if ( dev->hasFeature( OInputDevice::Absolute ) ) features += "[ x ]"; else features += "[ ]"; 63 if ( dev->hasFeature( OInputDevice::Absolute ) ) features += "[ x ]"; else features += "[ ]";
64 features += QString( "\nMiscellaneous: " ); 64 features += QString( "\nMiscellaneous: " );
65 if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) features += "[ x ]"; else features += "[ ]"; 65 if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) features += "[ x ]"; else features += "[ ]";
66 features += QString( "\nSwitches: " );
67 if ( dev->hasFeature( OInputDevice::Switches ) ) features += "[ x ]"; else features += "[ ]";
66 features += QString( "\nLeds: " ); 68 features += QString( "\nLeds: " );
67 if ( dev->hasFeature( OInputDevice::Leds ) ) features += "[ x ]"; else features += "[ ]"; 69 if ( dev->hasFeature( OInputDevice::Leds ) ) features += "[ x ]"; else features += "[ ]";
68 features += QString( "\nSound: " ); 70 features += QString( "\nSound: " );
69 if ( dev->hasFeature( OInputDevice::Sound ) ) features += "[ x ]"; else features += "[ ]"; 71 if ( dev->hasFeature( OInputDevice::Sound ) ) features += "[ x ]"; else features += "[ ]";
70 features += QString( "\nAutoRepeat " ); 72 features += QString( "\nAutoRepeat " );
71 if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) features += "[ x ]"; else features += "[ ]"; 73 if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) features += "[ x ]"; else features += "[ ]";
72 features += QString( "\nForceFeedback: " ); 74 features += QString( "\nForceFeedback: " );
73 if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) features += "[ x ]"; else features += "[ ]"; 75 if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) features += "[ x ]"; else features += "[ ]";
74 features += QString( "\nPowerManagement: " ); 76 features += QString( "\nPowerManagement: " );
75 if ( dev->hasFeature( OInputDevice::PowerManagement ) ) features += "[ x ]"; else features += "[ ]"; 77 if ( dev->hasFeature( OInputDevice::PowerManagement ) ) features += "[ x ]"; else features += "[ ]";
76 features += QString( "\nFeedbackStatus: " ); 78 features += QString( "\nFeedbackStatus: " );
77 if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) features += "[ x ]"; else features += "[ ]"; 79 if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) features += "[ x ]"; else features += "[ ]";
78 80
79 odebug << "========================================" 81 odebug << "========================================"
80 << "\nDevice: " << dev->name() 82 << "\nDevice: " << dev->name()
81 << "\nName: " << dev->identity() 83 << "\nName: " << dev->identity()
82 << "\nPath: " << dev->path() 84 << "\nPath: " << dev->path()
83 << "\nUniq: " << dev->uniq() 85 << "\nUniq: " << dev->uniq()
84 << features << "\n" 86 << features << "\n"
85 << oendl; 87 << oendl;
86 88
87 if ( dev->isHeld( OInputDevice::Key_LEFTSHIFT ) ) 89 if ( dev->isHeld( OInputDevice::Key_LEFTSHIFT ) )
88 odebug << "Left Shift is being held." << oendl; 90 odebug << "Left Shift is being held." << oendl;
89 else odebug << "Left Shift is _not_ being held." << oendl; 91 else odebug << "Left Shift is _not_ being held." << oendl;
90 92
91 if ( dev->isHeld( OInputDevice::Button_LEFT ) ) 93 if ( dev->isHeld( OInputDevice::Button_LEFT ) )
92 odebug << "Left Mouse Button is being held." << oendl; 94 odebug << "Left Mouse Button is being held." << oendl;
93 else odebug << "Left Mouse Button is _not_ being held." << oendl; 95 else odebug << "Left Mouse Button is _not_ being held." << oendl;
94 96
95 odebug << "Global key mask: " << dev->globalKeyMask() << oendl; 97 odebug << "Global key mask: " << dev->globalKeyMask() << oendl;
96 98 odebug << "Global switch mask: " << dev->globalSwitchMask() << oendl;
99
100
97 ++it; 101 ++it;
98 } 102 }
99} 103}
100 104
101#else 105#else
102 106
103#include <fcntl.h> 107#include <fcntl.h>
104#include <unistd.h> 108#include <unistd.h>
105#include <cstdlib> 109#include <cstdlib>
106#include <cstdio> 110#include <cstdio>
107#include <string> 111#include <string>
108 112
109#include <sys/types.h> 113#include <sys/types.h>
110#include <linux/input.h> 114#include <linux/input.h>
111 115
112using std::string; 116using std::string;
113 117
114const unsigned char BUT1 = 0x01; 118const unsigned char BUT1 = 0x01;
115const unsigned char BUT2 = 0x04; 119const unsigned char BUT2 = 0x04;
116const unsigned char BUT3 = 0x02; 120const unsigned char BUT3 = 0x02;
117const unsigned char BUT4 = 0x40; 121const unsigned char BUT4 = 0x40;
118const unsigned char BUT5 = 0x80; 122const unsigned char BUT5 = 0x80;
119 123
120#define BITMASK( name, numbits ) \ 124#define BITMASK( name, numbits ) \
@@ -310,25 +314,25 @@ int main( int argc, char **argv )
310 314
311 if( ( buf[ 0 ] & 0x20 ) != 0 ) 315 if( ( buf[ 0 ] & 0x20 ) != 0 )
312 dy += 256; 316 dy += 256;
313 317
314 printf( "( %d, %d )\t", dx, dy ); 318 printf( "( %d, %d )\t", dx, dy );
315 319
316 if( buf[ 0 ] & BUT1 ) 320 if( buf[ 0 ] & BUT1 )
317 printf( "Left\t" ); 321 printf( "Left\t" );
318 if( buf[ 0 ] & BUT2 ) 322 if( buf[ 0 ] & BUT2 )
319 printf( "Middle\t" ); 323 printf( "Middle\t" );
320 if( buf[ 0 ] & BUT3 ) 324 if( buf[ 0 ] & BUT3 )
321 printf( "Right\t" ); 325 printf( "Right\t" );
322 326
323 printf( "\n" ); 327 printf( "\n" );
324 } 328 }
325#endif 329#endif
326 330
327 //close( fd ); 331 //close( fd );
328 332
329 exit( EXIT_SUCCESS ); 333 exit( EXIT_SUCCESS );
330hell: 334hell:
331 exit( EXIT_FAILURE ); 335 exit( EXIT_FAILURE );
332} 336}
333 337
334#endif \ No newline at end of file 338#endif
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 33d5cd6..a75f566 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -23,48 +23,50 @@
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_zaurus.h" 30#include "odevice_zaurus.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/oinputsystem.h> 33#include <opie2/oinputsystem.h>
34#include <opie2/oresource.h> 34#include <opie2/oresource.h>
35 35
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/sound.h> 37#include <qpe/sound.h>
38 38
39/* QT */ 39/* QT */
40#include <qapplication.h> 40#include <qapplication.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qtextstream.h> 42#include <qtextstream.h>
43#include <qwindowsystem_qws.h> 43#include <qwindowsystem_qws.h>
44#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
45 45
46/* STD */ 46/* STD */
47#include <string.h>
48#include <errno.h>
47#include <fcntl.h> 49#include <fcntl.h>
48#include <math.h> 50#include <math.h>
49#include <stdlib.h> 51#include <stdlib.h>
50#include <signal.h> 52#include <signal.h>
51#include <sys/ioctl.h> 53#include <sys/ioctl.h>
52#include <sys/time.h> 54#include <sys/time.h>
53#include <unistd.h> 55#include <unistd.h>
54#ifndef QT_NO_SOUND 56#ifndef QT_NO_SOUND
55#include <linux/soundcard.h> 57#include <linux/soundcard.h>
56#endif 58#endif
57 59
58using namespace Opie::Core; 60using namespace Opie::Core;
59using namespace Opie::Core::Internal; 61using namespace Opie::Core::Internal;
60 62
61struct z_button z_buttons [] = { 63struct z_button z_buttons [] = {
62 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 64 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
63 "devicebuttons/z_calendar", 65 "devicebuttons/z_calendar",
64 "datebook", "nextView()", 66 "datebook", "nextView()",
65 "today", "raise()" }, 67 "today", "raise()" },
66 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 68 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
67 "devicebuttons/z_contact", 69 "devicebuttons/z_contact",
68 "addressbook", "raise()", 70 "addressbook", "raise()",
69 "addressbook", "beamBusinessCard()" }, 71 "addressbook", "beamBusinessCard()" },
70 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 72 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
@@ -283,50 +285,52 @@ void Zaurus::init(const QString& cpu_info)
283 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr ); 285 qDebug( "Zaurus::init() - Using the 2.4 Embedix HAL on a %s", (const char*) d->m_modelstr );
284 else 286 else
285 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); 287 qDebug( "Zaurus::init() - Using the 2.6 OpenZaurus HAL on a %s", (const char*) d->m_modelstr );
286} 288}
287 289
288void Zaurus::initButtons() 290void Zaurus::initButtons()
289{ 291{
290 if ( d->m_buttons ) 292 if ( d->m_buttons )
291 return; 293 return;
292 294
293 d->m_buttons = new QValueList <ODeviceButton>; 295 d->m_buttons = new QValueList <ODeviceButton>;
294 296
295 struct z_button * pz_buttons; 297 struct z_button * pz_buttons;
296 int buttoncount; 298 int buttoncount;
297 switch ( d->m_model ) 299 switch ( d->m_model )
298 { 300 {
299 case Model_Zaurus_SL6000: 301 case Model_Zaurus_SL6000:
300 pz_buttons = z_buttons_6000; 302 pz_buttons = z_buttons_6000;
301 buttoncount = ARRAY_SIZE(z_buttons_6000); 303 buttoncount = ARRAY_SIZE(z_buttons_6000);
302 break; 304 break;
303 case Model_Zaurus_SLC3100: // fallthrough 305 case Model_Zaurus_SLC3100: // fallthrough
304 case Model_Zaurus_SLC3000: // fallthrough 306 case Model_Zaurus_SLC3000: // fallthrough
305 case Model_Zaurus_SLC1000: // fallthrough 307 case Model_Zaurus_SLC1000: // fallthrough
306 case Model_Zaurus_SLC7x0: 308 case Model_Zaurus_SLC7x0:
307 if ( isQWS( ) ) { 309 if ( isQWS( ) )
308 addPreHandler(this); // hinge-sensor-handler 310 { // setup hinge sensor stuff
311 addPreHandler(this);
312 initHingeSensor();
309 } 313 }
310 pz_buttons = z_buttons_c700; 314 pz_buttons = z_buttons_c700;
311 buttoncount = ARRAY_SIZE(z_buttons_c700); 315 buttoncount = ARRAY_SIZE(z_buttons_c700);
312 break; 316 break;
313 default: 317 default:
314 pz_buttons = z_buttons; 318 pz_buttons = z_buttons;
315 buttoncount = ARRAY_SIZE(z_buttons); 319 buttoncount = ARRAY_SIZE(z_buttons);
316 break; 320 break;
317 } 321 }
318 322
319 for ( int i = 0; i < buttoncount; i++ ) { 323 for ( int i = 0; i < buttoncount; i++ ) {
320 struct z_button *zb = pz_buttons + i; 324 struct z_button *zb = pz_buttons + i;
321 ODeviceButton b; 325 ODeviceButton b;
322 326
323 b.setKeycode( zb->code ); 327 b.setKeycode( zb->code );
324 b.setUserText( QObject::tr( "Button", zb->utext )); 328 b.setUserText( QObject::tr( "Button", zb->utext ));
325 b.setPixmap( OResource::loadPixmap( zb->pix )); 329 b.setPixmap( OResource::loadPixmap( zb->pix ));
326 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); 330 b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction ));
327 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); 331 b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction ));
328 d->m_buttons->append( b ); 332 d->m_buttons->append( b );
329 } 333 }
330 334
331 reloadButtonMapping(); 335 reloadButtonMapping();
332} 336}
@@ -641,55 +645,108 @@ OHingeStatus Zaurus::readHingeSensor() const
641 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 645 int handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
642 if (handle == -1) 646 if (handle == -1)
643 { 647 {
644 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror 648 qWarning("Zaurus::readHingeSensor() - failed (%s)", "unknown reason" ); //FIXME: use strerror
645 return CASE_UNKNOWN; 649 return CASE_UNKNOWN;
646 } 650 }
647 else 651 else
648 { 652 {
649 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 653 int retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
650 ::close (handle); 654 ::close (handle);
651 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE ) 655 if ( retval == CASE_CLOSED || retval == CASE_PORTRAIT || retval == CASE_LANDSCAPE )
652 { 656 {
653 qDebug( "Zaurus::readHingeSensor() - result = %d", retval ); 657 qDebug( "Zaurus::readHingeSensor() - result = %d", retval );
654 return static_cast<OHingeStatus>( retval ); 658 return static_cast<OHingeStatus>( retval );
655 } 659 }
656 else 660 else
657 { 661 {
658 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 662 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" );
659 return CASE_UNKNOWN; 663 return CASE_UNKNOWN;
660 } 664 }
661 } 665 }
662 } 666 }
663 else 667 else
664 { 668 {
665 // corgi keyboard is event source 0 in OZ kernel 2.6 669 /*
670 * The corgi keyboard is event source 0 in OZ kernel 2.6.
671 * Hinge status is reported via Input System Switchs 0 and 1 like that:
672 *
673 * -------------------------
674 * | SW0 | SW1 | CASE |
675 * |-----|-----|-----------|
676 * | 0 0 Landscape |
677 * | 0 1 Portrait |
678 * | 1 0 Unknown |
679 * | 1 1 Closed |
680 * -------------------------
681 */
666 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); 682 OInputDevice* keyboard = OInputSystem::instance()->device( "event0" );
667 if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; 683 bool switch0 = true;
668 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; 684 bool switch1 = false;
669 else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; 685 if ( keyboard )
670 qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); 686 {
671 return CASE_UNKNOWN; 687 switch0 = keyboard->isHeld( OInputDevice::Switch0 );
688 switch1 = keyboard->isHeld( OInputDevice::Switch1 );
689 }
690 if ( switch0 )
691 {
692 return switch1 ? CASE_CLOSED : CASE_UNKNOWN;
693 }
694 else
695 {
696 return switch1 ? CASE_PORTRAIT : CASE_LANDSCAPE;
697 }
698 }
699}
700
701void Zaurus::initHingeSensor()
702{
703 if ( m_embedix ) return;
704
705 m_hinge.setName( "/dev/input/event0" );
706 if ( !m_hinge.open( IO_ReadOnly ) )
707 {
708 qDebug( "Zaurus::init() - Couldn't open /dev/input/event0 for read (%s)", strerror( errno ) );
709 return;
710 }
711
712 QSocketNotifier* sn = new QSocketNotifier( m_hinge.handle(), QSocketNotifier::Read, this );
713 QObject::connect( sn, SIGNAL(activated(int)), this, SLOT(hingeSensorTriggered()) );
714}
715
716void Zaurus::hingeSensorTriggered()
717{
718 qDebug( "Zaurus::hingeSensorTriggered() - got event" );
719 struct input_event e;
720 if ( ::read( m_hinge.handle(), &e, sizeof e ) > 0 )
721 {
722 qDebug( "Zaurus::hingeSensorTriggered() - event has type %d, code %d, value %d", e.type, e.code, e.value );
723 if ( e.type != EV_SW ) return;
724 if ( readHingeSensor() != CASE_UNKNOWN )
725 {
726 qDebug( "Zaurus::hingeSensorTriggered() - got valid switch event, calling rotateDefault()" );
727 QCopChannel::send( "QPE/Rotation", "rotateDefault()" );
728 }
672 } 729 }
673} 730}
674 731
675/* 732/*
676 * Take code from iPAQ device. 733 * Take code from iPAQ device.
677 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction. 734 * That way we switch the cursor directions depending on status of hinge sensor, eg. hardware direction.
678 * I hope that is ok - Alwin 735 * I hope that is ok - Alwin
679 */ 736 */
680bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 737bool Zaurus::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
681{ 738{
682 int newkeycode = keycode; 739 int newkeycode = keycode;
683 740
684 if ( !hasHingeSensor() ) return false; 741 if ( !hasHingeSensor() ) return false;
685 742
686 /* map cursor keys depending on the hinge status */ 743 /* map cursor keys depending on the hinge status */
687 switch ( keycode ) { 744 switch ( keycode ) {
688 // Rotate cursor keys 745 // Rotate cursor keys
689 case Key_Left : 746 case Key_Left :
690 case Key_Right: 747 case Key_Right:
691 case Key_Up : 748 case Key_Up :
692 case Key_Down : 749 case Key_Down :
693 { 750 {
694 if (rotation()==Rot90) { 751 if (rotation()==Rot90) {
695 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; 752 newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index 677e29f..bf30bc6 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -12,48 +12,49 @@
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
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_ZAURUS 30#ifndef ODEVICE_ZAURUS
31#define ODEVICE_ZAURUS 31#define ODEVICE_ZAURUS
32 32
33#include "odevice_abstractmobiledevice.h" 33#include "odevice_abstractmobiledevice.h"
34 34
35/* QT */ 35/* QT */
36#include <qfile.h>
36#include <qwindowsystem_qws.h> 37#include <qwindowsystem_qws.h>
37 38
38#ifndef ARRAY_SIZE 39#ifndef ARRAY_SIZE
39#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 40#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
40#endif 41#endif
41 42
42// _IO and friends are only defined in kernel headers ... 43// _IO and friends are only defined in kernel headers ...
43#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 44#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
44#define OD_IO(type,number) OD_IOC(0,type,number,0) 45#define OD_IO(type,number) OD_IOC(0,type,number,0)
45#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 46#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
46#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 47#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
47#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 48#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
48 49
49// Audio 50// Audio
50#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 51#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
51 52
52#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 53#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
53#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 54#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
54 55
55#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 56#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
56#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 57#define SHARP_BUZ_KEYSOUND 2 /* key sound */
57#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 58#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
58 59
59#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 60#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
@@ -78,68 +79,73 @@
78#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 79#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
79#define APM_EVT_POWER_BUTTON (1 << 0) 80#define APM_EVT_POWER_BUTTON (1 << 0)
80 81
81// Brightness Embedix 82// Brightness Embedix
82#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl" 83#define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl"
83#define SHARP_FL_IOCTL_ON 1 84#define SHARP_FL_IOCTL_ON 1
84#define SHARP_FL_IOCTL_OFF 2 85#define SHARP_FL_IOCTL_OFF 2
85#define SHARP_FL_IOCTL_STEP_CONTRAST 100 86#define SHARP_FL_IOCTL_STEP_CONTRAST 100
86#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101 87#define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
87#define SHARP_FL_IOCTL_GET_STEP 102 88#define SHARP_FL_IOCTL_GET_STEP 102
88 89
89// Vesa Standard 90// Vesa Standard
90#define FB_BLANK_UNBLANK 0 91#define FB_BLANK_UNBLANK 0
91#define FB_BLANK_POWERDOWN 4 92#define FB_BLANK_POWERDOWN 4
92 93
93namespace Opie { 94namespace Opie {
94namespace Core { 95namespace Core {
95namespace Internal { 96namespace Internal {
96 97
97class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter 98class Zaurus : public OAbstractMobileDevice, public QWSServer::KeyboardFilter
98{ 99{
99 protected: 100 protected:
100 virtual void init(const QString&); 101 virtual void init(const QString&);
101 virtual void initButtons(); 102 virtual void initButtons();
103 void initHingeSensor();
104
105 protected slots:
106 void hingeSensorTriggered();
102 107
103 public: 108 public:
104 virtual bool setDisplayBrightness( int b ); 109 virtual bool setDisplayBrightness( int b );
105 virtual bool setDisplayStatus( bool on ); 110 virtual bool setDisplayStatus( bool on );
106 virtual int displayBrightnessResolution() const; 111 virtual int displayBrightnessResolution() const;
107 112
108 virtual void playAlarmSound(); 113 virtual void playAlarmSound();
109 virtual void playKeySound(); 114 virtual void playKeySound();
110 virtual void playTouchSound(); 115 virtual void playTouchSound();
111 116
112 virtual QValueList <OLed> ledList() const; 117 virtual QValueList <OLed> ledList() const;
113 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 118 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
114 virtual OLedState ledState( OLed led ) const; 119 virtual OLedState ledState( OLed led ) const;
115 virtual bool setLedState( OLed led, OLedState st ); 120 virtual bool setLedState( OLed led, OLedState st );
116 121
117 virtual bool hasHingeSensor() const; 122 virtual bool hasHingeSensor() const;
118 virtual OHingeStatus readHingeSensor() const; 123 virtual OHingeStatus readHingeSensor() const;
119 124
120 virtual Transformation rotation() const; 125 virtual Transformation rotation() const;
121 virtual ODirection direction() const; 126 virtual ODirection direction() const;
122 virtual bool suspend(); 127 virtual bool suspend();
123 128
124 protected: 129 protected:
125 virtual void buzzer( int snd ); 130 virtual void buzzer( int snd );
126 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 131 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
127 132
128 QString m_backlightdev; 133 QString m_backlightdev;
129 OLedState m_leds[1]; 134 OLedState m_leds[1];
130 bool m_embedix; 135 bool m_embedix;
136 QFile m_hinge;
131}; 137};
132 138
133struct z_button { 139struct z_button {
134 Qt::Key code; 140 Qt::Key code;
135 char *utext; 141 char *utext;
136 char *pix; 142 char *pix;
137 char *fpressedservice; 143 char *fpressedservice;
138 char *fpressedaction; 144 char *fpressedaction;
139 char *fheldservice; 145 char *fheldservice;
140 char *fheldaction; 146 char *fheldaction;
141}; 147};
142} 148}
143} 149}
144} 150}
145#endif 151#endif
diff --git a/libopie2/opiecore/linux/oinputsystem.cpp b/libopie2/opiecore/linux/oinputsystem.cpp
index bad27ed..ebc417f 100644
--- a/libopie2/opiecore/linux/oinputsystem.cpp
+++ b/libopie2/opiecore/linux/oinputsystem.cpp
@@ -167,56 +167,94 @@ bool OInputDevice::hasFeature( Feature bit ) const
167 perror( "EVIOCGBIT" ); 167 perror( "EVIOCGBIT" );
168 return false; 168 return false;
169 } 169 }
170 else 170 else
171 return BIT_TEST( features, bit ); 171 return BIT_TEST( features, bit );
172} 172}
173 173
174 174
175bool OInputDevice::isHeld( Key bit ) const 175bool OInputDevice::isHeld( Key bit ) const
176{ 176{
177 BIT_MASK( keys, KEY_MAX ); 177 BIT_MASK( keys, KEY_MAX );
178 178
179 if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) 179 if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 )
180 { 180 {
181 perror( "EVIOCGKEY" ); 181 perror( "EVIOCGKEY" );
182 return false; 182 return false;
183 } 183 }
184 else 184 else
185 { 185 {
186 return BIT_TEST( keys, bit ); 186 return BIT_TEST( keys, bit );
187 } 187 }
188} 188}
189 189
190 190
191bool OInputDevice::isHeld( Switch bit ) const
192{
193 BIT_MASK( switches, SW_MAX );
194
195 if( ioctl( _fd, EVIOCGSW( sizeof(switches) ), switches ) < 0 )
196 {
197 perror( "EVIOCGSW" );
198 return false;
199 }
200 else
201 {
202 return BIT_TEST( switches, bit );
203 }
204}
205
206
191QString OInputDevice::globalKeyMask() const 207QString OInputDevice::globalKeyMask() const
192{ 208{
193 BIT_MASK( keys, KEY_MAX ); 209 BIT_MASK( keys, KEY_MAX );
194 210
195 if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) 211 if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 )
196 { 212 {
197 perror( "EVIOCGKEY" ); 213 perror( "EVIOCGKEY" );
198 return QString::null; 214 return QString::null;
199 } 215 }
200 else 216 else
201 { 217 {
202 QString keymask; 218 QString keymask;
203 for ( int i = 0; i < KEY_MAX; ++i ) 219 for ( int i = 0; i < KEY_MAX; ++i )
204 { 220 {
205 if ( BIT_TEST( keys, i ) ) keymask.append( QString().sprintf( "%0d, ", i ) ); 221 if ( BIT_TEST( keys, i ) ) keymask.append( QString().sprintf( "%0d, ", i ) );
206 } 222 }
207 return keymask; 223 return keymask;
208 224
209 } 225 }
210} 226}
211 227
212 228
229QString OInputDevice::globalSwitchMask() const
230{
231 BIT_MASK( switches, SW_MAX );
232
233 if( ioctl( _fd, EVIOCGSW( sizeof(switches) ), switches ) < 0 )
234 {
235 perror( "EVIOCGSW" );
236 return QString::null;
237 }
238 else
239 {
240 QString switchmask;
241 for ( int i = 0; i < SW_MAX; ++i )
242 {
243 if ( BIT_TEST( switches, i ) ) switchmask.append( QString().sprintf( "%0d, ", i ) );
244 }
245 return switchmask;
246
247 }
248}
249
250
213bool OInputDevice::isValid( const QString& path ) 251bool OInputDevice::isValid( const QString& path )
214{ 252{
215 char buf[BUFSIZE] = "<unknown>"; 253 char buf[BUFSIZE] = "<unknown>";
216 int fd = ::open( (const char*) path, O_RDONLY ); 254 int fd = ::open( (const char*) path, O_RDONLY );
217 if ( fd < 0 ) return false; 255 if ( fd < 0 ) return false;
218 int res = ::ioctl( fd, EVIOCGNAME(sizeof buf), buf ); 256 int res = ::ioctl( fd, EVIOCGNAME(sizeof buf), buf );
219 ::close( fd ); 257 ::close( fd );
220 return res >= 0; 258 return res >= 0;
221} 259}
222 260
diff --git a/libopie2/opiecore/linux/oinputsystem.h b/libopie2/opiecore/linux/oinputsystem.h
index 9676e73..fb5f498 100644
--- a/libopie2/opiecore/linux/oinputsystem.h
+++ b/libopie2/opiecore/linux/oinputsystem.h
@@ -73,70 +73,79 @@ class OInputSystem : public QObject
73 /** 73 /**
74 * @internal Rebuild the internal interface database 74 * @internal Rebuild the internal interface database
75 * @note Sometimes it might be useful to call this from client code, 75 * @note Sometimes it might be useful to call this from client code,
76 */ 76 */
77 void synchronize(); 77 void synchronize();
78 /** 78 /**
79 * @internal destructor 79 * @internal destructor
80 */ 80 */
81 ~OInputSystem(); 81 ~OInputSystem();
82 82
83 protected: 83 protected:
84 OInputSystem(); 84 OInputSystem();
85 85
86 static OInputSystem* _instance; 86 static OInputSystem* _instance;
87 DeviceMap _devices; 87 DeviceMap _devices;
88}; 88};
89 89
90 90
91class OInputDevice : public QObject 91class OInputDevice : public QObject
92{ 92{
93 public: 93 public:
94 OInputDevice( QObject* parent, const char* name = 0 ); 94 OInputDevice( QObject* parent, const char* name = 0 );
95 ~OInputDevice(); 95 ~OInputDevice();
96 96
97 #include "oinputsystemenums.h" 97 #include <opie2/oinputsystemenums.h>
98 98
99 public: 99 public:
100 /** 100 /**
101 * @returns the identity string of this input device 101 * @returns the identity string of this input device
102 */ 102 */
103 QString identity() const; 103 QString identity() const;
104 /** 104 /**
105 * @returns the path of this input device 105 * @returns the path of this input device
106 */ 106 */
107 QString path() const; 107 QString path() const;
108 /** 108 /**
109 * @returns a unique identifier for this input device 109 * @returns a unique identifier for this input device
110 * @note Only a few devices support this 110 * @note Only a few devices support this
111 */ 111 */
112 QString uniq() const; 112 QString uniq() const;
113 /** 113 /**
114 * @returns whether a certain @a Feature is being supported by this device 114 * @returns whether a certain @a Feature is being supported by this device
115 */ 115 */
116 bool hasFeature( Feature ) const; 116 bool hasFeature( Feature ) const;
117 /** 117 /**
118 * @returns whether a given @a Key or Button is being held at the moment 118 * @returns whether a given @a Key or Button is being held at the moment
119 */ 119 */
120 bool isHeld( Key ) const; 120 bool isHeld( Key ) const;
121 /** 121 /**
122 * @returns whether a given @a Switch is being held at the moment
123 */
124 bool isHeld( Switch ) const;
125 /**
122 * @internal 126 * @internal
123 * @returns a string containing a printable form of the global keymask 127 * @returns a string containing a printable form of the global keymask
124 */ 128 */
129 QString globalSwitchMask() const;
130 /**
131 * @internal
132 * @returns a string containing a printable form of the global switchmask
133 */
125 QString globalKeyMask() const; 134 QString globalKeyMask() const;
126 /** 135 /**
127 * @internal 136 * @internal
128 * @returns whether a certain @a path corresponds to an input device 137 * @returns whether a certain @a path corresponds to an input device
129 */ 138 */
130 static bool isValid( const QString& path ); 139 static bool isValid( const QString& path );
131 140
132 private: 141 private:
133 int _fd; 142 int _fd;
134 input_id _id; 143 input_id _id;
135 144
136}; 145};
137 146
138} 147}
139} 148}
140 149
141#endif // OINPUTSYSTEM_H 150#endif // OINPUTSYSTEM_H
142 151
diff --git a/libopie2/opiecore/linux/oinputsystemenums.h b/libopie2/opiecore/linux/oinputsystemenums.h
deleted file mode 100644
index 3461e5a..0000000
--- a/libopie2/opiecore/linux/oinputsystemenums.h
+++ b/dev/null
@@ -1,405 +0,0 @@
1
2 enum Feature
3 {
4 Synchronous = EV_SYN,
5 Keys = EV_KEY,
6 Relative = EV_REL,
7 Absolute = EV_ABS,
8 Miscellaneous = EV_MSC,
9 Leds = EV_LED,
10 Sound = EV_SND,
11 AutoRepeat = EV_REP,
12 ForceFeedback = EV_FF,
13 PowerManagement = EV_PWR,
14 ForceFeedbackStatus = EV_FF_STATUS,
15 };
16
17 enum Bus
18 {
19 PCI = BUS_PCI,
20 ISAPNP = BUS_ISAPNP,
21 HIL = BUS_HIL,
22 BLUETOOTH = BUS_BLUETOOTH,
23 ISA = BUS_ISA,
24 I8042 = BUS_I8042,
25 XTKBD = BUS_XTKBD,
26 RS232 = BUS_RS232,
27 GAMEPORT = BUS_GAMEPORT,
28 PARPORT = BUS_PARPORT,
29 AMIGA = BUS_AMIGA,
30 ADB = BUS_ADB,
31 I2C = BUS_I2C,
32 HOST = BUS_HOST,
33 };
34
35 enum Key
36 {
37 Key_RESERVED = 0,
38 Key_ESC = 1,
39 Key_1 = 2,
40 Key_2 = 3,
41 Key_3 = 4,
42 Key_4 = 5,
43 Key_5 = 6,
44 Key_6 = 7,
45 Key_7 = 8,
46 Key_8 = 9,
47 Key_9 = 10,
48 Key_0 = 11,
49 Key_MINUS = 12,
50 Key_EQUAL = 13,
51 Key_BACKSPACE = 14,
52 Key_TAB = 15,
53 Key_Q = 16,
54 Key_W = 17,
55 Key_E = 18,
56 Key_R = 19,
57 Key_T = 20,
58 Key_Y = 21,
59 Key_U = 22,
60 Key_I = 23,
61 Key_O = 24,
62 Key_P = 25,
63 Key_LEFTBRACE = 26,
64 Key_RIGHTBRACE = 27,
65 Key_ENTER = 28,
66 Key_LEFTCTRL = 29,
67 Key_A = 30,
68 Key_S = 31,
69 Key_D = 32,
70 Key_F = 33,
71 Key_G = 34,
72 Key_H = 35,
73 Key_J = 36,
74 Key_K = 37,
75 Key_L = 38,
76 Key_SEMICOLON = 39,
77 Key_APOSTROPHE = 40,
78 Key_GRAVE = 41,
79 Key_LEFTSHIFT = 42,
80 Key_BACKSLASH = 43,
81 Key_Z = 44,
82 Key_X = 45,
83 Key_C = 46,
84 Key_V = 47,
85 Key_B = 48,
86 Key_N = 49,
87 Key_M = 50,
88 Key_COMMA = 51,
89 Key_DOT = 52,
90 Key_SLASH = 53,
91 Key_RIGHTSHIFT = 54,
92 Key_KPASTERISK = 55,
93 Key_LEFTALT = 56,
94 Key_SPACE = 57,
95 Key_CAPSLOCK = 58,
96 Key_F1 = 59,
97 Key_F2 = 60,
98 Key_F3 = 61,
99 Key_F4 = 62,
100 Key_F5 = 63,
101 Key_F6 = 64,
102 Key_F7 = 65,
103 Key_F8 = 66,
104 Key_F9 = 67,
105 Key_F10 = 68,
106 Key_NUMLOCK = 69,
107 Key_SCROLLLOCK = 70,
108 Key_KP7 = 71,
109 Key_KP8 = 72,
110 Key_KP9 = 73,
111 Key_KPMINUS = 74,
112 Key_KP4 = 75,
113 Key_KP5 = 76,
114 Key_KP6 = 77,
115 Key_KPPLUS = 78,
116 Key_KP1 = 79,
117 Key_KP2 = 80,
118 Key_KP3 = 81,
119 Key_KP0 = 82,
120 Key_KPDOT = 83,
121
122 Key_ZENKAKUHANKAKU= 85,
123 Key_102ND = 86,
124 Key_F11 = 87,
125 Key_F12 = 88,
126 Key_RO = 89,
127 Key_KATAKANA = 90,
128 Key_HIRAGANA = 91,
129 Key_HENKAN = 92,
130 Key_KATAKANAHIRAGANA= 93,
131 Key_MUHENKAN = 94,
132 Key_KPJPCOMMA = 95,
133 Key_KPENTER = 96,
134 Key_RIGHTCTRL = 97,
135 Key_KPSLASH = 98,
136 Key_SYSRQ = 99,
137 Key_RIGHTALT = 100,
138 Key_LINEFEED = 101,
139 Key_HOME = 102,
140 Key_UP = 103,
141 Key_PAGEUP = 104,
142 Key_LEFT = 105,
143 Key_RIGHT = 106,
144 Key_END = 107,
145 Key_DOWN = 108,
146 Key_PAGEDOWN = 109,
147 Key_INSERT = 110,
148 Key_DELETE = 111,
149 Key_MACRO = 112,
150 Key_MUTE = 113,
151 Key_VOLUMEDOWN = 114,
152 Key_VOLUMEUP = 115,
153 Key_POWER = 116,
154 Key_KPEQUAL = 117,
155 Key_KPPLUSMINUS = 118,
156 Key_PAUSE = 119,
157
158 Key_KPCOMMA = 121,
159 Key_HANGUEL = 122,
160 Key_HANJA = 123,
161 Key_YEN = 124,
162 Key_LEFTMETA = 125,
163 Key_RIGHTMETA = 126,
164 Key_COMPOSE = 127,
165
166 Key_STOP = 128,
167 Key_AGAIN = 129,
168 Key_PROPS = 130,
169 Key_UNDO = 131,
170 Key_FRONT = 132,
171 Key_COPY = 133,
172 Key_OPEN = 134,
173 Key_PASTE = 135,
174 Key_FIND = 136,
175 Key_CUT = 137,
176 Key_HELP = 138,
177 Key_MENU = 139,
178 Key_CALC = 140,
179 Key_SETUP = 141,
180 Key_SLEEP = 142,
181 Key_WAKEUP = 143,
182 Key_FILE = 144,
183 Key_SENDFILE = 145,
184 Key_DELETEFILE = 146,
185 Key_XFER = 147,
186 Key_PROG1 = 148,
187 Key_PROG2 = 149,
188 Key_WWW = 150,
189 Key_MSDOS = 151,
190 Key_COFFEE = 152,
191 Key_DIRECTION = 153,
192 Key_CYCLEWINDOWS= 154,
193 Key_MAIL = 155,
194 Key_BOOKMARKS = 156,
195 Key_COMPUTER = 157,
196 Key_BACK = 158,
197 Key_FORWARD = 159,
198 Key_CLOSECD = 160,
199 Key_EJECTCD = 161,
200 Key_EJECTCLOSECD= 162,
201 Key_NEXTSONG = 163,
202 Key_PLAYPAUSE = 164,
203 Key_PREVIOUSSONG= 165,
204 Key_STOPCD = 166,
205 Key_RECORD = 167,
206 Key_REWIND = 168,
207 Key_PHONE = 169,
208 Key_ISO = 170,
209 Key_CONFIG = 171,
210 Key_HOMEPAGE = 172,
211 Key_REFRESH = 173,
212 Key_EXIT = 174,
213 Key_MOVE = 175,
214 Key_EDIT = 176,
215 Key_SCROLLUP = 177,
216 Key_SCROLLDOWN = 178,
217 Key_KPLEFTPAREN = 179,
218 Key_KPRIGHTPAREN= 180,
219
220 Key_F13 = 183,
221 Key_F14 = 184,
222 Key_F15 = 185,
223 Key_F16 = 186,
224 Key_F17 = 187,
225 Key_F18 = 188,
226 Key_F19 = 189,
227 Key_F20 = 190,
228 Key_F21 = 191,
229 Key_F22 = 192,
230 Key_F23 = 193,
231 Key_F24 = 194,
232
233 Key_PLAYCD = 200,
234 Key_PAUSECD = 201,
235 Key_PROG3 = 202,
236 Key_PROG4 = 203,
237 Key_SUSPEND = 205,
238 Key_CLOSE = 206,
239 Key_PLAY = 207,
240 Key_FASTFORWARD = 208,
241 Key_BASSBOOST = 209,
242 Key_PRINT = 210,
243 Key_HP = 211,
244 Key_CAMERA = 212,
245 Key_SOUND = 213,
246 Key_QUESTION = 214,
247 Key_EMAIL = 215,
248 Key_CHAT = 216,
249 Key_SEARCH = 217,
250 Key_CONNECT = 218,
251 Key_FINANCE = 219,
252 Key_SPORT = 220,
253 Key_SHOP = 221,
254 Key_ALTERASE = 222,
255 Key_CANCEL = 223,
256 Key_BRIGHTNESSDOWN= 224,
257 Key_BRIGHTNESSUP= 225,
258 Key_MEDIA = 226,
259
260 Key_UNKNOWN = 240,
261
262 Button_MISC = 0x100,
263 Button_0 = 0x100,
264 Button_1 = 0x101,
265 Button_2 = 0x102,
266 Button_3 = 0x103,
267 Button_4 = 0x104,
268 Button_5 = 0x105,
269 Button_6 = 0x106,
270 Button_7 = 0x107,
271 Button_8 = 0x108,
272 Button_9 = 0x109,
273
274 Button_MOUSE = 0x110,
275 Button_LEFT = 0x110,
276 Button_RIGHT = 0x111,
277 Button_MIDDLE = 0x112,
278 Button_SIDE = 0x113,
279 Button_EXTRA = 0x114,
280 Button_FORWARD = 0x115,
281 Button_BACK = 0x116,
282 Button_TASK = 0x117,
283
284 Button_JOYSTICK = 0x120,
285 Button_TRIGGER = 0x120,
286 Button_THUMB = 0x121,
287 Button_THUMB2 = 0x122,
288 Button_TOP = 0x123,
289 Button_TOP2 = 0x124,
290 Button_PINKIE = 0x125,
291 Button_BASE = 0x126,
292 Button_BASE2 = 0x127,
293 Button_BASE3 = 0x128,
294 Button_BASE4 = 0x129,
295 Button_BASE5 = 0x12a,
296 Button_BASE6 = 0x12b,
297 Button_DEAD = 0x12f,
298
299 Button_GAMEPAD = 0x130,
300 Button_A = 0x130,
301 Button_B = 0x131,
302 Button_C = 0x132,
303 Button_X = 0x133,
304 Button_Y = 0x134,
305 Button_Z = 0x135,
306 Button_TL = 0x136,
307 Button_TR = 0x137,
308 Button_TL2 = 0x138,
309 Button_TR2 = 0x139,
310 Button_SELECT = 0x13a,
311 Button_START = 0x13b,
312 Button_MODE = 0x13c,
313 Button_THUMBL = 0x13d,
314 Button_THUMBR = 0x13e,
315
316 Button_DIGI = 0x140,
317 Button_TOOL_PEN = 0x140,
318 Button_TOOL_RUBBER = 0x141,
319 Button_TOOL_BRUSH = 0x142,
320 Button_TOOL_PENCIL = 0x143,
321 Button_TOOL_AIRBRUSH= 0x144,
322 Button_TOOL_FINGER = 0x145,
323 Button_TOOL_MOUSE = 0x146,
324 Button_TOOL_LENS = 0x147,
325 Button_TOUCH = 0x14a,
326 Button_STYLUS = 0x14b,
327 Button_STYLUS2 = 0x14c,
328 Button_TOOL_DOUBLETAP= 0x14d,
329 Button_TOOL_TRIPLETAP= 0x14e,
330
331 Button_WHEEL = 0x150,
332 Button_GEAR_DOWN = 0x150,
333 Button_GEAR_UP = 0x151,
334
335 Key_OK = 0x160,
336 Key_SELECT = 0x161,
337 Key_GOTO = 0x162,
338 Key_CLEAR = 0x163,
339 Key_POWER2 = 0x164,
340 Key_OPTION = 0x165,
341 Key_INFO = 0x166,
342 Key_TIME = 0x167,
343 Key_VENDOR = 0x168,
344 Key_ARCHIVE = 0x169,
345 Key_PROGRAM = 0x16a,
346 Key_CHANNEL = 0x16b,
347 Key_FAVORITES = 0x16c,
348 Key_EPG = 0x16d,
349 Key_PVR = 0x16e,
350 Key_MHP = 0x16f,
351 Key_LANGUAGE = 0x170,
352 Key_TITLE = 0x171,
353 Key_SUBTITLE = 0x172,
354 Key_ANGLE = 0x173,
355 Key_ZOOM = 0x174,
356 Key_MODE = 0x175,
357 Key_KEYBOARD = 0x176,
358 Key_SCREEN = 0x177,
359 Key_PC = 0x178,
360 Key_TV = 0x179,
361 Key_TV2 = 0x17a,
362 Key_VCR = 0x17b,
363 Key_VCR2 = 0x17c,
364 Key_SAT = 0x17d,
365 Key_SAT2 = 0x17e,
366 Key_CD = 0x17f,
367 Key_TAPE = 0x180,
368 Key_RADIO = 0x181,
369 Key_TUNER = 0x182,
370 Key_PLAYER = 0x183,
371 Key_TEXT = 0x184,
372 Key_DVD = 0x185,
373 Key_AUX = 0x186,
374 Key_MP3 = 0x187,
375 Key_AUDIO = 0x188,
376 Key_VIDEO = 0x189,
377 Key_DIRECTORY = 0x18a,
378 Key_LIST = 0x18b,
379 Key_MEMO = 0x18c,
380 Key_CALENDAR = 0x18d,
381 Key_RED = 0x18e,
382 Key_GREEN = 0x18f,
383 Key_YELLOW = 0x190,
384 Key_BLUE = 0x191,
385 Key_CHANNELUP = 0x192,
386 Key_CHANNELDOWN = 0x193,
387 Key_FIRST = 0x194,
388 Key_LAST = 0x195,
389 Key_AB = 0x196,
390 Key_NEXT = 0x197,
391 Key_RESTART = 0x198,
392 Key_SLOW = 0x199,
393 Key_SHUFFLE = 0x19a,
394 Key_BREAK = 0x19b,
395 Key_PREVIOUS = 0x19c,
396 Key_DIGITS = 0x19d,
397 Key_TEEN = 0x19e,
398 Key_TWEN = 0x19f,
399
400 Key_DEL_EOL = 0x1c0,
401 Key_DEL_EOS = 0x1c1,
402 Key_INS_LINE = 0x1c2,
403 Key_DEL_LINE = 0x1c3,
404 };
405
diff --git a/libopie2/opiecore/linux_input.h b/libopie2/opiecore/linux_input.h
index b7a30bb..2df8a59 100644
--- a/libopie2/opiecore/linux_input.h
+++ b/libopie2/opiecore/linux_input.h
@@ -45,68 +45,70 @@ struct input_id {
45 __u16 product; 45 __u16 product;
46 __u16 version; 46 __u16 version;
47}; 47};
48 48
49struct input_absinfo { 49struct input_absinfo {
50 __s32 value; 50 __s32 value;
51 __s32 minimum; 51 __s32 minimum;
52 __s32 maximum; 52 __s32 maximum;
53 __s32 fuzz; 53 __s32 fuzz;
54 __s32 flat; 54 __s32 flat;
55}; 55};
56 56
57 #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ 57 #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
58 #define EVIOCGID _IOR('E', 0x02, struct input_id)/* get device ID */ 58 #define EVIOCGID _IOR('E', 0x02, struct input_id)/* get device ID */
59 #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ 59 #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */
60 #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ 60 #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */
61 61
62 #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 62 #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
63 #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ 63 #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
64 #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 64 #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
65 65
66 #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */ 66 #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */
67 #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 67 #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
68 #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 68 #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
69 #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
69 70
70 #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len)/* get event bits */ 71 #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len)/* get event bits */
71 #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ 72 #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */
72 #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */ 73 #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */
73 74
74 #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))/* send a force effect to a force feedback device */ 75 #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))/* send a force effect to a force feedback device */
75 #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ 76 #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
76 #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ 77 #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
77 78
78 #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 79 #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
79 80
80/* 81/*
81 * Event types 82 * Event types
82 */ 83 */
83 84
84 #define EV_SYN 0x00 85 #define EV_SYN 0x00
85 #define EV_KEY 0x01 86 #define EV_KEY 0x01
86 #define EV_REL 0x02 87 #define EV_REL 0x02
87 #define EV_ABS 0x03 88 #define EV_ABS 0x03
88 #define EV_MSC 0x04 89 #define EV_MSC 0x04
90 #define EV_SW 0x05
89 #define EV_LED 0x11 91 #define EV_LED 0x11
90 #define EV_SND 0x12 92 #define EV_SND 0x12
91 #define EV_REP 0x14 93 #define EV_REP 0x14
92 #define EV_FF 0x15 94 #define EV_FF 0x15
93 #define EV_PWR 0x16 95 #define EV_PWR 0x16
94 #define EV_FF_STATUS 0x17 96 #define EV_FF_STATUS 0x17
95 #define EV_MAX 0x1f 97 #define EV_MAX 0x1f
96 98
97/* 99/*
98 * Synchronization events. 100 * Synchronization events.
99 */ 101 */
100 102
101 #define SYN_REPORT 0 103 #define SYN_REPORT 0
102 #define SYN_CONFIG 1 104 #define SYN_CONFIG 1
103 105
104/* 106/*
105 * Keys and buttons 107 * Keys and buttons
106 */ 108 */
107 109
108 #define KEY_RESERVED 0 110 #define KEY_RESERVED 0
109 #define KEY_ESC 1 111 #define KEY_ESC 1
110 #define KEY_1 2 112 #define KEY_1 2
111 #define KEY_2 3 113 #define KEY_2 3
112 #define KEY_3 4 114 #define KEY_3 4
@@ -500,48 +502,62 @@ struct input_absinfo {
500 #define ABS_RZ 0x05 502 #define ABS_RZ 0x05
501 #define ABS_THROTTLE 0x06 503 #define ABS_THROTTLE 0x06
502 #define ABS_RUDDER 0x07 504 #define ABS_RUDDER 0x07
503 #define ABS_WHEEL 0x08 505 #define ABS_WHEEL 0x08
504 #define ABS_GAS 0x09 506 #define ABS_GAS 0x09
505 #define ABS_BRAKE 0x0a 507 #define ABS_BRAKE 0x0a
506 #define ABS_HAT0X 0x10 508 #define ABS_HAT0X 0x10
507 #define ABS_HAT0Y 0x11 509 #define ABS_HAT0Y 0x11
508 #define ABS_HAT1X 0x12 510 #define ABS_HAT1X 0x12
509 #define ABS_HAT1Y 0x13 511 #define ABS_HAT1Y 0x13
510 #define ABS_HAT2X 0x14 512 #define ABS_HAT2X 0x14
511 #define ABS_HAT2Y 0x15 513 #define ABS_HAT2Y 0x15
512 #define ABS_HAT3X 0x16 514 #define ABS_HAT3X 0x16
513 #define ABS_HAT3Y 0x17 515 #define ABS_HAT3Y 0x17
514 #define ABS_PRESSURE 0x18 516 #define ABS_PRESSURE 0x18
515 #define ABS_DISTANCE 0x19 517 #define ABS_DISTANCE 0x19
516 #define ABS_TILT_X 0x1a 518 #define ABS_TILT_X 0x1a
517 #define ABS_TILT_Y 0x1b 519 #define ABS_TILT_Y 0x1b
518 #define ABS_TOOL_WIDTH 0x1c 520 #define ABS_TOOL_WIDTH 0x1c
519 #define ABS_VOLUME 0x20 521 #define ABS_VOLUME 0x20
520 #define ABS_MISC 0x28 522 #define ABS_MISC 0x28
521 #define ABS_MAX 0x3f 523 #define ABS_MAX 0x3f
522 524
523/* 525/*
526 * Switch events
527 */
528
529 #define SW_0 0x00
530 #define SW_1 0x01
531 #define SW_2 0x02
532 #define SW_3 0x03
533 #define SW_4 0x04
534 #define SW_5 0x05
535 #define SW_6 0x06
536 #define SW_7 0x07
537 #define SW_MAX 0x0f
538
539/*
524 * Misc events 540 * Misc events
525 */ 541 */
526 542
527 #define MSC_SERIAL 0x00 543 #define MSC_SERIAL 0x00
528 #define MSC_PULSELED 0x01 544 #define MSC_PULSELED 0x01
529 #define MSC_GESTURE 0x02 545 #define MSC_GESTURE 0x02
530 #define MSC_MAX 0x07 546 #define MSC_MAX 0x07
531 547
532/* 548/*
533 * LEDs 549 * LEDs
534 */ 550 */
535 551
536 #define LED_NUML 0x00 552 #define LED_NUML 0x00
537 #define LED_CAPSL 0x01 553 #define LED_CAPSL 0x01
538 #define LED_SCROLLL 0x02 554 #define LED_SCROLLL 0x02
539 #define LED_COMPOSE 0x03 555 #define LED_COMPOSE 0x03
540 #define LED_KANA 0x04 556 #define LED_KANA 0x04
541 #define LED_SLEEP 0x05 557 #define LED_SLEEP 0x05
542 #define LED_SUSPEND 0x06 558 #define LED_SUSPEND 0x06
543 #define LED_MUTE 0x07 559 #define LED_MUTE 0x07
544 #define LED_MISC 0x08 560 #define LED_MISC 0x08
545 #define LED_MAX 0x0f 561 #define LED_MAX 0x0f
546 562
547/* 563/*
@@ -769,127 +785,131 @@ struct ff_effect {
769 __old = k[scancode]; \ 785 __old = k[scancode]; \
770 k[scancode] = val; \ 786 k[scancode] = val; \
771 break; \ 787 break; \
772 } \ 788 } \
773 } \ 789 } \
774 __old; }) 790 __old; })
775 791
776struct input_dev { 792struct input_dev {
777 793
778 void *private; 794 void *private;
779 795
780 char *name; 796 char *name;
781 char *phys; 797 char *phys;
782 char *uniq; 798 char *uniq;
783 struct input_id id; 799 struct input_id id;
784 800
785 unsigned long evbit[NBITS(EV_MAX)]; 801 unsigned long evbit[NBITS(EV_MAX)];
786 unsigned long keybit[NBITS(KEY_MAX)]; 802 unsigned long keybit[NBITS(KEY_MAX)];
787 unsigned long relbit[NBITS(REL_MAX)]; 803 unsigned long relbit[NBITS(REL_MAX)];
788 unsigned long absbit[NBITS(ABS_MAX)]; 804 unsigned long absbit[NBITS(ABS_MAX)];
789 unsigned long mscbit[NBITS(MSC_MAX)]; 805 unsigned long mscbit[NBITS(MSC_MAX)];
790 unsigned long ledbit[NBITS(LED_MAX)]; 806 unsigned long ledbit[NBITS(LED_MAX)];
791 unsigned long sndbit[NBITS(SND_MAX)]; 807 unsigned long sndbit[NBITS(SND_MAX)];
792 unsigned long ffbit[NBITS(FF_MAX)]; 808 unsigned long ffbit[NBITS(FF_MAX)];
809 unsigned long swbit[NBITS(SW_MAX)];
793 int ff_effects_max; 810 int ff_effects_max;
794 811
795 unsigned int keycodemax; 812 unsigned int keycodemax;
796 unsigned int keycodesize; 813 unsigned int keycodesize;
797 void *keycode; 814 void *keycode;
798 815
799 unsigned int repeat_key; 816 unsigned int repeat_key;
800 struct timer_list timer; 817 struct timer_list timer;
801 818
802 struct pm_dev *pm_dev; 819 struct pm_dev *pm_dev;
803 struct pt_regs *regs; 820 struct pt_regs *regs;
804 int state; 821 int state;
805 822
806 int sync; 823 int sync;
807 824
808 int abs[ABS_MAX + 1]; 825 int abs[ABS_MAX + 1];
809 int rep[REP_MAX + 1]; 826 int rep[REP_MAX + 1];
810 827
811 unsigned long key[NBITS(KEY_MAX)]; 828 unsigned long key[NBITS(KEY_MAX)];
812 unsigned long led[NBITS(LED_MAX)]; 829 unsigned long led[NBITS(LED_MAX)];
813 unsigned long snd[NBITS(SND_MAX)]; 830 unsigned long snd[NBITS(SND_MAX)];
831 unsigned long sw[NBITS(SW_MAX)];
814 832
815 int absmax[ABS_MAX + 1]; 833 int absmax[ABS_MAX + 1];
816 int absmin[ABS_MAX + 1]; 834 int absmin[ABS_MAX + 1];
817 int absfuzz[ABS_MAX + 1]; 835 int absfuzz[ABS_MAX + 1];
818 int absflat[ABS_MAX + 1]; 836 int absflat[ABS_MAX + 1];
819 837
820 int (*open)(struct input_dev *dev); 838 int (*open)(struct input_dev *dev);
821 void (*close)(struct input_dev *dev); 839 void (*close)(struct input_dev *dev);
822 int (*accept)(struct input_dev *dev, struct file *file); 840 int (*accept)(struct input_dev *dev, struct file *file);
823 int (*flush)(struct input_dev *dev, struct file *file); 841 int (*flush)(struct input_dev *dev, struct file *file);
824 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); 842 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
825 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect); 843 int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
826 int (*erase_effect)(struct input_dev *dev, int effect_id); 844 int (*erase_effect)(struct input_dev *dev, int effect_id);
827 845
828 struct input_handle *grab; 846 struct input_handle *grab;
829 struct device *dev; 847 struct device *dev;
830 848
831 struct list_headh_list; 849 struct list_headh_list;
832 struct list_headnode; 850 struct list_headnode;
833}; 851};
834 852
835/* 853/*
836 * Structure for hotplug & device<->driver matching. 854 * Structure for hotplug & device<->driver matching.
837 */ 855 */
838 856
839 #define INPUT_DEVICE_ID_MATCH_BUS1 857 #define INPUT_DEVICE_ID_MATCH_BUS1
840 #define INPUT_DEVICE_ID_MATCH_VENDOR2 858 #define INPUT_DEVICE_ID_MATCH_VENDOR2
841 #define INPUT_DEVICE_ID_MATCH_PRODUCT4 859 #define INPUT_DEVICE_ID_MATCH_PRODUCT4
842 #define INPUT_DEVICE_ID_MATCH_VERSION8 860 #define INPUT_DEVICE_ID_MATCH_VERSION8
843 861
844 #define INPUT_DEVICE_ID_MATCH_EVBIT0x010 862 #define INPUT_DEVICE_ID_MATCH_EVBIT0x010
845 #define INPUT_DEVICE_ID_MATCH_KEYBIT0x020 863 #define INPUT_DEVICE_ID_MATCH_KEYBIT0x020
846 #define INPUT_DEVICE_ID_MATCH_RELBIT0x040 864 #define INPUT_DEVICE_ID_MATCH_RELBIT0x040
847 #define INPUT_DEVICE_ID_MATCH_ABSBIT0x080 865 #define INPUT_DEVICE_ID_MATCH_ABSBIT0x080
848 #define INPUT_DEVICE_ID_MATCH_MSCIT0x100 866 #define INPUT_DEVICE_ID_MATCH_MSCIT0x100
849 #define INPUT_DEVICE_ID_MATCH_LEDBIT0x200 867 #define INPUT_DEVICE_ID_MATCH_LEDBIT0x200
850 #define INPUT_DEVICE_ID_MATCH_SNDBIT0x400 868 #define INPUT_DEVICE_ID_MATCH_SNDBIT0x400
851 #define INPUT_DEVICE_ID_MATCH_FFBIT0x800 869 #define INPUT_DEVICE_ID_MATCH_FFBIT0x800
870 #define INPUT_DEVICE_ID_MATCH_SWBIT0x1000
852 871
853#define INPUT_DEVICE_ID_MATCH_DEVICE\ 872#define INPUT_DEVICE_ID_MATCH_DEVICE\
854 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 873 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
855#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ 874#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
856 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) 875 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
857 876
858struct input_device_id { 877struct input_device_id {
859 878
860 unsigned long flags; 879 unsigned long flags;
861 880
862 struct input_id id; 881 struct input_id id;
863 882
864 unsigned long evbit[NBITS(EV_MAX)]; 883 unsigned long evbit[NBITS(EV_MAX)];
865 unsigned long keybit[NBITS(KEY_MAX)]; 884 unsigned long keybit[NBITS(KEY_MAX)];
866 unsigned long relbit[NBITS(REL_MAX)]; 885 unsigned long relbit[NBITS(REL_MAX)];
867 unsigned long absbit[NBITS(ABS_MAX)]; 886 unsigned long absbit[NBITS(ABS_MAX)];
868 unsigned long mscbit[NBITS(MSC_MAX)]; 887 unsigned long mscbit[NBITS(MSC_MAX)];
869 unsigned long ledbit[NBITS(LED_MAX)]; 888 unsigned long ledbit[NBITS(LED_MAX)];
870 unsigned long sndbit[NBITS(SND_MAX)]; 889 unsigned long sndbit[NBITS(SND_MAX)];
871 unsigned long ffbit[NBITS(FF_MAX)]; 890 unsigned long ffbit[NBITS(FF_MAX)];
891 unsigned long swbit[NBITS(SW_MAX)];
872 892
873 unsigned long driver_info; 893 unsigned long driver_info;
874}; 894};
875 895
876struct input_handle; 896struct input_handle;
877 897
878struct input_handler { 898struct input_handler {
879 899
880 void *private; 900 void *private;
881 901
882 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 902 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
883 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 903 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
884 void (*disconnect)(struct input_handle *handle); 904 void (*disconnect)(struct input_handle *handle);
885 905
886 struct file_operations *fops; 906 struct file_operations *fops;
887 int minor; 907 int minor;
888 char *name; 908 char *name;
889 909
890 struct input_device_id *id_table; 910 struct input_device_id *id_table;
891 struct input_device_id *blacklist; 911 struct input_device_id *blacklist;
892 912
893 struct list_headh_list; 913 struct list_headh_list;
894 struct list_headnode; 914 struct list_headnode;
895}; 915};
@@ -940,48 +960,53 @@ static inline void input_report_key(struct input_dev *dev, unsigned int code, in
940{ 960{
941 input_event(dev, EV_KEY, code, !!value); 961 input_event(dev, EV_KEY, code, !!value);
942} 962}
943 963
944static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value) 964static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value)
945{ 965{
946 input_event(dev, EV_REL, code, value); 966 input_event(dev, EV_REL, code, value);
947} 967}
948 968
949static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value) 969static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
950{ 970{
951 input_event(dev, EV_ABS, code, value); 971 input_event(dev, EV_ABS, code, value);
952} 972}
953 973
954static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value) 974static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value)
955{ 975{
956 input_event(dev, EV_FF, code, value); 976 input_event(dev, EV_FF, code, value);
957} 977}
958 978
959static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value) 979static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
960{ 980{
961 input_event(dev, EV_FF_STATUS, code, value); 981 input_event(dev, EV_FF_STATUS, code, value);
962} 982}
963 983
984static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value)
985{
986 input_event(dev, EV_SW, code, !!value);
987}
988
964static inline void input_regs(struct input_dev *dev, struct pt_regs *regs) 989static inline void input_regs(struct input_dev *dev, struct pt_regs *regs)
965{ 990{
966 dev->regs = regs; 991 dev->regs = regs;
967} 992}
968 993
969static inline void input_sync(struct input_dev *dev) 994static inline void input_sync(struct input_dev *dev)
970{ 995{
971 input_event(dev, EV_SYN, SYN_REPORT, 0); 996 input_event(dev, EV_SYN, SYN_REPORT, 0);
972 dev->regs = NULL; 997 dev->regs = NULL;
973} 998}
974 999
975static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1000static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
976{ 1001{
977 dev->absmin[axis] = min; 1002 dev->absmin[axis] = min;
978 dev->absmax[axis] = max; 1003 dev->absmax[axis] = max;
979 dev->absfuzz[axis] = fuzz; 1004 dev->absfuzz[axis] = fuzz;
980 dev->absflat[axis] = flat; 1005 dev->absflat[axis] = flat;
981 1006
982 dev->absbit[LONG(axis)] |= BIT(axis); 1007 dev->absbit[LONG(axis)] |= BIT(axis);
983} 1008}
984 1009
985extern struct class_simple *input_class; 1010extern struct class_simple *input_class;
986 1011
987#endif 1012#endif
diff --git a/libopie2/opiecore/oinputsystemenums.h b/libopie2/opiecore/oinputsystemenums.h
index 3461e5a..728423a 100644
--- a/libopie2/opiecore/oinputsystemenums.h
+++ b/libopie2/opiecore/oinputsystemenums.h
@@ -1,58 +1,71 @@
1 1
2 enum Feature 2 enum Feature
3 { 3 {
4 Synchronous = EV_SYN, 4 Synchronous = EV_SYN,
5 Keys = EV_KEY, 5 Keys = EV_KEY,
6 Relative = EV_REL, 6 Relative = EV_REL,
7 Absolute = EV_ABS, 7 Absolute = EV_ABS,
8 Miscellaneous = EV_MSC, 8 Miscellaneous = EV_MSC,
9 Switches = EV_SW,
9 Leds = EV_LED, 10 Leds = EV_LED,
10 Sound = EV_SND, 11 Sound = EV_SND,
11 AutoRepeat = EV_REP, 12 AutoRepeat = EV_REP,
12 ForceFeedback = EV_FF, 13 ForceFeedback = EV_FF,
13 PowerManagement = EV_PWR, 14 PowerManagement = EV_PWR,
14 ForceFeedbackStatus = EV_FF_STATUS, 15 ForceFeedbackStatus = EV_FF_STATUS,
15 }; 16 };
16 17
17 enum Bus 18 enum Bus
18 { 19 {
19 PCI = BUS_PCI, 20 PCI = BUS_PCI,
20 ISAPNP = BUS_ISAPNP, 21 ISAPNP = BUS_ISAPNP,
21 HIL = BUS_HIL, 22 HIL = BUS_HIL,
22 BLUETOOTH = BUS_BLUETOOTH, 23 BLUETOOTH = BUS_BLUETOOTH,
23 ISA = BUS_ISA, 24 ISA = BUS_ISA,
24 I8042 = BUS_I8042, 25 I8042 = BUS_I8042,
25 XTKBD = BUS_XTKBD, 26 XTKBD = BUS_XTKBD,
26 RS232 = BUS_RS232, 27 RS232 = BUS_RS232,
27 GAMEPORT = BUS_GAMEPORT, 28 GAMEPORT = BUS_GAMEPORT,
28 PARPORT = BUS_PARPORT, 29 PARPORT = BUS_PARPORT,
29 AMIGA = BUS_AMIGA, 30 AMIGA = BUS_AMIGA,
30 ADB = BUS_ADB, 31 ADB = BUS_ADB,
31 I2C = BUS_I2C, 32 I2C = BUS_I2C,
32 HOST = BUS_HOST, 33 HOST = BUS_HOST,
33 }; 34 };
34 35
36 enum Switch
37 {
38 Switch0 = SW_0,
39 Switch1 = SW_1,
40 Switch2 = SW_2,
41 Switch3 = SW_3,
42 Switch4 = SW_4,
43 Switch5 = SW_5,
44 Switch6 = SW_6,
45 Switch7 = SW_7,
46 };
47
35 enum Key 48 enum Key
36 { 49 {
37 Key_RESERVED = 0, 50 Key_RESERVED = 0,
38 Key_ESC = 1, 51 Key_ESC = 1,
39 Key_1 = 2, 52 Key_1 = 2,
40 Key_2 = 3, 53 Key_2 = 3,
41 Key_3 = 4, 54 Key_3 = 4,
42 Key_4 = 5, 55 Key_4 = 5,
43 Key_5 = 6, 56 Key_5 = 6,
44 Key_6 = 7, 57 Key_6 = 7,
45 Key_7 = 8, 58 Key_7 = 8,
46 Key_8 = 9, 59 Key_8 = 9,
47 Key_9 = 10, 60 Key_9 = 10,
48 Key_0 = 11, 61 Key_0 = 11,
49 Key_MINUS = 12, 62 Key_MINUS = 12,
50 Key_EQUAL = 13, 63 Key_EQUAL = 13,
51 Key_BACKSPACE = 14, 64 Key_BACKSPACE = 14,
52 Key_TAB = 15, 65 Key_TAB = 15,
53 Key_Q = 16, 66 Key_Q = 16,
54 Key_W = 17, 67 Key_W = 17,
55 Key_E = 18, 68 Key_E = 18,
56 Key_R = 19, 69 Key_R = 19,
57 Key_T = 20, 70 Key_T = 20,
58 Key_Y = 21, 71 Key_Y = 21,
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 76c9b79..176d178 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -376,48 +376,49 @@ CardDevice::~CardDevice()
376 376
377//================================================================================================= 377//=================================================================================================
378InputDevice::InputDevice( Category* parent, const QString& name ) 378InputDevice::InputDevice( Category* parent, const QString& name )
379 :Device( parent, name ) 379 :Device( parent, name )
380{ 380{
381 OListView* w = new OListView( devinfo ); 381 OListView* w = new OListView( devinfo );
382 details = w; 382 details = w;
383 w->addColumn( "Info" ); 383 w->addColumn( "Info" );
384 w->addColumn( "Value" ); 384 w->addColumn( "Value" );
385 w->hide(); 385 w->hide();
386} 386}
387 387
388void InputDevice::setInfo( const OInputDevice* dev ) 388void InputDevice::setInfo( const OInputDevice* dev )
389{ 389{
390 new OListViewItem( (OListView*) details, "Identity", dev->identity() ); 390 new OListViewItem( (OListView*) details, "Identity", dev->identity() );
391 new OListViewItem( (OListView*) details, "Path", dev->path() ); 391 new OListViewItem( (OListView*) details, "Path", dev->path() );
392 new OListViewItem( (OListView*) details, "Unique", dev->uniq() ); 392 new OListViewItem( (OListView*) details, "Unique", dev->uniq() );
393 393
394 QStringList text; 394 QStringList text;
395 if ( dev->hasFeature( OInputDevice::Synchronous ) ) text += "Synchronous"; 395 if ( dev->hasFeature( OInputDevice::Synchronous ) ) text += "Synchronous";
396 if ( dev->hasFeature( OInputDevice::Keys ) ) text += "Keys"; 396 if ( dev->hasFeature( OInputDevice::Keys ) ) text += "Keys";
397 if ( dev->hasFeature( OInputDevice::Relative ) ) text += "Relative"; 397 if ( dev->hasFeature( OInputDevice::Relative ) ) text += "Relative";
398 if ( dev->hasFeature( OInputDevice::Absolute ) ) text += "Absolute"; 398 if ( dev->hasFeature( OInputDevice::Absolute ) ) text += "Absolute";
399 if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) text += "Miscellaneous"; 399 if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) text += "Miscellaneous";
400 if ( dev->hasFeature( OInputDevice::Switches ) ) text += "Switches";
400 if ( dev->hasFeature( OInputDevice::Leds ) ) text += "Leds"; 401 if ( dev->hasFeature( OInputDevice::Leds ) ) text += "Leds";
401 if ( dev->hasFeature( OInputDevice::Sound ) ) text += "Sound"; 402 if ( dev->hasFeature( OInputDevice::Sound ) ) text += "Sound";
402 if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) text += "AutoRepeat"; 403 if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) text += "AutoRepeat";
403 if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) text += "ForceFeedback"; 404 if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) text += "ForceFeedback";
404 if ( dev->hasFeature( OInputDevice::PowerManagement ) ) text += "PowerManagement"; 405 if ( dev->hasFeature( OInputDevice::PowerManagement ) ) text += "PowerManagement";
405 if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) text += "ForceFeedbackStatus"; 406 if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) text += "ForceFeedbackStatus";
406 new OListViewItem( (OListView*) details, "Features", text.join( ", " ) ); 407 new OListViewItem( (OListView*) details, "Features", text.join( ", " ) );
407 408
408} 409}
409 410
410InputDevice::~InputDevice() 411InputDevice::~InputDevice()
411{ 412{
412} 413}
413 414
414//================================================================================================= 415//=================================================================================================
415UsbDevice::UsbDevice( Category* parent, const QString& name ) 416UsbDevice::UsbDevice( Category* parent, const QString& name )
416 :Device( parent, name ) 417 :Device( parent, name )
417{ 418{
418 details = new QPushButton( name, devinfo ); 419 details = new QPushButton( name, devinfo );
419 details->hide(); 420 details->hide();
420} 421}
421 422
422//================================================================================================= 423//=================================================================================================
423UsbDevice::UsbDevice( UsbDevice* parent, const QString& name ) 424UsbDevice::UsbDevice( UsbDevice* parent, const QString& name )