aboutsummaryrefslogtreecommitdiff
path: root/hid.h
diff options
context:
space:
mode:
Diffstat (limited to 'hid.h')
-rw-r--r--hid.h69
1 files changed, 40 insertions, 29 deletions
diff --git a/hid.h b/hid.h
index 527dddf..a246e5b 100644
--- a/hid.h
+++ b/hid.h
@@ -2,6 +2,7 @@
#define _HID_H
#include <stdio.h>
+#include <sys/syslog.h>
#include <m_pd.h>
@@ -12,26 +13,29 @@
#include "input_arrays.h"
#define HID_MAJOR_VERSION 0
-#define HID_MINOR_VERSION 6
+#define HID_MINOR_VERSION 7
-/* static char *version = "$Revision: 1.19 $"; */
+/* static char *version = "$Revision: 1.20 $"; */
/*------------------------------------------------------------------------------
* CLASS DEF
*/
typedef struct _hid
{
- t_object x_obj;
- t_int x_fd;
- t_int x_device_number;
- 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_outlet *x_data_outlet;
- t_outlet *x_device_name_outlet;
+ t_object x_obj;
+ t_int x_fd;
+// unsigned short x_device_number;
+ t_float 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_outlet *x_data_outlet;
+ t_outlet *x_device_name_outlet;
} t_hid;
@@ -52,36 +56,43 @@ typedef struct _hid
*/
t_int hid_instance_count;
+extern unsigned short global_debug_level;
/*------------------------------------------------------------------------------
* FUNCTION PROTOTYPES FOR DIFFERENT PLATFORMS
*/
/* support functions */
-void hid_output_event( t_hid *x, char *type, char *code, t_float value );
+void debug_print(t_int debug_level, const char *fmt, ...);
+void debug_error(t_hid *x, t_int debug_level, const char *fmt, ...);
+void hid_output_event(t_hid *x, char *type, char *code, t_float value);
/* generic, cross-platform functions implemented in a separate file for each
* platform
*/
-t_int hid_open_device( t_hid *x, t_int device_number );
-t_int hid_close_device( t_hid *x );
-t_int hid_build_device_list( t_hid* x );
-t_int hid_get_events( t_hid *x ) ;
-void hid_print( t_hid* x );
-void hid_platform_specific_free( t_hid *x );
+t_int hid_open_device(t_hid *x, t_int device_number);
+t_int hid_close_device(t_hid *x);
+void hid_build_device_list(void);
+t_int hid_get_events(t_hid *x);
+void hid_print(t_hid* x);
+void hid_platform_specific_free(t_hid *x);
+t_int get_device_number_by_ids(unsigned short vendor_id, unsigned short product_id);
+t_int get_device_number_from_usage_list(t_int device_number,
+ unsigned short usage_page, unsigned short usage);
+
/* cross-platform force feedback functions */
-t_int hid_ff_autocenter( t_hid *x, t_float value );
-t_int hid_ff_gain( t_hid *x, t_float value );
-t_int hid_ff_motors( t_hid *x, t_float value );
-t_int hid_ff_continue( t_hid *x );
-t_int hid_ff_pause( t_hid *x );
-t_int hid_ff_reset( t_hid *x );
-t_int hid_ff_stopall( t_hid *x );
+t_int hid_ff_autocenter(t_hid *x, t_float value);
+t_int hid_ff_gain(t_hid *x, t_float value);
+t_int hid_ff_motors(t_hid *x, t_float value);
+t_int hid_ff_continue(t_hid *x);
+t_int hid_ff_pause(t_hid *x);
+t_int hid_ff_reset(t_hid *x);
+t_int hid_ff_stopall(t_hid *x);
// these are just for testing...
-t_int hid_ff_fftest ( t_hid *x, t_float value);
-void hid_ff_print( t_hid *x );
+t_int hid_ff_fftest (t_hid *x, t_float value);
+void hid_ff_print(t_hid *x);