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
@@ -1,324 +1,325 @@
1 2005-??-??Opie 1.2.1 1 2005-??-??Opie 1.2.1
2 2
3 3
4 New Features 4 New Features
5 ------------ 5 ------------
6 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) 6 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
7 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) 7 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly)
8 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) 8 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer)
9 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) 9 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl)
10 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl) 10 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl)
11 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl) 11 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl)
12 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw) 12 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw)
13 * ZSafe: Made UI conform to Opie standards (drw) 13 * ZSafe: Made UI conform to Opie standards (drw)
14 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw) 14 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw)
15 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl) 15 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl)
16 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl) 16 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl)
17 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl) 17 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl)
18 * Opie-smb: Added Opie front end for Samba (ljp) 18 * Opie-smb: Added Opie front end for Samba (ljp)
19 * Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie) 19 * Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie)
20 * Opieplayer: rudimentary podcast support (ljp) 20 * Opieplayer: rudimentary podcast support (ljp)
21 21
22 Fixed Bugs 22 Fixed Bugs
23 ---------- 23 ----------
24 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl) 24 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl)
25 - We actually suspend the complete Opie now in that case. 25 - We actually suspend the complete Opie now in that case.
26 * #1384 - Battery status updated improperly when charging (skyhusker) 26 * #1384 - Battery status updated improperly when charging (skyhusker)
27 * #1476 - Wrong order of application entries in the O-menu (skyhusker) 27 * #1476 - Wrong order of application entries in the O-menu (skyhusker)
28 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl) 28 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl)
29 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) 29 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
30 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw) 30 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw)
31 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker) 31 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker)
32 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker) 32 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker)
33 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) 33 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
34 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) 34 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
35 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker) 35 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker)
36 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker) 36 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker)
37 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker) 37 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker)
38 * #1667 - Opie-IRC does not show messages from !channel (skyhusker) 38 * #1667 - Opie-IRC does not show messages from !channel (skyhusker)
39 * #1679 - Security PIN plugin is QVGA sized (hrw) 39 * #1679 - Security PIN plugin is QVGA sized (hrw)
40 * #1682 - Properly resize tab control in OTabWidget (drw) 40 * #1682 - Properly resize tab control in OTabWidget (drw)
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)
89 90
90 Fixed Bugs 91 Fixed Bugs
91 ---------- 92 ----------
92 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) 93 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
93 * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) 94 * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw)
94 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) 95 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp)
95 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) 96 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
96 * #1482 - Fix double '/' in paths (zecke) 97 * #1482 - Fix double '/' in paths (zecke)
97 * #1536 - Autosave of custom locations in opie backup (ar) 98 * #1536 - Autosave of custom locations in opie backup (ar)
98 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) 99 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
99 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) 100 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
100 * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) 101 * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw)
101 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) 102 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke)
102 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) 103 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
103 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) 104 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
104 * #1558 - Fixed opie-login breaking opie startup (mickeyl) 105 * #1558 - Fixed opie-login breaking opie startup (mickeyl)
105 * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) 106 * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning)
106 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) 107 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar)
107 * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) 108 * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers)
108 * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) 109 * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints)
109 * #1604 - Checkbook crashed on startup (drw) 110 * #1604 - Checkbook crashed on startup (drw)
110 * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) 111 * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers)
111 * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers) 112 * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers)
112 * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw) 113 * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw)
113 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) 114 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw)
114 * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw) 115 * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw)
115 * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw) 116 * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw)
116 * n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw) 117 * n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw)
117 * n.a. - AddressBook - fixed sorting by 'File As' name (drw) 118 * n.a. - AddressBook - fixed sorting by 'File As' name (drw)
118 * n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers) 119 * n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers)
119 * n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw) 120 * n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw)
120 121
121 Internal 122 Internal
122 -------- 123 --------
123 * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) 124 * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl)
124 * Killed the need for weak symbols in QtE (zecke) 125 * Killed the need for weak symbols in QtE (zecke)
125 * Added optional building libqpe without inline images (mickeyl) 126 * Added optional building libqpe without inline images (mickeyl)
126 * OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw) 127 * OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw)
127 128
128 2005-02-03Opie 1.1.9 129 2005-02-03Opie 1.1.9
129 130
130 New Features 131 New Features
131 ------------ 132 ------------
132 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) 133 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
133 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) 134 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl)
134 * Usability enhancements in OpieIRC (skyhusker) 135 * Usability enhancements in OpieIRC (skyhusker)
135 136
136 Fixed Bugs 137 Fixed Bugs
137 ---------- 138 ----------
138 * #1501 - Fixed bug in todo sql backend (eilers) 139 * #1501 - Fixed bug in todo sql backend (eilers)
139 * #1505 - Added more Swap sizes in memoryapplet (mickeyl) 140 * #1505 - Added more Swap sizes in memoryapplet (mickeyl)
140 * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke) 141 * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke)
141 * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke) 142 * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke)
142 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl) 143 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
143 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl) 144 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl)
144 * n.a. - Fixed numerous buglets in OpieIRC (skyhusker) 145 * n.a. - Fixed numerous buglets in OpieIRC (skyhusker)
145 146
146 Internal 147 Internal
147 -------- 148 --------
148 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 149 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
149 * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl) 150 * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl)
150 * Made Opie compilable with Qt/Embedded 2.3.10 (ar) 151 * Made Opie compilable with Qt/Embedded 2.3.10 (ar)
151 * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl) 152 * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl)
152 * Build tree cleanups (mickeyl) 153 * Build tree cleanups (mickeyl)
153 154
154 2004-11-26Opie 1.1.8 155 2004-11-26Opie 1.1.8
155 156
156 New Features 157 New Features
157 ------------ 158 ------------
158 * PackageManager supports installation of local ipkg files (drw) 159 * PackageManager supports installation of local ipkg files (drw)
159 * PackageManager supports linking of applications to root (drw) 160 * PackageManager supports linking of applications to root (drw)
160 * PackageManager supports src/gz feeds (drw,wimpie) 161 * PackageManager supports src/gz feeds (drw,wimpie)
161 * Added a syslog information tab to sysinfo (mickeyl) 162 * Added a syslog information tab to sysinfo (mickeyl)
162 * Added new, more consistent, PIM icons + a GIMP teplate (ar) 163 * Added new, more consistent, PIM icons + a GIMP teplate (ar)
163 164
164 Fixed Bugs 165 Fixed Bugs
165 ---------- 166 ----------
166 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) 167 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw)
167 * #1269 - VCards were imported into personal area if it was activated (eilers) 168 * #1269 - VCards were imported into personal area if it was activated (eilers)
168 * #1464 - Packagemanager dont set active filter after install a package (drw) 169 * #1464 - Packagemanager dont set active filter after install a package (drw)
169 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) 170 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers)
170 * #1493 - Fixed one column layout bug of the launcher (hrw) 171 * #1493 - Fixed one column layout bug of the launcher (hrw)
171 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) 172 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw)
172 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) 173 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw)
173 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) 174 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl)
174 175
175 Internal 176 Internal
176 -------- 177 --------
177 * Moved libopie1 to unsupported (mickeyl) 178 * Moved libopie1 to unsupported (mickeyl)
178 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) 179 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers)
179 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) 180 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers)
180 181
181 2004-11-14Opie 1.1.7 182 2004-11-14Opie 1.1.7
182 183
183 New Features 184 New Features
184 ------------ 185 ------------
185 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) 186 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers)
186 * Backup now uses the busy indicator when backing up and restore (ar) 187 * Backup now uses the busy indicator when backing up and restore (ar)
187 * OpiePlayer2 gained adding of Directories to the playlist (zecke) 188 * OpiePlayer2 gained adding of Directories to the playlist (zecke)
188 * OpiePlayer2 better error handling (zecke) 189 * OpiePlayer2 better error handling (zecke)
189 * OpiePlayer2 progress indication while streaming (zecke) 190 * OpiePlayer2 progress indication while streaming (zecke)
190 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) 191 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke)
191 * Ported brightnessapplet from Qtopia 1.7 (mickeyl) 192 * Ported brightnessapplet from Qtopia 1.7 (mickeyl)
192 * Opie-Eye got a Digital Camera File Backend (alwin,zecke) 193 * Opie-Eye got a Digital Camera File Backend (alwin,zecke)
193 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) 194 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke)
194 * Opie-Console use Custom Font and Size in a Profile (harlekin) 195 * Opie-Console use Custom Font and Size in a Profile (harlekin)
195 * Opie-Console transparently log the Output and Input to a file (harlekin) 196 * Opie-Console transparently log the Output and Input to a file (harlekin)
196 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) 197 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem)
197 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) 198 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem)
198 * Opie-Security gained a 'test authentication' button (clem) 199 * Opie-Security gained a 'test authentication' button (clem)
199 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults 200 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults
200 * Opie-Mail improve the handling of POP mail boxes (alwin) 201 * Opie-Mail improve the handling of POP mail boxes (alwin)
201 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) 202 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin)
202 * Opie IRC - backports of the 'NeIRC fork' (zecke) 203 * Opie IRC - backports of the 'NeIRC fork' (zecke)
203 204
204 Fixed Bugs 205 Fixed Bugs
205 ---------- 206 ----------
206 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) 207 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke)
207 * #608 - Make Opie usable for left handed users (zecke) 208 * #608 - Make Opie usable for left handed users (zecke)
208 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) 209 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke)
209 * #1245 - Opie-Go 'paused' (zecke) 210 * #1245 - Opie-Go 'paused' (zecke)
210 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) 211 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke)
211 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) 212 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke)
212 * #1395 - Build VNC Backend with gcc3.4 213 * #1395 - Build VNC Backend with gcc3.4
213 * #1440 - The icon of opie-mobilemsg is missing (CoreDump) 214 * #1440 - The icon of opie-mobilemsg is missing (CoreDump)
214 * #1426 - Add missing opie-bartender Icon (CoreDump) 215 * #1426 - Add missing opie-bartender Icon (CoreDump)
215 * #1445 - Opie-Sheet Has No Icon (CoreDump) 216 * #1445 - Opie-Sheet Has No Icon (CoreDump)
216 * #1448 - Brightness Applet added (mickeyl) 217 * #1448 - Brightness Applet added (mickeyl)
217 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) 218 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke)
218 * #1482 - Fix OFileSelector to be able to sort by size (zecke) 219 * #1482 - Fix OFileSelector to be able to sort by size (zecke)
219 * n.a. - Opie-mail: fixed some crasher, some layout-problems 220 * n.a. - Opie-mail: fixed some crasher, some layout-problems
220 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) 221 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke)
221 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) 222 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke)
222 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) 223 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem)
223 * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) 224 * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem)
224 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) 225 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl)
225 226
226 Internal 227 Internal
227 -------- 228 --------
228 * Opie-Qashmoney has been moved to unsupported (mickeyl) 229 * Opie-Qashmoney has been moved to unsupported (mickeyl)
229 * Opie-Ubrowser has been moved to unsupported (mickeyl) 230 * Opie-Ubrowser has been moved to unsupported (mickeyl)
230 231
231 2004-09-17Opie 1.1.6 232 2004-09-17Opie 1.1.6
232 233
233 New Features 234 New Features
234 ------------ 235 ------------
235 * Fifteen gained configurable number of items (zecke) 236 * Fifteen gained configurable number of items (zecke)
236 * Fifteen can have custom background images (zecke) 237 * Fifteen can have custom background images (zecke)
237 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) 238 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl)
238 * Integrated the new security framework into libopie2 (zecke,clem) 239 * Integrated the new security framework into libopie2 (zecke,clem)
239 * Converted the launcher to use the new security framework (zecke) 240 * Converted the launcher to use the new security framework (zecke)
240 * Backup can now handle custom locations for backup and restore (ar) 241 * Backup can now handle custom locations for backup and restore (ar)
241 * Implemented right-on-hold feedback (wimpie,zecke) 242 * Implemented right-on-hold feedback (wimpie,zecke)
242 * Lots of new features in opie-reader (tim,pohly) 243 * Lots of new features in opie-reader (tim,pohly)
243 * Build system cleanups (schurig) 244 * Build system cleanups (schurig)
244 245
245 Fixed Bugs 246 Fixed Bugs
246 -------- 247 --------
247 * #1005 - Fixed backup to CompactFlash (ar) 248 * #1005 - Fixed backup to CompactFlash (ar)
248 * #1167 - Fixed Opie write crashing on more text than one page (ar) 249 * #1167 - Fixed Opie write crashing on more text than one page (ar)
249 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) 250 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl)
250 * #1359 - Fixed bookmarks in Gutenbrowser (ljp) 251 * #1359 - Fixed bookmarks in Gutenbrowser (ljp)
251 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) 252 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers)
252 * #1370 - Pimconverter now reacts on cancel key (eilers) 253 * #1370 - Pimconverter now reacts on cancel key (eilers)
253 * #1376 - Bring back the capslock/numlock display (zecke) 254 * #1376 - Bring back the capslock/numlock display (zecke)
254 * #1383 - Language settings now warns about losing open apps (Markus Litz) 255 * #1383 - Language settings now warns about losing open apps (Markus Litz)
255 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) 256 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl)
256 * #1394 - Fixed oversized headline in opie-login (coredump) 257 * #1394 - Fixed oversized headline in opie-login (coredump)
257 * #1396 - Opie-console captures the escape key and vim is working (zecke) 258 * #1396 - Opie-console captures the escape key and vim is working (zecke)
258 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) 259 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl)
259 260
260 2004-07-06Opie 1.1.4 261 2004-07-06Opie 1.1.4
261 262
262 New Features 263 New Features
263 ------------ 264 ------------
264 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 265 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
265 * Added Conversion tool for pim-data (eilers) 266 * Added Conversion tool for pim-data (eilers)
266 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) 267 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers)
267 * Modified the PIM API for providing generic use of OPimRecords (eilers) 268 * Modified the PIM API for providing generic use of OPimRecords (eilers)
268 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) 269 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke)
269 270
270 Fixed Bugs 271 Fixed Bugs
271 -------- 272 --------
272 * #1068 - Country Drop Down Box Off Screen 273 * #1068 - Country Drop Down Box Off Screen
273 * #1291 - Opie tinykate does not open .desktop files (ar) 274 * #1291 - Opie tinykate does not open .desktop files (ar)
274 * #1291 - Opie sheet not saving correctly (ar) 275 * #1291 - Opie sheet not saving correctly (ar)
275 * #1294 - Opie does not know about British Summer Time 276 * #1294 - Opie does not know about British Summer Time
276 * #1314 - Drawpad initialization (mickeyl) 277 * #1314 - Drawpad initialization (mickeyl)
277 * #1317 - Packagemanager crashes on hold-down or install (chicken) 278 * #1317 - Packagemanager crashes on hold-down or install (chicken)
278 * #1321 - Batteryapplet graphic glitch (harlekin) 279 * #1321 - Batteryapplet graphic glitch (harlekin)
279 * #1324 - ZSafe not starting up (mickeyl) 280 * #1324 - ZSafe not starting up (mickeyl)
280 * #1328 - Personal Home Address fields is trimmed to 1char (eilers) 281 * #1328 - Personal Home Address fields is trimmed to 1char (eilers)
281 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) 282 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken)
282 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) 283 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl)
283 * #1348 - Datebook dependency on libopiedb2 (chicken) 284 * #1348 - Datebook dependency on libopiedb2 (chicken)
284 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) 285 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers)
285 286
286 2004-04-25Opie 1.1.3 287 2004-04-25Opie 1.1.3
287 288
288 * Introduced first implementation of SQL-Support using SQLite (eilers) 289 * Introduced first implementation of SQL-Support using SQLite (eilers)
289 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 290 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
290 * Added a real system graffiti character set (brad) 291 * Added a real system graffiti character set (brad)
291 * Added Generic Keyconfig Widget (zecke) 292 * Added Generic Keyconfig Widget (zecke)
292 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 293 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
293 * Added new Bible reader app - opie-dagger (drw) 294 * Added new Bible reader app - opie-dagger (drw)
294 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 295 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
295 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 296 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
296 * Enabled the possibility to pass command line arguments to applications (mickeyl) 297 * Enabled the possibility to pass command line arguments to applications (mickeyl)
297 * Added an about applet showing some credits and information about Opie (mickeyl) 298 * Added an about applet showing some credits and information about Opie (mickeyl)
298 * Added benchmarking functionality to sysinfo (mickeyl) 299 * Added benchmarking functionality to sysinfo (mickeyl)
299 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 300 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
300 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 301 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
301 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 302 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
302 * Clean-up of package information in control files (drw) 303 * Clean-up of package information in control files (drw)
303 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 304 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
304 * Improved big-screen support (zecke,ar) 305 * Improved big-screen support (zecke,ar)
305 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 306 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
306 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 307 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
307 * Added new package manager - opie-packagemanager (drw) 308 * Added new package manager - opie-packagemanager (drw)
308 * Improved light-n-power for C7x0 (mickeyl) 309 * Improved light-n-power for C7x0 (mickeyl)
309 * Added automatic rotation support for C7x0 (treke) 310 * Added automatic rotation support for C7x0 (treke)
310 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 311 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
311 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 312 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
312 313
313 2003-11-29Opie 1.0.3 314 2003-11-29Opie 1.0.3
314 315
315 * Released as Version 1.0.3 316 * Released as Version 1.0.3
316 * Improved i18n (various contributors) 317 * Improved i18n (various contributors)
317 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 318 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
318 * Made the Documents Tab optional (mickeyl) 319 * Made the Documents Tab optional (mickeyl)
319 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 320 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
320 321
321 2003-08-04Opie 1.0.0 322 2003-08-04Opie 1.0.0
322 323
323 * Released as Version 1.0.0 324 * Released as Version 1.0.0
324 * Including a PPP module for easy dial up (tille,harlekin,zecke) 325 * Including a PPP module for easy dial up (tille,harlekin,zecke)
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
@@ -1,334 +1,338 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27*/ 27*/
28 28
29#include <opie2/odebug.h> 29#include <opie2/odebug.h>
30#include <opie2/oinputsystem.h> 30#include <opie2/oinputsystem.h>
31 31
32using namespace Opie::Core; 32using namespace Opie::Core;
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <stdio.h> 35#include <stdio.h>
36#include <unistd.h> 36#include <unistd.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38#include <sys/fcntl.h> 38#include <sys/fcntl.h>
39 39
40#if 1 40#if 1
41 41
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 ) \
121 unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ 125 unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \
122 memset( name, 0, sizeof( name ) ) 126 memset( name, 0, sizeof( name ) )
123 127
124#define TEST_BIT( bitmask, bit ) \ 128#define TEST_BIT( bitmask, bit ) \
125 ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) 129 ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) )
126 130
127int Open_cPad() 131int Open_cPad()
128{ 132{
129 size_t MAX_DEVICES = 1; 133 size_t MAX_DEVICES = 1;
130 int fd = -1; 134 int fd = -1;
131 input_id info; 135 input_id info;
132 136
133 for( size_t i = 0; i < MAX_DEVICES; ++i ) 137 for( size_t i = 0; i < MAX_DEVICES; ++i )
134 { 138 {
135 string devpath( "/dev/input/event0" ); 139 string devpath( "/dev/input/event0" );
136 140
137 //devpath << (int)i; 141 //devpath << (int)i;
138 142
139 fd = open( devpath.c_str(), O_RDONLY, &info ); 143 fd = open( devpath.c_str(), O_RDONLY, &info );
140 144
141 if( fd >= 0 ) 145 if( fd >= 0 )
142 { 146 {
143 int version = -1; 147 int version = -1;
144 /* ioctl() accesses the underlying driver */ 148 /* ioctl() accesses the underlying driver */
145 if (ioctl(fd, EVIOCGVERSION, &version)) { 149 if (ioctl(fd, EVIOCGVERSION, &version)) {
146 perror("evdev ioctl"); 150 perror("evdev ioctl");
147 } 151 }
148 152
149 /* the EVIOCGVERSION ioctl() returns an int */ 153 /* the EVIOCGVERSION ioctl() returns an int */
150 /* so we unpack it and display it */ 154 /* so we unpack it and display it */
151 printf("evdev driver version is %d.%d.%d\n", 155 printf("evdev driver version is %d.%d.%d\n",
152 version >> 16, (version >> 8) & 0xff, 156 version >> 16, (version >> 8) & 0xff,
153 version & 0xff); 157 version & 0xff);
154 158
155 // Get Identifying info 159 // Get Identifying info
156 160
157 if( ioctl( fd, EVIOCGID, &info) ) 161 if( ioctl( fd, EVIOCGID, &info) )
158 { 162 {
159 perror( "event device ioctl" ); 163 perror( "event device ioctl" );
160 return -1; 164 return -1;
161 } 165 }
162 printf( "Bus: %#x, Vendor: %#x, Product: %#x, Version: %#x\n", 166 printf( "Bus: %#x, Vendor: %#x, Product: %#x, Version: %#x\n",
163 info.bustype, info.vendor, info.product, info.version ); 167 info.bustype, info.vendor, info.product, info.version );
164 168
165 switch ( info.bustype) 169 switch ( info.bustype)
166 { 170 {
167 case BUS_PCI : 171 case BUS_PCI :
168 printf(" is on a PCI bus\n"); 172 printf(" is on a PCI bus\n");
169 break; 173 break;
170 case BUS_USB : 174 case BUS_USB :
171 printf(" is on a Universal Serial Bus\n"); 175 printf(" is on a Universal Serial Bus\n");
172 break; 176 break;
173 /* ... */ 177 /* ... */
174 } 178 }
175 179
176 // Get feature types 180 // Get feature types
177 181
178 BITMASK( features, EV_MAX ); 182 BITMASK( features, EV_MAX );
179 183
180 if( ioctl( fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) 184 if( ioctl( fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 )
181 { 185 {
182 perror( "event device ioctl" ); 186 perror( "event device ioctl" );
183 return -1; 187 return -1;
184 } 188 }
185 189
186 printf( "Supported features:\n" ); 190 printf( "Supported features:\n" );
187 for( size_t bit = 0; bit < EV_MAX; ++bit ) 191 for( size_t bit = 0; bit < EV_MAX; ++bit )
188 { 192 {
189 if( TEST_BIT( features, bit ) ) 193 if( TEST_BIT( features, bit ) )
190 { 194 {
191 switch( bit ) 195 switch( bit )
192 { 196 {
193 case EV_SYN : 197 case EV_SYN :
194 printf(" Sync. Events\n"); 198 printf(" Sync. Events\n");
195 break; 199 break;
196 //case EV_RST: 200 //case EV_RST:
197 // printf( " Reset?\n" ); 201 // printf( " Reset?\n" );
198 // break; 202 // break;
199 case EV_KEY: 203 case EV_KEY:
200 printf( " Keys or buttons\n" ); 204 printf( " Keys or buttons\n" );
201 break; 205 break;
202 case EV_REL: 206 case EV_REL:
203 printf( " Relative axes\n" ); 207 printf( " Relative axes\n" );
204 break; 208 break;
205 case EV_ABS: 209 case EV_ABS:
206 printf( " Absolute axes\n" ); 210 printf( " Absolute axes\n" );
207 break; 211 break;
208 case EV_MSC: 212 case EV_MSC:
209 printf( " Misc\n" ); 213 printf( " Misc\n" );
210 break; 214 break;
211 case EV_LED: 215 case EV_LED:
212 printf( " Led's\n" ); 216 printf( " Led's\n" );
213 break; 217 break;
214 case EV_SND: 218 case EV_SND:
215 printf( " Sounds\n" ); 219 printf( " Sounds\n" );
216 break; 220 break;
217 case EV_REP: 221 case EV_REP:
218 printf( " Repeat\n" ); 222 printf( " Repeat\n" );
219 break; 223 break;
220 case EV_FF : // fallthrough 224 case EV_FF : // fallthrough
221 case EV_FF_STATUS: 225 case EV_FF_STATUS:
222 printf(" Force Feedback\n"); 226 printf(" Force Feedback\n");
223 break; 227 break;
224 case EV_PWR: 228 case EV_PWR:
225 printf(" Power Management\n"); 229 printf(" Power Management\n");
226 break; 230 break;
227 default: 231 default:
228 printf( " Unknown (bit %d)\n", bit ); 232 printf( " Unknown (bit %d)\n", bit );
229 } 233 }
230 } 234 }
231 } 235 }
232 236
233 // Check keystate 237 // Check keystate
234 238
235 BITMASK( keys, KEY_MAX ); 239 BITMASK( keys, KEY_MAX );
236 240
237 if( ioctl( fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) 241 if( ioctl( fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 )
238 { 242 {
239 perror( "event device ioctl" ); 243 perror( "event device ioctl" );
240 return -1; 244 return -1;
241 } 245 }
242 246
243 printf( "Key global status:\n" ); 247 printf( "Key global status:\n" );
244 for( size_t bit = 0; bit < KEY_MAX; ++bit ) 248 for( size_t bit = 0; bit < KEY_MAX; ++bit )
245 { 249 {
246 if( TEST_BIT( keys, bit ) ) 250 if( TEST_BIT( keys, bit ) )
247 { 251 {
248 printf( "Key (bit %d) active\n", bit ); 252 printf( "Key (bit %d) active\n", bit );
249 } 253 }
250 } 254 }
251 } 255 }
252 else 256 else
253 printf( "Failed to open device\n" ); 257 printf( "Failed to open device\n" );
254 258
255 close( fd ); 259 close( fd );
256 } 260 }
257 return fd; 261 return fd;
258} 262}
259 263
260 264
261int main( int argc, char **argv ) 265int main( int argc, char **argv )
262{ 266{
263 //printf(" Long: %d, int %d, short %d\n", sizeof( long ), sizeof( int ), sizeof( short ) ); 267 //printf(" Long: %d, int %d, short %d\n", sizeof( long ), sizeof( int ), sizeof( short ) );
264 //printf( "num chars %d\n", snprintf( NULL, 0, 0 ) ); 268 //printf( "num chars %d\n", snprintf( NULL, 0, 0 ) );
265 //exit( 0 ); 269 //exit( 0 );
266 Open_cPad(); 270 Open_cPad();
267 271
268#if 1 272#if 1
269 int fd = open( "/dev/input/event0", O_RDONLY ); 273 int fd = open( "/dev/input/event0", O_RDONLY );
270 274
271 if( fd == -1 ) 275 if( fd == -1 )
272 { 276 {
273 printf( "Failed to open device\n" ); 277 printf( "Failed to open device\n" );
274 goto hell; 278 goto hell;
275 } 279 }
276 280
277 struct input_event evbuf; 281 struct input_event evbuf;
278 282
279 for(;;) 283 for(;;)
280 { 284 {
281 if( read( fd, &evbuf, sizeof evbuf ) == -1 ) 285 if( read( fd, &evbuf, sizeof evbuf ) == -1 )
282 { 286 {
283 printf( "Read error\n" ); 287 printf( "Read error\n" );
284 goto hell; 288 goto hell;
285 } 289 }
286 290
287 printf( "Type: %d, Code: %d, Value: %d\n", evbuf.type, evbuf.code, evbuf.value ); 291 printf( "Type: %d, Code: %d, Value: %d\n", evbuf.type, evbuf.code, evbuf.value );
288 } 292 }
289 293
290#endif 294#endif
291#if 0 295#if 0
292 unsigned char buf[ 4 ]; 296 unsigned char buf[ 4 ];
293 297
294 for(;;) 298 for(;;)
295 { 299 {
296 if( read( fd, buf, sizeof buf ) == -1 ) 300 if( read( fd, buf, sizeof buf ) == -1 )
297 { 301 {
298 printf( "Read error\n" ); 302 printf( "Read error\n" );
299 goto hell; 303 goto hell;
300 } 304 }
301 305
302 printf( "Raw:\t%#x\t%#x\t%#x\t%#x\n", buf[ 0 ], buf[ 1 ], buf[ 2 ], buf[ 3 ] ); 306 printf( "Raw:\t%#x\t%#x\t%#x\t%#x\n", buf[ 0 ], buf[ 1 ], buf[ 2 ], buf[ 3 ] );
303 307
304 int dx = buf[ 1 ]; 308 int dx = buf[ 1 ];
305 309
306 if( ( buf[ 0 ] & 0x10 ) != 0 ) 310 if( ( buf[ 0 ] & 0x10 ) != 0 )
307 dx -= 256; 311 dx -= 256;
308 312
309 int dy = - buf[ 2 ]; 313 int dy = - buf[ 2 ];
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
@@ -1,738 +1,795 @@
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 =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 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
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#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"),
71 "devicebuttons/z_home", 73 "devicebuttons/z_home",
72 "QPE/Launcher", "home()", 74 "QPE/Launcher", "home()",
73 "buttonsettings", "raise()" }, 75 "buttonsettings", "raise()" },
74 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 76 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
75 "devicebuttons/z_menu", 77 "devicebuttons/z_menu",
76 "QPE/TaskBar", "toggleMenu()", 78 "QPE/TaskBar", "toggleMenu()",
77 "QPE/TaskBar", "toggleStartMenu()" }, 79 "QPE/TaskBar", "toggleStartMenu()" },
78 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 80 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
79 "devicebuttons/z_mail", 81 "devicebuttons/z_mail",
80 "opiemail", "raise()", 82 "opiemail", "raise()",
81 "opiemail", "newMail()" }, 83 "opiemail", "newMail()" },
82}; 84};
83 85
84struct z_button z_buttons_c700 [] = { 86struct z_button z_buttons_c700 [] = {
85 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 87 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
86 "devicebuttons/z_calendar", 88 "devicebuttons/z_calendar",
87 "datebook", "nextView()", 89 "datebook", "nextView()",
88 "today", "raise()" }, 90 "today", "raise()" },
89 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 91 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
90 "devicebuttons/z_contact", 92 "devicebuttons/z_contact",
91 "addressbook", "raise()", 93 "addressbook", "raise()",
92 "addressbook", "beamBusinessCard()" }, 94 "addressbook", "beamBusinessCard()" },
93 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 95 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
94 "devicebuttons/z_home", 96 "devicebuttons/z_home",
95 "QPE/Launcher", "home()", 97 "QPE/Launcher", "home()",
96 "buttonsettings", "raise()" }, 98 "buttonsettings", "raise()" },
97 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 99 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
98 "devicebuttons/z_menu", 100 "devicebuttons/z_menu",
99 "QPE/TaskBar", "toggleMenu()", 101 "QPE/TaskBar", "toggleMenu()",
100 "QPE/TaskBar", "toggleStartMenu()" }, 102 "QPE/TaskBar", "toggleStartMenu()" },
101 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 103 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
102 "devicebuttons/z_mail", 104 "devicebuttons/z_mail",
103 "opiemail", "raise()", 105 "opiemail", "raise()",
104 "opiemail", "newMail()" }, 106 "opiemail", "newMail()" },
105 107
106 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"), 108 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Hinge1"),
107 "devicebuttons/z_hinge1", 109 "devicebuttons/z_hinge1",
108 "QPE/Rotation", "rotateDefault()",0}, 110 "QPE/Rotation", "rotateDefault()",0},
109 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"), 111 { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Hinge2"),
110 "devicebuttons/z_hinge2", 112 "devicebuttons/z_hinge2",
111 "QPE/Rotation", "rotateDefault()",0}, 113 "QPE/Rotation", "rotateDefault()",0},
112 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"), 114 { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Hinge3"),
113 "devicebuttons/z_hinge3", 115 "devicebuttons/z_hinge3",
114 "QPE/Rotation", "rotateDefault()",0}, 116 "QPE/Rotation", "rotateDefault()",0},
115}; 117};
116 118
117struct z_button z_buttons_6000 [] = { 119struct z_button z_buttons_6000 [] = {
118 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 120 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
119 "devicebuttons/z_calendar", 121 "devicebuttons/z_calendar",
120 "datebook", "nextView()", 122 "datebook", "nextView()",
121 "today", "raise()" }, 123 "today", "raise()" },
122 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 124 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
123 "devicebuttons/z_contact", 125 "devicebuttons/z_contact",
124 "addressbook", "raise()", 126 "addressbook", "raise()",
125 "addressbook", "beamBusinessCard()" }, 127 "addressbook", "beamBusinessCard()" },
126 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 128 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
127 "devicebuttons/z_home", 129 "devicebuttons/z_home",
128 "QPE/Launcher", "home()", 130 "QPE/Launcher", "home()",
129 "buttonsettings", "raise()" }, 131 "buttonsettings", "raise()" },
130 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 132 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
131 "devicebuttons/z_menu", 133 "devicebuttons/z_menu",
132 "QPE/TaskBar", "toggleMenu()", 134 "QPE/TaskBar", "toggleMenu()",
133 "QPE/TaskBar", "toggleStartMenu()" }, 135 "QPE/TaskBar", "toggleStartMenu()" },
134 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 136 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
135 "devicebuttons/z_mail", 137 "devicebuttons/z_mail",
136 "opiemail", "raise()", 138 "opiemail", "raise()",
137 "opiemail", "newMail()" }, 139 "opiemail", "newMail()" },
138 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"), 140 { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Rotate Button"),
139 "devicebuttons/z_rotate", 141 "devicebuttons/z_rotate",
140 0, 142 0,
141 "QPE/Rotation", "rotateDefault()" }, 143 "QPE/Rotation", "rotateDefault()" },
142 { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 144 { Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
143 "devicebuttons/z_hinge3", 145 "devicebuttons/z_hinge3",
144 "QPE/VMemo", "toggleRecord()", 146 "QPE/VMemo", "toggleRecord()",
145 "sound", "raise()" }, 147 "sound", "raise()" },
146}; 148};
147 149
148// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 150// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
149// class up into individual classes. We would need three classes 151// class up into individual classes. We would need three classes
150// 152//
151// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) 153// Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000)
152// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) 154// Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600)
153// 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)
154// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) 156// Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000)
155 157
156void Zaurus::init(const QString& cpu_info) 158void Zaurus::init(const QString& cpu_info)
157{ 159{
158 // Set the time to wait until the system is really suspended 160 // Set the time to wait until the system is really suspended
159 // the delta between apm --suspend and sleeping 161 // the delta between apm --suspend and sleeping
160 setAPMTimeOut( 15000 ); 162 setAPMTimeOut( 15000 );
161 163
162 // generic distribution code already scanned /etc/issue at that point - 164 // generic distribution code already scanned /etc/issue at that point -
163 // embedix releases contain "Embedix <version> | Linux for Embedded Devices" 165 // embedix releases contain "Embedix <version> | Linux for Embedded Devices"
164 if ( d->m_sysverstr.contains( "embedix", false ) ) 166 if ( d->m_sysverstr.contains( "embedix", false ) )
165 { 167 {
166 d->m_vendorstr = "Sharp"; 168 d->m_vendorstr = "Sharp";
167 d->m_vendor = Vendor_Sharp; 169 d->m_vendor = Vendor_Sharp;
168 d->m_systemstr = "Zaurus"; 170 d->m_systemstr = "Zaurus";
169 d->m_system = System_Zaurus; 171 d->m_system = System_Zaurus;
170 m_embedix = true; 172 m_embedix = true;
171 } 173 }
172 else 174 else
173 { 175 {
174 d->m_vendorstr = "OpenZaurus Team"; 176 d->m_vendorstr = "OpenZaurus Team";
175 d->m_systemstr = "OpenZaurus"; 177 d->m_systemstr = "OpenZaurus";
176 d->m_system = System_OpenZaurus; 178 d->m_system = System_OpenZaurus;
177 // sysver already gathered 179 // sysver already gathered
178 180
179 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one 181 // OpenZaurus sometimes uses the 2.4 (embedix) kernel, check if this is one
180 FILE *uname = popen("uname -r", "r"); 182 FILE *uname = popen("uname -r", "r");
181 QFile f; 183 QFile f;
182 QString line; 184 QString line;
183 if ( f.open(IO_ReadOnly, uname) ) { 185 if ( f.open(IO_ReadOnly, uname) ) {
184 QTextStream ts ( &f ); 186 QTextStream ts ( &f );
185 line = ts.readLine(); 187 line = ts.readLine();
186 m_embedix = line.startsWith( "2.4." ); 188 m_embedix = line.startsWith( "2.4." );
187 f.close(); 189 f.close();
188 } 190 }
189 pclose(uname); 191 pclose(uname);
190 } 192 }
191 193
192 // check the Zaurus model 194 // check the Zaurus model
193 QString model; 195 QString model;
194 int loc = cpu_info.find( ":" ); 196 int loc = cpu_info.find( ":" );
195 if ( loc != -1 ) 197 if ( loc != -1 )
196 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); 198 model = cpu_info.mid( loc+2 ).simplifyWhiteSpace();
197 else 199 else
198 model = cpu_info; 200 model = cpu_info;
199 201
200 if ( model == "SHARP Corgi" ) { 202 if ( model == "SHARP Corgi" ) {
201 d->m_model = Model_Zaurus_SLC7x0; 203 d->m_model = Model_Zaurus_SLC7x0;
202 d->m_modelstr = "Zaurus SL-C700"; 204 d->m_modelstr = "Zaurus SL-C700";
203 } else if ( model == "SHARP Shepherd" ) { 205 } else if ( model == "SHARP Shepherd" ) {
204 d->m_model = Model_Zaurus_SLC7x0; 206 d->m_model = Model_Zaurus_SLC7x0;
205 d->m_modelstr = "Zaurus SL-C750"; 207 d->m_modelstr = "Zaurus SL-C750";
206 } else if ( model == "SHARP Husky" ) { 208 } else if ( model == "SHARP Husky" ) {
207 d->m_model = Model_Zaurus_SLC7x0; 209 d->m_model = Model_Zaurus_SLC7x0;
208 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 210 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
209 } else if ( model == "SHARP Boxer" ) { 211 } else if ( model == "SHARP Boxer" ) {
210 d->m_model = Model_Zaurus_SLC7x0; 212 d->m_model = Model_Zaurus_SLC7x0;
211 d->m_modelstr = "Zaurus SL-C760 or SL-C860"; 213 d->m_modelstr = "Zaurus SL-C760 or SL-C860";
212 } else if ( model == "SHARP Poodle" ) { 214 } else if ( model == "SHARP Poodle" ) {
213 d->m_model = Model_Zaurus_SLB600; 215 d->m_model = Model_Zaurus_SLB600;
214 d->m_modelstr = "Zaurus SL-B500 or SL-5600"; 216 d->m_modelstr = "Zaurus SL-B500 or SL-5600";
215 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 217 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
216 d->m_model = Model_Zaurus_SL5500; 218 d->m_model = Model_Zaurus_SL5500;
217 d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; 219 d->m_modelstr = "Zaurus SL-5500 or SL-5000d";
218 } else if ( model == "SHARP Tosa" ) { 220 } else if ( model == "SHARP Tosa" ) {
219 d->m_model = Model_Zaurus_SL6000; 221 d->m_model = Model_Zaurus_SL6000;
220 d->m_modelstr = "Zaurus SL-6000"; 222 d->m_modelstr = "Zaurus SL-6000";
221 } else if ( model == "SHARP Spitz" ) { 223 } else if ( model == "SHARP Spitz" ) {
222 d->m_model = Model_Zaurus_SLC3000; 224 d->m_model = Model_Zaurus_SLC3000;
223 d->m_modelstr = "Zaurus SL-C3000"; 225 d->m_modelstr = "Zaurus SL-C3000";
224 } else if ( model == "SHARP Akita" ) { 226 } else if ( model == "SHARP Akita" ) {
225 d->m_model = Model_Zaurus_SLC1000; 227 d->m_model = Model_Zaurus_SLC1000;
226 d->m_modelstr = "Zaurus SL-C1000"; 228 d->m_modelstr = "Zaurus SL-C1000";
227 } else if ( model == "SHARP Borzoi" ) { 229 } else if ( model == "SHARP Borzoi" ) {
228 d->m_model = Model_Zaurus_SLC3100; 230 d->m_model = Model_Zaurus_SLC3100;
229 d->m_modelstr = "Zaurus SL-C3100"; 231 d->m_modelstr = "Zaurus SL-C3100";
230 } else { 232 } else {
231 d->m_model = Model_Zaurus_SL5500; 233 d->m_model = Model_Zaurus_SL5500;
232 d->m_modelstr = "Unknown Zaurus"; 234 d->m_modelstr = "Unknown Zaurus";
233 } 235 }
234 236
235 // set path to backlight device in kernel 2.6 237 // set path to backlight device in kernel 2.6
236 switch ( d->m_model ) 238 switch ( d->m_model )
237 { 239 {
238 case Model_Zaurus_SLB600: // fallthrough 240 case Model_Zaurus_SLB600: // fallthrough
239 case Model_Zaurus_SL5500: 241 case Model_Zaurus_SL5500:
240 m_backlightdev = "/sys/class/backlight/locomo-backlight/"; 242 m_backlightdev = "/sys/class/backlight/locomo-backlight/";
241 break; 243 break;
242 case Model_Zaurus_SL6000: 244 case Model_Zaurus_SL6000:
243 m_backlightdev = "/sys/class/backlight/tosa-bl/"; 245 m_backlightdev = "/sys/class/backlight/tosa-bl/";
244 break; 246 break;
245 default: 247 default:
246 m_backlightdev = "/sys/class/backlight/corgi-bl/"; 248 m_backlightdev = "/sys/class/backlight/corgi-bl/";
247 } 249 }
248 250
249 // set initial rotation 251 // set initial rotation
250 switch( d->m_model ) 252 switch( d->m_model )
251 { 253 {
252 case Model_Zaurus_SL6000: // fallthrough 254 case Model_Zaurus_SL6000: // fallthrough
253 case Model_Zaurus_SLA300: 255 case Model_Zaurus_SLA300:
254 d->m_rotation = Rot0; 256 d->m_rotation = Rot0;
255 break; 257 break;
256 case Model_Zaurus_SLC3100: // fallthrough 258 case Model_Zaurus_SLC3100: // fallthrough
257 case Model_Zaurus_SLC3000: // fallthrough 259 case Model_Zaurus_SLC3000: // fallthrough
258 case Model_Zaurus_SLC1000: // fallthrough 260 case Model_Zaurus_SLC1000: // fallthrough
259 case Model_Zaurus_SLC7x0: 261 case Model_Zaurus_SLC7x0:
260 d->m_rotation = rotation(); 262 d->m_rotation = rotation();
261 d->m_direction = direction(); 263 d->m_direction = direction();
262 break; 264 break;
263 case Model_Zaurus_SLB600: // fallthrough 265 case Model_Zaurus_SLB600: // fallthrough
264 case Model_Zaurus_SL5000: // fallthrough 266 case Model_Zaurus_SL5000: // fallthrough
265 case Model_Zaurus_SL5500: // fallthrough 267 case Model_Zaurus_SL5500: // fallthrough
266 default: 268 default:
267 d->m_rotation = Rot270; 269 d->m_rotation = Rot270;
268 } 270 }
269 271
270 // set default qte driver 272 // set default qte driver
271 switch( d->m_model ) 273 switch( d->m_model )
272 { 274 {
273 case Model_Zaurus_SLC7x0: 275 case Model_Zaurus_SLC7x0:
274 d->m_qteDriver = "W100"; 276 d->m_qteDriver = "W100";
275 break; 277 break;
276 default: 278 default:
277 d->m_qteDriver = "Transformed"; 279 d->m_qteDriver = "Transformed";
278 } 280 }
279 281
280 m_leds[0] = Led_Off; 282 m_leds[0] = Led_Off;
281 283
282 if ( m_embedix ) 284 if ( m_embedix )
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}
333 337
334 338
335 339
336typedef struct sharp_led_status { 340typedef struct sharp_led_status {
337 int which; /* select which LED status is wanted. */ 341 int which; /* select which LED status is wanted. */
338 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 342 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
339} sharp_led_status; 343} sharp_led_status;
340 344
341void Zaurus::buzzer( int sound ) 345void Zaurus::buzzer( int sound )
342{ 346{
343#ifndef QT_NO_SOUND 347#ifndef QT_NO_SOUND
344 Sound *snd = 0; 348 Sound *snd = 0;
345 349
346 // All devices except SL5500 have a DSP device 350 // All devices except SL5500 have a DSP device
347 if ( d->m_model != Model_Zaurus_SL5000 351 if ( d->m_model != Model_Zaurus_SL5000
348 && d->m_model != Model_Zaurus_SL5500 ) { 352 && d->m_model != Model_Zaurus_SL5500 ) {
349 353
350 switch ( sound ){ 354 switch ( sound ){
351 case SHARP_BUZ_TOUCHSOUND: { 355 case SHARP_BUZ_TOUCHSOUND: {
352 static Sound touch_sound("touchsound"); 356 static Sound touch_sound("touchsound");
353 snd = &touch_sound; 357 snd = &touch_sound;
354 } 358 }
355 break; 359 break;
356 case SHARP_BUZ_KEYSOUND: { 360 case SHARP_BUZ_KEYSOUND: {
357 static Sound key_sound( "keysound" ); 361 static Sound key_sound( "keysound" );
358 snd = &key_sound; 362 snd = &key_sound;
359 } 363 }
360 break; 364 break;
361 case SHARP_BUZ_SCHEDULE_ALARM: 365 case SHARP_BUZ_SCHEDULE_ALARM:
362 default: { 366 default: {
363 static Sound alarm_sound("alarm"); 367 static Sound alarm_sound("alarm");
364 snd = &alarm_sound; 368 snd = &alarm_sound;
365 } 369 }
366 break; 370 break;
367 } 371 }
368 } 372 }
369 373
370 // If a soundname is defined, we expect that this device has 374 // If a soundname is defined, we expect that this device has
371 // sound capabilities.. Otherwise we expect to have the buzzer 375 // sound capabilities.. Otherwise we expect to have the buzzer
372 // device.. 376 // device..
373 if ( snd && snd->isFinished() ){ 377 if ( snd && snd->isFinished() ){
374 changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); 378 changeMixerForAlarm( 0, "/dev/sound/mixer", snd );
375 snd->play(); 379 snd->play();
376 } else if( !snd ) { 380 } else if( !snd ) {
377 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 381 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
378 382
379 if ( fd >= 0 ) { 383 if ( fd >= 0 ) {
380 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 384 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
381 ::close ( fd ); 385 ::close ( fd );
382 } 386 }
383 387
384 } 388 }
385#endif 389#endif
386} 390}
387 391
388 392
389void Zaurus::playAlarmSound() 393void Zaurus::playAlarmSound()
390{ 394{
391 buzzer( SHARP_BUZ_SCHEDULE_ALARM ); 395 buzzer( SHARP_BUZ_SCHEDULE_ALARM );
392} 396}
393 397
394void Zaurus::playTouchSound() 398void Zaurus::playTouchSound()
395{ 399{
396 buzzer( SHARP_BUZ_TOUCHSOUND ); 400 buzzer( SHARP_BUZ_TOUCHSOUND );
397} 401}
398 402
399void Zaurus::playKeySound() 403void Zaurus::playKeySound()
400{ 404{
401 buzzer( SHARP_BUZ_KEYSOUND ); 405 buzzer( SHARP_BUZ_KEYSOUND );
402} 406}
403 407
404 408
405QValueList <OLed> Zaurus::ledList() const 409QValueList <OLed> Zaurus::ledList() const
406{ 410{
407 QValueList <OLed> vl; 411 QValueList <OLed> vl;
408 vl << Led_Mail; 412 vl << Led_Mail;
409 return vl; 413 return vl;
410} 414}
411 415
412QValueList <OLedState> Zaurus::ledStateList( OLed l ) const 416QValueList <OLedState> Zaurus::ledStateList( OLed l ) const
413{ 417{
414 QValueList <OLedState> vl; 418 QValueList <OLedState> vl;
415 419
416 if ( l == Led_Mail ) 420 if ( l == Led_Mail )
417 vl << Led_Off << Led_On << Led_BlinkSlow; 421 vl << Led_Off << Led_On << Led_BlinkSlow;
418 return vl; 422 return vl;
419} 423}
420 424
421OLedState Zaurus::ledState( OLed which ) const 425OLedState Zaurus::ledState( OLed which ) const
422{ 426{
423 if ( which == Led_Mail ) 427 if ( which == Led_Mail )
424 return m_leds [0]; 428 return m_leds [0];
425 else 429 else
426 return Led_Off; 430 return Led_Off;
427} 431}
428 432
429bool Zaurus::setLedState( OLed which, OLedState st ) 433bool Zaurus::setLedState( OLed which, OLedState st )
430{ 434{
431 // Currently not supported on non_embedix kernels 435 // Currently not supported on non_embedix kernels
432 if (!m_embedix) 436 if (!m_embedix)
433 { 437 {
434 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); 438 qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" );
435 return false; 439 return false;
436 } 440 }
437 441
438 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 442 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
439 443
440 if ( which == Led_Mail ) { 444 if ( which == Led_Mail ) {
441 if ( fd >= 0 ) { 445 if ( fd >= 0 ) {
442 struct sharp_led_status leds; 446 struct sharp_led_status leds;
443 ::memset ( &leds, 0, sizeof( leds )); 447 ::memset ( &leds, 0, sizeof( leds ));
444 leds. which = SHARP_LED_MAIL_EXISTS; 448 leds. which = SHARP_LED_MAIL_EXISTS;
445 bool ok = true; 449 bool ok = true;
446 450
447 switch ( st ) { 451 switch ( st ) {
448 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 452 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
449 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 453 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
450 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 454 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
451 default : ok = false; 455 default : ok = false;
452 } 456 }
453 457
454 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 458 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
455 m_leds [0] = st; 459 m_leds [0] = st;
456 return true; 460 return true;
457 } 461 }
458 } 462 }
459 } 463 }
460 return false; 464 return false;
461} 465}
462 466
463int Zaurus::displayBrightnessResolution() const 467int Zaurus::displayBrightnessResolution() const
464{ 468{
465 int res = 1; 469 int res = 1;
466 if (m_embedix) 470 if (m_embedix)
467 { 471 {
468 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK ); 472 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_RDWR|O_NONBLOCK );
469 if ( fd ) 473 if ( fd )
470 { 474 {
471 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 ); 475 int value = ::ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
472 ::close( fd ); 476 ::close( fd );
473 return value ? value : res; 477 return value ? value : res;
474 } 478 }
475 } 479 }
476 else 480 else
477 { 481 {
478 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK ); 482 int fd = ::open( m_backlightdev + "max_brightness", O_RDONLY|O_NONBLOCK );
479 if ( fd ) 483 if ( fd )
480 { 484 {
481 char buf[100]; 485 char buf[100];
482 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res ); 486 if ( ::read( fd, &buf[0], sizeof buf ) ) ::sscanf( &buf[0], "%d", &res );
483 ::close( fd ); 487 ::close( fd );
484 } 488 }
485 } 489 }
486 return res; 490 return res;
487} 491}
488 492
489bool Zaurus::setDisplayBrightness( int bright ) 493bool Zaurus::setDisplayBrightness( int bright )
490{ 494{
491 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright ); 495 //qDebug( "Zaurus::setDisplayBrightness( %d )", bright );
492 bool res = false; 496 bool res = false;
493 497
494 if ( bright > 255 ) bright = 255; 498 if ( bright > 255 ) bright = 255;
495 if ( bright < 0 ) bright = 0; 499 if ( bright < 0 ) bright = 0;
496 500
497 int numberOfSteps = displayBrightnessResolution(); 501 int numberOfSteps = displayBrightnessResolution();
498 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; 502 int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255;
499 503
500 if ( m_embedix ) 504 if ( m_embedix )
501 { 505 {
502 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 506 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
503 if ( fd ) 507 if ( fd )
504 { 508 {
505 res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 ); 509 res = ( ::ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, val ) == 0 );
506 ::close( fd ); 510 ::close( fd );
507 } 511 }
508 } 512 }
509 else 513 else
510 { 514 {
511 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); 515 int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK );
512 if ( fd ) 516 if ( fd )
513 { 517 {
514 char buf[100]; 518 char buf[100];
515 int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); 519 int len = ::snprintf( &buf[0], sizeof buf, "%d", val );
516 res = ( ::write( fd, &buf[0], len ) == 0 ); 520 res = ( ::write( fd, &buf[0], len ) == 0 );
517 ::close( fd ); 521 ::close( fd );
518 } 522 }
519 } 523 }
520 return res; 524 return res;
521} 525}
522 526
523bool Zaurus::setDisplayStatus( bool on ) 527bool Zaurus::setDisplayStatus( bool on )
524{ 528{
525 bool res = false; 529 bool res = false;
526 if ( m_embedix ) 530 if ( m_embedix )
527 { 531 {
528 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK ); 532 int fd = ::open( SHARP_FL_IOCTL_DEVICE, O_WRONLY|O_NONBLOCK );
529 if ( fd ) 533 if ( fd )
530 { 534 {
531 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF; 535 int ioctlnum = on ? SHARP_FL_IOCTL_ON : SHARP_FL_IOCTL_OFF;
532 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 ); 536 res = ( ::ioctl ( fd, ioctlnum, 0 ) == 0 );
533 ::close ( fd ); 537 ::close ( fd );
534 } 538 }
535 } 539 }
536 else 540 else
537 { 541 {
538 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); 542 int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK );
539 if ( fd ) 543 if ( fd )
540 { 544 {
541 char buf[10]; 545 char buf[10];
542 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; 546 buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
543 buf[1] = '\0'; 547 buf[1] = '\0';
544 res = ( ::write( fd, &buf[0], 2 ) == 0 ); 548 res = ( ::write( fd, &buf[0], 2 ) == 0 );
545 ::close( fd ); 549 ::close( fd );
546 } 550 }
547 } 551 }
548 return res; 552 return res;
549} 553}
550 554
551Transformation Zaurus::rotation() const 555Transformation Zaurus::rotation() const
552{ 556{
553 qDebug( "Zaurus::rotation()" ); 557 qDebug( "Zaurus::rotation()" );
554 Transformation rot; 558 Transformation rot;
555 559
556 switch ( d->m_model ) { 560 switch ( d->m_model ) {
557 case Model_Zaurus_SLC3100: // fallthrough 561 case Model_Zaurus_SLC3100: // fallthrough
558 case Model_Zaurus_SLC3000: // fallthrough 562 case Model_Zaurus_SLC3000: // fallthrough
559 case Model_Zaurus_SLC1000: 563 case Model_Zaurus_SLC1000:
560 { 564 {
561 OHingeStatus hs = readHingeSensor(); 565 OHingeStatus hs = readHingeSensor();
562 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); 566 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
563 if ( hs == CASE_PORTRAIT ) rot = Rot0; 567 if ( hs == CASE_PORTRAIT ) rot = Rot0;
564 else if ( hs == CASE_UNKNOWN ) rot = Rot270; 568 else if ( hs == CASE_UNKNOWN ) rot = Rot270;
565 else rot = Rot270; 569 else rot = Rot270;
566 } 570 }
567 break; 571 break;
568 572
569 // SLC7x0 needs a special case here, because we were able to set the W100 573 // SLC7x0 needs a special case here, because we were able to set the W100
570 // hardware default rotation on kernel 2.6 to Rot0 574 // hardware default rotation on kernel 2.6 to Rot0
571 case Model_Zaurus_SLC7x0: 575 case Model_Zaurus_SLC7x0:
572 { 576 {
573 OHingeStatus hs = readHingeSensor(); 577 OHingeStatus hs = readHingeSensor();
574 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs ); 578 qDebug( "Zaurus::rotation() - hinge sensor = %d", (int) hs );
575 579
576 if ( m_embedix ) 580 if ( m_embedix )
577 { 581 {
578 if ( hs == CASE_PORTRAIT ) rot = Rot0; 582 if ( hs == CASE_PORTRAIT ) rot = Rot0;
579 else if ( hs == CASE_UNKNOWN ) rot = Rot270; 583 else if ( hs == CASE_UNKNOWN ) rot = Rot270;
580 else rot = Rot270; 584 else rot = Rot270;
581 } 585 }
582 else 586 else
583 { 587 {
584 if ( hs == CASE_PORTRAIT ) rot = Rot90; 588 if ( hs == CASE_PORTRAIT ) rot = Rot90;
585 else if ( hs == CASE_UNKNOWN ) rot = Rot0; 589 else if ( hs == CASE_UNKNOWN ) rot = Rot0;
586 else rot = Rot0; 590 else rot = Rot0;
587 } 591 }
588 } 592 }
589 break; 593 break;
590 case Model_Zaurus_SL6000: 594 case Model_Zaurus_SL6000:
591 case Model_Zaurus_SLB600: 595 case Model_Zaurus_SLB600:
592 case Model_Zaurus_SLA300: 596 case Model_Zaurus_SLA300:
593 case Model_Zaurus_SL5500: 597 case Model_Zaurus_SL5500:
594 case Model_Zaurus_SL5000: 598 case Model_Zaurus_SL5000:
595 default: 599 default:
596 rot = d->m_rotation; 600 rot = d->m_rotation;
597 break; 601 break;
598 } 602 }
599 603
600 return rot; 604 return rot;
601} 605}
602ODirection Zaurus::direction() const 606ODirection Zaurus::direction() const
603{ 607{
604 ODirection dir; 608 ODirection dir;
605 609
606 switch ( d->m_model ) { 610 switch ( d->m_model ) {
607 case Model_Zaurus_SLC3100: // fallthrough 611 case Model_Zaurus_SLC3100: // fallthrough
608 case Model_Zaurus_SLC3000: // fallthrough 612 case Model_Zaurus_SLC3000: // fallthrough
609 case Model_Zaurus_SLC1000: // fallthrough 613 case Model_Zaurus_SLC1000: // fallthrough
610 case Model_Zaurus_SLC7x0: { 614 case Model_Zaurus_SLC7x0: {
611 OHingeStatus hs = readHingeSensor(); 615 OHingeStatus hs = readHingeSensor();
612 if ( hs == CASE_PORTRAIT ) dir = CCW; 616 if ( hs == CASE_PORTRAIT ) dir = CCW;
613 else if ( hs == CASE_UNKNOWN ) dir = CCW; 617 else if ( hs == CASE_UNKNOWN ) dir = CCW;
614 else dir = CW; 618 else dir = CW;
615 } 619 }
616 break; 620 break;
617 case Model_Zaurus_SL6000: 621 case Model_Zaurus_SL6000:
618 case Model_Zaurus_SLA300: 622 case Model_Zaurus_SLA300:
619 case Model_Zaurus_SLB600: 623 case Model_Zaurus_SLB600:
620 case Model_Zaurus_SL5500: 624 case Model_Zaurus_SL5500:
621 case Model_Zaurus_SL5000: 625 case Model_Zaurus_SL5000:
622 default: dir = d->m_direction; 626 default: dir = d->m_direction;
623 break; 627 break;
624 } 628 }
625 return dir; 629 return dir;
626 630
627} 631}
628 632
629bool Zaurus::hasHingeSensor() const 633bool Zaurus::hasHingeSensor() const
630{ 634{
631 return d->m_model == Model_Zaurus_SLC7x0 || 635 return d->m_model == Model_Zaurus_SLC7x0 ||
632 d->m_model == Model_Zaurus_SLC3100 || 636 d->m_model == Model_Zaurus_SLC3100 ||
633 d->m_model == Model_Zaurus_SLC3000 || 637 d->m_model == Model_Zaurus_SLC3000 ||
634 d->m_model == Model_Zaurus_SLC1000; 638 d->m_model == Model_Zaurus_SLC1000;
635} 639}
636 640
637OHingeStatus Zaurus::readHingeSensor() const 641OHingeStatus Zaurus::readHingeSensor() const
638{ 642{
639 if (m_embedix) 643 if (m_embedix)
640 { 644 {
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;
696 } 753 }
697 } 754 }
698 break; 755 break;
699 756
700 } 757 }
701 if (newkeycode!=keycode) { 758 if (newkeycode!=keycode) {
702 if ( newkeycode != Key_unknown ) { 759 if ( newkeycode != Key_unknown ) {
703 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 760 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
704 } 761 }
705 return true; 762 return true;
706 } 763 }
707 return false; 764 return false;
708} 765}
709 766
710bool Zaurus::suspend() { 767bool Zaurus::suspend() {
711 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 768 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
712 return false; 769 return false;
713 770
714 bool res = false; 771 bool res = false;
715 QCopChannel::send( "QPE/System", "aboutToSuspend()" ); 772 QCopChannel::send( "QPE/System", "aboutToSuspend()" );
716 773
717 struct timeval tvs, tvn; 774 struct timeval tvs, tvn;
718 ::gettimeofday ( &tvs, 0 ); 775 ::gettimeofday ( &tvs, 0 );
719 776
720 ::sync(); // flush fs caches 777 ::sync(); // flush fs caches
721 res = ( ::system ( "apm --suspend" ) == 0 ); 778 res = ( ::system ( "apm --suspend" ) == 0 );
722 779
723 // This is needed because some apm implementations are asynchronous and we 780 // This is needed because some apm implementations are asynchronous and we
724 // can not be sure when exactly the device is really suspended 781 // can not be sure when exactly the device is really suspended
725 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 782 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
726 // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here. 783 // on non embedix eg. 2.6 kernel line apm is synchronous so we don't need it here.
727 784
728 if ( res && m_embedix) { 785 if ( res && m_embedix) {
729 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 786 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
730 ::usleep ( 200 * 1000 ); 787 ::usleep ( 200 * 1000 );
731 ::gettimeofday ( &tvn, 0 ); 788 ::gettimeofday ( &tvn, 0 );
732 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut ); 789 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < m_timeOut );
733 } 790 }
734 791
735 QCopChannel::send( "QPE/System", "returnFromSuspend()" ); 792 QCopChannel::send( "QPE/System", "returnFromSuspend()" );
736 793
737 return res; 794 return res;
738} 795}
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
@@ -1,145 +1,151 @@
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 =. Copyright (C) 2002-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 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
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)
60#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 61#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
61#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 62#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
62#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 63#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
63#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 64#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
64 65
65// LED 66// LED
66#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 67#define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
67#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 68#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
68#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 69#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
69 70
70#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 71#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
71#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 72#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
72#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 73#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
73 74
74// Rotation and Power Management 75// Rotation and Power Management
75#define SHARP_IOCTL_GET_ROTATION 0x413c 76#define SHARP_IOCTL_GET_ROTATION 0x413c
76 77
77#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 78#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
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
@@ -1,222 +1,260 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; version 2 of the License. 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11     ._= =}       : 11     ._= =}       :
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27*/ 27*/
28 28
29#include "oinputsystem.h" 29#include "oinputsystem.h"
30using namespace Opie::Core; 30using namespace Opie::Core;
31 31
32/* QT */ 32/* QT */
33#include <qdir.h> 33#include <qdir.h>
34#include <qfile.h> 34#include <qfile.h>
35 35
36/* STD */ 36/* STD */
37#include <errno.h> 37#include <errno.h>
38#include <string.h> 38#include <string.h>
39#include <sys/fcntl.h> 39#include <sys/fcntl.h>
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41#include <unistd.h> 41#include <unistd.h>
42 42
43#define BUFSIZE 256 43#define BUFSIZE 256
44#define BIT_MASK( name, numbits ) \ 44#define BIT_MASK( name, numbits ) \
45 unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ 45 unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \
46 memset( name, 0, sizeof( name ) ) 46 memset( name, 0, sizeof( name ) )
47#define BIT_TEST( bitmask, bit ) \ 47#define BIT_TEST( bitmask, bit ) \
48 ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) 48 ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) )
49 49
50/*====================================================================================== 50/*======================================================================================
51 * OInputSystem 51 * OInputSystem
52 *======================================================================================*/ 52 *======================================================================================*/
53 53
54OInputSystem* OInputSystem::_instance = 0; 54OInputSystem* OInputSystem::_instance = 0;
55 55
56OInputSystem::OInputSystem() : QObject() 56OInputSystem::OInputSystem() : QObject()
57{ 57{
58 qDebug( "OInputSystem::OInputSystem()" ); 58 qDebug( "OInputSystem::OInputSystem()" );
59 synchronize(); 59 synchronize();
60} 60}
61 61
62 62
63void OInputSystem::synchronize() 63void OInputSystem::synchronize()
64{ 64{
65 qDebug( "OInputSystem::synchronize()" ); 65 qDebug( "OInputSystem::synchronize()" );
66 QDir devInput( "/dev/input/" ); 66 QDir devInput( "/dev/input/" );
67 if ( devInput.exists() ) 67 if ( devInput.exists() )
68 { 68 {
69 QStringList devInputFiles = devInput.entryList( QDir::System, QDir::Name ); 69 QStringList devInputFiles = devInput.entryList( QDir::System, QDir::Name );
70 for ( QStringList::Iterator it = devInputFiles.begin(); it != devInputFiles.end(); ++it ) 70 for ( QStringList::Iterator it = devInputFiles.begin(); it != devInputFiles.end(); ++it )
71 { 71 {
72 QString absPath = devInput.absFilePath( *it ); 72 QString absPath = devInput.absFilePath( *it );
73 bool isValid = OInputDevice::isValid( absPath ); 73 bool isValid = OInputDevice::isValid( absPath );
74 qDebug( "OInputSystem::synchronize() - checking if '%s' is a valid input system node... '%s' [%s]", 74 qDebug( "OInputSystem::synchronize() - checking if '%s' is a valid input system node... '%s' [%s]",
75 (const char*) absPath, isValid ? "yes" : "no", isValid ? "(ok)" : strerror( errno ) ); 75 (const char*) absPath, isValid ? "yes" : "no", isValid ? "(ok)" : strerror( errno ) );
76 if ( isValid ) _devices.insert( *it, new OInputDevice( this, absPath ) ); 76 if ( isValid ) _devices.insert( *it, new OInputDevice( this, absPath ) );
77 } 77 }
78 } 78 }
79 qDebug( "OInputSystem::synchronize() done" ); 79 qDebug( "OInputSystem::synchronize() done" );
80 if ( !_devices.count() ) 80 if ( !_devices.count() )
81 qWarning( "OInputSystem::no devices found" ); 81 qWarning( "OInputSystem::no devices found" );
82} 82}
83 83
84 84
85OInputSystem::~OInputSystem() 85OInputSystem::~OInputSystem()
86{ 86{
87 qDebug( "OInputSystem::~OInputSystem()" ); 87 qDebug( "OInputSystem::~OInputSystem()" );
88} 88}
89 89
90 90
91int OInputSystem::count() const 91int OInputSystem::count() const
92{ 92{
93 return _devices.count(); 93 return _devices.count();
94} 94}
95 95
96 96
97OInputDevice* OInputSystem::device( const QString& device ) const 97OInputDevice* OInputSystem::device( const QString& device ) const
98{ 98{
99 return _devices[device]; 99 return _devices[device];
100} 100}
101 101
102 102
103OInputSystem* OInputSystem::instance() 103OInputSystem* OInputSystem::instance()
104{ 104{
105 if ( !_instance ) _instance = new OInputSystem(); 105 if ( !_instance ) _instance = new OInputSystem();
106 return _instance; 106 return _instance;
107} 107}
108 108
109 109
110OInputSystem::DeviceIterator OInputSystem::iterator() const 110OInputSystem::DeviceIterator OInputSystem::iterator() const
111{ 111{
112 return OInputSystem::DeviceIterator( _devices ); 112 return OInputSystem::DeviceIterator( _devices );
113} 113}
114 114
115/*====================================================================================== 115/*======================================================================================
116 * OInputDevice 116 * OInputDevice
117 *======================================================================================*/ 117 *======================================================================================*/
118 118
119OInputDevice::OInputDevice( QObject* parent, const char* name ) : QObject( parent, name ) 119OInputDevice::OInputDevice( QObject* parent, const char* name ) : QObject( parent, name )
120{ 120{
121 qDebug( "OInputDevice::OInputDevice( '%s' )", name ); 121 qDebug( "OInputDevice::OInputDevice( '%s' )", name );
122 122
123 _fd = ::open( name, O_RDONLY ); 123 _fd = ::open( name, O_RDONLY );
124 if ( _fd == -1 ) 124 if ( _fd == -1 )
125 { 125 {
126 qDebug( "OInputDevice::OInputDevice() - Warning: couldn't open %s (%s)", name, strerror( errno ) ); 126 qDebug( "OInputDevice::OInputDevice() - Warning: couldn't open %s (%s)", name, strerror( errno ) );
127 } 127 }
128} 128}
129 129
130 130
131OInputDevice::~OInputDevice() 131OInputDevice::~OInputDevice()
132{ 132{
133 qDebug( "OInputDevice::~OInputDevice()" ); 133 qDebug( "OInputDevice::~OInputDevice()" );
134} 134}
135 135
136 136
137QString OInputDevice::identity() const 137QString OInputDevice::identity() const
138{ 138{
139 char buf[BUFSIZE] = "<unknown>"; 139 char buf[BUFSIZE] = "<unknown>";
140 ::ioctl( _fd, EVIOCGNAME(sizeof buf), buf ); 140 ::ioctl( _fd, EVIOCGNAME(sizeof buf), buf );
141 return buf; 141 return buf;
142} 142}
143 143
144 144
145QString OInputDevice::path() const 145QString OInputDevice::path() const
146{ 146{
147 char buf[BUFSIZE] = "<unknown>"; 147 char buf[BUFSIZE] = "<unknown>";
148 ::ioctl( _fd, EVIOCGPHYS(sizeof buf), buf ); 148 ::ioctl( _fd, EVIOCGPHYS(sizeof buf), buf );
149 return buf; 149 return buf;
150} 150}
151 151
152 152
153QString OInputDevice::uniq() const 153QString OInputDevice::uniq() const
154{ 154{
155 char buf[BUFSIZE] = "<unknown>"; 155 char buf[BUFSIZE] = "<unknown>";
156 ::ioctl( _fd, EVIOCGUNIQ(sizeof buf), buf ); 156 ::ioctl( _fd, EVIOCGUNIQ(sizeof buf), buf );
157 return buf; 157 return buf;
158} 158}
159 159
160 160
161bool OInputDevice::hasFeature( Feature bit ) const 161bool OInputDevice::hasFeature( Feature bit ) const
162{ 162{
163 BIT_MASK( features, EV_MAX ); 163 BIT_MASK( features, EV_MAX );
164 164
165 if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) 165 if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 )
166 { 166 {
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
@@ -1,142 +1,151 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 3 =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 .=l. 4 .=l.
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can 6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; version 2 of the License. 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11     ._= =}       : 11     ._= =}       :
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that 13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27*/ 27*/
28 28
29#ifndef OINPUTSYSTEM_H 29#ifndef OINPUTSYSTEM_H
30#define OINPUTSYSTEM_H 30#define OINPUTSYSTEM_H
31 31
32#include "linux_input.h" 32#include "linux_input.h"
33 33
34/* QT */ 34/* QT */
35#include <qobject.h> 35#include <qobject.h>
36#include <qdict.h> 36#include <qdict.h>
37 37
38namespace Opie { 38namespace Opie {
39namespace Core { 39namespace Core {
40 40
41class OInputDevice; 41class OInputDevice;
42 42
43/** 43/**
44 * @brief A container class for the Linux input device subsystem 44 * @brief A container class for the Linux input device subsystem
45 * 45 *
46 * This class provides access to all available input system devices of your device. 46 * This class provides access to all available input system devices of your device.
47 * 47 *
48 * @author Michael 'Mickey' Lauer <mickey@Vanille.de> 48 * @author Michael 'Mickey' Lauer <mickey@Vanille.de>
49 */ 49 */
50class OInputSystem : public QObject 50class OInputSystem : public QObject
51{ 51{
52 public: 52 public:
53 typedef QDict<OInputDevice> DeviceMap; 53 typedef QDict<OInputDevice> DeviceMap;
54 typedef QDictIterator<OInputDevice> DeviceIterator; 54 typedef QDictIterator<OInputDevice> DeviceIterator;
55 55
56 /** 56 /**
57 * @returns the number of available input devices 57 * @returns the number of available input devices
58 */ 58 */
59 int count() const; 59 int count() const;
60 /** 60 /**
61 * @returns a pointer to the (one and only) @ref OInputSystem instance. 61 * @returns a pointer to the (one and only) @ref OInputSystem instance.
62 */ 62 */
63 static OInputSystem* instance(); 63 static OInputSystem* instance();
64 /** 64 /**
65 * @returns an iterator usable for iterating through all network interfaces. 65 * @returns an iterator usable for iterating through all network interfaces.
66 */ 66 */
67 DeviceIterator iterator() const; 67 DeviceIterator iterator() const;
68 /** 68 /**
69 * @returns a pointer to the @ref OAudioInterface object for the specified @a interface or 0, if not found 69 * @returns a pointer to the @ref OAudioInterface object for the specified @a interface or 0, if not found
70 * @see OAudioInterface 70 * @see OAudioInterface
71 */ 71 */
72 OInputDevice* device( const QString& interface ) const; 72 OInputDevice* device( const QString& interface ) const;
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
@@ -1,988 +1,1013 @@
1#ifndef _INPUT_H 1#ifndef _INPUT_H
2#define _INPUT_H 2#define _INPUT_H
3 3
4/* 4/*
5 * Copyright (c) 1999-2002 Vojtech Pavlik 5 * Copyright (c) 1999-2002 Vojtech Pavlik
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by 8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#else 15#else
16#include <sys/time.h> 16#include <sys/time.h>
17#include <sys/ioctl.h> 17#include <sys/ioctl.h>
18#include <asm/types.h> 18#include <asm/types.h>
19#endif 19#endif
20 20
21/* 21/*
22 * The event structure itself 22 * The event structure itself
23 */ 23 */
24 24
25struct input_event { 25struct input_event {
26 struct timeval time; 26 struct timeval time;
27 __u16 type; 27 __u16 type;
28 __u16 code; 28 __u16 code;
29 __s32 value; 29 __s32 value;
30}; 30};
31 31
32/* 32/*
33 * Protocol version. 33 * Protocol version.
34 */ 34 */
35 35
36 #define EV_VERSION 0x010000 36 #define EV_VERSION 0x010000
37 37
38/* 38/*
39 * IOCTLs (0x00 - 0x7f) 39 * IOCTLs (0x00 - 0x7f)
40 */ 40 */
41 41
42struct input_id { 42struct input_id {
43 __u16 bustype; 43 __u16 bustype;
44 __u16 vendor; 44 __u16 vendor;
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
113 #define KEY_4 5 115 #define KEY_4 5
114 #define KEY_5 6 116 #define KEY_5 6
115 #define KEY_6 7 117 #define KEY_6 7
116 #define KEY_7 8 118 #define KEY_7 8
117 #define KEY_8 9 119 #define KEY_8 9
118 #define KEY_9 10 120 #define KEY_9 10
119 #define KEY_0 11 121 #define KEY_0 11
120 #define KEY_MINUS 12 122 #define KEY_MINUS 12
121 #define KEY_EQUAL 13 123 #define KEY_EQUAL 13
122 #define KEY_BACKSPACE 14 124 #define KEY_BACKSPACE 14
123 #define KEY_TAB 15 125 #define KEY_TAB 15
124 #define KEY_Q 16 126 #define KEY_Q 16
125 #define KEY_W 17 127 #define KEY_W 17
126 #define KEY_E 18 128 #define KEY_E 18
127 #define KEY_R 19 129 #define KEY_R 19
128 #define KEY_T 20 130 #define KEY_T 20
129 #define KEY_Y 21 131 #define KEY_Y 21
130 #define KEY_U 22 132 #define KEY_U 22
131 #define KEY_I 23 133 #define KEY_I 23
132 #define KEY_O 24 134 #define KEY_O 24
133 #define KEY_P 25 135 #define KEY_P 25
134 #define KEY_LEFTBRACE 26 136 #define KEY_LEFTBRACE 26
135 #define KEY_RIGHTBRACE 27 137 #define KEY_RIGHTBRACE 27
136 #define KEY_ENTER 28 138 #define KEY_ENTER 28
137 #define KEY_LEFTCTRL 29 139 #define KEY_LEFTCTRL 29
138 #define KEY_A 30 140 #define KEY_A 30
139 #define KEY_S 31 141 #define KEY_S 31
140 #define KEY_D 32 142 #define KEY_D 32
141 #define KEY_F 33 143 #define KEY_F 33
142 #define KEY_G 34 144 #define KEY_G 34
143 #define KEY_H 35 145 #define KEY_H 35
144 #define KEY_J 36 146 #define KEY_J 36
145 #define KEY_K 37 147 #define KEY_K 37
146 #define KEY_L 38 148 #define KEY_L 38
147 #define KEY_SEMICOLON 39 149 #define KEY_SEMICOLON 39
148 #define KEY_APOSTROPHE 40 150 #define KEY_APOSTROPHE 40
149 #define KEY_GRAVE 41 151 #define KEY_GRAVE 41
150 #define KEY_LEFTSHIFT 42 152 #define KEY_LEFTSHIFT 42
151 #define KEY_BACKSLASH 43 153 #define KEY_BACKSLASH 43
152 #define KEY_Z 44 154 #define KEY_Z 44
153 #define KEY_X 45 155 #define KEY_X 45
154 #define KEY_C 46 156 #define KEY_C 46
155 #define KEY_V 47 157 #define KEY_V 47
156 #define KEY_B 48 158 #define KEY_B 48
157 #define KEY_N 49 159 #define KEY_N 49
158 #define KEY_M 50 160 #define KEY_M 50
159 #define KEY_COMMA 51 161 #define KEY_COMMA 51
160 #define KEY_DOT 52 162 #define KEY_DOT 52
161 #define KEY_SLASH 53 163 #define KEY_SLASH 53
162 #define KEY_RIGHTSHIFT 54 164 #define KEY_RIGHTSHIFT 54
163 #define KEY_KPASTERISK 55 165 #define KEY_KPASTERISK 55
164 #define KEY_LEFTALT 56 166 #define KEY_LEFTALT 56
165 #define KEY_SPACE 57 167 #define KEY_SPACE 57
166 #define KEY_CAPSLOCK 58 168 #define KEY_CAPSLOCK 58
167 #define KEY_F1 59 169 #define KEY_F1 59
168 #define KEY_F2 60 170 #define KEY_F2 60
169 #define KEY_F3 61 171 #define KEY_F3 61
170 #define KEY_F4 62 172 #define KEY_F4 62
171 #define KEY_F5 63 173 #define KEY_F5 63
172 #define KEY_F6 64 174 #define KEY_F6 64
173 #define KEY_F7 65 175 #define KEY_F7 65
174 #define KEY_F8 66 176 #define KEY_F8 66
175 #define KEY_F9 67 177 #define KEY_F9 67
176 #define KEY_F10 68 178 #define KEY_F10 68
177 #define KEY_NUMLOCK 69 179 #define KEY_NUMLOCK 69
178 #define KEY_SCROLLLOCK 70 180 #define KEY_SCROLLLOCK 70
179 #define KEY_KP7 71 181 #define KEY_KP7 71
180 #define KEY_KP8 72 182 #define KEY_KP8 72
181 #define KEY_KP9 73 183 #define KEY_KP9 73
182 #define KEY_KPMINUS 74 184 #define KEY_KPMINUS 74
183 #define KEY_KP4 75 185 #define KEY_KP4 75
184 #define KEY_KP5 76 186 #define KEY_KP5 76
185 #define KEY_KP6 77 187 #define KEY_KP6 77
186 #define KEY_KPPLUS 78 188 #define KEY_KPPLUS 78
187 #define KEY_KP1 79 189 #define KEY_KP1 79
188 #define KEY_KP2 80 190 #define KEY_KP2 80
189 #define KEY_KP3 81 191 #define KEY_KP3 81
190 #define KEY_KP0 82 192 #define KEY_KP0 82
191 #define KEY_KPDOT 83 193 #define KEY_KPDOT 83
192 194
193 #define KEY_ZENKAKUHANKAKU85 195 #define KEY_ZENKAKUHANKAKU85
194 #define KEY_102ND 86 196 #define KEY_102ND 86
195 #define KEY_F11 87 197 #define KEY_F11 87
196 #define KEY_F12 88 198 #define KEY_F12 88
197 #define KEY_RO 89 199 #define KEY_RO 89
198 #define KEY_KATAKANA 90 200 #define KEY_KATAKANA 90
199 #define KEY_HIRAGANA 91 201 #define KEY_HIRAGANA 91
200 #define KEY_HENKAN 92 202 #define KEY_HENKAN 92
201 #define KEY_KATAKANAHIRAGANA93 203 #define KEY_KATAKANAHIRAGANA93
202 #define KEY_MUHENKAN 94 204 #define KEY_MUHENKAN 94
203 #define KEY_KPJPCOMMA 95 205 #define KEY_KPJPCOMMA 95
204 #define KEY_KPENTER 96 206 #define KEY_KPENTER 96
205 #define KEY_RIGHTCTRL 97 207 #define KEY_RIGHTCTRL 97
206 #define KEY_KPSLASH 98 208 #define KEY_KPSLASH 98
207 #define KEY_SYSRQ 99 209 #define KEY_SYSRQ 99
208 #define KEY_RIGHTALT 100 210 #define KEY_RIGHTALT 100
209 #define KEY_LINEFEED 101 211 #define KEY_LINEFEED 101
210 #define KEY_HOME 102 212 #define KEY_HOME 102
211 #define KEY_UP 103 213 #define KEY_UP 103
212 #define KEY_PAGEUP 104 214 #define KEY_PAGEUP 104
213 #define KEY_LEFT 105 215 #define KEY_LEFT 105
214 #define KEY_RIGHT 106 216 #define KEY_RIGHT 106
215 #define KEY_END 107 217 #define KEY_END 107
216 #define KEY_DOWN 108 218 #define KEY_DOWN 108
217 #define KEY_PAGEDOWN 109 219 #define KEY_PAGEDOWN 109
218 #define KEY_INSERT 110 220 #define KEY_INSERT 110
219 #define KEY_DELETE 111 221 #define KEY_DELETE 111
220 #define KEY_MACRO 112 222 #define KEY_MACRO 112
221 #define KEY_MUTE 113 223 #define KEY_MUTE 113
222 #define KEY_VOLUMEDOWN 114 224 #define KEY_VOLUMEDOWN 114
223 #define KEY_VOLUMEUP 115 225 #define KEY_VOLUMEUP 115
224 #define KEY_POWER 116 226 #define KEY_POWER 116
225 #define KEY_KPEQUAL 117 227 #define KEY_KPEQUAL 117
226 #define KEY_KPPLUSMINUS 118 228 #define KEY_KPPLUSMINUS 118
227 #define KEY_PAUSE 119 229 #define KEY_PAUSE 119
228 230
229 #define KEY_KPCOMMA 121 231 #define KEY_KPCOMMA 121
230 #define KEY_HANGUEL 122 232 #define KEY_HANGUEL 122
231 #define KEY_HANJA 123 233 #define KEY_HANJA 123
232 #define KEY_YEN 124 234 #define KEY_YEN 124
233 #define KEY_LEFTMETA 125 235 #define KEY_LEFTMETA 125
234 #define KEY_RIGHTMETA 126 236 #define KEY_RIGHTMETA 126
235 #define KEY_COMPOSE 127 237 #define KEY_COMPOSE 127
236 238
237 #define KEY_STOP 128 239 #define KEY_STOP 128
238 #define KEY_AGAIN 129 240 #define KEY_AGAIN 129
239 #define KEY_PROPS 130 241 #define KEY_PROPS 130
240 #define KEY_UNDO 131 242 #define KEY_UNDO 131
241 #define KEY_FRONT 132 243 #define KEY_FRONT 132
242 #define KEY_COPY 133 244 #define KEY_COPY 133
243 #define KEY_OPEN 134 245 #define KEY_OPEN 134
244 #define KEY_PASTE 135 246 #define KEY_PASTE 135
245 #define KEY_FIND 136 247 #define KEY_FIND 136
246 #define KEY_CUT 137 248 #define KEY_CUT 137
247 #define KEY_HELP 138 249 #define KEY_HELP 138
248 #define KEY_MENU 139 250 #define KEY_MENU 139
249 #define KEY_CALC 140 251 #define KEY_CALC 140
250 #define KEY_SETUP 141 252 #define KEY_SETUP 141
251 #define KEY_SLEEP 142 253 #define KEY_SLEEP 142
252 #define KEY_WAKEUP 143 254 #define KEY_WAKEUP 143
253 #define KEY_FILE 144 255 #define KEY_FILE 144
254 #define KEY_SENDFILE 145 256 #define KEY_SENDFILE 145
255 #define KEY_DELETEFILE 146 257 #define KEY_DELETEFILE 146
256 #define KEY_XFER 147 258 #define KEY_XFER 147
257 #define KEY_PROG1 148 259 #define KEY_PROG1 148
258 #define KEY_PROG2 149 260 #define KEY_PROG2 149
259 #define KEY_WWW 150 261 #define KEY_WWW 150
260 #define KEY_MSDOS 151 262 #define KEY_MSDOS 151
261 #define KEY_COFFEE 152 263 #define KEY_COFFEE 152
262 #define KEY_DIRECTION 153 264 #define KEY_DIRECTION 153
263 #define KEY_CYCLEWINDOWS154 265 #define KEY_CYCLEWINDOWS154
264 #define KEY_MAIL 155 266 #define KEY_MAIL 155
265 #define KEY_BOOKMARKS 156 267 #define KEY_BOOKMARKS 156
266 #define KEY_COMPUTER 157 268 #define KEY_COMPUTER 157
267 #define KEY_BACK 158 269 #define KEY_BACK 158
268 #define KEY_FORWARD 159 270 #define KEY_FORWARD 159
269 #define KEY_CLOSECD 160 271 #define KEY_CLOSECD 160
270 #define KEY_EJECTCD 161 272 #define KEY_EJECTCD 161
271 #define KEY_EJECTCLOSECD162 273 #define KEY_EJECTCLOSECD162
272 #define KEY_NEXTSONG 163 274 #define KEY_NEXTSONG 163
273 #define KEY_PLAYPAUSE 164 275 #define KEY_PLAYPAUSE 164
274 #define KEY_PREVIOUSSONG165 276 #define KEY_PREVIOUSSONG165
275 #define KEY_STOPCD 166 277 #define KEY_STOPCD 166
276 #define KEY_RECORD 167 278 #define KEY_RECORD 167
277 #define KEY_REWIND 168 279 #define KEY_REWIND 168
278 #define KEY_PHONE 169 280 #define KEY_PHONE 169
279 #define KEY_ISO 170 281 #define KEY_ISO 170
280 #define KEY_CONFIG 171 282 #define KEY_CONFIG 171
281 #define KEY_HOMEPAGE 172 283 #define KEY_HOMEPAGE 172
282 #define KEY_REFRESH 173 284 #define KEY_REFRESH 173
283 #define KEY_EXIT 174 285 #define KEY_EXIT 174
284 #define KEY_MOVE 175 286 #define KEY_MOVE 175
285 #define KEY_EDIT 176 287 #define KEY_EDIT 176
286 #define KEY_SCROLLUP 177 288 #define KEY_SCROLLUP 177
287 #define KEY_SCROLLDOWN 178 289 #define KEY_SCROLLDOWN 178
288 #define KEY_KPLEFTPAREN 179 290 #define KEY_KPLEFTPAREN 179
289 #define KEY_KPRIGHTPAREN180 291 #define KEY_KPRIGHTPAREN180
290 292
291 #define KEY_F13 183 293 #define KEY_F13 183
292 #define KEY_F14 184 294 #define KEY_F14 184
293 #define KEY_F15 185 295 #define KEY_F15 185
294 #define KEY_F16 186 296 #define KEY_F16 186
295 #define KEY_F17 187 297 #define KEY_F17 187
296 #define KEY_F18 188 298 #define KEY_F18 188
297 #define KEY_F19 189 299 #define KEY_F19 189
298 #define KEY_F20 190 300 #define KEY_F20 190
299 #define KEY_F21 191 301 #define KEY_F21 191
300 #define KEY_F22 192 302 #define KEY_F22 192
301 #define KEY_F23 193 303 #define KEY_F23 193
302 #define KEY_F24 194 304 #define KEY_F24 194
303 305
304 #define KEY_PLAYCD 200 306 #define KEY_PLAYCD 200
305 #define KEY_PAUSECD 201 307 #define KEY_PAUSECD 201
306 #define KEY_PROG3 202 308 #define KEY_PROG3 202
307 #define KEY_PROG4 203 309 #define KEY_PROG4 203
308 #define KEY_SUSPEND 205 310 #define KEY_SUSPEND 205
309 #define KEY_CLOSE 206 311 #define KEY_CLOSE 206
310 #define KEY_PLAY 207 312 #define KEY_PLAY 207
311 #define KEY_FASTFORWARD 208 313 #define KEY_FASTFORWARD 208
312 #define KEY_BASSBOOST 209 314 #define KEY_BASSBOOST 209
313 #define KEY_PRINT 210 315 #define KEY_PRINT 210
314 #define KEY_HP 211 316 #define KEY_HP 211
315 #define KEY_CAMERA 212 317 #define KEY_CAMERA 212
316 #define KEY_SOUND 213 318 #define KEY_SOUND 213
317 #define KEY_QUESTION 214 319 #define KEY_QUESTION 214
318 #define KEY_EMAIL 215 320 #define KEY_EMAIL 215
319 #define KEY_CHAT 216 321 #define KEY_CHAT 216
320 #define KEY_SEARCH 217 322 #define KEY_SEARCH 217
321 #define KEY_CONNECT 218 323 #define KEY_CONNECT 218
322 #define KEY_FINANCE 219 324 #define KEY_FINANCE 219
323 #define KEY_SPORT 220 325 #define KEY_SPORT 220
324 #define KEY_SHOP 221 326 #define KEY_SHOP 221
325 #define KEY_ALTERASE 222 327 #define KEY_ALTERASE 222
326 #define KEY_CANCEL 223 328 #define KEY_CANCEL 223
327 #define KEY_BRIGHTNESSDOWN224 329 #define KEY_BRIGHTNESSDOWN224
328 #define KEY_BRIGHTNESSUP225 330 #define KEY_BRIGHTNESSUP225
329 #define KEY_MEDIA 226 331 #define KEY_MEDIA 226
330 332
331 #define KEY_UNKNOWN 240 333 #define KEY_UNKNOWN 240
332 334
333 #define BTN_MISC 0x100 335 #define BTN_MISC 0x100
334 #define BTN_0 0x100 336 #define BTN_0 0x100
335 #define BTN_1 0x101 337 #define BTN_1 0x101
336 #define BTN_2 0x102 338 #define BTN_2 0x102
337 #define BTN_3 0x103 339 #define BTN_3 0x103
338 #define BTN_4 0x104 340 #define BTN_4 0x104
339 #define BTN_5 0x105 341 #define BTN_5 0x105
340 #define BTN_6 0x106 342 #define BTN_6 0x106
341 #define BTN_7 0x107 343 #define BTN_7 0x107
342 #define BTN_8 0x108 344 #define BTN_8 0x108
343 #define BTN_9 0x109 345 #define BTN_9 0x109
344 346
345 #define BTN_MOUSE 0x110 347 #define BTN_MOUSE 0x110
346 #define BTN_LEFT 0x110 348 #define BTN_LEFT 0x110
347 #define BTN_RIGHT 0x111 349 #define BTN_RIGHT 0x111
348 #define BTN_MIDDLE 0x112 350 #define BTN_MIDDLE 0x112
349 #define BTN_SIDE 0x113 351 #define BTN_SIDE 0x113
350 #define BTN_EXTRA 0x114 352 #define BTN_EXTRA 0x114
351 #define BTN_FORWARD 0x115 353 #define BTN_FORWARD 0x115
352 #define BTN_BACK 0x116 354 #define BTN_BACK 0x116
353 #define BTN_TASK 0x117 355 #define BTN_TASK 0x117
354 356
355 #define BTN_JOYSTICK 0x120 357 #define BTN_JOYSTICK 0x120
356 #define BTN_TRIGGER 0x120 358 #define BTN_TRIGGER 0x120
357 #define BTN_THUMB 0x121 359 #define BTN_THUMB 0x121
358 #define BTN_THUMB2 0x122 360 #define BTN_THUMB2 0x122
359 #define BTN_TOP 0x123 361 #define BTN_TOP 0x123
360 #define BTN_TOP2 0x124 362 #define BTN_TOP2 0x124
361 #define BTN_PINKIE 0x125 363 #define BTN_PINKIE 0x125
362 #define BTN_BASE 0x126 364 #define BTN_BASE 0x126
363 #define BTN_BASE2 0x127 365 #define BTN_BASE2 0x127
364 #define BTN_BASE3 0x128 366 #define BTN_BASE3 0x128
365 #define BTN_BASE4 0x129 367 #define BTN_BASE4 0x129
366 #define BTN_BASE5 0x12a 368 #define BTN_BASE5 0x12a
367 #define BTN_BASE6 0x12b 369 #define BTN_BASE6 0x12b
368 #define BTN_DEAD 0x12f 370 #define BTN_DEAD 0x12f
369 371
370 #define BTN_GAMEPAD 0x130 372 #define BTN_GAMEPAD 0x130
371 #define BTN_A 0x130 373 #define BTN_A 0x130
372 #define BTN_B 0x131 374 #define BTN_B 0x131
373 #define BTN_C 0x132 375 #define BTN_C 0x132
374 #define BTN_X 0x133 376 #define BTN_X 0x133
375 #define BTN_Y 0x134 377 #define BTN_Y 0x134
376 #define BTN_Z 0x135 378 #define BTN_Z 0x135
377 #define BTN_TL 0x136 379 #define BTN_TL 0x136
378 #define BTN_TR 0x137 380 #define BTN_TR 0x137
379 #define BTN_TL2 0x138 381 #define BTN_TL2 0x138
380 #define BTN_TR2 0x139 382 #define BTN_TR2 0x139
381 #define BTN_SELECT 0x13a 383 #define BTN_SELECT 0x13a
382 #define BTN_START 0x13b 384 #define BTN_START 0x13b
383 #define BTN_MODE 0x13c 385 #define BTN_MODE 0x13c
384 #define BTN_THUMBL 0x13d 386 #define BTN_THUMBL 0x13d
385 #define BTN_THUMBR 0x13e 387 #define BTN_THUMBR 0x13e
386 388
387 #define BTN_DIGI 0x140 389 #define BTN_DIGI 0x140
388 #define BTN_TOOL_PEN 0x140 390 #define BTN_TOOL_PEN 0x140
389 #define BTN_TOOL_RUBBER 0x141 391 #define BTN_TOOL_RUBBER 0x141
390 #define BTN_TOOL_BRUSH 0x142 392 #define BTN_TOOL_BRUSH 0x142
391 #define BTN_TOOL_PENCIL 0x143 393 #define BTN_TOOL_PENCIL 0x143
392 #define BTN_TOOL_AIRBRUSH0x144 394 #define BTN_TOOL_AIRBRUSH0x144
393 #define BTN_TOOL_FINGER 0x145 395 #define BTN_TOOL_FINGER 0x145
394 #define BTN_TOOL_MOUSE 0x146 396 #define BTN_TOOL_MOUSE 0x146
395 #define BTN_TOOL_LENS 0x147 397 #define BTN_TOOL_LENS 0x147
396 #define BTN_TOUCH 0x14a 398 #define BTN_TOUCH 0x14a
397 #define BTN_STYLUS 0x14b 399 #define BTN_STYLUS 0x14b
398 #define BTN_STYLUS2 0x14c 400 #define BTN_STYLUS2 0x14c
399 #define BTN_TOOL_DOUBLETAP0x14d 401 #define BTN_TOOL_DOUBLETAP0x14d
400 #define BTN_TOOL_TRIPLETAP0x14e 402 #define BTN_TOOL_TRIPLETAP0x14e
401 403
402 #define BTN_WHEEL 0x150 404 #define BTN_WHEEL 0x150
403 #define BTN_GEAR_DOWN 0x150 405 #define BTN_GEAR_DOWN 0x150
404 #define BTN_GEAR_UP 0x151 406 #define BTN_GEAR_UP 0x151
405 407
406 #define KEY_OK 0x160 408 #define KEY_OK 0x160
407 #define KEY_SELECT 0x161 409 #define KEY_SELECT 0x161
408 #define KEY_GOTO 0x162 410 #define KEY_GOTO 0x162
409 #define KEY_CLEAR 0x163 411 #define KEY_CLEAR 0x163
410 #define KEY_POWER2 0x164 412 #define KEY_POWER2 0x164
411 #define KEY_OPTION 0x165 413 #define KEY_OPTION 0x165
412 #define KEY_INFO 0x166 414 #define KEY_INFO 0x166
413 #define KEY_TIME 0x167 415 #define KEY_TIME 0x167
414 #define KEY_VENDOR 0x168 416 #define KEY_VENDOR 0x168
415 #define KEY_ARCHIVE 0x169 417 #define KEY_ARCHIVE 0x169
416 #define KEY_PROGRAM 0x16a 418 #define KEY_PROGRAM 0x16a
417 #define KEY_CHANNEL 0x16b 419 #define KEY_CHANNEL 0x16b
418 #define KEY_FAVORITES 0x16c 420 #define KEY_FAVORITES 0x16c
419 #define KEY_EPG 0x16d 421 #define KEY_EPG 0x16d
420 #define KEY_PVR 0x16e 422 #define KEY_PVR 0x16e
421 #define KEY_MHP 0x16f 423 #define KEY_MHP 0x16f
422 #define KEY_LANGUAGE 0x170 424 #define KEY_LANGUAGE 0x170
423 #define KEY_TITLE 0x171 425 #define KEY_TITLE 0x171
424 #define KEY_SUBTITLE 0x172 426 #define KEY_SUBTITLE 0x172
425 #define KEY_ANGLE 0x173 427 #define KEY_ANGLE 0x173
426 #define KEY_ZOOM 0x174 428 #define KEY_ZOOM 0x174
427 #define KEY_MODE 0x175 429 #define KEY_MODE 0x175
428 #define KEY_KEYBOARD 0x176 430 #define KEY_KEYBOARD 0x176
429 #define KEY_SCREEN 0x177 431 #define KEY_SCREEN 0x177
430 #define KEY_PC 0x178 432 #define KEY_PC 0x178
431 #define KEY_TV 0x179 433 #define KEY_TV 0x179
432 #define KEY_TV2 0x17a 434 #define KEY_TV2 0x17a
433 #define KEY_VCR 0x17b 435 #define KEY_VCR 0x17b
434 #define KEY_VCR2 0x17c 436 #define KEY_VCR2 0x17c
435 #define KEY_SAT 0x17d 437 #define KEY_SAT 0x17d
436 #define KEY_SAT2 0x17e 438 #define KEY_SAT2 0x17e
437 #define KEY_CD 0x17f 439 #define KEY_CD 0x17f
438 #define KEY_TAPE 0x180 440 #define KEY_TAPE 0x180
439 #define KEY_RADIO 0x181 441 #define KEY_RADIO 0x181
440 #define KEY_TUNER 0x182 442 #define KEY_TUNER 0x182
441 #define KEY_PLAYER 0x183 443 #define KEY_PLAYER 0x183
442 #define KEY_TEXT 0x184 444 #define KEY_TEXT 0x184
443 #define KEY_DVD 0x185 445 #define KEY_DVD 0x185
444 #define KEY_AUX 0x186 446 #define KEY_AUX 0x186
445 #define KEY_MP3 0x187 447 #define KEY_MP3 0x187
446 #define KEY_AUDIO 0x188 448 #define KEY_AUDIO 0x188
447 #define KEY_VIDEO 0x189 449 #define KEY_VIDEO 0x189
448 #define KEY_DIRECTORY 0x18a 450 #define KEY_DIRECTORY 0x18a
449 #define KEY_LIST 0x18b 451 #define KEY_LIST 0x18b
450 #define KEY_MEMO 0x18c 452 #define KEY_MEMO 0x18c
451 #define KEY_CALENDAR 0x18d 453 #define KEY_CALENDAR 0x18d
452 #define KEY_RED 0x18e 454 #define KEY_RED 0x18e
453 #define KEY_GREEN 0x18f 455 #define KEY_GREEN 0x18f
454 #define KEY_YELLOW 0x190 456 #define KEY_YELLOW 0x190
455 #define KEY_BLUE 0x191 457 #define KEY_BLUE 0x191
456 #define KEY_CHANNELUP 0x192 458 #define KEY_CHANNELUP 0x192
457 #define KEY_CHANNELDOWN 0x193 459 #define KEY_CHANNELDOWN 0x193
458 #define KEY_FIRST 0x194 460 #define KEY_FIRST 0x194
459 #define KEY_LAST 0x195 461 #define KEY_LAST 0x195
460 #define KEY_AB 0x196 462 #define KEY_AB 0x196
461 #define KEY_NEXT 0x197 463 #define KEY_NEXT 0x197
462 #define KEY_RESTART 0x198 464 #define KEY_RESTART 0x198
463 #define KEY_SLOW 0x199 465 #define KEY_SLOW 0x199
464 #define KEY_SHUFFLE 0x19a 466 #define KEY_SHUFFLE 0x19a
465 #define KEY_BREAK 0x19b 467 #define KEY_BREAK 0x19b
466 #define KEY_PREVIOUS 0x19c 468 #define KEY_PREVIOUS 0x19c
467 #define KEY_DIGITS 0x19d 469 #define KEY_DIGITS 0x19d
468 #define KEY_TEEN 0x19e 470 #define KEY_TEEN 0x19e
469 #define KEY_TWEN 0x19f 471 #define KEY_TWEN 0x19f
470 472
471 #define KEY_DEL_EOL 0x1c0 473 #define KEY_DEL_EOL 0x1c0
472 #define KEY_DEL_EOS 0x1c1 474 #define KEY_DEL_EOS 0x1c1
473 #define KEY_INS_LINE 0x1c2 475 #define KEY_INS_LINE 0x1c2
474 #define KEY_DEL_LINE 0x1c3 476 #define KEY_DEL_LINE 0x1c3
475 477
476 #define KEY_MAX 0x1ff 478 #define KEY_MAX 0x1ff
477 479
478/* 480/*
479 * Relative axes 481 * Relative axes
480 */ 482 */
481 483
482 #define REL_X 0x00 484 #define REL_X 0x00
483 #define REL_Y 0x01 485 #define REL_Y 0x01
484 #define REL_Z 0x02 486 #define REL_Z 0x02
485 #define REL_HWHEEL 0x06 487 #define REL_HWHEEL 0x06
486 #define REL_DIAL 0x07 488 #define REL_DIAL 0x07
487 #define REL_WHEEL 0x08 489 #define REL_WHEEL 0x08
488 #define REL_MISC 0x09 490 #define REL_MISC 0x09
489 #define REL_MAX 0x0f 491 #define REL_MAX 0x0f
490 492
491/* 493/*
492 * Absolute axes 494 * Absolute axes
493 */ 495 */
494 496
495 #define ABS_X 0x00 497 #define ABS_X 0x00
496 #define ABS_Y 0x01 498 #define ABS_Y 0x01
497 #define ABS_Z 0x02 499 #define ABS_Z 0x02
498 #define ABS_RX 0x03 500 #define ABS_RX 0x03
499 #define ABS_RY 0x04 501 #define ABS_RY 0x04
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/*
548 * Autorepeat values 564 * Autorepeat values
549 */ 565 */
550 566
551 #define REP_DELAY 0x00 567 #define REP_DELAY 0x00
552 #define REP_PERIOD 0x01 568 #define REP_PERIOD 0x01
553 #define REP_MAX 0x01 569 #define REP_MAX 0x01
554 570
555/* 571/*
556 * Sounds 572 * Sounds
557 */ 573 */
558 574
559 #define SND_CLICK 0x00 575 #define SND_CLICK 0x00
560 #define SND_BELL 0x01 576 #define SND_BELL 0x01
561 #define SND_TONE 0x02 577 #define SND_TONE 0x02
562 #define SND_MAX 0x07 578 #define SND_MAX 0x07
563 579
564/* 580/*
565 * IDs. 581 * IDs.
566 */ 582 */
567 583
568 #define ID_BUS 0 584 #define ID_BUS 0
569 #define ID_VENDOR 1 585 #define ID_VENDOR 1
570 #define ID_PRODUCT 2 586 #define ID_PRODUCT 2
571 #define ID_VERSION 3 587 #define ID_VERSION 3
572 588
573 #define BUS_PCI 0x01 589 #define BUS_PCI 0x01
574 #define BUS_ISAPNP 0x02 590 #define BUS_ISAPNP 0x02
575 #define BUS_USB 0x03 591 #define BUS_USB 0x03
576 #define BUS_HIL 0x04 592 #define BUS_HIL 0x04
577 #define BUS_BLUETOOTH 0x05 593 #define BUS_BLUETOOTH 0x05
578 594
579 #define BUS_ISA 0x10 595 #define BUS_ISA 0x10
580 #define BUS_I8042 0x11 596 #define BUS_I8042 0x11
581 #define BUS_XTKBD 0x12 597 #define BUS_XTKBD 0x12
582 #define BUS_RS232 0x13 598 #define BUS_RS232 0x13
583 #define BUS_GAMEPORT 0x14 599 #define BUS_GAMEPORT 0x14
584 #define BUS_PARPORT 0x15 600 #define BUS_PARPORT 0x15
585 #define BUS_AMIGA 0x16 601 #define BUS_AMIGA 0x16
586 #define BUS_ADB 0x17 602 #define BUS_ADB 0x17
587 #define BUS_I2C 0x18 603 #define BUS_I2C 0x18
588 #define BUS_HOST 0x19 604 #define BUS_HOST 0x19
589 605
590/* 606/*
591 * Values describing the status of an effect 607 * Values describing the status of an effect
592 */ 608 */
593 #define FF_STATUS_STOPPED0x00 609 #define FF_STATUS_STOPPED0x00
594 #define FF_STATUS_PLAYING0x01 610 #define FF_STATUS_PLAYING0x01
595 #define FF_STATUS_MAX 0x01 611 #define FF_STATUS_MAX 0x01
596 612
597/* 613/*
598 * Structures used in ioctls to upload effects to a device 614 * Structures used in ioctls to upload effects to a device
599 * The first structures are not passed directly by using ioctls. 615 * The first structures are not passed directly by using ioctls.
600 * They are sub-structures of the actually sent structure (called ff_effect) 616 * They are sub-structures of the actually sent structure (called ff_effect)
601 */ 617 */
602 618
603struct ff_replay { 619struct ff_replay {
604 __u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */ 620 __u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */
605 __u16 delay; /* Time to wait before to start playing an effect */ 621 __u16 delay; /* Time to wait before to start playing an effect */
606}; 622};
607 623
608struct ff_trigger { 624struct ff_trigger {
609 __u16 button; /* Number of button triggering an effect */ 625 __u16 button; /* Number of button triggering an effect */
610 __u16 interval; /* Time to wait before an effect can be re-triggered (ms) */ 626 __u16 interval; /* Time to wait before an effect can be re-triggered (ms) */
611}; 627};
612 628
613struct ff_envelope { 629struct ff_envelope {
614 __u16 attack_length;/* Duration of attack (ms) */ 630 __u16 attack_length;/* Duration of attack (ms) */
615 __u16 attack_level;/* Level at beginning of attack */ 631 __u16 attack_level;/* Level at beginning of attack */
616 __u16 fade_length;/* Duration of fade (ms) */ 632 __u16 fade_length;/* Duration of fade (ms) */
617 __u16 fade_level;/* Level at end of fade */ 633 __u16 fade_level;/* Level at end of fade */
618}; 634};
619 635
620/* FF_CONSTANT */ 636/* FF_CONSTANT */
621struct ff_constant_effect { 637struct ff_constant_effect {
622 __s16 level; /* Strength of effect. Negative values are OK */ 638 __s16 level; /* Strength of effect. Negative values are OK */
623 struct ff_envelope envelope; 639 struct ff_envelope envelope;
624}; 640};
625 641
626/* FF_RAMP */ 642/* FF_RAMP */
627struct ff_ramp_effect { 643struct ff_ramp_effect {
628 __s16 start_level; 644 __s16 start_level;
629 __s16 end_level; 645 __s16 end_level;
630 struct ff_envelope envelope; 646 struct ff_envelope envelope;
631}; 647};
632 648
633/* FF_SPRING of FF_FRICTION */ 649/* FF_SPRING of FF_FRICTION */
634struct ff_condition_effect { 650struct ff_condition_effect {
635 __u16 right_saturation; /* Max level when joystick is on the right */ 651 __u16 right_saturation; /* Max level when joystick is on the right */
636 __u16 left_saturation; /* Max level when joystick in on the left */ 652 __u16 left_saturation; /* Max level when joystick in on the left */
637 653
638 __s16 right_coeff;/* Indicates how fast the force grows when the 654 __s16 right_coeff;/* Indicates how fast the force grows when the
639 joystick moves to the right */ 655 joystick moves to the right */
640 __s16 left_coeff;/* Same for left side */ 656 __s16 left_coeff;/* Same for left side */
641 657
642 __u16 deadband;/* Size of area where no force is produced */ 658 __u16 deadband;/* Size of area where no force is produced */
643 __s16 center;/* Position of dead zone */ 659 __s16 center;/* Position of dead zone */
644 660
645}; 661};
646 662
647/* FF_PERIODIC */ 663/* FF_PERIODIC */
648struct ff_periodic_effect { 664struct ff_periodic_effect {
649 __u16 waveform;/* Kind of wave (sine, square...) */ 665 __u16 waveform;/* Kind of wave (sine, square...) */
650 __u16 period;/* in ms */ 666 __u16 period;/* in ms */
651 __s16 magnitude;/* Peak value */ 667 __s16 magnitude;/* Peak value */
652 __s16 offset;/* Mean value of wave (roughly) */ 668 __s16 offset;/* Mean value of wave (roughly) */
653 __u16 phase; /* 'Horizontal' shift */ 669 __u16 phase; /* 'Horizontal' shift */
654 670
655 struct ff_envelope envelope; 671 struct ff_envelope envelope;
656 672
657/* Only used if waveform == FF_CUSTOM */ 673/* Only used if waveform == FF_CUSTOM */
658 __u32 custom_len;/* Number of samples */ 674 __u32 custom_len;/* Number of samples */
659 __s16 *custom_data;/* Buffer of samples */ 675 __s16 *custom_data;/* Buffer of samples */
660/* Note: the data pointed by custom_data is copied by the driver. You can 676/* Note: the data pointed by custom_data is copied by the driver. You can
661 * therefore dispose of the memory after the upload/update */ 677 * therefore dispose of the memory after the upload/update */
662}; 678};
663 679
664/* FF_RUMBLE */ 680/* FF_RUMBLE */
665/* Some rumble pads have two motors of different weight. 681/* Some rumble pads have two motors of different weight.
666 strong_magnitude represents the magnitude of the vibration generated 682 strong_magnitude represents the magnitude of the vibration generated
667 by the heavy motor. 683 by the heavy motor.
668*/ 684*/
669struct ff_rumble_effect { 685struct ff_rumble_effect {
670 __u16 strong_magnitude; /* Magnitude of the heavy motor */ 686 __u16 strong_magnitude; /* Magnitude of the heavy motor */
671 __u16 weak_magnitude; /* Magnitude of the light one */ 687 __u16 weak_magnitude; /* Magnitude of the light one */
672}; 688};
673 689
674/* 690/*
675 * Structure sent through ioctl from the application to the driver 691 * Structure sent through ioctl from the application to the driver
676 */ 692 */
677struct ff_effect { 693struct ff_effect {
678 __u16 type; 694 __u16 type;
679/* Following field denotes the unique id assigned to an effect. 695/* Following field denotes the unique id assigned to an effect.
680 * If user sets if to -1, a new effect is created, and its id is returned in the same field 696 * If user sets if to -1, a new effect is created, and its id is returned in the same field
681 * Else, the user sets it to the effect id it wants to update. 697 * Else, the user sets it to the effect id it wants to update.
682 */ 698 */
683 __s16 id; 699 __s16 id;
684 700
685 __u16 direction;/* Direction. 0 deg -> 0x0000 (down) 701 __u16 direction;/* Direction. 0 deg -> 0x0000 (down)
686 90 deg -> 0x4000 (left) 702 90 deg -> 0x4000 (left)
687 180 deg -> 0x8000 (up) 703 180 deg -> 0x8000 (up)
688 270 deg -> 0xC000 (right) 704 270 deg -> 0xC000 (right)
689 */ 705 */
690 706
691 struct ff_trigger trigger; 707 struct ff_trigger trigger;
692 struct ff_replay replay; 708 struct ff_replay replay;
693 709
694 union { 710 union {
695 struct ff_constant_effect constant; 711 struct ff_constant_effect constant;
696 struct ff_ramp_effect ramp; 712 struct ff_ramp_effect ramp;
697 struct ff_periodic_effect periodic; 713 struct ff_periodic_effect periodic;
698 struct ff_condition_effect condition[2]; /* One for each axis */ 714 struct ff_condition_effect condition[2]; /* One for each axis */
699 struct ff_rumble_effect rumble; 715 struct ff_rumble_effect rumble;
700 } u; 716 } u;
701}; 717};
702 718
703/* 719/*
704 * Force feedback effect types 720 * Force feedback effect types
705 */ 721 */
706 722
707 #define FF_RUMBLE0x50 723 #define FF_RUMBLE0x50
708 #define FF_PERIODIC0x51 724 #define FF_PERIODIC0x51
709 #define FF_CONSTANT0x52 725 #define FF_CONSTANT0x52
710 #define FF_SPRING0x53 726 #define FF_SPRING0x53
711 #define FF_FRICTION0x54 727 #define FF_FRICTION0x54
712 #define FF_DAMPER0x55 728 #define FF_DAMPER0x55
713 #define FF_INERTIA0x56 729 #define FF_INERTIA0x56
714 #define FF_RAMP 0x57 730 #define FF_RAMP 0x57
715 731
716/* 732/*
717 * Force feedback periodic effect types 733 * Force feedback periodic effect types
718 */ 734 */
719 735
720 #define FF_SQUARE0x58 736 #define FF_SQUARE0x58
721 #define FF_TRIANGLE0x59 737 #define FF_TRIANGLE0x59
722 #define FF_SINE 0x5a 738 #define FF_SINE 0x5a
723 #define FF_SAW_UP0x5b 739 #define FF_SAW_UP0x5b
724 #define FF_SAW_DOWN0x5c 740 #define FF_SAW_DOWN0x5c
725 #define FF_CUSTOM0x5d 741 #define FF_CUSTOM0x5d
726 742
727/* 743/*
728 * Set ff device properties 744 * Set ff device properties
729 */ 745 */
730 746
731 #define FF_GAIN 0x60 747 #define FF_GAIN 0x60
732 #define FF_AUTOCENTER0x61 748 #define FF_AUTOCENTER0x61
733 749
734 #define FF_MAX 0x7f 750 #define FF_MAX 0x7f
735 751
736#ifdef __KERNEL__ 752#ifdef __KERNEL__
737 753
738/* 754/*
739 * In-kernel definitions. 755 * In-kernel definitions.
740 */ 756 */
741 757
742#include <linux/fs.h> 758#include <linux/fs.h>
743#include <linux/timer.h> 759#include <linux/timer.h>
744 760
745#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) 761#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
746 #define BIT(x)(1UL<<((x)%BITS_PER_LONG)) 762 #define BIT(x)(1UL<<((x)%BITS_PER_LONG))
747#define LONG(x) ((x)/BITS_PER_LONG) 763#define LONG(x) ((x)/BITS_PER_LONG)
748 764
749#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \ 765#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
750 ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode]))) 766 ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
751 767
752 #define SET_INPUT_KEYCODE(dev, scancode, val) \ 768 #define SET_INPUT_KEYCODE(dev, scancode, val) \
753 ({ unsigned __old; \ 769 ({ unsigned __old; \
754 switch (dev->keycodesize) { \ 770 switch (dev->keycodesize) { \
755 case 1: { \ 771 case 1: { \
756 u8 *k = (u8 *)dev->keycode;\ 772 u8 *k = (u8 *)dev->keycode;\
757 __old = k[scancode]; \ 773 __old = k[scancode]; \
758 k[scancode] = val; \ 774 k[scancode] = val; \
759 break; \ 775 break; \
760 } \ 776 } \
761 case 2: { \ 777 case 2: { \
762 u16 *k = (u16 *)dev->keycode;\ 778 u16 *k = (u16 *)dev->keycode;\
763 __old = k[scancode]; \ 779 __old = k[scancode]; \
764 k[scancode] = val; \ 780 k[scancode] = val; \
765 break; \ 781 break; \
766 } \ 782 } \
767 default: { \ 783 default: { \
768 u32 *k = (u32 *)dev->keycode;\ 784 u32 *k = (u32 *)dev->keycode;\
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};
896 916
897struct input_handle { 917struct input_handle {
898 918
899 void *private; 919 void *private;
900 920
901 int open; 921 int open;
902 char *name; 922 char *name;
903 923
904 struct input_dev *dev; 924 struct input_dev *dev;
905 struct input_handler *handler; 925 struct input_handler *handler;
906 926
907 struct list_headd_node; 927 struct list_headd_node;
908 struct list_headh_node; 928 struct list_headh_node;
909}; 929};
910 930
911#define to_dev(n) container_of(n,struct input_dev,node) 931#define to_dev(n) container_of(n,struct input_dev,node)
912#define to_handler(n) container_of(n,struct input_handler,node); 932#define to_handler(n) container_of(n,struct input_handler,node);
913#define to_handle(n) container_of(n,struct input_handle,d_node) 933#define to_handle(n) container_of(n,struct input_handle,d_node)
914#define to_handle_h(n) container_of(n,struct input_handle,h_node) 934#define to_handle_h(n) container_of(n,struct input_handle,h_node)
915 935
916static inline void init_input_dev(struct input_dev *dev) 936static inline void init_input_dev(struct input_dev *dev)
917{ 937{
918 INIT_LIST_HEAD(&dev->h_list); 938 INIT_LIST_HEAD(&dev->h_list);
919 INIT_LIST_HEAD(&dev->node); 939 INIT_LIST_HEAD(&dev->node);
920} 940}
921 941
922void input_register_device(struct input_dev *); 942void input_register_device(struct input_dev *);
923void input_unregister_device(struct input_dev *); 943void input_unregister_device(struct input_dev *);
924 944
925void input_register_handler(struct input_handler *); 945void input_register_handler(struct input_handler *);
926void input_unregister_handler(struct input_handler *); 946void input_unregister_handler(struct input_handler *);
927 947
928int input_grab_device(struct input_handle *); 948int input_grab_device(struct input_handle *);
929void input_release_device(struct input_handle *); 949void input_release_device(struct input_handle *);
930 950
931int input_open_device(struct input_handle *); 951int input_open_device(struct input_handle *);
932void input_close_device(struct input_handle *); 952void input_close_device(struct input_handle *);
933 953
934int input_accept_process(struct input_handle *handle, struct file *file); 954int input_accept_process(struct input_handle *handle, struct file *file);
935int input_flush_device(struct input_handle* handle, struct file* file); 955int input_flush_device(struct input_handle* handle, struct file* file);
936 956
937void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 957void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
938 958
939static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) 959static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
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
988#endif 1013#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,405 +1,418 @@
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,
59 Key_U = 22, 72 Key_U = 22,
60 Key_I = 23, 73 Key_I = 23,
61 Key_O = 24, 74 Key_O = 24,
62 Key_P = 25, 75 Key_P = 25,
63 Key_LEFTBRACE = 26, 76 Key_LEFTBRACE = 26,
64 Key_RIGHTBRACE = 27, 77 Key_RIGHTBRACE = 27,
65 Key_ENTER = 28, 78 Key_ENTER = 28,
66 Key_LEFTCTRL = 29, 79 Key_LEFTCTRL = 29,
67 Key_A = 30, 80 Key_A = 30,
68 Key_S = 31, 81 Key_S = 31,
69 Key_D = 32, 82 Key_D = 32,
70 Key_F = 33, 83 Key_F = 33,
71 Key_G = 34, 84 Key_G = 34,
72 Key_H = 35, 85 Key_H = 35,
73 Key_J = 36, 86 Key_J = 36,
74 Key_K = 37, 87 Key_K = 37,
75 Key_L = 38, 88 Key_L = 38,
76 Key_SEMICOLON = 39, 89 Key_SEMICOLON = 39,
77 Key_APOSTROPHE = 40, 90 Key_APOSTROPHE = 40,
78 Key_GRAVE = 41, 91 Key_GRAVE = 41,
79 Key_LEFTSHIFT = 42, 92 Key_LEFTSHIFT = 42,
80 Key_BACKSLASH = 43, 93 Key_BACKSLASH = 43,
81 Key_Z = 44, 94 Key_Z = 44,
82 Key_X = 45, 95 Key_X = 45,
83 Key_C = 46, 96 Key_C = 46,
84 Key_V = 47, 97 Key_V = 47,
85 Key_B = 48, 98 Key_B = 48,
86 Key_N = 49, 99 Key_N = 49,
87 Key_M = 50, 100 Key_M = 50,
88 Key_COMMA = 51, 101 Key_COMMA = 51,
89 Key_DOT = 52, 102 Key_DOT = 52,
90 Key_SLASH = 53, 103 Key_SLASH = 53,
91 Key_RIGHTSHIFT = 54, 104 Key_RIGHTSHIFT = 54,
92 Key_KPASTERISK = 55, 105 Key_KPASTERISK = 55,
93 Key_LEFTALT = 56, 106 Key_LEFTALT = 56,
94 Key_SPACE = 57, 107 Key_SPACE = 57,
95 Key_CAPSLOCK = 58, 108 Key_CAPSLOCK = 58,
96 Key_F1 = 59, 109 Key_F1 = 59,
97 Key_F2 = 60, 110 Key_F2 = 60,
98 Key_F3 = 61, 111 Key_F3 = 61,
99 Key_F4 = 62, 112 Key_F4 = 62,
100 Key_F5 = 63, 113 Key_F5 = 63,
101 Key_F6 = 64, 114 Key_F6 = 64,
102 Key_F7 = 65, 115 Key_F7 = 65,
103 Key_F8 = 66, 116 Key_F8 = 66,
104 Key_F9 = 67, 117 Key_F9 = 67,
105 Key_F10 = 68, 118 Key_F10 = 68,
106 Key_NUMLOCK = 69, 119 Key_NUMLOCK = 69,
107 Key_SCROLLLOCK = 70, 120 Key_SCROLLLOCK = 70,
108 Key_KP7 = 71, 121 Key_KP7 = 71,
109 Key_KP8 = 72, 122 Key_KP8 = 72,
110 Key_KP9 = 73, 123 Key_KP9 = 73,
111 Key_KPMINUS = 74, 124 Key_KPMINUS = 74,
112 Key_KP4 = 75, 125 Key_KP4 = 75,
113 Key_KP5 = 76, 126 Key_KP5 = 76,
114 Key_KP6 = 77, 127 Key_KP6 = 77,
115 Key_KPPLUS = 78, 128 Key_KPPLUS = 78,
116 Key_KP1 = 79, 129 Key_KP1 = 79,
117 Key_KP2 = 80, 130 Key_KP2 = 80,
118 Key_KP3 = 81, 131 Key_KP3 = 81,
119 Key_KP0 = 82, 132 Key_KP0 = 82,
120 Key_KPDOT = 83, 133 Key_KPDOT = 83,
121 134
122 Key_ZENKAKUHANKAKU= 85, 135 Key_ZENKAKUHANKAKU= 85,
123 Key_102ND = 86, 136 Key_102ND = 86,
124 Key_F11 = 87, 137 Key_F11 = 87,
125 Key_F12 = 88, 138 Key_F12 = 88,
126 Key_RO = 89, 139 Key_RO = 89,
127 Key_KATAKANA = 90, 140 Key_KATAKANA = 90,
128 Key_HIRAGANA = 91, 141 Key_HIRAGANA = 91,
129 Key_HENKAN = 92, 142 Key_HENKAN = 92,
130 Key_KATAKANAHIRAGANA= 93, 143 Key_KATAKANAHIRAGANA= 93,
131 Key_MUHENKAN = 94, 144 Key_MUHENKAN = 94,
132 Key_KPJPCOMMA = 95, 145 Key_KPJPCOMMA = 95,
133 Key_KPENTER = 96, 146 Key_KPENTER = 96,
134 Key_RIGHTCTRL = 97, 147 Key_RIGHTCTRL = 97,
135 Key_KPSLASH = 98, 148 Key_KPSLASH = 98,
136 Key_SYSRQ = 99, 149 Key_SYSRQ = 99,
137 Key_RIGHTALT = 100, 150 Key_RIGHTALT = 100,
138 Key_LINEFEED = 101, 151 Key_LINEFEED = 101,
139 Key_HOME = 102, 152 Key_HOME = 102,
140 Key_UP = 103, 153 Key_UP = 103,
141 Key_PAGEUP = 104, 154 Key_PAGEUP = 104,
142 Key_LEFT = 105, 155 Key_LEFT = 105,
143 Key_RIGHT = 106, 156 Key_RIGHT = 106,
144 Key_END = 107, 157 Key_END = 107,
145 Key_DOWN = 108, 158 Key_DOWN = 108,
146 Key_PAGEDOWN = 109, 159 Key_PAGEDOWN = 109,
147 Key_INSERT = 110, 160 Key_INSERT = 110,
148 Key_DELETE = 111, 161 Key_DELETE = 111,
149 Key_MACRO = 112, 162 Key_MACRO = 112,
150 Key_MUTE = 113, 163 Key_MUTE = 113,
151 Key_VOLUMEDOWN = 114, 164 Key_VOLUMEDOWN = 114,
152 Key_VOLUMEUP = 115, 165 Key_VOLUMEUP = 115,
153 Key_POWER = 116, 166 Key_POWER = 116,
154 Key_KPEQUAL = 117, 167 Key_KPEQUAL = 117,
155 Key_KPPLUSMINUS = 118, 168 Key_KPPLUSMINUS = 118,
156 Key_PAUSE = 119, 169 Key_PAUSE = 119,
157 170
158 Key_KPCOMMA = 121, 171 Key_KPCOMMA = 121,
159 Key_HANGUEL = 122, 172 Key_HANGUEL = 122,
160 Key_HANJA = 123, 173 Key_HANJA = 123,
161 Key_YEN = 124, 174 Key_YEN = 124,
162 Key_LEFTMETA = 125, 175 Key_LEFTMETA = 125,
163 Key_RIGHTMETA = 126, 176 Key_RIGHTMETA = 126,
164 Key_COMPOSE = 127, 177 Key_COMPOSE = 127,
165 178
166 Key_STOP = 128, 179 Key_STOP = 128,
167 Key_AGAIN = 129, 180 Key_AGAIN = 129,
168 Key_PROPS = 130, 181 Key_PROPS = 130,
169 Key_UNDO = 131, 182 Key_UNDO = 131,
170 Key_FRONT = 132, 183 Key_FRONT = 132,
171 Key_COPY = 133, 184 Key_COPY = 133,
172 Key_OPEN = 134, 185 Key_OPEN = 134,
173 Key_PASTE = 135, 186 Key_PASTE = 135,
174 Key_FIND = 136, 187 Key_FIND = 136,
175 Key_CUT = 137, 188 Key_CUT = 137,
176 Key_HELP = 138, 189 Key_HELP = 138,
177 Key_MENU = 139, 190 Key_MENU = 139,
178 Key_CALC = 140, 191 Key_CALC = 140,
179 Key_SETUP = 141, 192 Key_SETUP = 141,
180 Key_SLEEP = 142, 193 Key_SLEEP = 142,
181 Key_WAKEUP = 143, 194 Key_WAKEUP = 143,
182 Key_FILE = 144, 195 Key_FILE = 144,
183 Key_SENDFILE = 145, 196 Key_SENDFILE = 145,
184 Key_DELETEFILE = 146, 197 Key_DELETEFILE = 146,
185 Key_XFER = 147, 198 Key_XFER = 147,
186 Key_PROG1 = 148, 199 Key_PROG1 = 148,
187 Key_PROG2 = 149, 200 Key_PROG2 = 149,
188 Key_WWW = 150, 201 Key_WWW = 150,
189 Key_MSDOS = 151, 202 Key_MSDOS = 151,
190 Key_COFFEE = 152, 203 Key_COFFEE = 152,
191 Key_DIRECTION = 153, 204 Key_DIRECTION = 153,
192 Key_CYCLEWINDOWS= 154, 205 Key_CYCLEWINDOWS= 154,
193 Key_MAIL = 155, 206 Key_MAIL = 155,
194 Key_BOOKMARKS = 156, 207 Key_BOOKMARKS = 156,
195 Key_COMPUTER = 157, 208 Key_COMPUTER = 157,
196 Key_BACK = 158, 209 Key_BACK = 158,
197 Key_FORWARD = 159, 210 Key_FORWARD = 159,
198 Key_CLOSECD = 160, 211 Key_CLOSECD = 160,
199 Key_EJECTCD = 161, 212 Key_EJECTCD = 161,
200 Key_EJECTCLOSECD= 162, 213 Key_EJECTCLOSECD= 162,
201 Key_NEXTSONG = 163, 214 Key_NEXTSONG = 163,
202 Key_PLAYPAUSE = 164, 215 Key_PLAYPAUSE = 164,
203 Key_PREVIOUSSONG= 165, 216 Key_PREVIOUSSONG= 165,
204 Key_STOPCD = 166, 217 Key_STOPCD = 166,
205 Key_RECORD = 167, 218 Key_RECORD = 167,
206 Key_REWIND = 168, 219 Key_REWIND = 168,
207 Key_PHONE = 169, 220 Key_PHONE = 169,
208 Key_ISO = 170, 221 Key_ISO = 170,
209 Key_CONFIG = 171, 222 Key_CONFIG = 171,
210 Key_HOMEPAGE = 172, 223 Key_HOMEPAGE = 172,
211 Key_REFRESH = 173, 224 Key_REFRESH = 173,
212 Key_EXIT = 174, 225 Key_EXIT = 174,
213 Key_MOVE = 175, 226 Key_MOVE = 175,
214 Key_EDIT = 176, 227 Key_EDIT = 176,
215 Key_SCROLLUP = 177, 228 Key_SCROLLUP = 177,
216 Key_SCROLLDOWN = 178, 229 Key_SCROLLDOWN = 178,
217 Key_KPLEFTPAREN = 179, 230 Key_KPLEFTPAREN = 179,
218 Key_KPRIGHTPAREN= 180, 231 Key_KPRIGHTPAREN= 180,
219 232
220 Key_F13 = 183, 233 Key_F13 = 183,
221 Key_F14 = 184, 234 Key_F14 = 184,
222 Key_F15 = 185, 235 Key_F15 = 185,
223 Key_F16 = 186, 236 Key_F16 = 186,
224 Key_F17 = 187, 237 Key_F17 = 187,
225 Key_F18 = 188, 238 Key_F18 = 188,
226 Key_F19 = 189, 239 Key_F19 = 189,
227 Key_F20 = 190, 240 Key_F20 = 190,
228 Key_F21 = 191, 241 Key_F21 = 191,
229 Key_F22 = 192, 242 Key_F22 = 192,
230 Key_F23 = 193, 243 Key_F23 = 193,
231 Key_F24 = 194, 244 Key_F24 = 194,
232 245
233 Key_PLAYCD = 200, 246 Key_PLAYCD = 200,
234 Key_PAUSECD = 201, 247 Key_PAUSECD = 201,
235 Key_PROG3 = 202, 248 Key_PROG3 = 202,
236 Key_PROG4 = 203, 249 Key_PROG4 = 203,
237 Key_SUSPEND = 205, 250 Key_SUSPEND = 205,
238 Key_CLOSE = 206, 251 Key_CLOSE = 206,
239 Key_PLAY = 207, 252 Key_PLAY = 207,
240 Key_FASTFORWARD = 208, 253 Key_FASTFORWARD = 208,
241 Key_BASSBOOST = 209, 254 Key_BASSBOOST = 209,
242 Key_PRINT = 210, 255 Key_PRINT = 210,
243 Key_HP = 211, 256 Key_HP = 211,
244 Key_CAMERA = 212, 257 Key_CAMERA = 212,
245 Key_SOUND = 213, 258 Key_SOUND = 213,
246 Key_QUESTION = 214, 259 Key_QUESTION = 214,
247 Key_EMAIL = 215, 260 Key_EMAIL = 215,
248 Key_CHAT = 216, 261 Key_CHAT = 216,
249 Key_SEARCH = 217, 262 Key_SEARCH = 217,
250 Key_CONNECT = 218, 263 Key_CONNECT = 218,
251 Key_FINANCE = 219, 264 Key_FINANCE = 219,
252 Key_SPORT = 220, 265 Key_SPORT = 220,
253 Key_SHOP = 221, 266 Key_SHOP = 221,
254 Key_ALTERASE = 222, 267 Key_ALTERASE = 222,
255 Key_CANCEL = 223, 268 Key_CANCEL = 223,
256 Key_BRIGHTNESSDOWN= 224, 269 Key_BRIGHTNESSDOWN= 224,
257 Key_BRIGHTNESSUP= 225, 270 Key_BRIGHTNESSUP= 225,
258 Key_MEDIA = 226, 271 Key_MEDIA = 226,
259 272
260 Key_UNKNOWN = 240, 273 Key_UNKNOWN = 240,
261 274
262 Button_MISC = 0x100, 275 Button_MISC = 0x100,
263 Button_0 = 0x100, 276 Button_0 = 0x100,
264 Button_1 = 0x101, 277 Button_1 = 0x101,
265 Button_2 = 0x102, 278 Button_2 = 0x102,
266 Button_3 = 0x103, 279 Button_3 = 0x103,
267 Button_4 = 0x104, 280 Button_4 = 0x104,
268 Button_5 = 0x105, 281 Button_5 = 0x105,
269 Button_6 = 0x106, 282 Button_6 = 0x106,
270 Button_7 = 0x107, 283 Button_7 = 0x107,
271 Button_8 = 0x108, 284 Button_8 = 0x108,
272 Button_9 = 0x109, 285 Button_9 = 0x109,
273 286
274 Button_MOUSE = 0x110, 287 Button_MOUSE = 0x110,
275 Button_LEFT = 0x110, 288 Button_LEFT = 0x110,
276 Button_RIGHT = 0x111, 289 Button_RIGHT = 0x111,
277 Button_MIDDLE = 0x112, 290 Button_MIDDLE = 0x112,
278 Button_SIDE = 0x113, 291 Button_SIDE = 0x113,
279 Button_EXTRA = 0x114, 292 Button_EXTRA = 0x114,
280 Button_FORWARD = 0x115, 293 Button_FORWARD = 0x115,
281 Button_BACK = 0x116, 294 Button_BACK = 0x116,
282 Button_TASK = 0x117, 295 Button_TASK = 0x117,
283 296
284 Button_JOYSTICK = 0x120, 297 Button_JOYSTICK = 0x120,
285 Button_TRIGGER = 0x120, 298 Button_TRIGGER = 0x120,
286 Button_THUMB = 0x121, 299 Button_THUMB = 0x121,
287 Button_THUMB2 = 0x122, 300 Button_THUMB2 = 0x122,
288 Button_TOP = 0x123, 301 Button_TOP = 0x123,
289 Button_TOP2 = 0x124, 302 Button_TOP2 = 0x124,
290 Button_PINKIE = 0x125, 303 Button_PINKIE = 0x125,
291 Button_BASE = 0x126, 304 Button_BASE = 0x126,
292 Button_BASE2 = 0x127, 305 Button_BASE2 = 0x127,
293 Button_BASE3 = 0x128, 306 Button_BASE3 = 0x128,
294 Button_BASE4 = 0x129, 307 Button_BASE4 = 0x129,
295 Button_BASE5 = 0x12a, 308 Button_BASE5 = 0x12a,
296 Button_BASE6 = 0x12b, 309 Button_BASE6 = 0x12b,
297 Button_DEAD = 0x12f, 310 Button_DEAD = 0x12f,
298 311
299 Button_GAMEPAD = 0x130, 312 Button_GAMEPAD = 0x130,
300 Button_A = 0x130, 313 Button_A = 0x130,
301 Button_B = 0x131, 314 Button_B = 0x131,
302 Button_C = 0x132, 315 Button_C = 0x132,
303 Button_X = 0x133, 316 Button_X = 0x133,
304 Button_Y = 0x134, 317 Button_Y = 0x134,
305 Button_Z = 0x135, 318 Button_Z = 0x135,
306 Button_TL = 0x136, 319 Button_TL = 0x136,
307 Button_TR = 0x137, 320 Button_TR = 0x137,
308 Button_TL2 = 0x138, 321 Button_TL2 = 0x138,
309 Button_TR2 = 0x139, 322 Button_TR2 = 0x139,
310 Button_SELECT = 0x13a, 323 Button_SELECT = 0x13a,
311 Button_START = 0x13b, 324 Button_START = 0x13b,
312 Button_MODE = 0x13c, 325 Button_MODE = 0x13c,
313 Button_THUMBL = 0x13d, 326 Button_THUMBL = 0x13d,
314 Button_THUMBR = 0x13e, 327 Button_THUMBR = 0x13e,
315 328
316 Button_DIGI = 0x140, 329 Button_DIGI = 0x140,
317 Button_TOOL_PEN = 0x140, 330 Button_TOOL_PEN = 0x140,
318 Button_TOOL_RUBBER = 0x141, 331 Button_TOOL_RUBBER = 0x141,
319 Button_TOOL_BRUSH = 0x142, 332 Button_TOOL_BRUSH = 0x142,
320 Button_TOOL_PENCIL = 0x143, 333 Button_TOOL_PENCIL = 0x143,
321 Button_TOOL_AIRBRUSH= 0x144, 334 Button_TOOL_AIRBRUSH= 0x144,
322 Button_TOOL_FINGER = 0x145, 335 Button_TOOL_FINGER = 0x145,
323 Button_TOOL_MOUSE = 0x146, 336 Button_TOOL_MOUSE = 0x146,
324 Button_TOOL_LENS = 0x147, 337 Button_TOOL_LENS = 0x147,
325 Button_TOUCH = 0x14a, 338 Button_TOUCH = 0x14a,
326 Button_STYLUS = 0x14b, 339 Button_STYLUS = 0x14b,
327 Button_STYLUS2 = 0x14c, 340 Button_STYLUS2 = 0x14c,
328 Button_TOOL_DOUBLETAP= 0x14d, 341 Button_TOOL_DOUBLETAP= 0x14d,
329 Button_TOOL_TRIPLETAP= 0x14e, 342 Button_TOOL_TRIPLETAP= 0x14e,
330 343
331 Button_WHEEL = 0x150, 344 Button_WHEEL = 0x150,
332 Button_GEAR_DOWN = 0x150, 345 Button_GEAR_DOWN = 0x150,
333 Button_GEAR_UP = 0x151, 346 Button_GEAR_UP = 0x151,
334 347
335 Key_OK = 0x160, 348 Key_OK = 0x160,
336 Key_SELECT = 0x161, 349 Key_SELECT = 0x161,
337 Key_GOTO = 0x162, 350 Key_GOTO = 0x162,
338 Key_CLEAR = 0x163, 351 Key_CLEAR = 0x163,
339 Key_POWER2 = 0x164, 352 Key_POWER2 = 0x164,
340 Key_OPTION = 0x165, 353 Key_OPTION = 0x165,
341 Key_INFO = 0x166, 354 Key_INFO = 0x166,
342 Key_TIME = 0x167, 355 Key_TIME = 0x167,
343 Key_VENDOR = 0x168, 356 Key_VENDOR = 0x168,
344 Key_ARCHIVE = 0x169, 357 Key_ARCHIVE = 0x169,
345 Key_PROGRAM = 0x16a, 358 Key_PROGRAM = 0x16a,
346 Key_CHANNEL = 0x16b, 359 Key_CHANNEL = 0x16b,
347 Key_FAVORITES = 0x16c, 360 Key_FAVORITES = 0x16c,
348 Key_EPG = 0x16d, 361 Key_EPG = 0x16d,
349 Key_PVR = 0x16e, 362 Key_PVR = 0x16e,
350 Key_MHP = 0x16f, 363 Key_MHP = 0x16f,
351 Key_LANGUAGE = 0x170, 364 Key_LANGUAGE = 0x170,
352 Key_TITLE = 0x171, 365 Key_TITLE = 0x171,
353 Key_SUBTITLE = 0x172, 366 Key_SUBTITLE = 0x172,
354 Key_ANGLE = 0x173, 367 Key_ANGLE = 0x173,
355 Key_ZOOM = 0x174, 368 Key_ZOOM = 0x174,
356 Key_MODE = 0x175, 369 Key_MODE = 0x175,
357 Key_KEYBOARD = 0x176, 370 Key_KEYBOARD = 0x176,
358 Key_SCREEN = 0x177, 371 Key_SCREEN = 0x177,
359 Key_PC = 0x178, 372 Key_PC = 0x178,
360 Key_TV = 0x179, 373 Key_TV = 0x179,
361 Key_TV2 = 0x17a, 374 Key_TV2 = 0x17a,
362 Key_VCR = 0x17b, 375 Key_VCR = 0x17b,
363 Key_VCR2 = 0x17c, 376 Key_VCR2 = 0x17c,
364 Key_SAT = 0x17d, 377 Key_SAT = 0x17d,
365 Key_SAT2 = 0x17e, 378 Key_SAT2 = 0x17e,
366 Key_CD = 0x17f, 379 Key_CD = 0x17f,
367 Key_TAPE = 0x180, 380 Key_TAPE = 0x180,
368 Key_RADIO = 0x181, 381 Key_RADIO = 0x181,
369 Key_TUNER = 0x182, 382 Key_TUNER = 0x182,
370 Key_PLAYER = 0x183, 383 Key_PLAYER = 0x183,
371 Key_TEXT = 0x184, 384 Key_TEXT = 0x184,
372 Key_DVD = 0x185, 385 Key_DVD = 0x185,
373 Key_AUX = 0x186, 386 Key_AUX = 0x186,
374 Key_MP3 = 0x187, 387 Key_MP3 = 0x187,
375 Key_AUDIO = 0x188, 388 Key_AUDIO = 0x188,
376 Key_VIDEO = 0x189, 389 Key_VIDEO = 0x189,
377 Key_DIRECTORY = 0x18a, 390 Key_DIRECTORY = 0x18a,
378 Key_LIST = 0x18b, 391 Key_LIST = 0x18b,
379 Key_MEMO = 0x18c, 392 Key_MEMO = 0x18c,
380 Key_CALENDAR = 0x18d, 393 Key_CALENDAR = 0x18d,
381 Key_RED = 0x18e, 394 Key_RED = 0x18e,
382 Key_GREEN = 0x18f, 395 Key_GREEN = 0x18f,
383 Key_YELLOW = 0x190, 396 Key_YELLOW = 0x190,
384 Key_BLUE = 0x191, 397 Key_BLUE = 0x191,
385 Key_CHANNELUP = 0x192, 398 Key_CHANNELUP = 0x192,
386 Key_CHANNELDOWN = 0x193, 399 Key_CHANNELDOWN = 0x193,
387 Key_FIRST = 0x194, 400 Key_FIRST = 0x194,
388 Key_LAST = 0x195, 401 Key_LAST = 0x195,
389 Key_AB = 0x196, 402 Key_AB = 0x196,
390 Key_NEXT = 0x197, 403 Key_NEXT = 0x197,
391 Key_RESTART = 0x198, 404 Key_RESTART = 0x198,
392 Key_SLOW = 0x199, 405 Key_SLOW = 0x199,
393 Key_SHUFFLE = 0x19a, 406 Key_SHUFFLE = 0x19a,
394 Key_BREAK = 0x19b, 407 Key_BREAK = 0x19b,
395 Key_PREVIOUS = 0x19c, 408 Key_PREVIOUS = 0x19c,
396 Key_DIGITS = 0x19d, 409 Key_DIGITS = 0x19d,
397 Key_TEEN = 0x19e, 410 Key_TEEN = 0x19e,
398 Key_TWEN = 0x19f, 411 Key_TWEN = 0x19f,
399 412
400 Key_DEL_EOL = 0x1c0, 413 Key_DEL_EOL = 0x1c0,
401 Key_DEL_EOS = 0x1c1, 414 Key_DEL_EOS = 0x1c1,
402 Key_INS_LINE = 0x1c2, 415 Key_INS_LINE = 0x1c2,
403 Key_DEL_LINE = 0x1c3, 416 Key_DEL_LINE = 0x1c3,
404 }; 417 };
405 418
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
@@ -1,432 +1,433 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 =. Copyright (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 3 =. Copyright (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5          .>+-= 5          .>+-=
6_;:,     .>    :=|. This program is free software; you can 6_;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10- .   .-<_>     .<> Foundation; version 2 of the License. 10- .   .-<_>     .<> Foundation; version 2 of the License.
11    ._= =}       : 11    ._= =}       :
12   .%`+i>       _;_. 12   .%`+i>       _;_.
13   .i_,=:_.      -<s. This program is distributed in the hope that 13   .i_,=:_.      -<s. This program is distributed in the hope that
14    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15   : ..    .:,     . . . without even the implied warranty of 15   : ..    .:,     . . . without even the implied warranty of
16   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; General Public License for more 18..}^=.=       =       ; General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20:     =  ...= . :.=- 20:     =  ...= . :.=-
21-.   .:....=;==+<; You should have received a copy of the GNU 21-.   .:....=;==+<; You should have received a copy of the GNU
22 -_. . .   )=.  = General Public License along with 22 -_. . .   )=.  = General Public License along with
23   --        :-=` this application; see the file LICENSE.GPL. 23   --        :-=` this application; see the file LICENSE.GPL.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27*/ 27*/
28 28
29#include "devicesinfo.h" 29#include "devicesinfo.h"
30/* OPIE */ 30/* OPIE */
31#include <opie2/odebug.h> 31#include <opie2/odebug.h>
32#include <opie2/oinputsystem.h> 32#include <opie2/oinputsystem.h>
33#include <opie2/opcmciasystem.h> 33#include <opie2/opcmciasystem.h>
34#include <opie2/olayout.h> 34#include <opie2/olayout.h>
35#include <opie2/olistview.h> 35#include <opie2/olistview.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37using namespace Opie::Core; 37using namespace Opie::Core;
38using namespace Opie::Ui; 38using namespace Opie::Ui;
39 39
40/* QT */ 40/* QT */
41#include <qobjectlist.h> 41#include <qobjectlist.h>
42#include <qlistview.h> 42#include <qlistview.h>
43#include <qcombobox.h> 43#include <qcombobox.h>
44#include <qfile.h> 44#include <qfile.h>
45#include <qpushbutton.h> 45#include <qpushbutton.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qtextstream.h> 47#include <qtextstream.h>
48#include <qtextview.h> 48#include <qtextview.h>
49#include <qtimer.h> 49#include <qtimer.h>
50#include <qwhatsthis.h> 50#include <qwhatsthis.h>
51 51
52//================================================================================================= 52//=================================================================================================
53DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) 53DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl )
54 :Opie::Ui::OListView( parent, name, fl ) 54 :Opie::Ui::OListView( parent, name, fl )
55{ 55{
56 addColumn( tr( "My Computer" ) ); 56 addColumn( tr( "My Computer" ) );
57 setAllColumnsShowFocus( true ); 57 setAllColumnsShowFocus( true );
58 setRootIsDecorated( true ); 58 setRootIsDecorated( true );
59 QWhatsThis::add( this, tr( "This is a list of all the devices currently recognized on this device." ) ); 59 QWhatsThis::add( this, tr( "This is a list of all the devices currently recognized on this device." ) );
60 60
61 DevicesView* root = this; 61 DevicesView* root = this;
62 ( new CpuCategory( root ) )->populate(); 62 ( new CpuCategory( root ) )->populate();
63 ( new InputCategory( root ) )->populate(); 63 ( new InputCategory( root ) )->populate();
64 ( new CardsCategory( root ) )->populate(); 64 ( new CardsCategory( root ) )->populate();
65 ( new UsbCategory( root ) )->populate(); 65 ( new UsbCategory( root ) )->populate();
66 66
67 connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) ); 67 connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)) );
68} 68}
69 69
70DevicesView::~DevicesView() 70DevicesView::~DevicesView()
71{ 71{
72} 72}
73 73
74 74
75void DevicesView::selectionChanged( QListViewItem* item ) 75void DevicesView::selectionChanged( QListViewItem* item )
76{ 76{
77 odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl; 77 odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl;
78 if ( item->parent() ) 78 if ( item->parent() )
79 { 79 {
80 QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget(); 80 QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget();
81 ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details ); 81 ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details );
82 } 82 }
83 else 83 else
84 { 84 {
85 odebug << "DevicesView::not a device node." << oendl; 85 odebug << "DevicesView::not a device node." << oendl;
86 } 86 }
87} 87}
88 88
89 89
90//================================================================================================= 90//=================================================================================================
91DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl ) 91DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl )
92 :QWidget( parent, name, fl ), details( 0 ) 92 :QWidget( parent, name, fl ), details( 0 )
93{ 93{
94 layout = new OAutoBoxLayout( this ); 94 layout = new OAutoBoxLayout( this );
95 layout->setSpacing( 2 ); 95 layout->setSpacing( 2 );
96 layout->setMargin( 2 ); 96 layout->setMargin( 2 );
97 view = new DevicesView( this ); 97 view = new DevicesView( this );
98 layout->addWidget( view, 100 ); 98 layout->addWidget( view, 100 );
99 stack = new QWidgetStack( this ); 99 stack = new QWidgetStack( this );
100 layout->addWidget( stack, 80 ); 100 layout->addWidget( stack, 80 );
101} 101}
102 102
103 103
104DevicesInfo::~DevicesInfo() 104DevicesInfo::~DevicesInfo()
105{ 105{
106} 106}
107 107
108 108
109void DevicesInfo::setDetailsWidget( QWidget* w ) 109void DevicesInfo::setDetailsWidget( QWidget* w )
110{ 110{
111 if ( details ) 111 if ( details )
112 { 112 {
113 qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() ); 113 qDebug( "hiding widget '%s' ('%s')", details->name(), details->className() );
114 stack->removeWidget( w ); 114 stack->removeWidget( w );
115 } 115 }
116 116
117 stack->addWidget( details = w, 40 ); 117 stack->addWidget( details = w, 40 );
118 stack->raiseWidget( details ); 118 stack->raiseWidget( details );
119} 119}
120 120
121 121
122//================================================================================================= 122//=================================================================================================
123Category::Category( DevicesView* parent, const QString& name ) 123Category::Category( DevicesView* parent, const QString& name )
124 :OListViewItem( parent, name ) 124 :OListViewItem( parent, name )
125{ 125{
126 odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl; 126 odebug << "Category '" << name << "' inserted. Scanning for devices..." << oendl;
127} 127}
128 128
129Category::~Category() 129Category::~Category()
130{ 130{
131} 131}
132 132
133//================================================================================================= 133//=================================================================================================
134CpuCategory::CpuCategory( DevicesView* parent ) 134CpuCategory::CpuCategory( DevicesView* parent )
135 :Category( parent, "1. Central Processing Unit" ) 135 :Category( parent, "1. Central Processing Unit" )
136{ 136{
137} 137}
138 138
139CpuCategory::~CpuCategory() 139CpuCategory::~CpuCategory()
140{ 140{
141} 141}
142 142
143void CpuCategory::populate() 143void CpuCategory::populate()
144{ 144{
145 odebug << "CpuCategory::populate()" << oendl; 145 odebug << "CpuCategory::populate()" << oendl;
146 QFile cpuinfofile( "/proc/cpuinfo" ); 146 QFile cpuinfofile( "/proc/cpuinfo" );
147 if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) ) 147 if ( !cpuinfofile.exists() || !cpuinfofile.open( IO_ReadOnly ) )
148 { 148 {
149 new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" ); 149 new CpuDevice( this, "ERROR: /proc/cpuinfo not found or unaccessible" );
150 return; 150 return;
151 } 151 }
152 QTextStream cpuinfo( &cpuinfofile ); 152 QTextStream cpuinfo( &cpuinfofile );
153 153
154 int cpucount = 0; 154 int cpucount = 0;
155 CpuDevice* dev = 0; 155 CpuDevice* dev = 0;
156 156
157 while ( !cpuinfo.atEnd() ) 157 while ( !cpuinfo.atEnd() )
158 { 158 {
159 QString line = cpuinfo.readLine(); 159 QString line = cpuinfo.readLine();
160 odebug << "got line '" << line << "'" << oendl; 160 odebug << "got line '" << line << "'" << oendl;
161 if ( line.lower().startsWith( "processor" ) ) 161 if ( line.lower().startsWith( "processor" ) )
162 { 162 {
163 dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) ); 163 dev = new CpuDevice( this, QString( "CPU #%1" ).arg( cpucount++ ) );
164 dev->addInfo( line ); 164 dev->addInfo( line );
165 } 165 }
166 else 166 else
167 { 167 {
168 if ( dev ) dev->addInfo( line ); 168 if ( dev ) dev->addInfo( line );
169 } 169 }
170 } 170 }
171} 171}
172 172
173//================================================================================================= 173//=================================================================================================
174InputCategory::InputCategory( DevicesView* parent ) 174InputCategory::InputCategory( DevicesView* parent )
175 :Category( parent, "2. Input Subsystem" ) 175 :Category( parent, "2. Input Subsystem" )
176{ 176{
177} 177}
178 178
179InputCategory::~InputCategory() 179InputCategory::~InputCategory()
180{ 180{
181} 181}
182 182
183void InputCategory::populate() 183void InputCategory::populate()
184{ 184{
185 odebug << "InputCategory::populate()" << oendl; 185 odebug << "InputCategory::populate()" << oendl;
186 OInputSystem* sys = OInputSystem::instance(); 186 OInputSystem* sys = OInputSystem::instance();
187 OInputSystem::DeviceIterator it = sys->iterator(); 187 OInputSystem::DeviceIterator it = sys->iterator();
188 while ( it.current() ) 188 while ( it.current() )
189 { 189 {
190 InputDevice* dev = new InputDevice( this, it.current()->identity() ); 190 InputDevice* dev = new InputDevice( this, it.current()->identity() );
191 dev->setInfo( it.current() ); 191 dev->setInfo( it.current() );
192 ++it; 192 ++it;
193 } 193 }
194} 194}
195 195
196//================================================================================================= 196//=================================================================================================
197CardsCategory::CardsCategory( DevicesView* parent ) 197CardsCategory::CardsCategory( DevicesView* parent )
198 :Category( parent, "3. Removable Cards" ) 198 :Category( parent, "3. Removable Cards" )
199{ 199{
200} 200}
201 201
202CardsCategory::~CardsCategory() 202CardsCategory::~CardsCategory()
203{ 203{
204} 204}
205 205
206void CardsCategory::populate() 206void CardsCategory::populate()
207{ 207{
208 odebug << "CardsCategory::populate()" << oendl; 208 odebug << "CardsCategory::populate()" << oendl;
209 OPcmciaSystem* sys = OPcmciaSystem::instance(); 209 OPcmciaSystem* sys = OPcmciaSystem::instance();
210 OPcmciaSystem::CardIterator it = sys->iterator(); 210 OPcmciaSystem::CardIterator it = sys->iterator();
211 while ( it.current() ) 211 while ( it.current() )
212 { 212 {
213 CardDevice *dev = new CardDevice( this, it.current()->identity() ); 213 CardDevice *dev = new CardDevice( this, it.current()->identity() );
214 dev->setInfo( it.current() ); 214 dev->setInfo( it.current() );
215 ++it; 215 ++it;
216 } 216 }
217} 217}
218 218
219//================================================================================================= 219//=================================================================================================
220UsbCategory::UsbCategory( DevicesView* parent ) 220UsbCategory::UsbCategory( DevicesView* parent )
221 :Category( parent, "4. Universal Serial Bus" ) 221 :Category( parent, "4. Universal Serial Bus" )
222{ 222{
223} 223}
224 224
225UsbCategory::~UsbCategory() 225UsbCategory::~UsbCategory()
226{ 226{
227} 227}
228 228
229void UsbCategory::populate() 229void UsbCategory::populate()
230{ 230{
231 odebug << "UsbCategory::populate()" << oendl; 231 odebug << "UsbCategory::populate()" << oendl;
232 QFile usbinfofile( "/proc/bus/usb/devices" ); 232 QFile usbinfofile( "/proc/bus/usb/devices" );
233 if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) 233 if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) )
234 { 234 {
235 new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); 235 new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" );
236 return; 236 return;
237 } 237 }
238 QTextStream usbinfo( &usbinfofile ); 238 QTextStream usbinfo( &usbinfofile );
239 239
240 int _bus, _level, _parent, _port, _count, _device, _channels, _power; 240 int _bus, _level, _parent, _port, _count, _device, _channels, _power;
241 float _speed; 241 float _speed;
242 QString _manufacturer, _product, _serial; 242 QString _manufacturer, _product, _serial;
243 243
244 int usbcount = 0; 244 int usbcount = 0;
245 UsbDevice* lastDev = 0; 245 UsbDevice* lastDev = 0;
246 UsbDevice* dev = 0; 246 UsbDevice* dev = 0;
247 while ( !usbinfo.atEnd() ) 247 while ( !usbinfo.atEnd() )
248 { 248 {
249 QString line = usbinfo.readLine(); 249 QString line = usbinfo.readLine();
250 odebug << "got line '" << line << "'" << oendl; 250 odebug << "got line '" << line << "'" << oendl;
251 if ( line.startsWith( "T:" ) ) 251 if ( line.startsWith( "T:" ) )
252 { 252 {
253 sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); 253 sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels);
254 254
255 if ( !_level ) 255 if ( !_level )
256 { 256 {
257 odebug << "adding new bus" << oendl; 257 odebug << "adding new bus" << oendl;
258 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); 258 dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) );
259 lastDev = dev; 259 lastDev = dev;
260 } 260 }
261 else 261 else
262 { 262 {
263 odebug << "adding new dev" << oendl; 263 odebug << "adding new dev" << oendl;
264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); 264 dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) );
265 lastDev = dev; 265 lastDev = dev;
266 } 266 }
267 } 267 }
268 else if ( line.startsWith( "S: Product" ) ) 268 else if ( line.startsWith( "S: Product" ) )
269 { 269 {
270 int dp = line.find( '=' ); 270 int dp = line.find( '=' );
271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); 271 dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" );
272 } 272 }
273 else 273 else
274 { 274 {
275 continue; 275 continue;
276 } 276 }
277 } 277 }
278} 278}
279 279
280 280
281//================================================================================================= 281//=================================================================================================
282Device::Device( Category* parent, const QString& name ) 282Device::Device( Category* parent, const QString& name )
283 :OListViewItem( parent, name ) 283 :OListViewItem( parent, name )
284{ 284{
285 devinfo = static_cast<QWidget*>( listView()->parent() ); 285 devinfo = static_cast<QWidget*>( listView()->parent() );
286} 286}
287 287
288Device::Device( Device* parent, const QString& name ) 288Device::Device( Device* parent, const QString& name )
289 :OListViewItem( parent, name ) 289 :OListViewItem( parent, name )
290{ 290{
291 devinfo = static_cast<QWidget*>( listView()->parent() ); 291 devinfo = static_cast<QWidget*>( listView()->parent() );
292} 292}
293 293
294Device::~Device() 294Device::~Device()
295{ 295{
296} 296}
297 297
298 298
299QWidget* Device::detailsWidget() 299QWidget* Device::detailsWidget()
300{ 300{
301 return details; 301 return details;
302} 302}
303 303
304//================================================================================================= 304//=================================================================================================
305CpuDevice::CpuDevice( Category* parent, const QString& name ) 305CpuDevice::CpuDevice( Category* parent, const QString& name )
306 :Device( parent, name ) 306 :Device( parent, name )
307{ 307{
308 OListView* w = new OListView( devinfo ); 308 OListView* w = new OListView( devinfo );
309 details = w; 309 details = w;
310 w->addColumn( "Info" ); 310 w->addColumn( "Info" );
311 w->addColumn( "Value" ); 311 w->addColumn( "Value" );
312 w->hide(); 312 w->hide();
313} 313}
314 314
315CpuDevice::~CpuDevice() 315CpuDevice::~CpuDevice()
316{ 316{
317} 317}
318 318
319void CpuDevice::addInfo( const QString& info ) 319void CpuDevice::addInfo( const QString& info )
320{ 320{
321 int dp = info.find( ':' ); 321 int dp = info.find( ':' );
322 if ( dp != -1 ) 322 if ( dp != -1 )
323 { 323 {
324 new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) ); 324 new OListViewItem( (OListView*) details, info.left( dp ), info.right( info.length()-dp ) );
325 } 325 }
326} 326}
327 327
328//================================================================================================= 328//=================================================================================================
329CardDevice::CardDevice( Category* parent, const QString& name ) 329CardDevice::CardDevice( Category* parent, const QString& name )
330 :Device( parent, name ) 330 :Device( parent, name )
331{ 331{
332 OListView* w = new OListView( devinfo ); 332 OListView* w = new OListView( devinfo );
333 details = w; 333 details = w;
334 w->addColumn( "Info" ); 334 w->addColumn( "Info" );
335 w->addColumn( "Value" ); 335 w->addColumn( "Value" );
336 w->hide(); 336 w->hide();
337} 337}
338 338
339void CardDevice::setInfo( const OPcmciaSocket* card ) 339void CardDevice::setInfo( const OPcmciaSocket* card )
340{ 340{
341 QStringList vendorlst = card->productIdentityVector(); 341 QStringList vendorlst = card->productIdentityVector();
342 for( QStringList::Iterator it = vendorlst.begin(); it != vendorlst.end(); ++it ) 342 for( QStringList::Iterator it = vendorlst.begin(); it != vendorlst.end(); ++it )
343 { 343 {
344 new OListViewItem( (OListView*) details, "VendorID", *it ); 344 new OListViewItem( (OListView*) details, "VendorID", *it );
345 } 345 }
346 new OListViewItem( (OListView*) details, "Manufacturer", card->manufacturerIdentity() ); 346 new OListViewItem( (OListView*) details, "Manufacturer", card->manufacturerIdentity() );
347 new OListViewItem( (OListView*) details, "Function", card->function() ); 347 new OListViewItem( (OListView*) details, "Function", card->function() );
348 348
349 QStringList text; 349 QStringList text;
350 OPcmciaSocket::OPcmciaSocketCardStatus status = card->status(); 350 OPcmciaSocket::OPcmciaSocketCardStatus status = card->status();
351 if ( status ) 351 if ( status )
352 { 352 {
353 if ( status & OPcmciaSocket::Occupied ) text += "Occupied"; 353 if ( status & OPcmciaSocket::Occupied ) text += "Occupied";
354 if ( status & OPcmciaSocket::OccupiedCardBus ) text += "CardBus"; 354 if ( status & OPcmciaSocket::OccupiedCardBus ) text += "CardBus";
355 if ( status & OPcmciaSocket::WriteProtected ) text += "WriteProtected"; 355 if ( status & OPcmciaSocket::WriteProtected ) text += "WriteProtected";
356 if ( status & OPcmciaSocket::BatteryLow ) text += "BatteryLow"; 356 if ( status & OPcmciaSocket::BatteryLow ) text += "BatteryLow";
357 if ( status & OPcmciaSocket::BatteryDead ) text += "BatteryDead"; 357 if ( status & OPcmciaSocket::BatteryDead ) text += "BatteryDead";
358 if ( status & OPcmciaSocket::Ready ) text += "Ready"; 358 if ( status & OPcmciaSocket::Ready ) text += "Ready";
359 if ( status & OPcmciaSocket::Suspended ) text += "Suspended"; 359 if ( status & OPcmciaSocket::Suspended ) text += "Suspended";
360 if ( status & OPcmciaSocket::Attention ) text += "Attention"; 360 if ( status & OPcmciaSocket::Attention ) text += "Attention";
361 if ( status & OPcmciaSocket::InsertionInProgress ) text += "InsertionInProgress"; 361 if ( status & OPcmciaSocket::InsertionInProgress ) text += "InsertionInProgress";
362 if ( status & OPcmciaSocket::RemovalInProgress ) text += "RemovalInProgress"; 362 if ( status & OPcmciaSocket::RemovalInProgress ) text += "RemovalInProgress";
363 if ( status & OPcmciaSocket::ThreeVolts ) text += "3V"; 363 if ( status & OPcmciaSocket::ThreeVolts ) text += "3V";
364 if ( status & OPcmciaSocket::SupportsVoltage ) text += "SupportsVoltage"; 364 if ( status & OPcmciaSocket::SupportsVoltage ) text += "SupportsVoltage";
365 } 365 }
366 else 366 else
367 { 367 {
368 text += "<unknown>"; 368 text += "<unknown>";
369 } 369 }
370 new OListViewItem( (OListView*) details, "Status", text.join( ", " ) ); 370 new OListViewItem( (OListView*) details, "Status", text.join( ", " ) );
371} 371}
372 372
373CardDevice::~CardDevice() 373CardDevice::~CardDevice()
374{ 374{
375} 375}
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 )
424 :Device( parent, name ) 425 :Device( parent, name )
425{ 426{
426 details = new QPushButton( name, devinfo ); 427 details = new QPushButton( name, devinfo );
427 details->hide(); 428 details->hide();
428} 429}
429 430
430UsbDevice::~UsbDevice() 431UsbDevice::~UsbDevice()
431{ 432{
432} 433}