author | mickeyl <mickeyl> | 2005-02-02 16:37:12 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-02-02 16:37:12 (UTC) |
commit | 8ea35f618c5811b59f4460d0f2198b9818db281e (patch) (unidiff) | |
tree | 0ef5a73e14c9b236dde77cb866401ab0ad3a103f /examples | |
parent | 896b1f8f0855feec3bb6cb9944c5f7a7b2d6cd1f (diff) | |
download | opie-8ea35f618c5811b59f4460d0f2198b9818db281e.zip opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.gz opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.bz2 |
more input system stuff
-rw-r--r-- | examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp index 5450966..a9c0fd2 100644 --- a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp +++ b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp | |||
@@ -1,318 +1,324 @@ | |||
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 | ||
32 | using namespace Opie::Core; | 32 | using 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 | ||
42 | int main( int argc, char** argv ) | 42 | int 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 Device '" << 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; | ||
56 | features += QString( "\nSynchronous: " ); | ||
57 | if ( dev->hasFeature( OInputDevice::Synchronous ) ) features += "[ x ]"; else features += "[ ]"; | ||
58 | features += QString( "\nKeys or Buttons: " ); | ||
59 | if ( dev->hasFeature( OInputDevice::Keys ) ) features += "[ x ]"; else features += "[ ]"; | ||
60 | features += QString( "\nRelative Axes: " ); | ||
61 | if ( dev->hasFeature( OInputDevice::Relative ) ) features += "[ x ]"; else features += "[ ]"; | ||
62 | features += QString( "\nAbsolute Axes: " ); | ||
63 | if ( dev->hasFeature( OInputDevice::Absolute ) ) features += "[ x ]"; else features += "[ ]"; | ||
64 | features += QString( "\nMiscellaneous: " ); | ||
65 | if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) features += "[ x ]"; else features += "[ ]"; | ||
66 | features += QString( "\nLeds: " ); | ||
67 | if ( dev->hasFeature( OInputDevice::Leds ) ) features += "[ x ]"; else features += "[ ]"; | ||
68 | features += QString( "\nSound: " ); | ||
69 | if ( dev->hasFeature( OInputDevice::Sound ) ) features += "[ x ]"; else features += "[ ]"; | ||
70 | features += QString( "\nAutoRepeat " ); | ||
71 | if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) features += "[ x ]"; else features += "[ ]"; | ||
72 | features += QString( "\nForceFeedback: " ); | ||
73 | if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) features += "[ x ]"; else features += "[ ]"; | ||
74 | features += QString( "\nPowerManagement: " ); | ||
75 | if ( dev->hasFeature( OInputDevice::PowerManagement ) ) features += "[ x ]"; else features += "[ ]"; | ||
76 | features += QString( "\nFeedbackStatus: " ); | ||
77 | if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) features += "[ x ]"; else features += "[ ]"; | ||
78 | |||
55 | odebug << "========================================" | 79 | odebug << "========================================" |
56 | << "\nDevice: " << dev->name() | 80 | << "\nDevice: " << dev->name() |
57 | << "\nName: " << dev->identity() | 81 | << "\nName: " << dev->identity() |
58 | << "\nPath: " << dev->path() | 82 | << "\nPath: " << dev->path() |
59 | << "\nUniq: " << dev->uniq() | 83 | << "\nUniq: " << dev->uniq() |
84 | << features << "\n" | ||
60 | << oendl; | 85 | << oendl; |
61 | 86 | ||
62 | ++it; | 87 | ++it; |
63 | } | 88 | } |
64 | } | 89 | } |
65 | 90 | ||
66 | #else | 91 | #else |
67 | 92 | ||
68 | #include <fcntl.h> | 93 | #include <fcntl.h> |
69 | #include <unistd.h> | 94 | #include <unistd.h> |
70 | #include <cstdlib> | 95 | #include <cstdlib> |
71 | #include <cstdio> | 96 | #include <cstdio> |
72 | #include <string> | 97 | #include <string> |
73 | 98 | ||
74 | #include <sys/types.h> | 99 | #include <sys/types.h> |
75 | #include <linux/input.h> | 100 | #include <linux/input.h> |
76 | 101 | ||
77 | using std::string; | 102 | using std::string; |
78 | 103 | ||
79 | const unsigned char BUT1 = 0x01; | 104 | const unsigned char BUT1 = 0x01; |
80 | const unsigned char BUT2 = 0x04; | 105 | const unsigned char BUT2 = 0x04; |
81 | const unsigned char BUT3 = 0x02; | 106 | const unsigned char BUT3 = 0x02; |
82 | const unsigned char BUT4 = 0x40; | 107 | const unsigned char BUT4 = 0x40; |
83 | const unsigned char BUT5 = 0x80; | 108 | const unsigned char BUT5 = 0x80; |
84 | 109 | ||
85 | #define BITMASK( name, numbits ) \ | 110 | #define BITMASK( name, numbits ) \ |
86 | unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ | 111 | unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ |
87 | memset( name, 0, sizeof( name ) ) | 112 | memset( name, 0, sizeof( name ) ) |
88 | 113 | ||
89 | #define TEST_BIT( bitmask, bit ) \ | 114 | #define TEST_BIT( bitmask, bit ) \ |
90 | ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) | 115 | ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) |
91 | 116 | ||
92 | int Open_cPad() | 117 | int Open_cPad() |
93 | { | 118 | { |
94 | size_t MAX_DEVICES = 1; | 119 | size_t MAX_DEVICES = 1; |
95 | int fd = -1; | 120 | int fd = -1; |
96 | input_id info; | 121 | input_id info; |
97 | 122 | ||
98 | for( size_t i = 0; i < MAX_DEVICES; ++i ) | 123 | for( size_t i = 0; i < MAX_DEVICES; ++i ) |
99 | { | 124 | { |
100 | string devpath( "/dev/input/event0" ); | 125 | string devpath( "/dev/input/event0" ); |
101 | 126 | ||
102 | //devpath << (int)i; | 127 | //devpath << (int)i; |
103 | 128 | ||
104 | fd = open( devpath.c_str(), O_RDONLY, &info ); | 129 | fd = open( devpath.c_str(), O_RDONLY, &info ); |
105 | 130 | ||
106 | if( fd >= 0 ) | 131 | if( fd >= 0 ) |
107 | { | 132 | { |
108 | int version = -1; | 133 | int version = -1; |
109 | /* ioctl() accesses the underlying driver */ | 134 | /* ioctl() accesses the underlying driver */ |
110 | if (ioctl(fd, EVIOCGVERSION, &version)) { | 135 | if (ioctl(fd, EVIOCGVERSION, &version)) { |
111 | perror("evdev ioctl"); | 136 | perror("evdev ioctl"); |
112 | } | 137 | } |
113 | 138 | ||
114 | /* the EVIOCGVERSION ioctl() returns an int */ | 139 | /* the EVIOCGVERSION ioctl() returns an int */ |
115 | /* so we unpack it and display it */ | 140 | /* so we unpack it and display it */ |
116 | printf("evdev driver version is %d.%d.%d\n", | 141 | printf("evdev driver version is %d.%d.%d\n", |
117 | version >> 16, (version >> 8) & 0xff, | 142 | version >> 16, (version >> 8) & 0xff, |
118 | version & 0xff); | 143 | version & 0xff); |
119 | 144 | ||
120 | // Get Identifying info | 145 | // Get Identifying info |
121 | 146 | ||
122 | if( ioctl( fd, EVIOCGID, &info) ) | 147 | if( ioctl( fd, EVIOCGID, &info) ) |
123 | { | 148 | { |
124 | perror( "event device ioctl" ); | 149 | perror( "event device ioctl" ); |
125 | return -1; | 150 | return -1; |
126 | } | 151 | } |
127 | printf( "Bus: %#x, Vendor: %#x, Product: %#x, Version: %#x\n", | 152 | printf( "Bus: %#x, Vendor: %#x, Product: %#x, Version: %#x\n", |
128 | info.bustype, info.vendor, info.product, info.version ); | 153 | info.bustype, info.vendor, info.product, info.version ); |
129 | 154 | ||
130 | switch ( info.bustype) | 155 | switch ( info.bustype) |
131 | { | 156 | { |
132 | case BUS_PCI : | 157 | case BUS_PCI : |
133 | printf(" is on a PCI bus\n"); | 158 | printf(" is on a PCI bus\n"); |
134 | break; | 159 | break; |
135 | case BUS_USB : | 160 | case BUS_USB : |
136 | printf(" is on a Universal Serial Bus\n"); | 161 | printf(" is on a Universal Serial Bus\n"); |
137 | break; | 162 | break; |
138 | /* ... */ | 163 | /* ... */ |
139 | } | 164 | } |
140 | 165 | ||
141 | // Get device 'name' | ||
142 | |||
143 | char name[256] = "Unknown"; | ||
144 | if( ioctl( fd, EVIOCGNAME(sizeof name ), name) < 0 ) | ||
145 | { | ||
146 | perror( "event device ioctl" ); | ||
147 | }else | ||
148 | printf( "Device name '%s'\n", name ); | ||
149 | |||
150 | if(ioctl(fd, EVIOCGPHYS(sizeof(name)), name) < 0) { | ||
151 | perror("event ioctl"); | ||
152 | }else | ||
153 | printf("Device path '%s'\n", name ); | ||
154 | |||
155 | if(ioctl(fd, EVIOCGUNIQ(sizeof(name)), name) < 0) { | ||
156 | perror("event ioctl"); | ||
157 | }else | ||
158 | printf("Device identity '%s'\n", name ); | ||
159 | |||
160 | // Get feature types | 166 | // Get feature types |
161 | 167 | ||
162 | BITMASK( features, EV_MAX ); | 168 | BITMASK( features, EV_MAX ); |
163 | 169 | ||
164 | if( ioctl( fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) | 170 | if( ioctl( fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) |
165 | { | 171 | { |
166 | perror( "event device ioctl" ); | 172 | perror( "event device ioctl" ); |
167 | return -1; | 173 | return -1; |
168 | } | 174 | } |
169 | 175 | ||
170 | printf( "Supported features:\n" ); | 176 | printf( "Supported features:\n" ); |
171 | for( size_t bit = 0; bit < EV_MAX; ++bit ) | 177 | for( size_t bit = 0; bit < EV_MAX; ++bit ) |
172 | { | 178 | { |
173 | if( TEST_BIT( features, bit ) ) | 179 | if( TEST_BIT( features, bit ) ) |
174 | { | 180 | { |
175 | switch( bit ) | 181 | switch( bit ) |
176 | { | 182 | { |
177 | case EV_SYN : | 183 | case EV_SYN : |
178 | printf(" Sync. Events\n"); | 184 | printf(" Sync. Events\n"); |
179 | break; | 185 | break; |
180 | //case EV_RST: | 186 | //case EV_RST: |
181 | // printf( " Reset?\n" ); | 187 | // printf( " Reset?\n" ); |
182 | // break; | 188 | // break; |
183 | case EV_KEY: | 189 | case EV_KEY: |
184 | printf( " Keys or buttons\n" ); | 190 | printf( " Keys or buttons\n" ); |
185 | break; | 191 | break; |
186 | case EV_REL: | 192 | case EV_REL: |
187 | printf( " Relative axes\n" ); | 193 | printf( " Relative axes\n" ); |
188 | break; | 194 | break; |
189 | case EV_ABS: | 195 | case EV_ABS: |
190 | printf( " Absolute axes\n" ); | 196 | printf( " Absolute axes\n" ); |
191 | break; | 197 | break; |
192 | case EV_MSC: | 198 | case EV_MSC: |
193 | printf( " Misc\n" ); | 199 | printf( " Misc\n" ); |
194 | break; | 200 | break; |
195 | case EV_LED: | 201 | case EV_LED: |
196 | printf( " Led's\n" ); | 202 | printf( " Led's\n" ); |
197 | break; | 203 | break; |
198 | case EV_SND: | 204 | case EV_SND: |
199 | printf( " Sounds\n" ); | 205 | printf( " Sounds\n" ); |
200 | break; | 206 | break; |
201 | case EV_REP: | 207 | case EV_REP: |
202 | printf( " Repeat\n" ); | 208 | printf( " Repeat\n" ); |
203 | break; | 209 | break; |
204 | case EV_FF : // fallthrough | 210 | case EV_FF : // fallthrough |
205 | case EV_FF_STATUS: | 211 | case EV_FF_STATUS: |
206 | printf(" Force Feedback\n"); | 212 | printf(" Force Feedback\n"); |
207 | break; | 213 | break; |
208 | case EV_PWR: | 214 | case EV_PWR: |
209 | printf(" Power Management\n"); | 215 | printf(" Power Management\n"); |
210 | break; | 216 | break; |
211 | default: | 217 | default: |
212 | printf( " Unknown (bit %d)\n", bit ); | 218 | printf( " Unknown (bit %d)\n", bit ); |
213 | } | 219 | } |
214 | } | 220 | } |
215 | } | 221 | } |
216 | 222 | ||
217 | // Check keystate | 223 | // Check keystate |
218 | 224 | ||
219 | BITMASK( keys, KEY_MAX ); | 225 | BITMASK( keys, KEY_MAX ); |
220 | 226 | ||
221 | if( ioctl( fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) | 227 | if( ioctl( fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) |
222 | { | 228 | { |
223 | perror( "event device ioctl" ); | 229 | perror( "event device ioctl" ); |
224 | return -1; | 230 | return -1; |
225 | } | 231 | } |
226 | 232 | ||
227 | printf( "Key global status:\n" ); | 233 | printf( "Key global status:\n" ); |
228 | for( size_t bit = 0; bit < KEY_MAX; ++bit ) | 234 | for( size_t bit = 0; bit < KEY_MAX; ++bit ) |
229 | { | 235 | { |
230 | if( TEST_BIT( keys, bit ) ) | 236 | if( TEST_BIT( keys, bit ) ) |
231 | { | 237 | { |
232 | printf( "Key (bit %d) active\n", bit ); | 238 | printf( "Key (bit %d) active\n", bit ); |
233 | } | 239 | } |
234 | } | 240 | } |
235 | } | 241 | } |
236 | else | 242 | else |
237 | printf( "Failed to open device\n" ); | 243 | printf( "Failed to open device\n" ); |
238 | 244 | ||
239 | close( fd ); | 245 | close( fd ); |
240 | } | 246 | } |
241 | return fd; | 247 | return fd; |
242 | } | 248 | } |
243 | 249 | ||
244 | 250 | ||
245 | int main( int argc, char **argv ) | 251 | int main( int argc, char **argv ) |
246 | { | 252 | { |
247 | //printf(" Long: %d, int %d, short %d\n", sizeof( long ), sizeof( int ), sizeof( short ) ); | 253 | //printf(" Long: %d, int %d, short %d\n", sizeof( long ), sizeof( int ), sizeof( short ) ); |
248 | //printf( "num chars %d\n", snprintf( NULL, 0, 0 ) ); | 254 | //printf( "num chars %d\n", snprintf( NULL, 0, 0 ) ); |
249 | //exit( 0 ); | 255 | //exit( 0 ); |
250 | Open_cPad(); | 256 | Open_cPad(); |
251 | 257 | ||
252 | #if 1 | 258 | #if 1 |
253 | int fd = open( "/dev/input/event0", O_RDONLY ); | 259 | int fd = open( "/dev/input/event0", O_RDONLY ); |
254 | 260 | ||
255 | if( fd == -1 ) | 261 | if( fd == -1 ) |
256 | { | 262 | { |
257 | printf( "Failed to open device\n" ); | 263 | printf( "Failed to open device\n" ); |
258 | goto hell; | 264 | goto hell; |
259 | } | 265 | } |
260 | 266 | ||
261 | struct input_event evbuf; | 267 | struct input_event evbuf; |
262 | 268 | ||
263 | for(;;) | 269 | for(;;) |
264 | { | 270 | { |
265 | if( read( fd, &evbuf, sizeof evbuf ) == -1 ) | 271 | if( read( fd, &evbuf, sizeof evbuf ) == -1 ) |
266 | { | 272 | { |
267 | printf( "Read error\n" ); | 273 | printf( "Read error\n" ); |
268 | goto hell; | 274 | goto hell; |
269 | } | 275 | } |
270 | 276 | ||
271 | printf( "Type: %d, Code: %d, Value: %d\n", evbuf.type, evbuf.code, evbuf.value ); | 277 | printf( "Type: %d, Code: %d, Value: %d\n", evbuf.type, evbuf.code, evbuf.value ); |
272 | } | 278 | } |
273 | 279 | ||
274 | #endif | 280 | #endif |
275 | #if 0 | 281 | #if 0 |
276 | unsigned char buf[ 4 ]; | 282 | unsigned char buf[ 4 ]; |
277 | 283 | ||
278 | for(;;) | 284 | for(;;) |
279 | { | 285 | { |
280 | if( read( fd, buf, sizeof buf ) == -1 ) | 286 | if( read( fd, buf, sizeof buf ) == -1 ) |
281 | { | 287 | { |
282 | printf( "Read error\n" ); | 288 | printf( "Read error\n" ); |
283 | goto hell; | 289 | goto hell; |
284 | } | 290 | } |
285 | 291 | ||
286 | printf( "Raw:\t%#x\t%#x\t%#x\t%#x\n", buf[ 0 ], buf[ 1 ], buf[ 2 ], buf[ 3 ] ); | 292 | printf( "Raw:\t%#x\t%#x\t%#x\t%#x\n", buf[ 0 ], buf[ 1 ], buf[ 2 ], buf[ 3 ] ); |
287 | 293 | ||
288 | int dx = buf[ 1 ]; | 294 | int dx = buf[ 1 ]; |
289 | 295 | ||
290 | if( ( buf[ 0 ] & 0x10 ) != 0 ) | 296 | if( ( buf[ 0 ] & 0x10 ) != 0 ) |
291 | dx -= 256; | 297 | dx -= 256; |
292 | 298 | ||
293 | int dy = - buf[ 2 ]; | 299 | int dy = - buf[ 2 ]; |
294 | 300 | ||
295 | if( ( buf[ 0 ] & 0x20 ) != 0 ) | 301 | if( ( buf[ 0 ] & 0x20 ) != 0 ) |
296 | dy += 256; | 302 | dy += 256; |
297 | 303 | ||
298 | printf( "( %d, %d )\t", dx, dy ); | 304 | printf( "( %d, %d )\t", dx, dy ); |
299 | 305 | ||
300 | if( buf[ 0 ] & BUT1 ) | 306 | if( buf[ 0 ] & BUT1 ) |
301 | printf( "Left\t" ); | 307 | printf( "Left\t" ); |
302 | if( buf[ 0 ] & BUT2 ) | 308 | if( buf[ 0 ] & BUT2 ) |
303 | printf( "Middle\t" ); | 309 | printf( "Middle\t" ); |
304 | if( buf[ 0 ] & BUT3 ) | 310 | if( buf[ 0 ] & BUT3 ) |
305 | printf( "Right\t" ); | 311 | printf( "Right\t" ); |
306 | 312 | ||
307 | printf( "\n" ); | 313 | printf( "\n" ); |
308 | } | 314 | } |
309 | #endif | 315 | #endif |
310 | 316 | ||
311 | //close( fd ); | 317 | //close( fd ); |
312 | 318 | ||
313 | exit( EXIT_SUCCESS ); | 319 | exit( EXIT_SUCCESS ); |
314 | hell: | 320 | hell: |
315 | exit( EXIT_FAILURE ); | 321 | exit( EXIT_FAILURE ); |
316 | } | 322 | } |
317 | 323 | ||
318 | #endif \ No newline at end of file | 324 | #endif \ No newline at end of file |