[PD-cvs] externals/io/hidio hidio.c, 1.17, 1.18 hidio.h, 1.17, 1.18 hidio_windows.c, 1.5, 1.6
Olaf Matthes
olafmatt at users.sourceforge.net
Tue Jan 2 23:00:05 CET 2007
Update of /cvsroot/pure-data/externals/io/hidio
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31865
Modified Files:
hidio.c hidio.h hidio_windows.c
Log Message:
added plattform_specific_new and a pointer to my Windows specific stuff in t_hid struct
Index: hidio.c
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** hidio.c 2 Jan 2007 05:37:06 -0000 1.17
--- hidio.c 2 Jan 2007 22:00:00 -0000 1.18
***************
*** 398,404 ****
static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv)
{
- 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
if (new_device_number > -1)
--- 398,404 ----
static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv)
{
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
+ debug_post(LOG_DEBUG,"hid_%s",s->s_name);
if (new_device_number > -1)
***************
*** 555,562 ****
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 */
!
x->x_device_number = get_device_number_from_arguments(argc, argv);
--- 555,561 ----
x->x_delay = DEFAULT_DELAY;
for(i=0; i<MAX_DEVICES; ++i) last_execute_time[i] = 0;
! #ifdef _WINDOWS
! x->x_hid_device = hidio_platform_specific_new(x);
! #endif
x->x_device_number = get_device_number_from_arguments(argc, argv);
Index: hidio.h
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** hidio.h 2 Jan 2007 20:45:40 -0000 1.17
--- hidio.h 2 Jan 2007 22:00:00 -0000 1.18
***************
*** 83,87 ****
#endif
#ifdef _WIN32
! HANDLE x_fd;
#endif
#ifdef __linux__
--- 83,87 ----
#endif
#ifdef _WIN32
! void *x_hid_device;
#endif
#ifdef __linux__
***************
*** 187,191 ****
extern void hidio_print(t_hidio* x); /* print info to the console */
extern void hidio_platform_specific_info(t_hidio* x); /* device info on the status outlet */
! extern void hidio_platform_specific_free(t_hidio *x);
extern short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id);
/* TODO: this function should probably accept the single unsigned for the combined usage_page and usage, instead of two separate variables */
--- 187,192 ----
extern void hidio_print(t_hidio* x); /* print info to the console */
extern void hidio_platform_specific_info(t_hidio* x); /* device info on the status outlet */
! extern void hidio_platform_specific_free(t_hidio *x);
! extern void *hidio_platform_specific_new(t_hidio *x);
extern short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id);
/* TODO: this function should probably accept the single unsigned for the combined usage_page and usage, instead of two separate variables */
***************
*** 195,200 ****
/* cross-platform force feedback functions */
! extern void hidio_ff_autocenter(t_hidio *x, t_float value);
! extern void hidio_ff_gain(t_hidio *x, t_float value);
extern t_int hidio_ff_motors(t_hidio *x, t_float value);
extern t_int hidio_ff_continue(t_hidio *x);
--- 196,201 ----
/* cross-platform force feedback functions */
! extern t_int hidio_ff_autocenter(t_hidio *x, t_float value);
! extern t_int hidio_ff_gain(t_hidio *x, t_float value);
extern t_int hidio_ff_motors(t_hidio *x, t_float value);
extern t_int hidio_ff_continue(t_hidio *x);
Index: hidio_windows.c
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_windows.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** hidio_windows.c 2 Jan 2007 20:45:40 -0000 1.5
--- hidio_windows.c 2 Jan 2007 22:00:00 -0000 1.6
***************
*** 25,34 ****
#include <winbase.h>
#include <stdio.h>
! #include <setupapi.h>
!
! /*
! * Please note that this file needs the Microsoft Driver Developent Kit (DDK)
! * to be installed in order to compile!
! */
#ifdef _MSC_VER
[...1245 lines suppressed...]
+
+ if (self)
+ freebytes(self, sizeof(t_hid_device));
+ }
+ void *hidio_platform_specific_new(t_hidio *x)
+ {
+ t_hid_device *self;
+
+ debug_print(LOG_DEBUG,"hidio_platform_specific_new");
+
+ /* alloc memory for our instance */
+ self = (t_hid_device *)getbytes(sizeof(t_hid_device));
+ self->fh = INVALID_HANDLE_VALUE;
+
+ return (void *)self; /* return void pointer to our data struct */
+ }
#endif /* _WINDOWS */
More information about the Pd-cvs
mailing list