Update of /cvsroot/pure-data/externals/hcs/hid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10764
Modified Files: TODO hid_darwin.c hid_rel2abs.pd mouse-help.pd mouse.pd Added Files: keyboard-help.pd keyboard.pd Log Message: quick kludge to add more event types for MacOS X, including a test version of keyboard support
Index: mouse.pd =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/mouse.pd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mouse.pd 14 Nov 2004 22:29:43 -0000 1.3 --- mouse.pd 27 Nov 2004 19:29:34 -0000 1.4 *************** *** 1,3 **** ! #N canvas 305 189 713 458 10; #X obj 125 38 inlet; #X obj 5 346 outlet; --- 1,3 ---- ! #N canvas 305 189 717 462 10; #X obj 125 38 inlet; #X obj 5 346 outlet; *************** *** 17,21 **** #X obj 5 283 autoscale -1 1; #X obj 110 283 autoscale -1 1; - #X obj 220 284 autoscale -1 1; #X obj 67 233 route rel_x rel_y rel_wheel; #X obj 271 258 print MOUSE_UNIMPLEMENTED_EVENT; --- 17,20 ---- *************** *** 29,33 **** #X text 414 436 $Author$; #X text 414 423 $Revision$; ! #X connect 0 0 21 0; #X connect 6 0 5 0; #X connect 7 0 6 0; --- 28,32 ---- #X text 414 436 $Author$; #X text 414 423 $Revision$; ! #X connect 0 0 20 0; #X connect 6 0 5 0; #X connect 7 0 6 0; *************** *** 37,45 **** #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; --- 36,43 ---- #X connect 15 0 1 0; #X connect 16 0 2 0; ! #X connect 17 0 15 0; ! #X connect 17 1 16 0; ! #X connect 17 2 3 0; ! #X connect 20 0 21 0; ! #X connect 21 0 17 0; ! #X connect 21 1 4 0;
Index: hid_darwin.c =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/hid_darwin.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** hid_darwin.c 16 Nov 2004 01:35:35 -0000 1.11 --- hid_darwin.c 27 Nov 2004 19:29:34 -0000 1.12 *************** *** 116,119 **** --- 116,124 ---- } break; + case kHIDPage_KeyboardOrKeypad: + sprintf(linux_type, "key"); + /* temporary kludge until I feel like writing the translation table */ + sprintf(linux_code, "key_%ld", element->usage); + break; case kHIDPage_Button: sprintf(linux_type, "key"); *************** *** 121,124 **** --- 126,143 ---- sprintf(linux_code, "btn_%ld", element->usage - 1); break; + case kHIDPage_LEDs: + /* temporary kludge until I feel like writing the translation table */ + sprintf(linux_type, "led"); + sprintf(linux_code, "led_%ld", element->usage - 1); + break; + case kHIDPage_PID: + /* temporary kludge until I feel like writing the translation table */ + sprintf(linux_type, "ff"); + sprintf(linux_code, "ff_%ld", element->usage - 1); + break; + default: + /* temporary kludge until I feel like writing the translation table */ + sprintf(linux_type, "not_implemented"); + sprintf(linux_code, "notimp_%ld", element->usage - 1); } }
--- NEW FILE: keyboard.pd --- #N canvas 0 22 470 320 10; #X msg 96 64 start; #X msg 105 83 stop; #X obj 77 30 inlet; #X obj 77 107 hid $1; #X obj 77 139 route key; #X obj 77 273 outlet; #X connect 0 0 3 0; #X connect 1 0 3 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 5 0;
--- NEW FILE: keyboard-help.pd --- #N canvas 109 184 569 474 10; #X obj 168 91 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1 ; #X obj 11 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; #X symbolatom 168 222 12 0 0 0 code - -; #X floatatom 296 222 5 0 0 1 value - -; #X obj 168 195 unpack symbol float; #X text 239 238 buttons; #X obj 2 2 cnv 15 550 20 empty empty [keyboard] 2 11 1 18 -233017 -66577 0; #X msg 215 93 open 1; #X text 1 432 (C) Copyright 2004 Hans-Christoph Steiner hans@at.or.at ; #X text 218 446 released under the GNU GPL; #X text 414 446 $Author: eighthave $; #X text 414 433 $Revision: 1.1 $; #X obj 348 402 all_about_hid; #X text 239 403 For more info:; #X msg 220 112 open 3; #X msg 225 131 open 5; #X obj 168 154 keyboard 0; #X obj 32 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; #X obj 53 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; #X obj 74 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; #X obj 95 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; #X obj 116 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 137 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 158 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 179 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 200 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 221 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 242 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 263 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 284 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 305 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 326 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 347 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 368 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 389 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 1 1; #X obj 410 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 431 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 452 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 473 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X obj 494 369 tgl 20 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; #X text 117 270 Most keyboards can detect multiple keys at the same time. You can test yours by pressing and holding keys and counting how many "X"s are shown below; #X text 8 36 Use a keyboard device with Pd. This object gives you raw access to the keyboard events. Pd does not need to have focus in order get the key events. No matter which application has focus , this object will get keyboard events.; #X obj 75 315 route key_4 key_5 key_6 key_7 key_8 key_9 key_10 key_11 key_12 key_13 key_14 key_15 key_16 key_17 key_18 key_19 key_20 key_21 key_22 key_23 key_24 key_25 key_26 key_27; #X connect 0 0 16 0; #X connect 4 0 2 0; #X connect 4 1 3 0; #X connect 7 0 16 0; #X connect 14 0 16 0; #X connect 15 0 16 0; #X connect 16 0 4 0; #X connect 16 0 42 0; #X connect 42 0 1 0; #X connect 42 1 17 0; #X connect 42 2 18 0; #X connect 42 3 19 0; #X connect 42 4 20 0; #X connect 42 5 21 0; #X connect 42 6 22 0; #X connect 42 7 23 0; #X connect 42 8 24 0; #X connect 42 9 25 0; #X connect 42 10 26 0; #X connect 42 11 27 0; #X connect 42 12 28 0; #X connect 42 13 29 0; #X connect 42 14 30 0; #X connect 42 15 31 0; #X connect 42 16 32 0; #X connect 42 17 33 0; #X connect 42 18 34 0; #X connect 42 19 35 0; #X connect 42 20 36 0; #X connect 42 21 37 0; #X connect 42 22 38 0; #X connect 42 23 39 0;
Index: mouse-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/mouse-help.pd,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mouse-help.pd 16 Nov 2004 05:06:49 -0000 1.7 --- mouse-help.pd 27 Nov 2004 19:29:34 -0000 1.8 *************** *** 1,5 **** ! #N canvas 53 201 666 460 10; #X symbolatom 211 268 6 0 0 1 code - -; ! #X obj 130 106 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1; #X floatatom 339 268 5 0 0 1 value - -; --- 1,5 ---- ! #N canvas 470 274 674 468 10; #X symbolatom 211 268 6 0 0 1 code - -; ! #X obj 130 106 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1; #X floatatom 339 268 5 0 0 1 value - -; *************** *** 13,54 **** #X obj 283 334 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X msg 175 93 open 0; ! #X msg 180 112 open 1; ! #X msg 185 131 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 186 pd mouse-noise 1; ! #X msg 536 118 open 0; ! #X msg 541 137 open 1; ! #X msg 546 156 open 2; ! #X obj 425 119 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1; #X text 308 95 turn this on to make some noise with the mouse; --- 13,88 ---- #X obj 283 334 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X msg 175 83 open 0; ! #X msg 180 102 open 1; ! #X msg 185 121 open 2; ! #N canvas 289 90 660 570 mouse-noise 0; #X obj 100 25 inlet; #X obj 210 294 noise~; ! #X obj 155 316 osc~; #X obj 113 367 *~; #X msg 162 103 ; pd dsp 1; ! #X obj 110 510 dac~; #X obj 338 61 inlet; #X text 400 62 open msgs; ! #X obj 138 169 mouse $1; #X obj 101 78 t f b; ! #X text 328 192 get button value only; #X obj 210 320 *~; ! #X obj 499 330 notescale 40 90; ! #X obj 317 242 / 2; ! #X obj 113 458 pan; ! #X obj 289 439 line; ! #X msg 289 416 $1 20; ! #X obj 313 328 +; ! #X obj 359 328 f; ! #X msg 343 297 0; ! #X msg 141 131 close; ! #X obj 155 223 hid_rel2abs 0 100; ! #X obj 155 243 - 100; ! #X obj 155 262 abs; ! #X obj 189 192 unpack symbol float; ! #X obj 110 315 line~; ! #X msg 110 292 $1 3; ! #X obj 155 297 * 20; ! #X obj 326 349 min 20; ! #X obj 326 368 max 0; ! #X obj 296 301 int; ! #X obj 326 389 / 20; ! #X connect 0 0 9 0; ! #X connect 1 0 11 0; ! #X connect 2 0 3 1; ! #X connect 3 0 14 0; ! #X connect 6 0 8 0; ! #X connect 8 0 26 0; ! #X connect 8 1 21 0; ! #X connect 8 2 30 0; ! #X connect 8 3 24 0; ! #X connect 9 0 8 0; ! #X connect 9 1 4 0; ! #X connect 11 0 3 1; ! #X connect 13 0 11 1; ! #X connect 14 0 5 0; ! #X connect 14 1 5 1; ! #X connect 15 0 14 1; ! #X connect 16 0 15 0; ! #X connect 17 0 28 0; ! #X connect 18 0 17 1; ! #X connect 19 0 18 1; ! #X connect 19 0 17 1; ! #X connect 20 0 8 0; ! #X connect 21 0 22 0; ! #X connect 22 0 23 0; ! #X connect 23 0 27 0; ! #X connect 24 1 13 0; ! #X connect 25 0 3 0; ! #X connect 26 0 25 0; ! #X connect 27 0 2 0; ! #X connect 28 0 29 0; ! #X connect 29 0 18 0; ! #X connect 29 0 31 0; ! #X connect 30 0 17 0; ! #X connect 31 0 16 0; #X restore 425 186 pd mouse-noise 1; ! #X obj 425 119 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1; #X text 308 95 turn this on to make some noise with the mouse; *************** *** 83,111 **** the output of axis data. Move the device around as fast as possible in each axis to calibrate it.; - #X obj 130 161 mouse 0; #X text 13 111 turn on polling:; ! #X connect 1 0 36 0; ! #X connect 9 0 36 0; ! #X connect 10 0 36 0; ! #X connect 11 0 36 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 0 0; ! #X connect 18 1 2 0; ! #X connect 34 0 6 0; ! #X connect 34 1 7 0; ! #X connect 34 2 8 0; ! #X connect 34 3 20 0; ! #X connect 34 4 21 0; ! #X connect 34 5 22 0; ! #X connect 34 6 23 0; ! #X connect 34 7 24 0; ! #X connect 34 8 26 0; ! #X connect 34 9 33 0; ! #X connect 36 0 5 0; ! #X connect 36 1 4 0; ! #X connect 36 2 3 0; ! #X connect 36 3 18 0; ! #X connect 36 3 34 0; --- 117,151 ---- the output of axis data. Move the device around as fast as possible in each axis to calibrate it.; #X text 13 111 turn on polling:; ! #X msg 533 163 open $1; ! #X obj 516 140 hradio 15 1 1 8 empty empty choose_a_device 0 -6 1 9 ! -262144 -1 -1 2; ! #X floatatom 516 165 1 0 0 0 - - -; ! #X msg 180 146 refresh; ! #X obj 130 171 mouse 0; ! #X connect 1 0 38 0; ! #X connect 9 0 38 0; ! #X connect 10 0 38 0; ! #X connect 11 0 38 0; ! #X connect 13 0 12 0; ! #X connect 15 0 0 0; ! #X connect 15 1 2 0; ! #X connect 31 0 6 0; ! #X connect 31 1 7 0; ! #X connect 31 2 8 0; ! #X connect 31 3 17 0; ! #X connect 31 4 18 0; ! #X connect 31 5 19 0; ! #X connect 31 6 20 0; ! #X connect 31 7 21 0; ! #X connect 31 8 23 0; ! #X connect 31 9 30 0; ! #X connect 34 0 12 1; ! #X connect 35 0 36 0; ! #X connect 35 0 34 0; ! #X connect 37 0 38 0; ! #X connect 38 0 5 0; ! #X connect 38 1 4 0; ! #X connect 38 2 3 0; ! #X connect 38 3 15 0; ! #X connect 38 3 31 0;
Index: TODO =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/TODO,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TODO 20 Nov 2004 03:52:54 -0000 1.8 --- TODO 27 Nov 2004 19:29:33 -0000 1.9 *************** *** 161,162 **** --- 161,178 ---- on the unchanged axis when the hatswitch is moved in along the X or Y axis (as opposed to diagonally). + + + ______________________________________________________________________________ + - BUG: on MacOS X, mouse axis data is limited by the screen dimensions + + - the axes data stops outputting when the mouse pointer reaches the edge of + the screen. Hopefully the HID Manager API will allow raw mouse data + access. It must since its used with games. + + _________________________________________________________________________________________ + - BUG: on MacOS X, two keyboard key codes are reported as hatswitches + + abs abs_hat0x Button Input, Keyboard Usage 0x39 + abs abs_hat0y Button Input, Keyboard Usage 0x39 + + I am pretty sure this is just a display problem, but it might not be.
Index: hid_rel2abs.pd =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/hid_rel2abs.pd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hid_rel2abs.pd 20 Nov 2004 03:52:54 -0000 1.1 --- hid_rel2abs.pd 27 Nov 2004 19:29:34 -0000 1.2 *************** *** 1,17 **** ! #N canvas 0 22 458 308 10; #X obj 137 20 inlet; ! #X obj 222 267 outlet; #X floatatom 221 81 5 0 0 0 - - -; #X obj 137 81 route reset; #X obj 221 174 +; ! #X obj 251 174 f; ! #X msg 137 126 0; #X connect 0 0 3 0; ! #X connect 3 0 6 0; #X connect 3 1 2 0; #X connect 3 1 4 0; - #X connect 4 0 5 0; #X connect 4 0 1 0; #X connect 5 0 4 1; ! #X connect 6 0 4 1; ! #X connect 6 0 5 1; --- 1,25 ---- ! #N canvas 0 22 466 316 10; #X obj 137 20 inlet; ! #X obj 221 272 outlet; #X floatatom 221 81 5 0 0 0 - - -; #X obj 137 81 route reset; #X obj 221 174 +; ! #X obj 281 174 f; ! #X obj 232 195 min $2; ! #X obj 232 214 max $1; ! #X obj 260 137 f $1; ! #X obj 215 26 loadbang; ! #X msg 215 45 reset; #X connect 0 0 3 0; ! #X connect 3 0 8 0; #X connect 3 1 2 0; #X connect 3 1 4 0; #X connect 4 0 1 0; + #X connect 4 0 6 0; #X connect 5 0 4 1; ! #X connect 6 0 7 0; ! #X connect 7 0 5 0; ! #X connect 8 0 4 1; ! #X connect 8 0 5 0; ! #X connect 9 0 10 0; ! #X connect 10 0 3 0;