Update of /cvsroot/pure-data/externals/io/hidio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17192
Modified Files: Makefile hidio-help.pd hidio.c hidio.h hidio_darwin.c hidio_linux.c Added Files: hidio_types.c Log Message:
- laid out new event labeling scheme based more on USB HID rather than Linux input.h. It works on my devices on my Mac OS X. I probably broke Linux support. The scheme is in a new file, hidio_types.c
- all event symbols except the vendor-defined usage are generated in hidio_setup(). The symbols for vendor-defined usages are generated when the device's element list is built.
- changed macros to work cleanly when compiled on Windows using MinGW gcc
- fixed up help file to better represent the state of things (still could be much better)
Index: hidio.h =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** hidio.h 4 Dec 2006 16:46:25 -0000 1.8 --- hidio.h 8 Dec 2006 06:33:26 -0000 1.9 *************** *** 3,21 ****
#include <stdio.h> ! #ifdef _WINDOWS #include "pthread.h" /* needs pthread library */ #define LOG_DEBUG 7 #define LOG_INFO 6 #define LOG_WARNING 4 ! #define LOG_ERR 3 #define vsnprintf _vsnprintf #else #include <sys/syslog.h> #include <pthread.h> ! #endif
#ifdef _MSC_VER /* this only applies to Microsoft compilers */ #pragma warning (disable: 4305 4244 4761) ! #endif
#ifdef __linux__ --- 3,21 ----
#include <stdio.h> ! #ifdef _WIN32 #include "pthread.h" /* needs pthread library */ #define LOG_DEBUG 7 #define LOG_INFO 6 #define LOG_WARNING 4 ! #define LOG_ERR 3 #define vsnprintf _vsnprintf #else #include <sys/syslog.h> #include <pthread.h> ! #endif /* _WIN32 */
#ifdef _MSC_VER /* this only applies to Microsoft compilers */ #pragma warning (disable: 4305 4244 4761) ! #endif /* _MSC_VER */
#ifdef __linux__ *************** *** 25,29 **** #ifdef PD #include <m_pd.h> ! #else #include "ext.h" #include "ext_obex.h" --- 25,29 ---- #ifdef PD #include <m_pd.h> ! #else /* Max */ #include "ext.h" #include "ext_obex.h" *************** *** 38,61 **** #define pd_error(x, b) error(b) #define SETSYMBOL SETSYM ! #endif ! ! /* ! * this is automatically generated from linux/input.h by ! * make-arrays-from-input.h.pl to be the cross-platform event types and codes ! */ ! #include "input_arrays.h"
#define HIDIO_MAJOR_VERSION 0 #define HIDIO_MINOR_VERSION 0
! /* static char *version = "$Revision$"; */ ! ! /*------------------------------------------------------------------------------ ! * MACRO DEFINES ! */ ! ! #ifndef CLIP ! #define CLIP(a, lo, hi) ( (a)>(lo)?( (a)<(hi)?(a):(hi) ):(lo) ) ! #endif
/*------------------------------------------------------------------------------ --- 38,55 ---- #define pd_error(x, b) error(b) #define SETSYMBOL SETSYM ! #endif /* PD */
#define HIDIO_MAJOR_VERSION 0 #define HIDIO_MINOR_VERSION 0
! /* static char *version = "$Revision$"; */ ! ! /*------------------------------------------------------------------------------ ! * MACRO DEFINES ! */ ! ! #ifndef CLIP ! #define CLIP(a, lo, hi) ( (a)>(lo)?( (a)<(hi)?(a):(hi) ):(lo) ) ! #endif /* NOT CLIP */
/*------------------------------------------------------------------------------ *************** *** 97,107 **** #ifndef PD void *x_obex; ! #endif ! #ifdef _WINDOWS ! HANDLE x_fd; ! #endif #ifdef __linux__ ! t_int x_fd; ! #endif void *x_ff_device; short x_device_number; --- 91,101 ---- #ifndef PD void *x_obex; ! #endif /* PD */ ! #ifdef _WIN32 ! HANDLE x_fd; ! #endif /* _WIN32 */ #ifdef __linux__ ! t_int x_fd; ! #endif /* __linux */ void *x_ff_device; short x_device_number; *************** *** 118,122 **** pthread_cond_t x_requestcondition; pthread_cond_t x_answercondition; ! pthread_t x_thread; t_int x_priority; } t_hidio; --- 112,116 ---- pthread_cond_t x_requestcondition; pthread_cond_t x_answercondition; ! pthread_t x_thread; t_int x_priority; } t_hidio; *************** *** 147,153 **** #endif /* __linux__ */ #ifdef _WIN32 ! /* this stores the UsagePage and UsageID */ unsigned short usage_page; ! unsigned short usage_id; #endif /* _WIN32 */ #ifdef __APPLE__ --- 141,147 ---- #endif /* __linux__ */ #ifdef _WIN32 ! /* this stores the UsagePage and UsageID */ unsigned short usage_page; ! unsigned short usage_id; #endif /* _WIN32 */ #ifdef __APPLE__ *************** *** 213,219 **** void hidio_ff_print(t_hidio *x);
! #endif /* #ifndef _HIDIO_H */ --- 207,240 ---- void hidio_ff_print(t_hidio *x);
+ /*============================================================================== + * event symbols array sizes + *============================================================================== + */ + + #define ABSOLUTE_ARRAY_MAX 16 + #define BUTTON_ARRAY_MAX 128 + #define KEY_ARRAY_MAX 256 + #define LED_ARRAY_MAX 77 + #define PID_ARRAY_MAX 256 + #define RELATIVE_ARRAY_MAX 16
+ /*============================================================================== + * symbol pointers for pre-generated event symbols + *============================================================================== + */
+ extern t_symbol *ps_absolute, *ps_button, *ps_key, *ps_led, *ps_pid, *ps_relative;
! extern t_symbol *absolute_symbols[ABSOLUTE_ARRAY_MAX]; ! extern t_symbol *button_symbols[BUTTON_ARRAY_MAX]; ! extern t_symbol *key_symbols[KEY_ARRAY_MAX]; ! extern t_symbol *led_symbols[LED_ARRAY_MAX]; ! extern t_symbol *pid_symbols[PID_ARRAY_MAX]; ! extern t_symbol *relative_symbols[RELATIVE_ARRAY_MAX]; ! ! void generate_event_symbols(); ! void generate_type_symbols(); ! ! ! #endif /* NOT _HIDIO_H */
Index: hidio.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** hidio.c 4 Dec 2006 16:46:25 -0000 1.10 --- hidio.c 8 Dec 2006 06:33:26 -0000 1.11 *************** *** 3,7 **** /* interface to native HID (Human Interface Devices) API */ /* Written by Hans-Christoph Steiner hans@at.or.at */ ! /* Max/MSP port by Olaf Matthes olaf.matthes@gmx.de */ /* */ /* Copyright (c) 2004-2006 Hans-Christoph Steiner */ --- 3,7 ---- /* interface to native HID (Human Interface Devices) API */ /* Written by Hans-Christoph Steiner hans@at.or.at */ ! /* Max/MSP port by Olaf Matthes olaf.matthes@gmx.de */ /* */ /* Copyright (c) 2004-2006 Hans-Christoph Steiner */ *************** *** 24,40 **** /* */ /* --------------------------------------------------------------------------*/ ! ! #ifdef _WINDOWS ! /* any Windows specific includes go in here */ ! #ifdef PD ! #include <windows.h> ! #endif /* PD */ #else #include <unistd.h> ! #include <ctype.h> ! #endif ! #include <stdarg.h> ! #include <stdlib.h> ! #include <string.h>
#include "hidio.h" --- 24,40 ---- /* */ /* --------------------------------------------------------------------------*/ ! ! #ifdef _WIN32 ! /* any Windows specific includes go in here */ ! #ifdef PD ! #include <windows.h> ! #endif /* PD */ #else #include <unistd.h> ! #include <ctype.h> ! #endif /* _WIN32 */ ! #include <stdarg.h> ! #include <stdlib.h> ! #include <string.h>
#include "hidio.h" *************** *** 73,76 **** --- 73,83 ---- /* pre-generated symbols */ t_symbol *ps_open, *ps_device, *ps_poll, *ps_total, *ps_range; + t_symbol *ps_absolute, *ps_button, *ps_key, *ps_led, *ps_pid, *ps_relative; + t_symbol *absolute_symbols[ABSOLUTE_ARRAY_MAX]; + t_symbol *button_symbols[BUTTON_ARRAY_MAX]; + t_symbol *key_symbols[KEY_ARRAY_MAX]; + t_symbol *led_symbols[LED_ARRAY_MAX]; + t_symbol *pid_symbols[PID_ARRAY_MAX]; + t_symbol *relative_symbols[RELATIVE_ARRAY_MAX];
/*------------------------------------------------------------------------------ *************** *** 92,96 **** { if(message_debug_level <= global_debug_level) ! { char buf[MAXPDSTRING]; va_list ap; --- 99,103 ---- { if(message_debug_level <= global_debug_level) ! { char buf[MAXPDSTRING]; va_list ap; *************** *** 99,103 **** vsnprintf(buf, MAXPDSTRING-1, fmt, ap); post(buf); ! va_end(ap);
} --- 106,110 ---- vsnprintf(buf, MAXPDSTRING-1, fmt, ap); post(buf); ! va_end(ap);
} *************** *** 126,130 **** #else atom_setlong(output_atom, output_value); ! #endif outlet_anything( x->x_status_outlet, selector, 1, output_atom); freebytes(output_atom,sizeof(t_atom)); --- 133,137 ---- #else atom_setlong(output_atom, output_value); ! #endif /* PD */ outlet_anything( x->x_status_outlet, selector, 1, output_atom); freebytes(output_atom,sizeof(t_atom)); *************** *** 168,172 **** atom_setlong(output_data + 2, element[x->x_device_number][i]->min); atom_setlong(output_data + 3, element[x->x_device_number][i]->max); ! #endif outlet_anything(x->x_status_outlet, ps_range, 4, output_data); } --- 175,179 ---- atom_setlong(output_data + 2, element[x->x_device_number][i]->min); atom_setlong(output_data + 3, element[x->x_device_number][i]->max); ! #endif /* PD */ outlet_anything(x->x_status_outlet, ps_range, 4, output_data); } *************** *** 198,202 **** char *device_type_string; long device_type_instance; ! #endif unsigned int usage; unsigned short vendor_id; --- 205,209 ---- char *device_type_string; long device_type_instance; ! #endif /* PD */ unsigned int usage; unsigned short vendor_id; *************** *** 213,217 **** atom_arg_getsym(&first_argument, 0,argc,argv); if(first_argument == _sym_nothing) ! #endif { // single float arg means device # post("first_argument == &s_"); --- 220,224 ---- atom_arg_getsym(&first_argument, 0,argc,argv); if(first_argument == _sym_nothing) ! #endif /* PD */ { // single float arg means device # post("first_argument == &s_"); *************** *** 220,224 **** #else atom_arg_getlong(&device_number, 0, argc, argv); ! #endif if(device_number < 0) device_number = -1; debug_print(LOG_DEBUG,"[hidio] setting device# to %d",device_number); --- 227,231 ---- #else 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); *************** *** 231,235 **** device_type_string = atom_string(argv); // LATER do we have to free this string manually??? ! #endif usage = name_to_usage(device_type_string); device_number = get_device_number_from_usage(0, usage >> 16, --- 238,242 ---- device_type_string = atom_string(argv); // LATER do we have to free this string manually??? ! #endif /* PD */ usage = name_to_usage(device_type_string); device_number = get_device_number_from_usage(0, usage >> 16, *************** *** 249,253 **** atom_arg_getsym(&second_argument, 1,argc,argv); if( second_argument == _sym_nothing ) ! #endif { /* a symbol then a float means match on usage */ #ifdef PD --- 256,260 ---- atom_arg_getsym(&second_argument, 1,argc,argv); if( second_argument == _sym_nothing ) ! #endif /* PD */ { /* a symbol then a float means match on usage */ #ifdef PD *************** *** 259,263 **** usage = name_to_usage(device_type_string); atom_arg_getlong(&device_type_instance, 1, argc, argv); ! #endif debug_print(LOG_DEBUG,"[hidio] looking for %s at #%d", device_type_string, device_type_instance); --- 266,270 ---- 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", device_type_string, device_type_instance); *************** *** 281,286 **** void hidio_output_event(t_hidio *x, t_hid_element *output_data) { ! if( (output_data->value != output_data->previous_value) || ! (output_data->relative) ) // relative data should always be output { t_atom event_data[3]; --- 288,293 ---- 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) ) { t_atom event_data[3]; *************** *** 390,398 **** * open / same device no action * closed / different device open ! * open / different device close open */ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv) { ! short device_number; debug_print(LOG_DEBUG,"hid_%s",s->s_name); --- 397,405 ---- * open / same device no action * closed / different device open ! * open / different device close, open */ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv) { ! short device_number; debug_print(LOG_DEBUG,"hid_%s",s->s_name); *************** *** 418,423 **** double right_now = clock_getlogicaltime(); #else double right_now = (double)systime_ms(); ! #endif t_hid_element *current_element; --- 425,433 ---- double right_now = clock_getlogicaltime(); #else + /* TODO: this should use gettime() not systime_ms(). This needs to be logical + * time, not system time because the idea is that only one instance should get + * events from the OS in each slice of logical time hans@at.or.at */ double right_now = (double)systime_ms(); ! #endif /* PD */ t_hid_element *current_element; *************** *** 482,492 **** hidio_set_from_float(x, (float)l); } ! #endif
static void hidio_debug(t_hidio *x, t_float f) { ! pthread_mutex_lock(&x->x_mutex); global_debug_level = f; ! pthread_mutex_unlock(&x->x_mutex); }
--- 492,502 ---- hidio_set_from_float(x, (float)l); } ! #endif /* NOT PD */
static void hidio_debug(t_hidio *x, t_float f) { ! pthread_mutex_lock(&x->x_mutex); global_debug_level = f; ! pthread_mutex_unlock(&x->x_mutex); }
*************** *** 498,502 **** static void *hidio_child(void *zz) { ! t_hidio *x = zz; short device_number = -1;
--- 508,512 ---- static void *hidio_child(void *zz) { ! t_hidio *x = zz; short device_number = -1;
*************** *** 514,530 **** /* store running state to be restored after the device has been opened */ t_int started = x->x_started; ! int ret; ! /* check whether we have to close previous device */ ! if (x->x_device_open && device_number != x->x_device_number) ! { ! pthread_mutex_unlock(&x->x_mutex); ! stop_poll(x); ! ret = hidio_close_device(x); ! pthread_mutex_lock(&x->x_mutex); ! x->x_device_open = 0; ! device_number = -1; ! } ! /* no device open, so open one now */ ! if (!x->x_device_open) { pthread_mutex_unlock(&x->x_mutex); --- 524,540 ---- /* store running state to be restored after the device has been opened */ t_int started = x->x_started; ! int ret; ! /* check whether we have to close previous device */ ! if (x->x_device_open && device_number != x->x_device_number) ! { ! pthread_mutex_unlock(&x->x_mutex); ! stop_poll(x); ! ret = hidio_close_device(x); ! pthread_mutex_lock(&x->x_mutex); ! x->x_device_open = 0; ! device_number = -1; ! } ! /* no device open, so open one now */ ! if (!x->x_device_open) { pthread_mutex_unlock(&x->x_mutex); *************** *** 538,542 **** else { ! x->x_device_open = 1; device_number = x->x_device_number; /* keep local copy */ pthread_mutex_unlock(&x->x_mutex); --- 548,552 ---- else { ! x->x_device_open = 1; device_number = x->x_device_number; /* keep local copy */ pthread_mutex_unlock(&x->x_mutex); *************** *** 549,553 **** output_device_number(x); pthread_mutex_lock(&x->x_mutex); ! } } if (x->x_requestcode == REQUEST_OPEN) --- 559,563 ---- output_device_number(x); pthread_mutex_lock(&x->x_mutex); ! } } if (x->x_requestcode == REQUEST_OPEN) *************** *** 619,661 **** }
! /* change priority of child thread */ ! #ifdef PD ! static void hidio_priority(t_hidio *x, t_floatarg p) ! #else ! static void hidio_priority(t_hidio *x, long p) ! #endif ! { ! pthread_mutex_lock(&x->x_mutex); ! p = 2 * (CLIP(p, 0, 10) - 5); ! if (x->x_thread) ! { ! struct sched_param parm; ! int policy; ! if (pthread_getschedparam(x->x_thread, &policy, &parm) < 0) ! { ! post("hidio: warning: failed to get thread priority"); ! } ! else ! { ! parm.sched_priority = x->x_priority + (int)p; /* adjust priority */ ! ! if (parm.sched_priority < sched_get_priority_min(policy)) ! { ! parm.sched_priority = sched_get_priority_min(policy); ! } ! else if (parm.sched_priority > sched_get_priority_max(policy)) ! { ! parm.sched_priority = sched_get_priority_max(policy); ! } ! ! if (pthread_setschedparam(x->x_thread, policy, &parm) < 0) ! { ! post("hidio: warning: failed to change thread priority to %d", parm.sched_priority); ! } ! } ! } ! pthread_mutex_unlock(&x->x_mutex); ! } !
/*------------------------------------------------------------------------------ --- 629,671 ---- }
! /* change priority of child thread */ ! #ifdef PD ! static void hidio_priority(t_hidio *x, t_floatarg p) ! #else ! static void hidio_priority(t_hidio *x, long p) ! #endif ! { ! pthread_mutex_lock(&x->x_mutex); ! p = 2 * (CLIP(p, 0, 10) - 5); ! if (x->x_thread) ! { ! struct sched_param parm; ! int policy; ! if (pthread_getschedparam(x->x_thread, &policy, &parm) < 0) ! { ! post("hidio: warning: failed to get thread priority"); ! } ! else ! { ! parm.sched_priority = x->x_priority + (int)p; /* adjust priority */ ! ! if (parm.sched_priority < sched_get_priority_min(policy)) ! { ! parm.sched_priority = sched_get_priority_min(policy); ! } ! else if (parm.sched_priority > sched_get_priority_max(policy)) ! { ! parm.sched_priority = sched_get_priority_max(policy); ! } ! ! if (pthread_setschedparam(x->x_thread, policy, &parm) < 0) ! { ! post("hidio: warning: failed to change thread priority to %d", parm.sched_priority); ! } ! } ! } ! pthread_mutex_unlock(&x->x_mutex); ! } !
/*------------------------------------------------------------------------------ *************** *** 700,709 **** pthread_cond_destroy(&x->x_answercondition); pthread_mutex_destroy(&x->x_mutex); ! }
/* create a new instance of this class */ static void *hidio_new(t_symbol *s, int argc, t_atom *argv) { ! unsigned int i; #ifdef PD t_hidio *x = (t_hidio *)pd_new(hidio_class); --- 710,719 ---- pthread_cond_destroy(&x->x_answercondition); pthread_mutex_destroy(&x->x_mutex); ! }
/* create a new instance of this class */ static void *hidio_new(t_symbol *s, int argc, t_atom *argv) { ! unsigned int i; #ifdef PD t_hidio *x = (t_hidio *)pd_new(hidio_class); *************** *** 722,738 **** x->x_status_outlet = outlet_new(x, "anything"); x->x_data_outlet = outlet_new(x, "anything"); ! #endif
- /* init vars */ - global_debug_level = 9; /* high numbers here means see more messages */ - x->x_has_ff = 0; - x->x_device_open = 0; - x->x_started = 0; - x->x_delay = DEFAULT_DELAY; - for(i=0; i<MAX_DEVICES; ++i) last_execute_time[i] = 0; - #ifdef _WINDOWS - x->x_fd = INVALID_HANDLE_VALUE; - #endif - pthread_mutex_init(&x->x_mutex, 0); pthread_cond_init(&x->x_requestcondition, 0); --- 732,748 ---- x->x_status_outlet = outlet_new(x, "anything"); x->x_data_outlet = outlet_new(x, "anything"); ! #endif /* PD */ ! ! /* init vars */ ! global_debug_level = 9; /* high numbers here means see more messages */ ! x->x_has_ff = 0; ! x->x_device_open = 0; ! x->x_started = 0; ! x->x_delay = DEFAULT_DELAY; ! for(i=0; i<MAX_DEVICES; ++i) last_execute_time[i] = 0; ! #ifdef _WIN32 ! x->x_fd = INVALID_HANDLE_VALUE; ! #endif /* _WIN32 */
pthread_mutex_init(&x->x_mutex, 0); pthread_cond_init(&x->x_requestcondition, 0); *************** *** 745,750 ****
x->x_requestcode = REQUEST_NOTHING; ! pthread_create(&x->x_thread, 0, hidio_child, x); ! return (x); } --- 755,760 ----
x->x_requestcode = REQUEST_NOTHING; ! pthread_create(&x->x_thread, 0, hidio_child, x); ! return (x); } *************** *** 768,771 **** --- 778,782 ---- 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_print,gensym("print"),0); class_addmethod(hidio_class,(t_method) hidio_info,gensym("info"),0); *************** *** 784,790 **** /* ff tests */ class_addmethod(hidio_class,(t_method) hidio_ff_fftest,gensym("fftest"),A_DEFFLOAT,0); ! class_addmethod(hidio_class,(t_method) hidio_ff_print,gensym("ff_print"),0); ! ! class_addmethod(hidio_class,(t_method) hidio_priority, gensym("priority"), A_FLOAT, A_NULL);
--- 795,801 ---- /* ff tests */ class_addmethod(hidio_class,(t_method) hidio_ff_fftest,gensym("fftest"),A_DEFFLOAT,0); ! class_addmethod(hidio_class,(t_method) hidio_ff_print,gensym("ff_print"),0); ! ! class_addmethod(hidio_class,(t_method) hidio_priority, gensym("priority"), A_FLOAT, A_NULL);
*************** *** 800,803 **** --- 811,816 ---- ps_range = gensym("range");
+ generate_type_symbols(); + generate_event_symbols(); } #else /* Max */ *************** *** 815,827 **** if (m == 2) { ! switch (a) ! { ! case 0: ! sprintf(s, "(list) Received Events"); ! break; ! case 1: ! sprintf(s, "(list) Status Info"); ! break; ! } } else --- 828,840 ---- if (m == 2) { ! switch (a) ! { ! case 0: ! sprintf(s, "(list) Received Events"); ! break; ! case 1: ! sprintf(s, "(list) Status Info"); ! break; ! } } else *************** *** 860,863 **** --- 873,877 ---- 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_print, "print",0); class_addmethod(c, (method)hidio_info, "info",0); *************** *** 876,881 **** class_addmethod(c, (method)hidio_ff_fftest, "fftest",A_DEFFLOAT,0); class_addmethod(c, (method)hidio_ff_print, "ff_print",0); ! /* perfomrance / system stuff */ ! class_addmethod(c, (method)hidio_priority, "priority", A_LONG,0);
class_addmethod(c, (method)hidio_assist, "assist", A_CANT, 0); --- 890,895 ---- class_addmethod(c, (method)hidio_ff_fftest, "fftest",A_DEFFLOAT,0); class_addmethod(c, (method)hidio_ff_print, "ff_print",0); ! /* perfomrance / system stuff */ ! class_addmethod(c, (method)hidio_priority, "priority", A_LONG,0);
class_addmethod(c, (method)hidio_assist, "assist", A_CANT, 0); *************** *** 892,898 ****
finder_addclass("Devices", "hidio"); ! post("hidio %d.%d: © 2006 by Hans-Christoph Steiner & Olaf Matthes", HIDIO_MAJOR_VERSION, HIDIO_MINOR_VERSION); ! post("hidio: compiled on "__DATE__" at "__TIME__ " "); /* pre-generate often used symbols */ --- 906,912 ----
finder_addclass("Devices", "hidio"); ! post("hidio %d.%d: © 2006 by Hans-Christoph Steiner & Olaf Matthes", HIDIO_MAJOR_VERSION, HIDIO_MINOR_VERSION); ! post("hidio: compiled on "__DATE__" at "__TIME__ " "); /* pre-generate often used symbols */ *************** *** 903,908 **** ps_range = gensym("range");
return 0; } ! #endif
--- 917,924 ---- ps_range = gensym("range");
+ generate_event_symbols(); + return 0; } ! #endif /* PD */
Index: hidio_darwin.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_darwin.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hidio_darwin.c 1 Dec 2006 15:07:46 -0000 1.2 --- hidio_darwin.c 8 Dec 2006 06:33:26 -0000 1.3 *************** *** 91,112 **** * [hidio]/linux style events */ ! static void convert_axis_to_symbols(pRecElement pCurrentHIDElement, t_hid_element *new_element, char *axis) { - char buffer[MAXPDSTRING]; if (pCurrentHIDElement->relative) { ! new_element->type = gensym("rel"); ! snprintf(buffer, sizeof(buffer), "rel_%s", axis); ! new_element->name = gensym(buffer); } else { ! new_element->type = gensym("abs"); ! snprintf(buffer, sizeof(buffer), "abs_%s", axis); ! new_element->name = gensym(buffer); } }
- static void get_usage_symbols(pRecElement pCurrentHIDElement, t_hid_element *new_element) { --- 91,109 ---- * [hidio]/linux style events */ ! static void convert_axis_to_symbols(pRecElement pCurrentHIDElement, ! t_hid_element *new_element, int array_index) { if (pCurrentHIDElement->relative) { ! new_element->type = ps_relative; ! new_element->name = relative_symbols[array_index]; } else { ! new_element->type = ps_absolute; ! new_element->name = absolute_symbols[array_index]; } }
static void get_usage_symbols(pRecElement pCurrentHIDElement, t_hid_element *new_element) { *************** *** 125,134 **** }
- switch(pCurrentHIDElement->type) - { - case kIOHIDElementTypeInput_Button: - new_element->type = gensym("key"); - break; - } switch (pCurrentHIDElement->usagePage) { --- 122,125 ---- *************** *** 136,161 **** switch (pCurrentHIDElement->usage) { ! case kHIDUsage_GD_X: convert_axis_to_symbols(pCurrentHIDElement, new_element, "x"); break; ! case kHIDUsage_GD_Y: convert_axis_to_symbols(pCurrentHIDElement, new_element, "y"); break; ! case kHIDUsage_GD_Z: convert_axis_to_symbols(pCurrentHIDElement, new_element, "z"); break; ! case kHIDUsage_GD_Rx: convert_axis_to_symbols(pCurrentHIDElement, new_element, "rx"); break; ! case kHIDUsage_GD_Ry: convert_axis_to_symbols(pCurrentHIDElement, new_element, "ry"); break; ! case kHIDUsage_GD_Rz: convert_axis_to_symbols(pCurrentHIDElement, new_element, "rz"); break; ! case kHIDUsage_GD_Slider: ! new_element->type = gensym("abs"); ! new_element->name = gensym("abs_throttle"); ! break; ! case kHIDUsage_GD_Dial: ! new_element->type = gensym("abs"); ! new_element->name = gensym("abs_ry"); ! break; ! case kHIDUsage_GD_Wheel: ! new_element->type = gensym("rel"); ! new_element->name = gensym("rel_wheel"); ! break; ! case kHIDUsage_GD_Hatswitch: // this is still a mystery how to handle ! new_element->type = gensym("abs"); ! new_element->name = gensym("hatswitch"); break; default: --- 127,143 ---- switch (pCurrentHIDElement->usage) { ! case kHIDUsage_GD_X: convert_axis_to_symbols(pCurrentHIDElement, new_element, 0); break; ! case kHIDUsage_GD_Y: convert_axis_to_symbols(pCurrentHIDElement, new_element, 1); break; ! case kHIDUsage_GD_Z: convert_axis_to_symbols(pCurrentHIDElement, new_element, 2); break; ! case kHIDUsage_GD_Rx: convert_axis_to_symbols(pCurrentHIDElement, new_element, 3); break; ! case kHIDUsage_GD_Ry: convert_axis_to_symbols(pCurrentHIDElement, new_element, 4); break; ! case kHIDUsage_GD_Rz: convert_axis_to_symbols(pCurrentHIDElement, new_element, 5); break; ! case kHIDUsage_GD_Slider: convert_axis_to_symbols(pCurrentHIDElement, new_element, 6); break; ! case kHIDUsage_GD_Dial: convert_axis_to_symbols(pCurrentHIDElement, new_element, 7); break; ! case kHIDUsage_GD_Wheel: convert_axis_to_symbols(pCurrentHIDElement, new_element, 8); break; ! case kHIDUsage_GD_Hatswitch: // this is still a mystery how to handle ! new_element->type = ps_absolute; ! new_element->name = absolute_symbols[9]; /* hatswitch */ break; default: *************** *** 169,178 **** { case kHIDUsage_Sim_Rudder: ! new_element->type = gensym("abs"); ! new_element->name = gensym("abs_rz"); break; case kHIDUsage_Sim_Throttle: ! new_element->type = gensym("abs"); ! new_element->name = gensym("abs_throttle"); break; default: --- 151,160 ---- { case kHIDUsage_Sim_Rudder: ! new_element->type = ps_absolute; ! new_element->name = absolute_symbols[5]; /* rz */ break; case kHIDUsage_Sim_Throttle: ! new_element->type = ps_absolute; ! new_element->name = absolute_symbols[6]; /* slider */ break; default: *************** *** 183,208 **** break; case kHIDPage_KeyboardOrKeypad: ! new_element->type = gensym("key"); ! /* temporary kludge until I feel like writing the translation table */ ! snprintf(buffer, sizeof(buffer), "key_%ld", pCurrentHIDElement->usage); ! new_element->name = gensym(buffer); break; case kHIDPage_Button: ! new_element->type = gensym("key"); ! /* HID Manager button numbers start at 1, [hidio] start at 0 */ ! snprintf(buffer, sizeof(buffer), "btn_%ld", pCurrentHIDElement->usage - 1); ! new_element->name = gensym(buffer); break; case kHIDPage_LEDs: ! /* temporary kludge until I feel like writing the translation table */ ! new_element->type = gensym("led"); ! snprintf(buffer, sizeof(buffer), "led_%ld", pCurrentHIDElement->usage); ! new_element->name = gensym(buffer); break; case kHIDPage_PID: ! /* temporary kludge until I feel like writing the translation table */ ! new_element->type = gensym("ff"); ! snprintf(buffer, sizeof(buffer), "ff_%ld", pCurrentHIDElement->usage); ! new_element->name = gensym(buffer); break; default: --- 165,186 ---- break; case kHIDPage_KeyboardOrKeypad: ! new_element->type = ps_key; ! if( (pCurrentHIDElement->usage > -1) && ! (pCurrentHIDElement->usage < KEY_ARRAY_MAX) ) ! new_element->name = key_symbols[pCurrentHIDElement->usage]; ! else /* PowerBook ADB keyboard reports 0xffffffff */ ! new_element->name = key_symbols[0]; break; case kHIDPage_Button: ! new_element->type = ps_button; ! new_element->name = button_symbols[pCurrentHIDElement->usage]; break; case kHIDPage_LEDs: ! new_element->type = ps_led; ! new_element->name = led_symbols[pCurrentHIDElement->usage]; break; case kHIDPage_PID: ! new_element->type = ps_pid; ! new_element->name = pid_symbols[pCurrentHIDElement->usage]; break; default: *************** *** 215,219 **** }
! static t_float get_type_name_instance(t_symbol *type, t_symbol *name, int argc, t_hid_element **argv) --- 193,198 ---- }
! /* this functions checks to see if there are any existing instances of a given ! * type/code and assigns an number to this instance */ static t_float get_type_name_instance(t_symbol *type, t_symbol *name, int argc, t_hid_element **argv) *************** *** 759,763 **** }
! void hidio_print(t_hidio *x) { --- 738,742 ---- }
! /* TODO: this should be dumped for [devices( and [elements( messages */ void hidio_print(t_hidio *x) { *************** *** 831,835 **** /* FFPROP_FFGAIN has a integer range of 0-10000 */ result = FFDeviceSetForceFeedbackProperty( ! (FFDeviceObjectReference)x->x_ff_device, FFPROP_FFGAIN, &ffgain_value ); if ( result != FF_OK ) { --- 810,815 ---- /* FFPROP_FFGAIN has a integer range of 0-10000 */ result = FFDeviceSetForceFeedbackProperty( ! (FFDeviceObjectReference)x->x_ff_device, FFPROP_FFGAIN, ! &ffgain_value ); if ( result != FF_OK ) {
--- NEW FILE: hidio_types.c ---
#include "m_pd.h" #include "hidio.h"
//#define DEBUG(x) #define DEBUG(x) x
/*============================================================================== * "codes" for elements *============================================================================== */
/* absolute axes (joysticks, gamepads, tablets, etc.) */ static char *absolute_strings[ABSOLUTE_ARRAY_MAX] = { "x","y","z","rx","ry","rz","slider","dial", "wheel","hatswitch","absolute_10","absolute_11","absolute_12","absolute_13", "absolute_14","absolute_15" };
/* keys (keyboards, keypads) */ static char *key_strings[KEY_ARRAY_MAX] = { "key_0","errorrollover","postfail","errorundefined","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","q_key","r_key","s_key","t_key","u_key","v_key","w_key","x_key","y_key","z_key","1_key","2_key","3_key","4_key","5_key","6_key","7_key","8_key","9_key","0_key","enter","escape","deleteorbackspace","tab","spacebar","hyphen","equalsign","openbracket","closebracket","backslash","nonuspound","semicolon","quote","graveaccentandtilde","comma","period","slash","capslock","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","printscreen","scrolllock","pause","insert","home","pageup","deleteforward","end","pagedown","rightarrow","leftarrow","downarrow","uparrow","keypad_numlock","keypad_slash","keypad_asterisk","keypad_hyphen","keypad_plus","keypad_enter","keypad_1","keypad_2","keypad_3","keypad_4","keypad_5","keypad_6","keypad_7","keypad_8","keypad_9","keypad_0","keypad_period","nonusbackslash","application","power","keypad_equalsign","f13","f14","f15","f16","f17","f18","f19","f20","f21","f22","f23","f24","execute","help","menu","select","stop","again","undo","cut","copy","paste","find","mute","volumeup","volumedown","lockingcapslock","lockingnumlock","lockingscrolllock","keypad_comma","keypad_equalsignas400","international1","international2","international3","international4","international5","international6","international7","international8","international9","lang1","lang2","lang3","lang4","lang5","lang6","lang7","lang8","lang9","alternateerase","sysreqorattention","cancel","clear","prior","return","separator","out","oper","clearoragain","crselorprops","exsel","key_165","key_166","key_167","key_168","key_169","key_170","key_171","key_172","key_173","key_174","key_175","key_176","key_177","key_178","key_179","key_180","key_181","key_182","key_183","key_184","key_185","key_186","key_187","key_188","key_189","key_190","key_191","key_192","key_193","key_194","key_195","key_196","key_197","key_198","key_199","key_200","key_201","key_202","key_203","key_204","key_205","key_206","key_207","key_208","key_209","key_210","key_211","key_212","key_213","key_214","key_215","key_216","key_217","key_218","key_219","key_220","key_221","key_222","key_223","leftcontrol","leftshift","leftalt","leftgui","rightcontrol","rightshift","rightalt","rightgui","key_232","key_233","key_234","key_235","key_236","key_237","key_238","key_239","key_240","key_241","key_242","key_243","key_244","key_245","key_246","key_247","key_248","key_249","key_250","key_251","key_252","key_253","key_254","key_255"
};
/* LEDs (keyboards, gamepads, etc.) */ static char *led_strings[LED_ARRAY_MAX] = { "numlock","capslock","scrolllock","compose","kana","power","shift", "donotdisturb","mute","toneenable","highcutfilter","lowcutfilter", "equalizerenable","soundfieldon","surroundon","repeat","stereo", "samplingratedetect","spinning","cav","clv","recordingformatdetect", "offhook","ring","messagewaiting","datamode","batteryoperation","batteryok", "batterylow","speaker","headset","hold","microphone","coverage","nightmode", "sendcalls","callpickup","conference","standby","cameraon","cameraoff", "online","offline","busy","ready","paperout","paperjam","remote","forward", "reverse","stop","rewind","fastforward","play","pause","record","error", "usage","usageinuseindicator","usagemultimodeindicator","indicatoron", "indicatorflash","indicatorslowblink","indicatorfastblink","indicatoroff", "flashontime","slowblinkontime","slowblinkofftime","fastblinkontime", "fastblinkofftime","usageindicatorcolor","indicatorred","indicatorgreen", "indicatoramber","genericindicator","systemsuspend","externalpowerconnected" };
/* PID, Physical Interface Devices (force feedback joysticks, mice, etc.) */ static char *pid_strings[PID_ARRAY_MAX] = { "pid_0","physicalinterfacedevice","pid_2","pid_3","pid_4","pid_5","pid_6","pid_7", "pid_8","pid_9","pid_10","pid_11","pid_12","pid_13","pid_14","pid_15", "pid_16","pid_17","pid_18","pid_19","pid_20","pid_21","pid_22","pid_23", "pid_24","pid_25","pid_26","pid_27","pid_28","pid_29","pid_30","pid_31", "normal","seteffectreport","effectblockindex","paramblockoffset","rom_flag", "effecttype","constantforce","ramp","customforcedata","pid_41","pid_42", "pid_43","pid_44","pid_45","pid_46","pid_47","square","sine","triangle", "sawtoothup","sawtoothdown","pid_53","pid_54","pid_55","pid_56","pid_57", "pid_58","pid_59","pid_60","pid_61","pid_62","pid_63","spring","damper", "inertia","friction","pid_68","pid_69","pid_70","pid_71","pid_72","pid_73", "pid_74","pid_75","pid_76","pid_77","pid_78","pid_79","duration", "sampleperiod","gain","triggerbutton","triggerrepeatinterval","axesenable", "directionenable","direction","typespecificblockoffset","blocktype", "setenvelopereport","attacklevel","attacktime","fadelevel","fadetime", "setconditionreport","cp_offset","positivecoefficient", "negativecoefficient","positivesaturation","negativesaturation","deadband", "downloadforcesample","isochcustomforceenable","customforcedatareport", "customforcedata","customforcevendordefineddata","setcustomforcereport", "customforcedataoffset","samplecount","setperiodicreport","offset", "magnitude","phase","period","setconstantforcereport","setrampforcereport", "rampstart","rampend","effectoperationreport","effectoperation", "opeffectstart","opeffectstartsolo","opeffectstop","loopcount", "devicegainreport","devicegain","poolreport","ram_poolsize", "rom_poolsize","rom_effectblockcount","simultaneouseffectsmax", "poolalignment","poolmovereport","movesource","movedestination", "movelength","blockloadreport","pid_138","blockloadstatus", "blockloadsuccess","blockloadfull","blockloaderror","blockhandle", "blockfreereport","typespecificblockhandle","statereport","pid_147", "effectplaying","devicecontrolreport","devicecontrol","dc_enableactuators", "dc_disableactuators","dc_stopalleffects","dc_devicereset","dc_devicepause", "dc_devicecontinue","pid_157","pid_158","devicepaused","actuatorsenabled", "pid_161","pid_162","pid_163","safetyswitch","actuatoroverrideswitch", "actuatorpower","startdelay","parameterblocksize","devicemanagedpool", "sharedparameterblocks","createneweffectreport","ram_poolavailable", "pid_173","pid_174","pid_175","pid_176","pid_177","pid_178","pid_179", "pid_180","pid_181","pid_182","pid_183","pid_184","pid_185","pid_186", "pid_187","pid_188","pid_189","pid_190","pid_191","pid_192","pid_193", "pid_194","pid_195","pid_196","pid_197","pid_198","pid_199","pid_200", "pid_201","pid_202","pid_203","pid_204","pid_205","pid_206","pid_207", "pid_208","pid_209","pid_210","pid_211","pid_212","pid_213","pid_214", "pid_215","pid_216","pid_217","pid_218","pid_219","pid_220","pid_221", "pid_222","pid_223","pid_224","pid_225","pid_226","pid_227","pid_228", "pid_229","pid_230","pid_231","pid_232","pid_233","pid_234","pid_235", "pid_236","pid_237","pid_238","pid_239","pid_240","pid_241","pid_242", "pid_243","pid_244","pid_245","pid_246","pid_247","pid_248","pid_249", "pid_250","pid_251","pid_252","pid_253","pid_254","pid_255" };
/* relative axes (mice) */ static char *relative_strings[RELATIVE_ARRAY_MAX] = { "x","y","z","rx","ry","rz", "hwheel","dial","wheel","misc","relative_10","relative_11", "relative_12","relative_13","relative_14","relative_15" };
/*============================================================================== * conversion functions *============================================================================== */
static void generate_button_symbols(t_symbol *symbols[], unsigned int size) { unsigned int i; char string_buffer[MAXPDSTRING];
for(i = 0; i < size; ++i) { sprintf(string_buffer,"button_%d",i); symbols[i] = gensym(string_buffer); } }
static void generate_symbols_from_strings(t_symbol *symbols[], char *strings[], unsigned int size) { unsigned int i;
for(i = 0; i < size; ++i) symbols[i] = gensym(strings[i]); }
void generate_event_symbols() { DEBUG(post("generate_event_symbols");); generate_button_symbols(button_symbols, BUTTON_ARRAY_MAX); DEBUG(post("button");); generate_symbols_from_strings(absolute_symbols, absolute_strings, ABSOLUTE_ARRAY_MAX); DEBUG(post("absolute");); generate_symbols_from_strings(key_symbols, key_strings, KEY_ARRAY_MAX); DEBUG(post("key");); generate_symbols_from_strings(led_symbols, led_strings, LED_ARRAY_MAX); DEBUG(post("led");); generate_symbols_from_strings(pid_symbols, pid_strings, PID_ARRAY_MAX); DEBUG(post("pid");); generate_symbols_from_strings(relative_symbols, relative_strings, RELATIVE_ARRAY_MAX); DEBUG(post("relative %s",relative_symbols[4]->s_name);); DEBUG(post("generate_event_symbols");); }
void generate_type_symbols() { ps_absolute = gensym("absolute"); ps_button = gensym("button"); ps_key = gensym("key"); ps_led = gensym("led"); ps_pid = gensym("pid"); ps_relative = gensym("relative"); }
Index: Makefile =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 30 Nov 2006 05:53:40 -0000 1.1 --- Makefile 8 Dec 2006 06:33:26 -0000 1.2 *************** *** 16,25 **** # for emacs etags: make etags_`uname -s`
etags_Darwin: ! etags *.[ch] linux/input.h HID\ Utilities\ Source/*.[ch] \ /System/Library/Frameworks/IOKit.framework/Headers/hid*/*.[ch]
etags_Linux: ! etags *.[ch] /usr/include/*.h linux/input.h /usr/include/sys/*.h --- 16,32 ---- # for emacs etags: + etags ../../../pd/src/*.h *.[ch] linux/input.h make etags_`uname -s`
etags_Darwin: ! etags -a HID\ Utilities\ Source/*.[ch] \ ! /System/Library/Frameworks/ForceFeedback.framework/Headers/*.h \ ! /System/Library/Frameworks/Carbon.framework/Headers/*.h \ /System/Library/Frameworks/IOKit.framework/Headers/hid*/*.[ch]
etags_Linux: ! etags -a /usr/include/*.h linux/input.h /usr/include/sys/*.h ! ! etags_MINGW: ! etags -a /usr/include/*.h /usr/include/sys/*.h \ ! /usr/local/include/*.h /usr/local/include/sys/*.h
Index: hidio_linux.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_linux.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hidio_linux.c 30 Nov 2006 05:53:40 -0000 1.1 --- hidio_linux.c 8 Dec 2006 06:33:26 -0000 1.2 *************** *** 16,19 **** --- 16,25 ---- #include "hidio.h"
+ /* + * this is automatically generated from linux/input.h by + * make-arrays-from-input.h.pl to be the cross-platform event types and codes + */ + #include "input_arrays.h" + #define DEBUG(x) //#define DEBUG(x) x
Index: hidio-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio-help.pd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hidio-help.pd 30 Nov 2006 06:14:59 -0000 1.2 --- hidio-help.pd 8 Dec 2006 06:33:26 -0000 1.3 *************** *** 1,30 **** ! #N canvas 157 38 925 599 10; ! #X floatatom 27 439 5 0 0 0 - - -; ! #X floatatom 83 439 5 0 0 0 - - -; ! #X floatatom 63 395 6 0 0 0 - - -; ! #X obj 191 164 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 25 ! ; ! #X floatatom 571 340 12 0 0 1 value - -; ! #X symbolatom 531 356 15 0 0 1 event_code - -; ! #X symbolatom 492 372 15 0 0 1 event_type - -; ! #X obj 2 2 cnv 15 900 20 empty empty [hid] 2 11 1 18 -233017 -66577 0; ! #X text 274 332 outlet message format:; ! #X obj 772 99 ev-list; ! #X obj 772 150 ev_syn-list; ! #X obj 772 172 ev_key-list; ! #X obj 772 194 ev_rel-list; ! #X obj 772 216 ev_abs-list; ! #X obj 772 238 ev_msc-list; ! #X obj 772 260 ev_led-list; ! #X obj 772 282 ev_snd-list; ! #X obj 772 304 ev_rep-list; ! #X obj 772 326 ev_ff-list; ! #X obj 772 348 ev_ff_status-list; ! #X text 740 80 Event Types:; ! #X text 740 131 Event Codes:; ! #X floatatom 138 343 5 0 0 1 ev_syn - -; ! #X obj 111 342 +; ! #X msg 111 322 1; #X msg 374 140 close; #X msg 374 119 refresh; --- 1,13 ---- ! #N canvas 157 38 862 587 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 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 0; ! #X text 224 324 outlet message format:; #X msg 374 140 close; #X msg 374 119 refresh; *************** *** 37,44 **** #X msg 374 201 poll 2; #X text 370 186 start polling and set the poll delay in ms; ! #X text 462 33 !!! This software is very much alpha , so any aspect of it could change without notice !!!; ! #X obj 16 291 route key rel abs syn; ! #X obj 9 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; #N canvas 278 328 631 544 Event_Codes 0; --- 20,26 ---- #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 ; #N canvas 278 328 631 544 Event_Codes 0; *************** *** 194,198 **** #X text 245 463 298; #X text 245 477 299; ! #X restore 774 414 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 --- 176,180 ---- #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 *************** *** 237,241 **** #X text 230 255 EV_PWR; #X text 61 255 Power Events (for UPS); ! #X restore 774 394 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 --- 219,223 ---- #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 *************** *** 243,250 **** #X obj 11 9 cnv 15 400 30 empty empty Event_Values 20 12 1 14 -261681 -66577 0; ! #X restore 774 434 pd Event_Values; ! #X floatatom 140 439 5 0 0 0 - - -; ! #X obj 421 394 route abs_hat0x abs_hat0y abs_hat1x abs_hat1y; ! #X floatatom 421 416 7 0 0 0 - - -; #X msg 374 161 print; #X text 437 141 close the device; --- 225,230 ---- #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 161 print; #X text 437 141 close the device; *************** *** 254,313 **** #X text 9 238 is greater than 1 , then the poll; #X text 9 251 delay is set to that number.; ! #X obj 27 419 route rel_x rel_y rel_z rel_wheel; ! #X floatatom 196 439 5 0 0 0 - - -; ! #X obj 492 321 unpack s s f; ! #X text 298 346 event_type event_code value; ! #X obj 63 374 route abs_x abs_y abs_z abs_rx abs_ry abs_rz abs_throttle ! ; ! #X obj 421 432 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 ! -1; ! #X floatatom 498 416 7 0 0 0 - - -; ! #X obj 498 432 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 ! 1; ! #X floatatom 576 416 7 0 0 0 - - -; ! #X obj 576 432 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 ! 1; ! #X floatatom 653 416 7 0 0 0 - - -; ! #X obj 653 432 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 ! 1; ! #X floatatom 113 395 6 0 0 0 - - -; ! #X floatatom 163 395 6 0 0 0 - - -; ! #X floatatom 213 395 6 0 0 0 - - -; ! #X floatatom 263 395 6 0 0 0 - - -; ! #X floatatom 313 395 6 0 0 0 - - -; ! #X floatatom 363 395 6 0 0 0 - - -; ! #X obj 39 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; ! #X obj 69 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; ! #X obj 99 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1 ; ! #X obj 129 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 159 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 189 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 219 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 249 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 279 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 309 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 339 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 369 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 399 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 9 460 route btn_0 btn_1 btn_2 btn_3 btn_4 btn_5 btn_6 btn_7 ! btn_8 btn_9 btn_10 btn_11 btn_12 btn_13 btn_14 btn_15; ! #X obj 429 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; ! #X obj 459 502 tgl 25 0 empty empty empty 0 -6 0 8 -195568 -1 -1 0 1; - #X obj 262 298 cyclone/prepend set; #X msg 25 155 debug 0; #X msg 298 145 info; --- 234,274 ---- #X text 9 238 is greater than 1 , then the poll; #X text 9 251 delay is set to that number.; ! #X floatatom 196 445 5 0 0 0 - - -; ! #X floatatom 113 401 6 0 0 0 - - -; ! #X floatatom 163 401 6 0 0 0 - - -; ! #X floatatom 213 401 6 0 0 0 - - -; ! #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 msg 25 155 debug 0; #X msg 298 145 info; *************** *** 351,355 **** #X connect 17 9 15 0; #X restore 117 70 pd route info; ! #X obj 81 96 tgl 15 0 empty empty open 0 -6 0 8 -262144 -1 -1 0 1; #X obj 110 22 inlet; #X obj 123 43 print info; --- 312,316 ---- #X connect 17 9 15 0; #X restore 117 70 pd route info; ! #X obj 81 96 tgl 15 0 empty empty open 0 -6 0 8 -262144 -1 -1 1 1; #X obj 110 22 inlet; #X obj 123 43 print info; *************** *** 375,379 **** #X connect 2 0 0 0; #X connect 2 0 3 0; ! #X restore 420 271 pd see device info; #N canvas 0 22 380 450 open 0; #X obj 77 61 hradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 --- 336,340 ---- #X connect 2 0 0 0; #X connect 2 0 3 0; ! #X restore 575 278 pd see device info; #N canvas 0 22 380 450 open 0; #X obj 77 61 hradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 *************** *** 433,464 **** #X connect 7 0 4 0; #X restore 174 37 pd open by vendor/product ID; - #N canvas 114 93 467 346 test 0; - #X obj 144 45 inlet; - #X obj 88 104 route DESKTOP; - #X obj 87 158 route DESKTOP57; - #X obj 70 207 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 - -1; - #X floatatom 95 212 5 0 0 0 - - -; - #X obj 148 215 spigot; - #X obj 146 256 print test; - #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 connect 0 0 1 0; - #X connect 0 0 8 0; - #X connect 1 0 2 0; - #X connect 2 0 3 0; - #X connect 2 0 4 0; - #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 restore 197 303 pd test; #X msg 504 201 poll 200; ! #X msg 261 317 key key_leftctrl 1; #X text 49 543 (C) Copyright 2004 Hans-Christoph Steiner hans@at.or.at ; --- 394,399 ---- #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 text 49 543 (C) Copyright 2004 Hans-Christoph Steiner hans@at.or.at ; *************** *** 491,500 **** #X coords 0 -1 1 1 165 17 1 60 60; #X restore 25 134 pd serin; ! #X msg 262 114 open 1; #N canvas 162 133 570 420 serin 0; ! #X obj 209 61 cnv 15 15 15 empty $0-open-canvas 1 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 1; #X obj 60 13 inlet; #X msg 200 202 label $1; --- 426,435 ---- #X coords 0 -1 1 1 165 17 1 60 60; #X restore 25 134 pd serin; ! #X msg 262 114 open 2; #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 -1 0; #X obj 60 61 hradio 15 1 1 10 empty empty empty 0 -6 0 8 -225271 -1 ! -1 2; #X obj 60 13 inlet; #X msg 200 202 label $1; *************** *** 521,589 **** #X restore 262 93 pd serin; #X obj 646 486 pddp/open all_about_hid; ! #X obj 304 250 hidio; ! #X connect 3 0 99 0; ! #X connect 22 0 23 1; ! #X connect 23 0 22 0; ! #X connect 24 0 23 0; ! #X connect 25 0 99 0; ! #X connect 26 0 99 0; ! #X connect 32 0 99 0; ! #X connect 33 0 99 0; ! #X connect 36 0 82 0; ! #X connect 36 1 51 0; ! #X connect 36 2 55 0; ! #X connect 36 3 24 0; ! #X connect 42 0 43 0; ! #X connect 42 1 57 0; ! #X connect 42 2 59 0; ! #X connect 42 3 61 0; ! #X connect 43 0 56 0; ! #X connect 44 0 99 0; ! #X connect 51 0 0 0; ! #X connect 51 1 1 0; ! #X connect 51 2 41 0; ! #X connect 51 3 52 0; ! #X connect 53 0 6 0; ! #X connect 53 1 5 0; ! #X connect 53 2 4 0; ! #X connect 55 0 2 0; ! #X connect 55 1 63 0; ! #X connect 55 2 64 0; ! #X connect 55 3 65 0; ! #X connect 55 4 66 0; ! #X connect 55 5 67 0; ! #X connect 55 6 68 0; ! #X connect 55 7 42 0; ! #X connect 57 0 58 0; ! #X connect 59 0 60 0; ! #X connect 61 0 62 0; ! #X connect 82 0 37 0; ! #X connect 82 1 69 0; ! #X connect 82 2 70 0; ! #X connect 82 3 71 0; ! #X connect 82 4 72 0; ! #X connect 82 5 73 0; ! #X connect 82 6 74 0; ! #X connect 82 7 75 0; ! #X connect 82 8 76 0; ! #X connect 82 9 77 0; ! #X connect 82 10 78 0; ! #X connect 82 11 79 0; ! #X connect 82 12 80 0; ! #X connect 82 13 81 0; ! #X connect 82 14 83 0; ! #X connect 82 15 84 0; ! #X connect 85 0 93 0; ! #X connect 86 0 99 0; ! #X connect 87 0 99 0; ! #X connect 89 0 99 0; ! #X connect 90 0 99 0; ! #X connect 92 0 99 0; ! #X connect 95 0 86 0; ! #X connect 96 0 99 0; ! #X connect 97 0 96 0; ! #X connect 99 0 36 0; ! #X connect 99 0 53 0; ! #X connect 99 0 85 0; ! #X connect 99 0 91 0; ! #X connect 99 1 88 0; --- 456,562 ---- #X restore 262 93 pd serin; #X obj 646 486 pddp/open all_about_hid; ! #X obj 306 235 hidio; ! #X obj 226 290 flatspace/prepend set; ! #X obj 544 315 unpack symbol symbol float float; ! #X floatatom 683 336 2 0 0 1 instance - -; ! #X obj 65 368 route x y z rx ry rz slider dial; ! #X obj 27 425 route x y wheel; ! #X obj 10 314 route key relative absolute; ! #X text 218 341 [event_type event_code instance value(; ! #N canvas 0 22 454 304 remove 0; ! #X obj 134 12 inlet; ! #X obj 109 60 unpack symbol symbol float float; ! #X obj 110 107 pack symbol symbol float; ! #X obj 110 135 list trim; ! #X obj 116 196 outlet; ! #X connect 0 0 1 0; ! #X connect 1 0 2 0; ! #X connect 1 1 2 1; ! #X connect 1 3 2 2; ! #X connect 2 0 3 0; ! #X connect 3 0 4 0; ! #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 471 350 raw 0; ! #X obj 144 45 inlet; ! #X obj 88 104 route DESKTOP; ! #X obj 87 158 route DESKTOP57; ! #X obj 70 207 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 ! -1; ! #X floatatom 95 212 5 0 0 0 - - -; ! #X obj 148 215 spigot; ! #X obj 146 256 print test; ! #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 connect 0 0 1 0; ! #X connect 0 0 8 0; ! #X connect 1 0 2 0; ! #X connect 2 0 3 0; ! #X connect 2 0 4 0; ! #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 restore 408 294 pd raw; ! #X floatatom 63 401 6 0 0 0 - - -; ! #X connect 2 0 65 0; ! #X connect 8 0 65 0; ! #X connect 9 0 65 0; ! #X connect 15 0 65 0; ! #X connect 16 0 65 0; ! #X connect 24 0 65 0; ! #X connect 53 0 65 0; ! #X connect 54 0 65 0; ! #X connect 56 0 65 0; ! #X connect 57 0 65 0; ! #X connect 58 0 65 0; ! #X connect 61 0 53 0; ! #X connect 62 0 65 0; ! #X connect 63 0 62 0; ! #X connect 65 0 75 0; ! #X connect 65 0 67 0; ! #X connect 65 0 66 0; ! #X connect 65 0 73 0; ! #X connect 65 1 55 0; ! #X connect 66 0 59 0; ! #X connect 67 0 5 0; ! #X connect 67 1 4 0; ! #X connect 67 2 68 0; ! #X connect 67 3 3 0; ! #X connect 69 0 76 0; ! #X connect 69 1 32 0; ! #X connect 69 2 33 0; ! #X connect 69 3 34 0; ! #X connect 69 4 35 0; ! #X connect 69 5 36 0; ! #X connect 69 6 37 0; ! #X connect 70 0 0 0; ! #X connect 70 1 1 0; ! #X connect 70 2 23 0; ! #X connect 70 3 31 0; ! #X connect 71 0 74 0; ! #X connect 71 1 70 0; ! #X connect 71 2 69 0; ! #X connect 73 0 71 0; ! #X connect 74 0 19 0; ! #X connect 74 1 38 0; ! #X connect 74 2 39 0; ! #X connect 74 3 40 0; ! #X connect 74 4 41 0; ! #X connect 74 5 42 0; ! #X connect 74 6 43 0; ! #X connect 74 7 44 0; ! #X connect 74 8 45 0; ! #X connect 74 9 46 0; ! #X connect 74 10 47 0; ! #X connect 74 11 48 0; ! #X connect 74 12 49 0; ! #X connect 74 13 50 0; ! #X connect 74 14 51 0; ! #X connect 74 15 52 0;