-rw-r--r-- | libopie2/opiecore/oinputsystem.cpp | 16 | ||||
-rw-r--r-- | libopie2/opiecore/oinputsystem.h | 40 | ||||
-rw-r--r-- | libopie2/opiecore/oinputsystemenums.h | 405 |
3 files changed, 425 insertions, 36 deletions
diff --git a/libopie2/opiecore/oinputsystem.cpp b/libopie2/opiecore/oinputsystem.cpp index 8253c18..29de35c 100644 --- a/libopie2/opiecore/oinputsystem.cpp +++ b/libopie2/opiecore/oinputsystem.cpp | |||
@@ -1,156 +1,172 @@ | |||
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 "oinputsystem.h" | 29 | #include "oinputsystem.h" |
30 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | 34 | ||
35 | /* STD */ | 35 | /* STD */ |
36 | #include <errno.h> | 36 | #include <errno.h> |
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <sys/fcntl.h> | 38 | #include <sys/fcntl.h> |
39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> |
40 | 40 | ||
41 | #define BUFSIZE 256 | 41 | #define BUFSIZE 256 |
42 | #define BIT_MASK( name, numbits ) \ | 42 | #define BIT_MASK( name, numbits ) \ |
43 | unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ | 43 | unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ |
44 | memset( name, 0, sizeof( name ) ) | 44 | memset( name, 0, sizeof( name ) ) |
45 | #define BIT_TEST( bitmask, bit ) \ | 45 | #define BIT_TEST( bitmask, bit ) \ |
46 | ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) | 46 | ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) |
47 | 47 | ||
48 | /*====================================================================================== | 48 | /*====================================================================================== |
49 | * OInputSystem | 49 | * OInputSystem |
50 | *======================================================================================*/ | 50 | *======================================================================================*/ |
51 | 51 | ||
52 | OInputSystem* OInputSystem::_instance = 0; | 52 | OInputSystem* OInputSystem::_instance = 0; |
53 | 53 | ||
54 | OInputSystem::OInputSystem() : QObject() | 54 | OInputSystem::OInputSystem() : QObject() |
55 | { | 55 | { |
56 | qDebug( "OInputSystem::OInputSystem()" ); | 56 | qDebug( "OInputSystem::OInputSystem()" ); |
57 | synchronize(); | 57 | synchronize(); |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | void OInputSystem::synchronize() | 61 | void OInputSystem::synchronize() |
62 | { | 62 | { |
63 | qDebug( "OInputSystem::synchronize()" ); | 63 | qDebug( "OInputSystem::synchronize()" ); |
64 | if ( QFile::exists( "/dev/input/event0" ) ) _devices.insert( "0", new OInputDevice( this, "/dev/input/event0" ) ); | 64 | if ( QFile::exists( "/dev/input/event0" ) ) _devices.insert( "0", new OInputDevice( this, "/dev/input/event0" ) ); |
65 | if ( QFile::exists( "/dev/input/event1" ) ) _devices.insert( "1", new OInputDevice( this, "/dev/input/event1" ) ); | 65 | if ( QFile::exists( "/dev/input/event1" ) ) _devices.insert( "1", new OInputDevice( this, "/dev/input/event1" ) ); |
66 | if ( QFile::exists( "/dev/input/event2" ) ) _devices.insert( "2", new OInputDevice( this, "/dev/input/event2" ) ); | 66 | if ( QFile::exists( "/dev/input/event2" ) ) _devices.insert( "2", new OInputDevice( this, "/dev/input/event2" ) ); |
67 | if ( QFile::exists( "/dev/input/event3" ) ) _devices.insert( "3", new OInputDevice( this, "/dev/input/event3" ) ); | 67 | if ( QFile::exists( "/dev/input/event3" ) ) _devices.insert( "3", new OInputDevice( this, "/dev/input/event3" ) ); |
68 | qDebug( "OInputSystem::synchronize() done" ); | 68 | qDebug( "OInputSystem::synchronize() done" ); |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | OInputSystem::~OInputSystem() | 72 | OInputSystem::~OInputSystem() |
73 | { | 73 | { |
74 | qDebug( "OInputSystem::~OInputSystem()" ); | 74 | qDebug( "OInputSystem::~OInputSystem()" ); |
75 | } | 75 | } |
76 | 76 | ||
77 | 77 | ||
78 | int OInputSystem::count() const | 78 | int OInputSystem::count() const |
79 | { | 79 | { |
80 | return _devices.count(); | 80 | return _devices.count(); |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | OInputDevice* OInputSystem::device( const QString& device ) const | 84 | OInputDevice* OInputSystem::device( const QString& device ) const |
85 | { | 85 | { |
86 | return _devices[device]; | 86 | return _devices[device]; |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | OInputSystem* OInputSystem::instance() | 90 | OInputSystem* OInputSystem::instance() |
91 | { | 91 | { |
92 | if ( !_instance ) _instance = new OInputSystem(); | 92 | if ( !_instance ) _instance = new OInputSystem(); |
93 | return _instance; | 93 | return _instance; |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | OInputSystem::DeviceIterator OInputSystem::iterator() const | 97 | OInputSystem::DeviceIterator OInputSystem::iterator() const |
98 | { | 98 | { |
99 | return OInputSystem::DeviceIterator( _devices ); | 99 | return OInputSystem::DeviceIterator( _devices ); |
100 | } | 100 | } |
101 | 101 | ||
102 | /*====================================================================================== | 102 | /*====================================================================================== |
103 | * OInputDevice | 103 | * OInputDevice |
104 | *======================================================================================*/ | 104 | *======================================================================================*/ |
105 | 105 | ||
106 | OInputDevice::OInputDevice( QObject* parent, const char* name ) : QObject( parent, name ) | 106 | OInputDevice::OInputDevice( QObject* parent, const char* name ) : QObject( parent, name ) |
107 | { | 107 | { |
108 | qDebug( "OInputDevice::OInputDevice( '%s' )", name ); | 108 | qDebug( "OInputDevice::OInputDevice( '%s' )", name ); |
109 | 109 | ||
110 | _fd = ::open( name, O_RDONLY ); | 110 | _fd = ::open( name, O_RDONLY ); |
111 | if ( _fd == -1 ) | 111 | if ( _fd == -1 ) |
112 | { | 112 | { |
113 | qDebug( "OInputDevice::OInputDevice() - Warning: couldn't open %s (%s)", name, strerror( errno ) ); | 113 | qDebug( "OInputDevice::OInputDevice() - Warning: couldn't open %s (%s)", name, strerror( errno ) ); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | OInputDevice::~OInputDevice() | 118 | OInputDevice::~OInputDevice() |
119 | { | 119 | { |
120 | qDebug( "OInputDevice::~OInputDevice()" ); | 120 | qDebug( "OInputDevice::~OInputDevice()" ); |
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | QString OInputDevice::identity() const | 124 | QString OInputDevice::identity() const |
125 | { | 125 | { |
126 | char buf[BUFSIZE] = "<unknown>"; | 126 | char buf[BUFSIZE] = "<unknown>"; |
127 | ::ioctl( _fd, EVIOCGNAME(sizeof buf), buf ); | 127 | ::ioctl( _fd, EVIOCGNAME(sizeof buf), buf ); |
128 | return buf; | 128 | return buf; |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | QString OInputDevice::path() const | 132 | QString OInputDevice::path() const |
133 | { | 133 | { |
134 | char buf[BUFSIZE] = "<unknown>"; | 134 | char buf[BUFSIZE] = "<unknown>"; |
135 | ::ioctl( _fd, EVIOCGPHYS(sizeof buf), buf ); | 135 | ::ioctl( _fd, EVIOCGPHYS(sizeof buf), buf ); |
136 | return buf; | 136 | return buf; |
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | QString OInputDevice::uniq() const | 140 | QString OInputDevice::uniq() const |
141 | { | 141 | { |
142 | char buf[BUFSIZE] = "<unknown>"; | 142 | char buf[BUFSIZE] = "<unknown>"; |
143 | ::ioctl( _fd, EVIOCGUNIQ(sizeof buf), buf ); | 143 | ::ioctl( _fd, EVIOCGUNIQ(sizeof buf), buf ); |
144 | return buf; | 144 | return buf; |
145 | } | 145 | } |
146 | 146 | ||
147 | |||
147 | bool OInputDevice::hasFeature( Feature bit ) const | 148 | bool OInputDevice::hasFeature( Feature bit ) const |
148 | { | 149 | { |
149 | BIT_MASK( features, EV_MAX ); | 150 | BIT_MASK( features, EV_MAX ); |
150 | 151 | ||
151 | if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) | 152 | if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) |
152 | return false; | 153 | return false; |
153 | else | 154 | else |
154 | return BIT_TEST( features, bit ); | 155 | return BIT_TEST( features, bit ); |
155 | } | 156 | } |
156 | 157 | ||
158 | |||
159 | bool OInputDevice::isHeld( Key bit ) const | ||
160 | { | ||
161 | BIT_MASK( keys, KEY_MAX ); | ||
162 | |||
163 | if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) | ||
164 | { | ||
165 | perror( "EVIOCGKEY" ); | ||
166 | return false; | ||
167 | } | ||
168 | else | ||
169 | { | ||
170 | return BIT_TEST( keys, bit ); | ||
171 | } | ||
172 | } | ||
diff --git a/libopie2/opiecore/oinputsystem.h b/libopie2/opiecore/oinputsystem.h index 3746023..9020bc1 100644 --- a/libopie2/opiecore/oinputsystem.h +++ b/libopie2/opiecore/oinputsystem.h | |||
@@ -1,148 +1,116 @@ | |||
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 | #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 | ||
38 | namespace Opie { | 38 | namespace Opie { |
39 | namespace Core { | 39 | namespace Core { |
40 | 40 | ||
41 | class OInputDevice; | 41 | class OInputDevice; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * @brief A container class for all input devices | 44 | * @brief A container class for all input devices |
45 | * | 45 | * |
46 | * This class provides access to all available input system devices of your computer. | 46 | * This class provides access to all available input system devices of your computer. |
47 | * | 47 | * |
48 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 48 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
49 | */ | 49 | */ |
50 | class OInputSystem : public QObject | 50 | class 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 desctructor | 79 | * @internal desctructor |
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 | ||
91 | class OInputDevice : public QObject | 91 | class OInputDevice : public QObject |
92 | { | 92 | { |
93 | public: | ||
94 | |||
95 | enum Feature | ||
96 | { | ||
97 | Synchronous = EV_SYN, | ||
98 | Keys = EV_KEY, | ||
99 | Relative = EV_REL, | ||
100 | Absolute = EV_ABS, | ||
101 | Miscellaneous = EV_MSC, | ||
102 | Leds = EV_LED, | ||
103 | Sound = EV_SND, | ||
104 | AutoRepeat = EV_REP, | ||
105 | ForceFeedback = EV_FF, | ||
106 | PowerManagement = EV_PWR, | ||
107 | ForceFeedbackStatus = EV_FF_STATUS, | ||
108 | }; | ||
109 | |||
110 | enum Bus | ||
111 | { | ||
112 | PCI = BUS_PCI, | ||
113 | ISAPNP = BUS_ISAPNP, | ||
114 | HIL = BUS_HIL, | ||
115 | BLUETOOTH = BUS_BLUETOOTH, | ||
116 | ISA = BUS_ISA, | ||
117 | I8042 = BUS_I8042, | ||
118 | XTKBD = BUS_XTKBD, | ||
119 | RS232 = BUS_RS232, | ||
120 | GAMEPORT = BUS_GAMEPORT, | ||
121 | PARPORT = BUS_PARPORT, | ||
122 | AMIGA = BUS_AMIGA, | ||
123 | ADB = BUS_ADB, | ||
124 | I2C = BUS_I2C, | ||
125 | HOST = BUS_HOST, | ||
126 | }; | ||
127 | |||
128 | public: | 93 | public: |
129 | OInputDevice( QObject* parent, const char* name = 0 ); | 94 | OInputDevice( QObject* parent, const char* name = 0 ); |
130 | ~OInputDevice(); | 95 | ~OInputDevice(); |
96 | |||
97 | #include "oinputsystemenums.h" | ||
131 | 98 | ||
132 | public: | 99 | public: |
133 | QString identity() const; | 100 | QString identity() const; |
134 | QString path() const; | 101 | QString path() const; |
135 | QString uniq() const; | 102 | QString uniq() const; |
136 | bool hasFeature( Feature ) const; | 103 | bool hasFeature( Feature ) const; |
104 | bool isHeld( Key ) const; | ||
137 | 105 | ||
138 | private: | 106 | private: |
139 | int _fd; | 107 | int _fd; |
140 | input_id _id; | 108 | input_id _id; |
141 | 109 | ||
142 | }; | 110 | }; |
143 | 111 | ||
144 | } | 112 | } |
145 | } | 113 | } |
146 | 114 | ||
147 | #endif // OINPUTSYSTEM_H | 115 | #endif // OINPUTSYSTEM_H |
148 | 116 | ||
diff --git a/libopie2/opiecore/oinputsystemenums.h b/libopie2/opiecore/oinputsystemenums.h new file mode 100644 index 0000000..3461e5a --- a/dev/null +++ b/libopie2/opiecore/oinputsystemenums.h | |||
@@ -0,0 +1,405 @@ | |||
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 | |||