From e2dfa073d484b3e165715c20fcef162d8b83513d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 2 Jun 2006 21:32:53 +0000 Subject: added a bunch more status info in the Pd domain: device count, range for each element, etc svn path=/trunk/externals/hcs/hid/; revision=5158 --- hid.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'hid.h') diff --git a/hid.h b/hid.h index bd31b88..23b65a4 100644 --- a/hid.h +++ b/hid.h @@ -15,7 +15,7 @@ #define HID_MAJOR_VERSION 0 #define HID_MINOR_VERSION 7 -/* static char *version = "$Revision: 1.24 $"; */ +/* static char *version = "$Revision: 1.25 $"; */ /*------------------------------------------------------------------------------ * GLOBAL DEFINES @@ -40,38 +40,31 @@ typedef struct _hid { t_object x_obj; t_int x_fd; + void *x_ff_device; short x_device_number; -// unsigned short vendor_id; // USB idVendor for current device -// unsigned short product_id; // USB idProduct for current device t_int x_has_ff; - void *x_ff_device; - t_clock *x_clock; - t_int x_delay; t_int x_started; t_int x_device_open; + t_int x_delay; + t_clock *x_clock; t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_hid; - /*------------------------------------------------------------------------------ * GLOBAL VARIABLES */ -/* - * count the number of instances of this object so that certain free() +/* count the number of instances of this object so that certain free() * functions can be called only after the final instance is detroyed. */ t_int hid_instance_count; extern unsigned short global_debug_level; -/* next I need to make a data structure to hold the data to be output for this - * poll. This should probably be an array for efficiency */ - - +/* built up when the elements of an open device are enumerated */ typedef struct _hid_element { #ifdef __linux__ @@ -83,11 +76,16 @@ typedef struct _hid_element t_symbol *name; // Linux "code"; HID "usage" unsigned char polled; // is it polled or queued? (maybe only on Mac OS X?) 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_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; +/* mostly for status querying */ +unsigned short device_count; + /* store element structs to eliminate symbol table lookups, etc. */ t_hid_element *element[MAX_DEVICES][MAX_ELEMENTS]; /* number of active elements per device */ -- cgit v1.2.1