aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2004-11-14 22:29:43 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2004-11-14 22:29:43 +0000
commitcb245d85d24a739ae72eebae78c3959ec42b3695 (patch)
tree2575ad5e16999ebc2ca37a61aebcd3f40905a62c
parente12059711346f72f73cb3595548f75d88aef56d1 (diff)
removed the ev_ from the types
svn path=/trunk/externals/hcs/hid/; revision=2270
-rw-r--r--TODO12
-rw-r--r--doc/hid-help.pd144
-rw-r--r--doc/joystick-help.pd104
-rw-r--r--doc/mouse-help.pd168
-rw-r--r--hid.c10
-rw-r--r--hid_darwin.c19
-rw-r--r--joystick.pd60
-rwxr-xr-xmake-arrays-from-input.h.pl11
-rw-r--r--mouse.pd42
9 files changed, 292 insertions, 278 deletions
diff --git a/TODO b/TODO
index 5f5df00..d51c069 100644
--- a/TODO
+++ b/TODO
@@ -93,6 +93,18 @@ void hid_post(const char *format, const char *);
= if device is closed and obj is started, open device and start
+==============================================================================
+= event name changes
+
+- make key/button Type ev_btn rather than ev_key
+
+- perhaps remove the "ev_" prefix on event Types for efficiency and clarity
+
+==============================================================================
+= mapping object ideas
+
+- [mousefilter]-like object to easily control things with a button
+
______________________________________________________________________________
------------------------------------------------------------------------------
BUGS
diff --git a/doc/hid-help.pd b/doc/hid-help.pd
index 340480f..8e43b8b 100644
--- a/doc/hid-help.pd
+++ b/doc/hid-help.pd
@@ -1,13 +1,13 @@
-#N canvas 156 27 943 666 10;
-#X msg 390 265 ev_rel rel_x 2 3.57445e+09;
-#X obj 390 244 prepend set;
+#N canvas 267 62 963 686 10;
+#X msg 430 325 rel rel_x 0 3.31743e+09;
+#X obj 430 304 prepend set;
#X obj 149 473 route rel_x rel_y;
#X floatatom 149 493 5 0 0 0 - - -;
#X floatatom 206 493 5 0 0 0 - - -;
#X msg 148 77 start;
#X msg 174 96 stop;
-#X floatatom 531 375 12 0 0 1 time - -;
-#X obj 438 355 unpack s s f f;
+#X floatatom 521 385 12 0 0 1 time - -;
+#X obj 428 365 unpack s s f f;
#X msg 239 57 open 0;
#X msg 246 75 open 1;
#X msg 253 93 open 2;
@@ -15,16 +15,16 @@
#X msg 265 129 open 4;
#X floatatom 206 454 7 0 0 0 - - -;
#X floatatom 264 454 7 0 0 0 - - -;
-#X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 25 25
+#X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 25
;
-#X floatatom 500 392 12 0 0 1 value - -;
-#X symbolatom 468 409 10 0 0 1 eventcode - -;
-#X symbolatom 438 428 15 0 0 1 eventtype - -;
-#X obj 177 296 bng 35 250 50 0 empty empty event_received 38 18 1 9
--225280 -1 -1;
+#X floatatom 490 402 12 0 0 1 value - -;
+#X symbolatom 459 419 10 0 0 1 event_code - -;
+#X symbolatom 428 438 15 0 0 1 event_type - -;
+#X obj 17 271 bng 35 250 50 0 empty empty event_received 38 18 1 9
+-262144 -1 -1;
#X obj 2 2 cnv 15 900 20 empty empty [hid] 2 11 1 18 -233017 -66577
0;
-#X text 362 287 outlet message format:;
+#X text 363 234 outlet message format:;
#X obj 742 104 ev-list;
#X obj 742 155 ev_syn-list;
#X obj 742 177 ev_key-list;
@@ -38,19 +38,16 @@
#X obj 742 353 ev_ff_status-list;
#X text 710 85 Event Types:;
#X text 710 136 Event Codes:;
-#X obj 223 287 print INPUT_EVENT;
-#X obj 223 266 spigot;
-#X obj 269 266 tgl 17 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 93 345 route ev_key ev_rel ev_abs ev_syn;
+#X obj 63 262 print INPUT_EVENT;
+#X obj 63 241 spigot;
+#X obj 109 241 tgl 17 0 empty empty console_print 19 9 1 9 -262131
+-1 -1 0 1;
#X floatatom 289 398 5 0 0 1 ev_syn - -;
#X obj 262 397 +;
#X msg 262 377 1;
#X msg 336 136 close;
-#X text 380 136 probably not needed;
#X msg 336 113 refresh;
#X text 397 111 refresh device list;
-#X obj 248 225 hid 2;
#X obj 94 524 unpack s f f;
#X obj 133 542 tgl 25 0 empty empty any_button 27 13 1 9 -195568 -1
-1 0 1;
@@ -59,103 +56,54 @@
#X text 49 588 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
;
#X text 266 602 released under the GNU GPL;
-#X text 472 589 $Revision: 1.8 $$Date: 2004-11-07 16:28:25 $;
+#X text 472 589 $Revision: 1.9 $$Date: 2004-11-14 22:29:43 $;
#X text 473 602 $Author: eighthave $;
#X obj 206 433 route abs_x abs_y abs_z;
#X floatatom 322 454 7 0 0 0 - - -;
#X msg 398 180 poll 20;
#X msg 336 180 poll 2;
#X text 332 159 start polling and set the poll delay in ms;
-#X text 386 301 event_type event_code value timestamp;
-#X msg 465 180 poll 2000;
-#X text 371 56 !!! This software is very much alpha \, so any aspect
-of it could change without notice !!!;
-#X text 650 400 REFRESH RATES;
-#X text 660 415 ADB = 15.5 ms;
-#X text 660 430 USB mice on Windows = 8-10 ms;
-#X text 660 445 USB mice on GNU/Linux = 1-10 ms;
-#X text 660 460 USB wireless mice = 12-20 ms;
-#X text 660 475 PS/2 mouse = 5-25 ms;
-#X text 660 490 P5 Glove = 22 ms;
-#N canvas 0 22 454 304 JustFOrTestng 0;
-#X msg 390 265 ev_rel rel_x 0 2.56485e+09;
-#X obj 390 244 prepend set;
-#X msg 148 77 start;
-#X msg 174 96 stop;
-#X msg 239 57 open 0;
-#X msg 246 75 open 1;
-#X msg 253 93 open 2;
-#X msg 259 111 open 3;
-#X msg 265 129 open 4;
-#X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 25
-;
-#X obj 223 266 spigot;
-#X obj 269 266 tgl 17 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X msg 336 136 close;
-#X text 380 136 probably not needed;
-#X msg 336 113 refresh;
-#X text 397 111 refresh device list;
-#X msg 398 180 poll 20;
-#X msg 336 180 poll 2;
-#X text 332 159 start polling and set the poll delay in ms;
+#X text 387 248 event_type event_code value timestamp;
#X msg 465 180 poll 2000;
#X text 371 56 !!! This software is very much alpha \, so any aspect
of it could change without notice !!!;
#X obj 248 225 hid 1;
-#X connect 1 0 0 0;
-#X connect 2 0 21 0;
-#X connect 3 0 21 0;
-#X connect 4 0 21 0;
-#X connect 5 0 21 0;
-#X connect 6 0 21 0;
-#X connect 7 0 21 0;
-#X connect 8 0 21 0;
-#X connect 9 0 21 0;
-#X connect 11 0 10 1;
-#X connect 12 0 21 0;
-#X connect 14 0 21 0;
-#X connect 16 0 21 0;
-#X connect 17 0 21 0;
-#X connect 19 0 21 0;
-#X connect 21 0 10 0;
-#X connect 21 0 1 0;
-#X restore 446 483 pd JustFOrTestng;
+#X obj 93 345 route key rel abs syn;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 2 1 4 0;
-#X connect 5 0 47 0;
-#X connect 6 0 47 0;
+#X connect 5 0 61 0;
+#X connect 6 0 61 0;
#X connect 8 0 19 0;
#X connect 8 1 18 0;
#X connect 8 2 17 0;
#X connect 8 3 7 0;
-#X connect 9 0 47 0;
-#X connect 10 0 47 0;
-#X connect 11 0 47 0;
-#X connect 12 0 47 0;
-#X connect 13 0 47 0;
-#X connect 16 0 47 0;
+#X connect 9 0 61 0;
+#X connect 10 0 61 0;
+#X connect 11 0 61 0;
+#X connect 12 0 61 0;
+#X connect 13 0 61 0;
+#X connect 16 0 61 0;
#X connect 37 0 36 0;
#X connect 37 0 20 0;
#X connect 38 0 37 1;
-#X connect 39 0 48 0;
-#X connect 39 1 2 0;
-#X connect 39 2 56 0;
-#X connect 39 3 42 0;
-#X connect 40 0 41 1;
+#X connect 39 0 40 1;
+#X connect 40 0 39 0;
#X connect 41 0 40 0;
-#X connect 42 0 41 0;
-#X connect 43 0 47 0;
-#X connect 45 0 47 0;
-#X connect 47 0 37 0;
-#X connect 47 0 39 0;
-#X connect 47 0 1 0;
-#X connect 47 0 8 0;
-#X connect 48 1 49 0;
-#X connect 56 0 14 0;
-#X connect 56 1 15 0;
-#X connect 56 2 57 0;
-#X connect 58 0 47 0;
-#X connect 59 0 47 0;
-#X connect 62 0 47 0;
+#X connect 42 0 61 0;
+#X connect 43 0 61 0;
+#X connect 45 1 46 0;
+#X connect 53 0 14 0;
+#X connect 53 1 15 0;
+#X connect 53 2 54 0;
+#X connect 55 0 61 0;
+#X connect 56 0 61 0;
+#X connect 59 0 61 0;
+#X connect 61 0 37 0;
+#X connect 61 0 1 0;
+#X connect 61 0 8 0;
+#X connect 61 0 62 0;
+#X connect 62 0 45 0;
+#X connect 62 1 2 0;
+#X connect 62 2 53 0;
+#X connect 62 3 41 0;
diff --git a/doc/joystick-help.pd b/doc/joystick-help.pd
index 6807228..9013a0b 100644
--- a/doc/joystick-help.pd
+++ b/doc/joystick-help.pd
@@ -1,44 +1,72 @@
-#N canvas 182 322 672 437 10;
-#X symbolatom 339 141 0 0 0 0 - - -;
-#X obj 178 21 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1
+#N canvas 96 237 669 433 10;
+#X obj 168 41 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1
;
-#X floatatom 420 144 5 0 0 0 - - -;
-#X floatatom 93 184 7 0 0 3 Y - -;
-#X floatatom 39 184 7 0 0 3 X - -;
-#X obj 158 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X floatatom 63 184 7 0 0 3 Y-axis - -;
+#X floatatom 9 184 7 0 0 3 X-axis - -;
+#X obj 219 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 203 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 264 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 248 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 309 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 294 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 355 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 178 74 joystick 3;
-#X floatatom 153 184 5 0 0 0 - - -;
-#X floatatom 196 184 5 0 0 0 - - -;
-#X obj 158 271 route btn_1 btn_2 btn_3 btn_4 btn_5 btn_6 btn_7 btn_8
+#X floatatom 123 184 7 0 0 3 twist - -;
+#X floatatom 182 184 5 0 0 0 - - -;
+#X obj 219 271 route btn_1 btn_2 btn_3 btn_4 btn_5 btn_6 btn_7 btn_8
btn_9;
-#X obj 339 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
-1;
-#X obj 384 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
-1;
-#X obj 430 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
-1;
-#X obj 475 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
-1;
-#X obj 338 115 unpack s f;
-#X connect 1 0 9 0;
-#X connect 9 0 4 0;
-#X connect 9 1 3 0;
-#X connect 9 2 10 0;
-#X connect 9 3 11 0;
-#X connect 12 0 5 0;
-#X connect 12 1 6 0;
-#X connect 12 2 7 0;
-#X connect 12 3 8 0;
-#X connect 12 4 13 0;
-#X connect 12 5 14 0;
-#X connect 12 6 15 0;
-#X connect 12 7 16 0;
-#X connect 17 0 0 0;
-#X connect 17 1 2 0;
+#X obj 400 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 445 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 491 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 536 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 168 104 joystick 3;
+#X obj 581 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 627 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X symbolatom 441 178 6 0 0 1 code - -;
+#X floatatom 569 178 5 0 0 1 value - -;
+#X obj 441 151 unpack symbol float;
+#X text 512 194 buttons;
+#X obj 2 2 cnv 15 650 20 empty empty [joystick] 2 11 1 18 -233017 -66577
+0;
+#X msg 215 43 open 1;
+#X msg 220 62 open 2;
+#X msg 225 81 open 3;
+#X text 1 382 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
+;
+#X text 218 396 released under the GNU GPL;
+#X text 414 396 $Author: eighthave $;
+#X text 414 383 $Revision: 1.2 $;
+#X obj 526 350 all_about_hid;
+#X text 417 351 For more info:;
+#X floatatom 225 184 5 0 0 0 - - -;
+#X floatatom 268 184 5 0 0 0 - - -;
+#X connect 0 0 14 0;
+#X connect 9 0 3 0;
+#X connect 9 1 4 0;
+#X connect 9 2 5 0;
+#X connect 9 3 6 0;
+#X connect 9 4 10 0;
+#X connect 9 5 11 0;
+#X connect 9 6 12 0;
+#X connect 9 7 13 0;
+#X connect 9 8 15 0;
+#X connect 9 9 16 0;
+#X connect 14 0 2 0;
+#X connect 14 1 1 0;
+#X connect 14 2 7 0;
+#X connect 14 3 8 0;
+#X connect 14 4 31 0;
+#X connect 14 5 32 0;
+#X connect 14 6 19 0;
+#X connect 14 6 9 0;
+#X connect 19 0 17 0;
+#X connect 19 1 18 0;
+#X connect 22 0 14 0;
+#X connect 23 0 14 0;
+#X connect 24 0 14 0;
diff --git a/doc/mouse-help.pd b/doc/mouse-help.pd
index 0280fbc..3bac550 100644
--- a/doc/mouse-help.pd
+++ b/doc/mouse-help.pd
@@ -1,82 +1,104 @@
-#N canvas 225 161 684 449 10;
-#X symbolatom 233 198 0 0 0 0 - - -;
-#X obj 200 36 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
+#N canvas 354 179 662 416 10;
+#X symbolatom 211 218 6 0 0 1 code - -;
+#X obj 130 56 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
;
-#X floatatom 309 200 5 0 0 0 - - -;
-#X floatatom 190 199 5 0 0 3 wheel - -;
-#X floatatom 135 199 7 0 0 3 Y - -;
-#X floatatom 81 199 7 0 0 3 X - -;
-#X obj 28 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1
-;
-#X obj 108 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X floatatom 339 218 5 0 0 1 value - -;
+#X floatatom 140 218 5 0 0 3 wheel - -;
+#X floatatom 85 218 7 0 0 3 Y - -;
+#X floatatom 31 218 7 0 0 3 X - -;
+#X obj 193 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 238 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+1;
+#X obj 284 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 188 294 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X msg 175 43 open 0;
+#X msg 180 62 open 1;
+#X msg 185 81 open 2;
+#N canvas 462 248 632 542 mouse-noise 0;
+#X obj 100 25 inlet;
+#X obj 210 294 noise~;
+#X obj 155 293 osc~;
+#X obj 155 266 * 4000;
+#X obj 113 367 *~;
+#X msg 162 103 \; pd dsp 1;
+#X obj 103 418 dac~;
+#X obj 338 61 inlet;
+#X text 400 62 open msgs;
+#X obj 143 173 mouse \$1;
+#X obj 101 78 t f b;
+#X obj 194 196 unpack s f;
+#X text 270 197 get button value only;
+#X obj 210 320 *~;
+#X connect 0 0 10 0;
+#X connect 1 0 13 0;
+#X connect 2 0 4 1;
+#X connect 3 0 2 0;
+#X connect 4 0 6 0;
+#X connect 4 0 6 1;
+#X connect 7 0 9 0;
+#X connect 9 0 4 0;
+#X connect 9 1 3 0;
+#X connect 9 3 11 0;
+#X connect 10 0 4 0;
+#X connect 10 0 9 0;
+#X connect 10 1 5 0;
+#X connect 11 1 13 1;
+#X connect 13 0 4 1;
+#X restore 425 136 pd mouse-noise 1;
+#X msg 536 68 open 0;
+#X msg 541 87 open 1;
+#X msg 546 106 open 2;
+#X obj 425 69 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
+;
+#X text 308 45 turn this on to make some noise with the mouse;
+#X obj 130 111 mouse 1;
+#X obj 211 191 unpack symbol float;
+#X text 282 234 buttons;
+#X obj 193 264 route btn_1 btn_2 btn_3 btn_4 btn_5 btn_6 btn_7 btn_8
+;
+#X obj 330 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 28 271 route btn_left btn_middle btn_right;
-#X text 26 250 the standard three buttons;
-#X obj 268 323 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 376 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 342 323 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 421 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 417 323 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 467 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 491 323 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 513 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 566 323 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
+#X obj 2 2 cnv 15 650 20 empty empty [mouse] 2 11 1 18 -233017 -66577
+0;
+#X obj 559 287 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0
1;
-#X obj 268 295 route btn_side btn_extra btn_forward btn_back btn_task
-;
-#X msg 245 23 open 0;
-#X msg 250 42 open 1;
-#X msg 255 61 open 2;
-#X obj 200 91 mouse 1;
-#N canvas 462 248 604 514 mouse-noise 0;
-#X obj 90 55 inlet;
-#X obj 113 173 mouse \$1;
-#X obj 180 294 noise~;
-#X obj 125 293 osc~;
-#X obj 125 266 * 4000;
-#X obj 113 367 *~;
-#X msg 162 103 \; pd dsp 1;
-#X obj 103 418 dac~;
-#X obj 91 78 t f a b;
-#X connect 0 0 8 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 5 1;
-#X connect 3 0 5 1;
-#X connect 4 0 3 0;
-#X connect 5 0 7 0;
-#X connect 5 0 7 1;
-#X connect 8 0 5 0;
-#X connect 8 1 1 0;
-#X connect 8 2 6 0;
-#X restore 464 163 pd mouse-noise 1;
-#X msg 505 95 open 0;
-#X msg 510 114 open 1;
-#X msg 515 133 open 2;
-#X obj 464 96 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1
+#X text 1 372 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
;
-#X text 347 72 turn this on to make some noise with the mouse;
-#X connect 1 0 20 0;
-#X connect 9 0 6 0;
-#X connect 9 1 7 0;
-#X connect 9 2 8 0;
-#X connect 9 3 16 0;
-#X connect 16 0 11 0;
-#X connect 16 1 12 0;
-#X connect 16 2 13 0;
-#X connect 16 3 14 0;
-#X connect 16 4 15 0;
-#X connect 17 0 20 0;
-#X connect 18 0 20 0;
-#X connect 19 0 20 0;
-#X connect 20 0 5 0;
-#X connect 20 1 4 0;
-#X connect 20 2 3 0;
-#X connect 20 3 0 0;
-#X connect 20 4 2 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 0;
-#X connect 24 0 21 0;
-#X connect 25 0 21 0;
+#X text 218 386 released under the GNU GPL;
+#X text 414 386 $Author: eighthave $;
+#X text 414 373 $Revision: 1.4 $;
+#X obj 526 340 all_about_hid;
+#X text 417 341 For more info:;
+#X connect 1 0 18 0;
+#X connect 9 0 18 0;
+#X connect 10 0 18 0;
+#X connect 11 0 18 0;
+#X connect 13 0 12 1;
+#X connect 14 0 12 1;
+#X connect 15 0 12 1;
+#X connect 16 0 12 0;
+#X connect 18 0 5 0;
+#X connect 18 1 4 0;
+#X connect 18 2 3 0;
+#X connect 18 3 19 0;
+#X connect 18 3 21 0;
+#X connect 19 0 0 0;
+#X connect 19 1 2 0;
+#X connect 21 0 6 0;
+#X connect 21 1 7 0;
+#X connect 21 2 8 0;
+#X connect 21 3 22 0;
+#X connect 21 4 23 0;
+#X connect 21 5 24 0;
+#X connect 21 6 25 0;
+#X connect 21 7 26 0;
+#X connect 21 8 28 0;
diff --git a/hid.c b/hid.c
index 9a091dc..1bd9390 100644
--- a/hid.c
+++ b/hid.c
@@ -32,16 +32,6 @@
//#define DEBUG(x)
#define DEBUG(x) x
-/*
- * Various Max Refresh Rates:
- ADB = 15.5 ms
- USB mice on Windows = 8-10 ms
- USB mice on GNU/Linux = 1-10 ms
- USB wireless mice = 12-20 ms
- PS/2 mouse = 5-25 ms
- P5 Globe = 22 ms
- */
-
#define DEFAULT_DELAY 5
/*------------------------------------------------------------------------------
diff --git a/hid_darwin.c b/hid_darwin.c
index 49ec028..003515d 100644
--- a/hid_darwin.c
+++ b/hid_darwin.c
@@ -76,12 +76,12 @@ void convertAxis(pRecElement element, char *linux_type, char *linux_code, char a
{
if (element->relative)
{
- sprintf(linux_type,"ev_rel");
+ sprintf(linux_type,"rel");
sprintf(linux_code,"rel_%c",axis);
}
else
{
- sprintf(linux_type,"ev_abs");
+ sprintf(linux_type,"abs");
sprintf(linux_code,"abs_%c",axis);
}
}
@@ -94,7 +94,7 @@ void convertDarwinElementToLinuxTypeCode(pRecElement element, char *linux_type,
switch(element->type)
{
case kIOHIDElementTypeInput_Button:
- sprintf(linux_type, "ev_key");
+ sprintf(linux_type, "key");
break;
}
@@ -110,11 +110,11 @@ void convertDarwinElementToLinuxTypeCode(pRecElement element, char *linux_type,
case kHIDUsage_GD_Ry: convertAxis(element, linux_type, linux_code, 'y'); break;
case kHIDUsage_GD_Rz: convertAxis(element, linux_type, linux_code, 'z'); break;
case kHIDUsage_GD_Wheel:
- sprintf(linux_type,"ev_rel");sprintf(linux_code,"rel_wheel");break;
+ sprintf(linux_type,"rel");sprintf(linux_code,"rel_wheel");break;
}
break;
case kHIDPage_Button:
- sprintf(linux_type, "ev_key");
+ sprintf(linux_type, "key");
sprintf(linux_code, "btn_%ld", element->usage);
break;
}
@@ -172,15 +172,20 @@ t_int hid_build_element_list(t_hid *x)
DEBUG(post("[hid] found %d elements:",numElements););
+ post("-----------------------------------------------------------");
+ post(" TYPE\t\tCODE\tEVENT NAME");
+ post("-----------------------------------------------------------");
for(i=0; i<numElements; i++)
{
convertDarwinElementToLinuxTypeCode(pCurrentHIDElement,type,code);
HIDGetTypeName((IOHIDElementType) pCurrentHIDElement->type, type_name);
HIDGetUsageName(pCurrentHIDElement->usagePage, pCurrentHIDElement->usage, usage_name);
- post("\tType: %s \t code: %s \t event name: \t %s, %s",type,code,type_name,usage_name);
+ post(" %s\t%s\t%s, %s",type,code,type_name,usage_name);
pCurrentHIDElement = HIDGetNextDeviceElement (pCurrentHIDElement, kHIDElementTypeInput);
}
+ post("-----------------------------------------------------------");
+
return (0);
}
@@ -230,7 +235,7 @@ t_int hid_get_events(t_hid *x)
); //end DEBUG
convertDarwinElementToLinuxTypeCode(pCurrentHIDElement,type,code);
- DEBUG(post("type: %s code: %s event name: %s",type,code,event_output_string););
+// DEBUG(post("type: %s code: %s event name: %s",type,code,event_output_string););
// TODO: convert this to a common time format, i.e. Linux struct timeval
hid_output_event(x,type,code,(t_float)value,(t_float)(event.timestamp).lo);
diff --git a/joystick.pd b/joystick.pd
index 830496b..c1432c8 100644
--- a/joystick.pd
+++ b/joystick.pd
@@ -1,21 +1,16 @@
-#N canvas 353 77 803 591 10;
+#N canvas 368 109 807 595 10;
#X msg 96 64 start;
#X msg 105 83 stop;
#X obj 77 30 inlet;
#X obj 207 160 print UNKNOWN_JOYSTICK_EVENT_TYPE;
-#X text 260 134 types (1=buttons 3=abs axes);
#X obj 218 286 print UNKNOWN_JOYSTICK_EVENT_CODE;
#X obj 38 508 outlet;
-#X obj 143 327 outlet;
-#X obj 164 307 outlet;
+#X obj 180 327 outlet;
+#X obj 201 307 outlet;
#X text 52 244 codes (0=X 1=Y 6=throttle 7=rudder \, 16=hat0X \, 17=hat0Y)
;
#X obj 411 417 outlet;
-#X text 401 433 button_num;
-#X text 492 434 button_value;
-#X obj 511 418 outlet;
#X obj 77 107 hid \$1;
-#X obj 38 264 route abs_x abs_y 7 16 17 6;
#X obj 38 489 autoscale -1 1;
#X obj 68 468 outlet;
#X obj 68 449 autoscale -1 1;
@@ -23,25 +18,32 @@
#X obj 99 409 autoscale -1 1;
#X obj 130 388 outlet;
#X obj 130 369 autoscale -1 1;
-#X obj 79 139 route ev_abs ev_key;
#X obj 221 91 print RAW;
-#X obj 411 351 unpack s f f;
-#X connect 0 0 14 0;
-#X connect 1 0 14 0;
-#X connect 2 0 14 0;
-#X connect 14 0 23 0;
-#X connect 15 0 16 0;
-#X connect 15 1 18 0;
-#X connect 15 2 20 0;
-#X connect 15 3 22 0;
-#X connect 15 4 7 0;
-#X connect 15 5 8 0;
-#X connect 16 0 6 0;
-#X connect 18 0 17 0;
-#X connect 20 0 19 0;
-#X connect 22 0 21 0;
-#X connect 23 0 15 0;
-#X connect 23 1 25 0;
-#X connect 23 2 3 0;
-#X connect 25 0 10 0;
-#X connect 25 1 13 0;
+#X obj 79 139 route abs key;
+#X text 401 433 button code/value list;
+#X obj 38 264 route abs_x abs_y abs_z 16 17 6;
+#X text 91 509 X-axis;
+#X text 117 468 Y-axis;
+#X text 152 430 twist;
+#X text 11 552 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
+;
+#X text 228 566 released under the GNU GPL;
+#X text 424 566 $Author: eighthave $;
+#X text 424 553 $Revision: 1.2 $$Date: 2004-11-14 22:29:43 $;
+#X connect 0 0 10 0;
+#X connect 1 0 10 0;
+#X connect 2 0 10 0;
+#X connect 10 0 19 0;
+#X connect 11 0 5 0;
+#X connect 13 0 12 0;
+#X connect 15 0 14 0;
+#X connect 17 0 16 0;
+#X connect 19 0 21 0;
+#X connect 19 1 9 0;
+#X connect 19 2 3 0;
+#X connect 21 0 11 0;
+#X connect 21 1 13 0;
+#X connect 21 2 15 0;
+#X connect 21 3 17 0;
+#X connect 21 4 6 0;
+#X connect 21 5 7 0;
diff --git a/make-arrays-from-input.h.pl b/make-arrays-from-input.h.pl
index 4030b01..0ebb7ea 100755
--- a/make-arrays-from-input.h.pl
+++ b/make-arrays-from-input.h.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
use Switch;
@@ -162,8 +162,15 @@ print(ARRAYS "#include \"hid.h\"\n\n");
print(HEADER "\#ifndef _INPUT_ARRAYS_H\n");
print(HEADER "\#define _INPUT_ARRAYS_H\n\n\n");
+# strip the ev_ from the type names
+for ($i=0; $i <= $#EV; ++$i) {
+ $_ = $EV[$i];
+ s/ev_//;
+ $EVtemp[$i] = $_;
+}
+
# generate a C array for each array and stick them all in the same file
-printArray("ev",@EV);
+printArray("ev",@EVtemp);
printArray("ev_syn",@SYN);
printArray("ev_key",@KEY);
printArray("ev_rel",@REL);
diff --git a/mouse.pd b/mouse.pd
index 1c6adea..a981cb5 100644
--- a/mouse.pd
+++ b/mouse.pd
@@ -1,10 +1,9 @@
-#N canvas 305 189 693 438 10;
+#N canvas 305 189 713 458 10;
#X obj 125 38 inlet;
#X obj 5 346 outlet;
#X obj 110 346 outlet;
#X obj 220 346 outlet;
#X obj 500 347 outlet;
-#X obj 586 347 outlet;
#X msg 355 119 open \$1;
#X obj 356 94 makefilename mouse%d;
#X obj 356 68 f \$1;
@@ -12,10 +11,6 @@
#X text 4 364 X;
#X text 115 369 Y;
#X text 222 367 wheel;
-#X text 485 368 button code;
-#X text 574 368 button value;
-#X obj 125 155 route ev_rel ev_key;
-#X obj 500 238 unpack s f;
#X msg 187 84 open \$1;
#X obj 187 61 f \$1;
#X obj 187 37 loadbang;
@@ -26,20 +21,25 @@
#X obj 271 258 print MOUSE_UNIMPLEMENTED_EVENT;
#X text 343 139 this is for once this feature is implemented;
#X obj 125 115 hid \$1;
-#X connect 0 0 26 0;
+#X obj 125 155 route rel key;
+#X text 484 368 button code/value list;
+#X text 1 422 (C) Copyright 2004 Hans-Christoph Steiner <hans@at.or.at>
+;
+#X text 218 436 released under the GNU GPL;
+#X text 414 436 $Author: eighthave $;
+#X text 414 423 $Revision: 1.3 $;
+#X connect 0 0 21 0;
+#X connect 6 0 5 0;
#X connect 7 0 6 0;
#X connect 8 0 7 0;
-#X connect 9 0 8 0;
-#X connect 15 0 23 0;
-#X connect 15 1 16 0;
-#X connect 16 0 4 0;
-#X connect 16 1 5 0;
-#X connect 18 0 17 0;
-#X connect 19 0 18 0;
-#X connect 20 0 1 0;
-#X connect 21 0 2 0;
-#X connect 22 0 3 0;
-#X connect 23 0 20 0;
-#X connect 23 1 21 0;
-#X connect 23 2 22 0;
-#X connect 26 0 15 0;
+#X connect 13 0 12 0;
+#X connect 14 0 13 0;
+#X connect 15 0 1 0;
+#X connect 16 0 2 0;
+#X connect 17 0 3 0;
+#X connect 18 0 15 0;
+#X connect 18 1 16 0;
+#X connect 18 2 17 0;
+#X connect 21 0 22 0;
+#X connect 22 0 18 0;
+#X connect 22 1 4 0;