From 2c54414ff1d4a90c06e6e9f3ee5d78ecd2f3977e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 28 May 2006 01:05:45 +0000 Subject: compiles and works on GNU/Linux now, but needs to have the new open methods implemented svn path=/trunk/externals/hcs/hid/; revision=5146 --- hid_darwin.c | 12 ++++++------ hid_linux.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/hid_darwin.c b/hid_darwin.c index b9da2f9..07076b3 100644 --- a/hid_darwin.c +++ b/hid_darwin.c @@ -416,8 +416,8 @@ void hid_print_device_list(t_hid *x) void hid_platform_specific_info(t_hid *x) { pRecDevice pCurrentHIDDevice = NULL; - char vendor_id_pointer[7]; - char product_id_pointer[7]; + char vendor_id_string[7]; + char product_id_string[7]; t_symbol *output_symbol; t_atom *output_atom = getbytes(sizeof(t_atom)); @@ -450,15 +450,15 @@ void hid_platform_specific_info(t_hid *x) outlet_anything( x->x_status_outlet, gensym("transport"), 1, output_atom); /* vendor id */ - sprintf(vendor_id_pointer,"0x%04x", + sprintf(vendor_id_string,"0x%04x", (unsigned int)pCurrentHIDDevice->vendorID); - SETSYMBOL(output_atom, gensym(vendor_id_pointer)); + SETSYMBOL(output_atom, gensym(vendor_id_string)); outlet_anything( x->x_status_outlet, gensym("vendorID"), 1, output_atom); /* product id */ - sprintf(product_id_pointer,"0x%04x", + sprintf(product_id_string,"0x%04x", (unsigned int)pCurrentHIDDevice->productID); - SETSYMBOL(output_atom, gensym(product_id_pointer)); + SETSYMBOL(output_atom, gensym(product_id_string)); outlet_anything( x->x_status_outlet, gensym("productID"), 1, output_atom); } diff --git a/hid_linux.c b/hid_linux.c index 81d511c..05d8fa8 100644 --- a/hid_linux.c +++ b/hid_linux.c @@ -460,7 +460,7 @@ t_int hid_close_device(t_hid *x) return (close(x->x_fd)); } -t_int hid_build_device_list(t_hid *x) +void hid_build_device_list(void) { debug_print(LOG_DEBUG,"hid_build_device_list"); /* the device list should be refreshed here */ @@ -470,8 +470,6 @@ t_int hid_build_device_list(t_hid *x) * the device list. Once the device name can be other things in addition * the current t_float, then this will probably need to be changed. */ - - return (0); } void hid_platform_specific_free(t_hid *x) @@ -479,6 +477,47 @@ void hid_platform_specific_free(t_hid *x) /* nothing to be done here on GNU/Linux */ } +/* device info on the status outlet */ +void hid_platform_specific_info(t_hid* x) +{ + struct input_id my_id; + char device_name[256] = "Unknown"; + char vendor_id_string[7]; + char product_id_string[7]; + t_symbol *output_symbol; + t_atom *output_atom = getbytes(sizeof(t_atom)); + + ioctl(x->x_fd, EVIOCGID); + sprintf(vendor_id_string,"0x%04x", my_id.vendor); + SETSYMBOL(output_atom, gensym(vendor_id_string)); + outlet_anything( x->x_status_outlet, gensym("vendorID"), + 1, output_atom); + sprintf(product_id_string,"0x%04x", my_id.product); + SETSYMBOL(output_atom, gensym(product_id_string)); + outlet_anything( x->x_status_outlet, gensym("productID"), + 1, output_atom); + ioctl(x->x_fd, EVIOCGNAME(sizeof(device_name)), device_name); + SETSYMBOL(output_atom, gensym(device_name)); + outlet_anything( x->x_status_outlet, gensym("name"), + 1, output_atom); + freebytes(output_atom,sizeof(t_atom)); +} + + +t_int get_device_number_by_id(unsigned short vendor_id, unsigned short product_id) +{ + + return -1; +} + +t_int get_device_number_from_usage_list(t_int device_number, + unsigned short usage_page, + unsigned short usage) +{ + + return -1; +} + #endif /* #ifdef __linux__ */ -- cgit v1.2.1