Revision: 10078 http://pure-data.svn.sourceforge.net/pure-data/?rev=10078&view=rev Author: eighthave Date: 2008-06-23 11:39:32 -0700 (Mon, 23 Jun 2008)
Log Message: ----------- implemented [devices( and [elements( messages on Mac OS X, to eventally replace [print(
Modified Paths: -------------- trunk/externals/io/hidio/hidio-help.pd trunk/externals/io/hidio/hidio.c trunk/externals/io/hidio/hidio.h trunk/externals/io/hidio/hidio_darwin.c
Modified: trunk/externals/io/hidio/hidio-help.pd =================================================================== --- trunk/externals/io/hidio/hidio-help.pd 2008-06-23 16:46:32 UTC (rev 10077) +++ trunk/externals/io/hidio/hidio-help.pd 2008-06-23 18:39:32 UTC (rev 10078) @@ -1,12 +1,12 @@ -#N canvas 726 139 886 611 10; +#N canvas 219 36 843 580 10; #X floatatom 27 445 5 0 0 0 - - -; #X floatatom 83 445 5 0 0 0 - - -; -#X obj 191 164 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 25 -25; +#X obj 191 164 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 25 +; #X floatatom 765 335 5 0 0 1 value - -; #X symbolatom 631 360 15 0 0 1 event_code - -; #X symbolatom 544 377 15 0 0 1 event_type - -; -#X obj 2 2 cnv 15 900 20 empty empty [hidio] 2 11 1 18 -233017 -66577 +#X obj 2 2 cnv 15 600 20 empty empty hidio 2 11 1 18 -233017 -66577 0; #X text 224 324 outlet message format:; #X msg 374 130 close; @@ -20,208 +20,6 @@ of it could change without notice !!!; #X obj 9 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 66455 ; -#N canvas 278 328 631 544 Event_Codes 0; -#X text 28 48 (For a complete listing of Linux Input Events , see -/usr/include/linux/input.h.); -#X obj 11 9 cnv 15 580 30 empty empty Event_Codes 20 12 1 14 -225271 --66577 0; -#X text 32 118 EVENT CODE; -#X text 162 118 #define; -#X text 232 118 number; -#X text 32 133 -----------------------------------; -#X text 32 148 X Axis; -#X text 32 163 Y Axis; -#X text 32 178 Z Axis; -#X text 32 193 Horizontal Wheel; -#X text 32 208 Dial; -#X text 32 223 Wheel; -#X text 32 238 Misc; -#X text 162 148 REL_X; -#X text 162 163 REL_Y; -#X text 162 178 REL_Z; -#X text 162 193 REL_HWHEEL; -#X text 162 208 REL_DIAL; -#X text 162 223 REL_WHEEL; -#X text 162 238 REL_MISC; -#X text 247 148 0; -#X text 247 163 1; -#X text 247 178 2; -#X text 247 193 6; -#X text 247 208 7; -#X text 247 223 8; -#X text 247 238 9; -#X text 307 118 EVENT CODE; -#X text 457 118 #define; -#X text 547 118 number; -#X text 307 148 Absolute X; -#X text 307 163 Absolute Y; -#X text 307 178 Absolute Z; -#X text 307 193 RX; -#X text 307 208 RY; -#X text 307 223 RZ; -#X text 307 238 Throttle; -#X text 307 253 Rudder; -#X text 307 268 Wheel; -#X text 307 283 Gas Pedal; -#X text 307 298 Brake Pedal; -#X text 307 313 Hat Switch 0 X-axis; -#X text 307 328 Hat Switch 0 Y-axis; -#X text 307 343 Hat Switch 1 X-axis; -#X text 307 358 Hat Switch 1 Y-axis; -#X text 307 373 Hat Switch 2 X-axis; -#X text 307 388 Hat Switch 2 Y-axis; -#X text 307 403 Hat Switch 3 X-axis; -#X text 307 418 Hat Switch 3 Y-axis; -#X text 307 433 Pressure; -#X text 307 448 Distance; -#X text 307 463 Tilt X-Axis; -#X text 307 478 Tilt Y-Axis; -#X text 307 493 Misc; -#X text 457 148 ABS_X; -#X text 457 163 ABS_Y; -#X text 457 178 ABS_Z; -#X text 457 193 ABS_RX; -#X text 457 208 ABS_RY; -#X text 457 223 ABS_RZ; -#X text 457 238 ABS_THROTTLE; -#X text 457 253 ABS_RUDDER; -#X text 457 268 ABS_WHEEL; -#X text 457 283 ABS_GAS; -#X text 457 298 ABS_BRAKE; -#X text 457 313 ABS_HAT0X; -#X text 457 328 ABS_HAT0Y; -#X text 457 343 ABS_HAT1X; -#X text 457 358 ABS_HAT1Y; -#X text 457 373 ABS_HAT2X; -#X text 457 388 ABS_HAT2Y; -#X text 457 403 ABS_HAT3X; -#X text 457 418 ABS_HAT3Y; -#X text 457 433 ABS_PRESSURE; -#X text 457 448 ABS_DISTANCE; -#X text 457 463 ABS_TILT_X; -#X text 457 478 ABS_TILT_Y; -#X text 457 493 ABS_MISC; -#X text 563 148 0; -#X text 563 163 1; -#X text 563 178 2; -#X text 563 193 3; -#X text 563 208 4; -#X text 563 223 5; -#X text 563 238 6; -#X text 563 253 7; -#X text 563 268 8; -#X text 563 283 9; -#X text 563 298 10; -#X text 563 313 16; -#X text 563 328 17; -#X text 563 343 18; -#X text 563 358 19; -#X text 563 373 20; -#X text 563 388 21; -#X text 563 403 22; -#X text 563 418 23; -#X text 563 433 24; -#X text 563 448 25; -#X text 563 463 26; -#X text 563 478 27; -#X text 563 493 28; -#X obj 30 89 cnv 15 250 25 empty empty Relative_Axes 20 12 1 12 -241660 --66577 0; -#X obj 308 89 cnv 15 280 25 empty empty Absolute_Axes 20 12 1 12 -241660 --66577 0; -#X text 307 133 ----------------------------------------; -#X text 32 285 EVENT CODE; -#X text 138 285 #define; -#X text 232 285 number; -#X text 32 300 -----------------------------------; -#X obj 30 256 cnv 15 250 25 empty empty Joystick_Buttons 20 12 1 12 --241660 -66577 0; -#X text 138 315 BTN_TRIGGER; -#X text 32 315 Trigger; -#X text 32 330 Thumb; -#X text 32 345 Thumb 2; -#X text 32 360 Top; -#X text 32 375 Top 2; -#X text 32 390 Pinkie; -#X text 32 405 Base 1; -#X text 138 404 BTN_BASE; -#X text 138 330 BTN_THUMB; -#X text 138 345 BTN_THUMB2; -#X text 138 360 BTN_TOP; -#X text 138 375 BTN_TOP2; -#X text 138 390 BTN_PINKIE; -#X text 245 315 288; -#X text 245 330 289; -#X text 245 345 290; -#X text 245 360 291; -#X text 245 375 292; -#X text 245 390 293; -#X text 245 405 294; -#X text 245 419 295; -#X text 245 434 296; -#X text 245 448 297; -#X text 138 418 BTN_BASE2; -#X text 138 433 BTN_BASE3; -#X text 138 447 BTN_BASE4; -#X text 32 419 Base 2; -#X text 32 434 Base 3; -#X text 32 448 Base 4; -#X text 32 463 Base 5; -#X text 32 477 Base 6; -#X text 138 462 BTN_BASE5; -#X text 138 476 BTN_BASE6; -#X text 245 463 298; -#X text 245 477 299; -#X restore 698 94 pd Event_Codes; -#N canvas 50 289 469 317 Event_Types 0; -#X text 28 48 (For a complete listing of Linux Input Events , see -/usr/include/linux/input.h.); -#X text 61 90 EVENT TYPE; -#X text 61 135 Keys and Buttons; -#X text 61 150 Relative Axes; -#X text 61 165 Absolute Axes; -#X text 61 180 Misc Events; -#X text 61 195 LED Event; -#X text 61 210 Sounds; -#X text 61 225 Autorepeat Values; -#X text 61 240 Force Feedback; -#X text 230 90 #define; -#X text 230 135 EV_KEY; -#X text 230 150 EV_REL; -#X text 230 165 EV_ABS; -#X text 230 180 EV_MSC; -#X text 230 195 EV_LED; -#X text 230 210 EV_SND; -#X text 230 225 EV_REP; -#X text 230 240 EV_FF; -#X text 315 90 number; -#X text 331 120 0; -#X text 331 135 1; -#X text 331 150 2; -#X text 331 165 3; -#X text 331 180 4; -#X text 331 195 17; -#X text 331 210 18; -#X text 331 225 20; -#X text 331 240 21; -#X obj 11 9 cnv 15 400 30 empty empty Event_Types 20 12 1 14 -262131 --66577 0; -#X text 230 120 EV_SYN; -#X text 61 270 Force Feedback Status; -#X text 61 120 Syncronization Events; -#X text 230 270 EV_FF_STATUS; -#X text 331 270 23; -#X text 61 105 -------------------------------------------; -#X text 331 255 22; -#X text 230 255 EV_PWR; -#X text 61 255 Power Events (for UPS); -#X restore 698 74 pd Event_Types; -#N canvas 0 22 450 300 Event_Values 0; -#X text 28 48 (For a complete listing of Linux Input Events , see -/usr/include/linux/input.h.); -#X obj 11 9 cnv 15 400 30 empty empty Event_Values 20 12 1 14 -261681 --66577 0; -#X restore 698 114 pd Event_Values; #X floatatom 140 445 5 0 0 0 - - -; #X msg 374 151 print; #X text 437 131 close the device; @@ -390,7 +188,7 @@ #X connect 2 0 4 0; #X connect 7 0 4 0; #X restore 174 37 pd open by vendor/product ID; -#X msg 225 309 relative x 0 -1; +#X msg 225 309 button button_2 0 0; #X text 49 543 (C) Copyright 2004 Hans-Christoph Steiner hans@at.or.at ; #N canvas 162 133 570 420 serin 0; @@ -504,7 +302,7 @@ #X obj 455 295 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X msg 262 104 open 6; -#N canvas 766 107 771 427 output 1; +#N canvas 766 107 771 427 output 0; #X obj 286 341 outlet; #X msg 112 70 255; #X obj 108 112 pack 0 16; @@ -542,7 +340,7 @@ #X obj 420 240 pack; #X msg 421 295 write 8 1 0 $1; #X msg 419 197 write 0x000c 0x0001 0 1023; -#N canvas 552 22 800 488 ifeel 1; +#N canvas 552 22 800 488 ifeel 0; #X obj 127 257 outlet; #X msg 545 30 set 0x11 0x0a $1 $2 0x00 $3 0x00; #X msg 187 201 write 0xff00 0x0002 6 0; @@ -600,61 +398,67 @@ #X connect 31 0 0 0; #X connect 32 0 0 0; #X connect 33 0 0 0; -#X restore 373 211 pd output support; +#X restore 357 219 pd output support; #X obj 27 420 route x y wheel rx ry; #X obj 241 445 print NOT MAPPED; -#X connect 2 0 60 0; -#X connect 8 0 60 0; -#X connect 9 0 60 0; -#X connect 21 0 60 0; -#X connect 50 0 60 0; -#X connect 51 0 60 0; -#X connect 53 0 60 0; -#X connect 54 0 60 0; -#X connect 57 0 50 0; -#X connect 58 0 72 0; -#X connect 60 0 69 0; -#X connect 60 0 62 0; -#X connect 60 0 61 0; -#X connect 60 0 67 0; -#X connect 60 1 52 0; -#X connect 61 0 55 0; -#X connect 62 0 5 0; -#X connect 62 1 4 0; -#X connect 62 2 63 0; -#X connect 62 3 3 0; -#X connect 64 0 70 0; -#X connect 64 1 29 0; -#X connect 64 2 30 0; -#X connect 64 3 31 0; -#X connect 64 4 32 0; -#X connect 64 5 33 0; -#X connect 64 6 34 0; -#X connect 65 0 68 0; -#X connect 65 1 74 0; -#X connect 65 2 64 0; -#X connect 67 0 65 0; -#X connect 68 0 16 0; -#X connect 68 1 35 0; -#X connect 68 2 36 0; -#X connect 68 3 37 0; -#X connect 68 4 38 0; -#X connect 68 5 39 0; -#X connect 68 6 40 0; -#X connect 68 7 41 0; -#X connect 68 8 42 0; -#X connect 68 9 43 0; -#X connect 68 10 44 0; -#X connect 68 11 45 0; -#X connect 68 12 46 0; -#X connect 68 13 47 0; -#X connect 68 14 48 0; -#X connect 68 15 49 0; -#X connect 71 0 69 1; -#X connect 72 0 60 0; -#X connect 73 0 60 0; -#X connect 74 0 0 0; -#X connect 74 1 1 0; -#X connect 74 2 20 0; -#X connect 74 4 28 0; -#X connect 74 5 75 0; +#X text 437 173 print a list of devices to the Pd window; +#X msg 374 172 devices; +#X msg 374 193 elements; +#X text 437 194 print a list of elements for the current device; +#X connect 2 0 57 0; +#X connect 8 0 57 0; +#X connect 9 0 57 0; +#X connect 18 0 57 0; +#X connect 47 0 57 0; +#X connect 48 0 57 0; +#X connect 50 0 57 0; +#X connect 51 0 57 0; +#X connect 54 0 47 0; +#X connect 55 0 69 0; +#X connect 57 0 66 0; +#X connect 57 0 59 0; +#X connect 57 0 58 0; +#X connect 57 0 64 0; +#X connect 57 1 49 0; +#X connect 58 0 52 0; +#X connect 59 0 5 0; +#X connect 59 1 4 0; +#X connect 59 2 60 0; +#X connect 59 3 3 0; +#X connect 61 0 67 0; +#X connect 61 1 26 0; +#X connect 61 2 27 0; +#X connect 61 3 28 0; +#X connect 61 4 29 0; +#X connect 61 5 30 0; +#X connect 61 6 31 0; +#X connect 62 0 65 0; +#X connect 62 1 71 0; +#X connect 62 2 61 0; +#X connect 64 0 62 0; +#X connect 65 0 16 0; +#X connect 65 1 32 0; +#X connect 65 2 33 0; +#X connect 65 3 34 0; +#X connect 65 4 35 0; +#X connect 65 5 36 0; +#X connect 65 6 37 0; +#X connect 65 7 38 0; +#X connect 65 8 39 0; +#X connect 65 9 40 0; +#X connect 65 10 41 0; +#X connect 65 11 42 0; +#X connect 65 12 43 0; +#X connect 65 13 44 0; +#X connect 65 14 45 0; +#X connect 65 15 46 0; +#X connect 68 0 66 1; +#X connect 69 0 57 0; +#X connect 70 0 57 0; +#X connect 71 0 0 0; +#X connect 71 1 1 0; +#X connect 71 2 17 0; +#X connect 71 4 25 0; +#X connect 71 5 72 0; +#X connect 74 0 57 0; +#X connect 75 0 57 0;
Modified: trunk/externals/io/hidio/hidio.c =================================================================== --- trunk/externals/io/hidio/hidio.c 2008-06-23 16:46:32 UTC (rev 10077) +++ trunk/externals/io/hidio/hidio.c 2008-06-23 18:39:32 UTC (rev 10078) @@ -79,6 +79,9 @@ t_symbol *pid_symbols[PID_ARRAY_MAX]; t_symbol *relative_symbols[RELATIVE_ARRAY_MAX];
+/* TODO consider issuing a pd_error if more than one instance is attached to + * one given device */ + /*------------------------------------------------------------------------------ * FUNCTION PROTOTYPES */ @@ -637,6 +640,8 @@ class_addmethod(hidio_class,(t_method) hidio_debug,gensym("debug"),A_DEFFLOAT,0); class_addmethod(hidio_class,(t_method) hidio_build_device_list,gensym("refresh"),0); /* TODO: [print( should be dumped for [devices( and [elements( messages */ + class_addmethod(hidio_class,(t_method) hidio_devices,gensym("devices"),0); + class_addmethod(hidio_class,(t_method) hidio_elements,gensym("elements"),0); class_addmethod(hidio_class,(t_method) hidio_print,gensym("print"),0); class_addmethod(hidio_class,(t_method) hidio_info,gensym("info"),0); class_addmethod(hidio_class,(t_method) hidio_open,gensym("open"),A_GIMME,0); @@ -721,6 +726,8 @@ class_addmethod(c, (method)hidio_debug, "debug",A_DEFFLOAT,0); class_addmethod(c, (method)hidio_build_device_list, "refresh",0); /* TODO: [print( should be dumped for [devices( and [elements( messages */ + class_addmethod(c, (method)hidio_devices, "devices",0); + class_addmethod(c, (method)hidio_elements, "elements",0); class_addmethod(c, (method)hidio_print, "print",0); class_addmethod(c, (method)hidio_info, "info",0); class_addmethod(c, (method)hidio_open, "open",A_GIMME,0);
Modified: trunk/externals/io/hidio/hidio.h =================================================================== --- trunk/externals/io/hidio/hidio.h 2008-06-23 16:46:32 UTC (rev 10077) +++ trunk/externals/io/hidio/hidio.h 2008-06-23 18:39:32 UTC (rev 10078) @@ -192,6 +192,8 @@ t_int instance, t_int value); extern void hidio_write_event_ints(t_hidio *x, t_int type, t_int code, t_int instance, t_int value); +extern void hidio_devices(t_hidio* x); /* print device list to the console */ +extern void hidio_elements(t_hidio* x); /* print element list to the console */ extern void hidio_print(t_hidio* x); /* print info to the console */ extern void hidio_platform_specific_info(t_hidio *x); /* device info on the status outlet */ extern void hidio_platform_specific_free(t_hidio *x);
Modified: trunk/externals/io/hidio/hidio_darwin.c =================================================================== --- trunk/externals/io/hidio/hidio_darwin.c 2008-06-23 16:46:32 UTC (rev 10077) +++ trunk/externals/io/hidio/hidio_darwin.c 2008-06-23 18:39:32 UTC (rev 10078) @@ -480,9 +480,10 @@ } }
-static void hidio_print_element_list(t_hidio *x) + +void hidio_elements(t_hidio *x) { -// debug_post(LOG_DEBUG,"hidio_print_element_list"); +// debug_post(LOG_DEBUG,"hidio_elements"); int i; pRecElement pCurrentHIDElement; pRecDevice pCurrentHIDDevice; @@ -496,7 +497,9 @@ error("[hidio]: device %d is not a valid device\n",x->x_device_number); return; } - post("[hidio] found %d elements:",element_count[x->x_device_number]); + post("__________________________________________________"); + post("[hidio] found %d elements in '%s' '%s' (device #%d)", element_count[x->x_device_number], + pCurrentHIDDevice->manufacturer, pCurrentHIDDevice->product, x->x_device_number); post("\n TYPE\t\tCODE\t#\tcookie\tEVENT NAME"); post("-----------------------------------------------------------"); for(i=0; i<element_count[x->x_device_number]; i++) @@ -506,7 +509,7 @@ HIDGetTypeName((IOHIDElementType) pCurrentHIDElement->type, type_name); HIDGetUsageName(pCurrentHIDElement->usagePage, pCurrentHIDElement->usage, usage_name); - post(" %s\t%s\t%d\t%d\t%s, %s", current_element->type->s_name, + post(" %s\t%s\t%d\t%d\t%s, %s", current_element->type->s_name, current_element->name->s_name,(int) current_element->instance, pCurrentHIDElement->cookie, type_name, usage_name); @@ -540,18 +543,19 @@ }
-static void hidio_print_device_list(t_hidio *x) +void hidio_devices(t_hidio *x) { char device_type_buffer[256]; t_int i, numdevs; unsigned int j; pRecDevice pCurrentHIDDevice = NULL;
+ if( !HIDHaveDeviceList() ) hidio_build_device_list(); if( HIDHaveDeviceList() ) { numdevs = (t_int) HIDCountDevices(); - post(""); + post("\n[hidio]: current device list:"); /* display device list in console */ for(i=0; i < numdevs; i++) { @@ -865,10 +869,10 @@ void hidio_print(t_hidio *x) { if( !HIDHaveDeviceList() ) hidio_build_device_list(); - hidio_print_device_list(x); + hidio_devices(x); if(x->x_device_open) { - hidio_print_element_list(x); + hidio_elements(x); hidio_ff_print(x); } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.