From 5e357ed1cc0c85e950d6ab5fc27d249df7fae2bf Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 1 Jan 2007 01:06:11 +0000 Subject: renamed debug_print() to debug_post() since its a wrapper to post() svn path=/trunk/externals/io/hidio/; revision=7116 --- hidio-help.pd | 86 ++++++++++++++++++++++++++++----------------------------- hidio.c | 58 +++++++++++++++++++++++--------------- hidio.h | 6 ++-- hidio_darwin.c | 80 +++++++++++++++++++++++++---------------------------- hidio_linux.c | 24 ++++++++-------- hidio_windows.c | 12 ++++---- 6 files changed, 136 insertions(+), 130 deletions(-) diff --git a/hidio-help.pd b/hidio-help.pd index 592fc72..cf51eaf 100644 --- a/hidio-help.pd +++ b/hidio-help.pd @@ -1,4 +1,4 @@ -#N canvas 157 38 878 603 10; +#N canvas 157 38 886 611 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 @@ -14,15 +14,15 @@ #X text 435 117 refresh device list; #X text 537 487 For more info:; #X text 266 557 released under the GNU GPL; -#X text 472 544 $Revision: 1.4 $$Date: 2006-12-31 22:49:16 $; +#X text 472 544 $Revision: 1.5 $$Date: 2007-01-01 01:06:11 $; #X text 473 557 $Author: eighthave $; #X msg 436 201 poll 20; #X msg 374 201 poll 2; #X text 370 186 start polling and set the poll delay in ms; #X text 425 33 !!! This software is very much alpha \, so any aspect of it could change without notice !!!; -#X obj 9 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 -; +#X obj 9 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +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.); @@ -240,36 +240,36 @@ of it could change without notice !!!; #X floatatom 263 401 6 0 0 0 - - -; #X floatatom 313 401 6 0 0 0 - - -; #X floatatom 363 401 6 0 0 0 - - -; -#X obj 39 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 -; -#X obj 69 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 -; -#X obj 99 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 -; -#X obj 129 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 159 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 189 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 219 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 249 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 279 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 309 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 339 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 369 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 399 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 429 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; -#X obj 459 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 -1; +#X obj 39 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 69 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 99 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 129 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 159 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 189 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 219 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 249 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 279 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 309 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 339 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 369 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 399 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 133004 +133004; +#X obj 429 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; +#X obj 459 508 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 66455 +66455; #X msg 25 155 debug 9; #X msg 298 145 info; #N canvas 743 25 411 235 see 0; @@ -394,7 +394,7 @@ IDs (it is not case sensitive):; #X connect 7 0 4 0; #X restore 174 37 pd open by vendor/product ID; #X msg 504 201 poll 200; -#X msg 225 309 relative y 0 1; +#X msg 225 309 key key_255 0 133004; #X text 49 543 (C) Copyright 2004 Hans-Christoph Steiner ; #N canvas 162 133 570 420 serin 0; @@ -425,12 +425,12 @@ IDs (it is not case sensitive):; #X connect 10 0 8 0; #X coords 0 -1 1 1 165 17 1 60 60; #X restore 25 134 pd serin; -#X msg 262 114 open 2; +#X msg 262 114 open 0; #N canvas 162 133 570 420 serin 0; -#X obj 209 61 cnv 15 15 15 empty \$0-open-canvas 2 4 8 0 14 -233017 +#X obj 209 61 cnv 15 15 15 empty \$0-open-canvas 0 4 8 0 14 -233017 -1 0; #X obj 60 61 hradio 15 1 1 10 empty empty empty 0 -6 0 8 -225271 -1 --1 2; +-1 0; #X obj 60 13 inlet; #X msg 200 202 label \$1; #X obj 200 180 makefilename %d; @@ -478,7 +478,7 @@ IDs (it is not case sensitive):; #X restore 10 293 pd remove instance numbers; #X obj 9 466 route a_key b_key c_key d_key e_key f_key g_key h_key i_key j_key k_key l_key m_key n_key o_key p_key; -#N canvas 114 93 475 354 raw 0; +#N canvas 114 93 487 366 raw 0; #X obj 144 45 inlet; #X obj 88 104 route DESKTOP; #X obj 87 158 route DESKTOP57; @@ -490,10 +490,10 @@ i_key j_key k_key l_key m_key n_key o_key p_key; #X obj 189 192 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 292 122 spigot; -#X obj 290 163 print test; #X obj 333 99 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 354 45 inlet; +#X obj 290 162 print RAW; #X connect 0 0 1 0; #X connect 0 0 8 0; #X connect 1 0 2 0; @@ -502,9 +502,9 @@ i_key j_key k_key l_key m_key n_key o_key p_key; #X connect 2 0 5 0; #X connect 5 0 6 0; #X connect 7 0 5 1; -#X connect 8 0 9 0; -#X connect 10 0 8 1; -#X connect 11 0 10 0; +#X connect 8 0 11 0; +#X connect 9 0 8 1; +#X connect 10 0 9 0; #X restore 408 294 pd raw; #X floatatom 63 401 6 0 0 0 - - -; #X obj 455 295 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 diff --git a/hidio.c b/hidio.c index d2c114c..5542c75 100644 --- a/hidio.c +++ b/hidio.c @@ -94,7 +94,7 @@ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv); * SUPPORT FUNCTIONS */ -void debug_print(t_int message_debug_level, const char *fmt, ...) +void debug_post(t_int message_debug_level, const char *fmt, ...) { if(message_debug_level <= global_debug_level) { @@ -229,7 +229,7 @@ static short get_device_number_from_arguments(int argc, t_atom *argv) atom_arg_getlong(&device_number, 0, argc, argv); #endif /* PD */ if(device_number < 0) device_number = -1; - debug_print(LOG_DEBUG,"[hidio] setting device# to %d",device_number); + debug_post(LOG_DEBUG,"[hidio] setting device# to %d",device_number); } else { // single symbol arg means first instance of a device type @@ -242,7 +242,7 @@ static short get_device_number_from_arguments(int argc, t_atom *argv) usage = name_to_usage(device_type_string); device_number = get_device_number_from_usage(0, usage >> 16, usage & 0xffff); - debug_print(LOG_INFO,"[hidio] using 0x%04x 0x%04x for %s", + debug_post(LOG_INFO,"[hidio] using 0x%04x 0x%04x for %s", usage >> 16, usage & 0xffff, device_type_string); } } @@ -267,7 +267,7 @@ static short get_device_number_from_arguments(int argc, t_atom *argv) usage = name_to_usage(device_type_string); atom_arg_getlong(&device_type_instance, 1, argc, argv); #endif /* PD */ - debug_print(LOG_DEBUG,"[hidio] looking for %s at #%d", + debug_post(LOG_DEBUG,"[hidio] looking for %s at #%d", device_type_string, device_type_instance); device_number = get_device_number_from_usage(device_type_instance, usage >> 16, @@ -291,31 +291,38 @@ void hidio_output_event(t_hidio *x, t_hid_element *output_data) if( (output_data->relative) || // relative data should always be output (output_data->value != output_data->previous_value) ) { +/* debug_post(LOG_DEBUG,"hidio_output_event: instance %d/%d last: %llu", + x->x_instance+1, hidio_instance_count, + last_execute_time[x->x_device_number]);*/ t_atom event_data[3]; + /* TODO: this output message should be stored in t_hid_element, then just + * the value updated. That would save a bit of CPU time since this is + * run for every event that is output. */ #ifdef PD - SETSYMBOL(event_data, output_data->name); + SETSYMBOL(event_data, output_data->name); SETFLOAT(event_data + 1, output_data->instance); SETFLOAT(event_data + 2, output_data->value); #else /* Max */ atom_setsym(event_data, output_data->name); + //TODO: why is this line repeated? atom_setsym(event_data, output_data->name); atom_setlong(event_data + 1, (long)output_data->instance); atom_setlong(event_data + 2, (long)output_data->value); #endif /* PD */ outlet_anything(x->x_data_outlet, output_data->type, 3, event_data); - } + } } /* stop polling the device */ static void hidio_stop_poll(t_hidio* x) { - debug_print(LOG_DEBUG,"hidio_stop_poll"); + debug_post(LOG_DEBUG,"hidio_stop_poll"); if (x->x_started) { clock_unset(x->x_clock); - debug_print(LOG_INFO,"[hidio] polling stopped"); + debug_post(LOG_INFO,"[hidio] polling stopped"); x->x_started = 0; } } @@ -330,7 +337,7 @@ static void hidio_stop_poll(t_hidio* x) */ void hidio_poll(t_hidio* x, t_float f) { - debug_print(LOG_DEBUG,"hidio_poll"); + debug_post(LOG_DEBUG,"hidio_poll"); /* if the user sets the delay less than 2, set to block size */ if( f > 2 ) @@ -346,7 +353,7 @@ void hidio_poll(t_hidio* x, t_float f) if(!x->x_started) { clock_delay(x->x_clock, x->x_delay); - debug_print(LOG_DEBUG,"[hidio] polling started"); + debug_post(LOG_DEBUG,"[hidio] polling started"); x->x_started = 1; } } @@ -377,14 +384,14 @@ static void hidio_set_from_float(t_hidio *x, t_floatarg f) /* close the device */ t_int hidio_close(t_hidio *x) { - debug_print(LOG_DEBUG,"hidio_close"); + debug_post(LOG_DEBUG,"hidio_close"); /* just to be safe, stop it first */ hidio_stop_poll(x); if(! hidio_close_device(x)) { - debug_print(LOG_INFO,"[hidio] closed device %d",x->x_device_number); + debug_post(LOG_INFO,"[hidio] closed device %d",x->x_device_number); x->x_device_open = 0; return (0); } @@ -403,7 +410,7 @@ t_int hidio_close(t_hidio *x) */ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv) { - debug_print(LOG_DEBUG,"hid_%s",s->s_name); + debug_post(LOG_DEBUG,"hid_%s",s->s_name); short new_device_number = get_device_number_from_arguments(argc, argv); t_int started = x->x_started; // store state to restore after device is opened @@ -431,12 +438,12 @@ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv) * accurately reflect [hidio]'s state */ if (started) hidio_set_from_float(x,x->x_delay); // TODO is this useful? - debug_print(LOG_DEBUG,"[hidio] set device# to %d",new_device_number); + debug_post(LOG_DEBUG,"[hidio] set device# to %d",new_device_number); output_device_number(x); } } } - else debug_print(LOG_WARNING,"[hidio] device does not exist"); + else debug_post(LOG_WARNING,"[hidio] device does not exist"); /* always output open result so you can test for success in Pd space */ output_open_status(x); } @@ -444,7 +451,7 @@ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv) static void hidio_tick(t_hidio *x) { -// debug_print(LOG_DEBUG,"hidio_tick"); +// debug_post(LOG_DEBUG,"hidio_tick"); t_hid_element *current_element; unsigned int i; #ifdef PD @@ -454,17 +461,22 @@ static void hidio_tick(t_hidio *x) clock_getftime(&right_now); #endif /* PD */ - debug_print(LOG_DEBUG,"# %u\tnow: %u\tlast: %u", x->x_device_number, - right_now, last_execute_time[x->x_device_number]); +// debug_post(LOG_DEBUG,"# %u\tnow: %llu\tlast: %llu", x->x_device_number, +// right_now, last_execute_time[x->x_device_number]); if(right_now > last_execute_time[x->x_device_number]) { hidio_get_events(x); last_execute_time[x->x_device_number] = right_now; -/* post("executing: instance %d/%d at %ld", - x->x_instance, hidio_instance_count, right_now);*/ +/* debug_post(LOG_DEBUG,"executing: instance %d/%d at %llu last: %llu", + x->x_instance+1, hidio_instance_count, right_now, + last_execute_time[x->x_device_number]);*/ } for(i=0; i< element_count[x->x_device_number]; ++i) { + /* TODO: since relative events need to be output every time, they need + * to be flagged when new relative events arrive. Otherwise, it'll + * just spam out relative events no matter if anything new has + * arrived */ current_element = element[x->x_device_number][i]; if(current_element->previous_value != current_element->value) { @@ -491,7 +503,7 @@ static void hidio_info(t_hidio *x) static void hidio_float(t_hidio* x, t_floatarg f) { - debug_print(LOG_DEBUG,"hid_float"); + debug_post(LOG_DEBUG,"hid_float"); hidio_set_from_float(x,f); } @@ -499,7 +511,7 @@ static void hidio_float(t_hidio* x, t_floatarg f) #ifndef PD /* Max */ static void hidio_int(t_hidio* x, long l) { - debug_print(LOG_DEBUG,"hid_int"); + debug_post(LOG_DEBUG,"hid_int"); hidio_set_from_float(x, (float)l); } @@ -516,7 +528,7 @@ static void hidio_debug(t_hidio *x, t_float f) */ static void hidio_free(t_hidio* x) { - debug_print(LOG_DEBUG,"hidio_free"); + debug_post(LOG_DEBUG,"hidio_free"); hidio_close(x); clock_free(x->x_clock); diff --git a/hidio.h b/hidio.h index e7d08c5..907ecb3 100644 --- a/hidio.h +++ b/hidio.h @@ -42,7 +42,7 @@ typedef void t_clock; #define HIDIO_MAJOR_VERSION 0 #define HIDIO_MINOR_VERSION 0 -/* static char *version = "$Revision: 1.12 $"; */ +/* static char *version = "$Revision: 1.13 $"; */ /*------------------------------------------------------------------------------ * MACRO DEFINES @@ -150,7 +150,7 @@ typedef struct _hid_element unsigned char relative; // relative data gets output everytime t_int min; // from device report t_int max; // from device report - t_float instance; // usage page/usage instance # ([absolute throttle 2 163( + t_float instance; // usage page/usage instance # (e.g. [absolute x 2 163( ) t_int value; // output the sum of events in a poll for relative axes t_int previous_value; //only output on change on abs and buttons } t_hid_element; @@ -168,7 +168,7 @@ extern unsigned short element_count[MAX_DEVICES]; */ /* support functions */ -void debug_print(t_int debug_level, const char *fmt, ...); +void debug_post(t_int debug_level, const char *fmt, ...); void debug_error(t_hidio *x, t_int debug_level, const char *fmt, ...); void hidio_output_event(t_hidio *x, t_hid_element *output_data); diff --git a/hidio_darwin.c b/hidio_darwin.c index 1e77731..d9ae055 100644 --- a/hidio_darwin.c +++ b/hidio_darwin.c @@ -110,17 +110,17 @@ static void convert_axis_to_symbols(pRecElement pCurrentHIDElement, static void get_usage_symbols(pRecElement pCurrentHIDElement, t_hid_element *new_element) { -// debug_print(LOG_DEBUG,"get_usage_symbols"); +// debug_post(LOG_DEBUG,"get_usage_symbols"); char buffer[MAXPDSTRING]; if(new_element == NULL) { - debug_print(LOG_EMERG,"[hidio] new_element == NULL!! This is a bug, please report it."); + debug_post(LOG_EMERG,"[hidio] new_element == NULL!! This is a bug, please report it."); return; } if(pCurrentHIDElement == NULL) { - debug_print(LOG_EMERG,"[hidio] pCurrentHIDElement == NULL!! This is a bug, please report it."); + debug_post(LOG_EMERG,"[hidio] pCurrentHIDElement == NULL!! This is a bug, please report it."); return; } @@ -302,7 +302,7 @@ double calculate_event_latency( uint64_t endTime, uint64_t startTime ) short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id) { - debug_print(LOG_DEBUG,"get_device_number_from_usage"); + debug_post(LOG_DEBUG,"get_device_number_from_usage"); pRecDevice pCurrentHIDDevice; t_int i; @@ -315,7 +315,7 @@ short get_device_number_by_id(unsigned short vendor_id, unsigned short product_i while(pCurrentHIDDevice != NULL) { --i; - debug_print(LOG_INFO,"compare 0x%04x == 0x%04x 0x%04x == 0x%04x", + debug_post(LOG_INFO,"compare 0x%04x == 0x%04x 0x%04x == 0x%04x", pCurrentHIDDevice->vendorID, vendor_id, pCurrentHIDDevice->productID, @@ -336,7 +336,7 @@ short get_device_number_from_usage(short device_number, unsigned short usage_page, unsigned short usage) { -// debug_print(LOG_DEBUG,"get_device_number_from_usage"); +// debug_post(LOG_DEBUG,"get_device_number_from_usage"); pRecDevice pCurrentHIDDevice; t_int i; @@ -369,7 +369,7 @@ short get_device_number_from_usage(short device_number, HIDGetUsageName(pCurrentHIDDevice->usagePage, pCurrentHIDDevice->usage, cstrDeviceName); - debug_print(LOG_DEBUG,"[hidio]: found a %s at %d/%d: %s %s" + debug_post(LOG_DEBUG,"[hidio]: found a %s at %d/%d: %s %s" ,cstrDeviceName, i, total_devices, @@ -440,29 +440,29 @@ static void hidio_build_element_list(t_hidio *x) case kHIDUsage_GD_Dial: case kHIDUsage_GD_Wheel: //case kHIDUsage_GD_Hatswitch: // hatswitches are more like buttons, so queue them - debug_print(LOG_INFO,"[hidio] storing absolute axis to poll %s, %s (0x%04x 0x%04x)", + debug_post(LOG_INFO,"[hidio] storing absolute axis to poll %s, %s (0x%04x 0x%04x)", type_name, usage_name, pCurrentHIDElement->usagePage, pCurrentHIDElement->usage); if(HIDDequeueElement(pCurrentHIDDevice,pCurrentHIDElement) != kIOReturnSuccess) - debug_print(LOG_ERR,"[hidio] could not dequeue element"); + debug_post(LOG_ERR,"[hidio] could not dequeue element"); new_element->polled = 1; break; } default: - debug_print(LOG_INFO,"\tqueuing element %s, %s (0x%04x 0x%04x)", + debug_post(LOG_INFO,"\tqueuing element %s, %s (0x%04x 0x%04x)", type_name, usage_name, pCurrentHIDElement->usagePage, pCurrentHIDElement->usage); } } else { - debug_print(LOG_INFO,"\tqueuing element %s, %s (0x%04x 0x%04x)", + debug_post(LOG_INFO,"\tqueuing element %s, %s (0x%04x 0x%04x)", type_name, usage_name, pCurrentHIDElement->usagePage, pCurrentHIDElement->usage); } new_element->min = pCurrentHIDElement->min; new_element->max = pCurrentHIDElement->max; - debug_print(LOG_DEBUG,"\tlogical min %d max %d", + debug_post(LOG_DEBUG,"\tlogical min %d max %d", pCurrentHIDElement->min,pCurrentHIDElement->max); element[x->x_device_number][element_count[x->x_device_number]] = new_element; ++element_count[x->x_device_number]; @@ -473,7 +473,7 @@ static void hidio_build_element_list(t_hidio *x) static void hidio_print_element_list(t_hidio *x) { -// debug_print(LOG_DEBUG,"hidio_print_element_list"); +// debug_post(LOG_DEBUG,"hidio_print_element_list"); int i; pRecElement pCurrentHIDElement; pRecDevice pCurrentHIDDevice; @@ -507,7 +507,7 @@ static void hidio_print_element_list(t_hidio *x) void hidio_ff_print( t_hidio *x ) { - debug_print(LOG_DEBUG,"hidio_ff_print"); + debug_post(LOG_DEBUG,"hidio_ff_print"); HRESULT result; UInt32 value; @@ -663,14 +663,14 @@ void hidio_get_events(t_hidio *x) (IOHIDElementCookie) event.elementCookie) ); current_element->value = event.value; -// debug_print(LOG_DEBUG,"output this: %s %s %d prev %d",current_element->type->s_name, +// debug_post(LOG_DEBUG,"output this: %s %s %d prev %d",current_element->type->s_name, // current_element->name->s_name, current_element->value, // current_element->previous_value); -// debug_print(LOG_DEBUG,"timestamp: %u %u", event.timestamp.hi, event.timestamp.lo); +// debug_post(LOG_DEBUG,"timestamp: %u %u", event.timestamp.hi, event.timestamp.lo); timestamp = * (uint64_t *) &(event.timestamp); now = mach_absolute_time(); difference = calculate_event_latency(now, timestamp); - // temp hack to measure latency +// temp hack to measure latency if( latency_i < LATENCY_MAX) { latency[latency_i] = (int) difference; @@ -680,18 +680,11 @@ void hidio_get_events(t_hidio *x) } else { -/* for(j=0;jx_device_number]; ++i) @@ -709,7 +702,7 @@ void hidio_get_events(t_hidio *x) // TODO: return the same as POSIX open()/close() - 0=success, -1=fail t_int hidio_open_device(t_hidio *x, short device_number) { - debug_print(LOG_DEBUG,"hidio_open_device"); + debug_post(LOG_DEBUG,"hidio_open_device"); t_int result = 0; pRecDevice pCurrentHIDDevice = NULL; @@ -733,7 +726,7 @@ t_int hidio_open_device(t_hidio *x, short device_number) debug_error(x,LOG_ERR,"[hidio]: device %d is not a valid device\n",device_number); return(1); } - debug_print(LOG_WARNING,"[hidio] opened device %d: %s %s", + debug_post(LOG_WARNING,"[hidio] opened device %d: %s %s", device_number, pCurrentHIDDevice->manufacturer, pCurrentHIDDevice->product); hidio_build_element_list(x); @@ -741,7 +734,7 @@ t_int hidio_open_device(t_hidio *x, short device_number) hidDevice = AllocateHIDObjectFromRecDevice( pCurrentHIDDevice ); if( FFIsForceFeedback(hidDevice) == FF_OK ) { - debug_print(LOG_WARNING,"\tdevice has Force Feedback support"); + debug_post(LOG_WARNING,"\tdevice has Force Feedback support"); if( FFCreateDevice(hidDevice,&ffDeviceReference) == FF_OK ) { x->x_has_ff = 1; @@ -760,7 +753,7 @@ t_int hidio_open_device(t_hidio *x, short device_number) // TODO: return the same as POSIX open()/close() - 0=success, -1=fail t_int hidio_close_device(t_hidio *x) { - debug_print(LOG_DEBUG,"hidio_close_device"); + debug_post(LOG_DEBUG,"hidio_close_device"); t_int result = 0; // pRecDevice pCurrentHIDDevice = hidio_get_device_by_number(x->x_device_number); @@ -779,9 +772,9 @@ void hidio_build_device_list(void) int device_number = 0; pRecDevice pCurrentHIDDevice; - debug_print(LOG_DEBUG,"hidio_build_device_list"); + debug_post(LOG_DEBUG,"hidio_build_device_list"); - debug_print(LOG_WARNING,"[hidio] Building device list..."); + debug_post(LOG_WARNING,"[hidio] Building device list..."); if(HIDBuildDeviceList (0, 0)) post("[hidio]: no HID devices found\n"); @@ -797,7 +790,7 @@ void hidio_build_device_list(void) pCurrentHIDDevice = HIDGetNextDevice(pCurrentHIDDevice); } device_count = (unsigned int) HIDCountDevices(); // set the global variable - debug_print(LOG_WARNING,"[hidio] completed device list."); + debug_post(LOG_WARNING,"[hidio] completed device list."); } /* TODO: this should be dumped for [devices( and [elements( messages */ @@ -816,7 +809,7 @@ void hidio_print(t_hidio *x) void hidio_platform_specific_free(t_hidio *x) { int j; - debug_print(LOG_DEBUG,"hidio_platform_specific_free"); + debug_post(LOG_DEBUG,"hidio_platform_specific_free"); /* only call this if the last instance is being freed */ if (hidio_instance_count < 1) { @@ -824,10 +817,11 @@ void hidio_platform_specific_free(t_hidio *x) HIDReleaseAllDeviceQueues(); HIDReleaseDeviceList(); } - for(j=0;jlinux_code) ) { output_element->value = hidio_input_event.value; - debug_print(9,"i: %d linux_type: %d linux_code: %d", i, + debug_post(9,"i: %d linux_type: %d linux_code: %d", i, output_element->linux_type, output_element->linux_code); - debug_print(9,"value to output: %d",output_element->value); + debug_post(9,"value to output: %d",output_element->value); break; } } @@ -421,7 +421,7 @@ void hidio_get_events(t_hidio *x) } DEBUG( if(event_counter > 0) - debug_print(8,"output %d events",event_counter); + debug_post(8,"output %d events",event_counter); ); return; @@ -437,7 +437,7 @@ void hidio_print(t_hidio* x) // TODO: return the same as POSIX open()/close() - 0=success, -1=fail t_int hidio_open_device(t_hidio *x, short device_number) { - debug_print(LOG_DEBUG,"hidio_open_device"); + debug_post(LOG_DEBUG,"hidio_open_device"); char device_name[MAXPDSTRING] = "Unknown"; char block_device[MAXPDSTRING] = "/dev/input/event0"; @@ -481,7 +481,7 @@ t_int hidio_open_device(t_hidio *x, short device_number) // TODO: return the same as POSIX open()/close() - 0=success, -1=fail t_int hidio_close_device(t_hidio *x) { - debug_print(LOG_DEBUG,"hidio_close_device"); + debug_post(LOG_DEBUG,"hidio_close_device"); if(x->x_fd <0) return 0; else @@ -504,9 +504,9 @@ void hidio_build_device_list(void) char block_device[MAXPDSTRING] = "/dev/input/event0"; struct input_event x_input_event; - debug_print(LOG_DEBUG,"hidio_build_device_list"); + debug_post(LOG_DEBUG,"hidio_build_device_list"); - debug_print(LOG_WARNING,"[hidio] Building device list..."); + debug_post(LOG_WARNING,"[hidio] Building device list..."); for(i=0; i