Update of /cvsroot/pure-data/externals/io/hidio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28233
Modified Files: hidio.c hidio.h hidio_darwin.c hidio_linux.c hidio_windows.c Log Message: builds on all platforms now, but doesn't link on MinGW
Index: hidio_darwin.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_darwin.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** hidio_darwin.c 2 Jan 2007 20:40:49 -0000 1.9 --- hidio_darwin.c 3 Jan 2007 06:33:25 -0000 1.10 *************** *** 889,893 **** */
! t_int hidio_ff_send_ff_command (t_hidio *x, UInt32 ff_command) { HRESULT result = 0; --- 889,893 ---- */
! void hidio_ff_send_ff_command (t_hidio *x, UInt32 ff_command) { HRESULT result = 0; *************** *** 901,949 **** }
! t_int hidio_ff_continue( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_continue"); ! return( hidio_ff_send_ff_command( x, FFSFFC_CONTINUE ) ); }
! t_int hidio_ff_pause( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_pause"); ! return( hidio_ff_send_ff_command( x, FFSFFC_PAUSE ) ); }
! t_int hidio_ff_reset( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_reset"); ! return( hidio_ff_send_ff_command( x, FFSFFC_RESET ) ); }
! t_int hidio_ff_setactuatorsoff( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_setactuatorsoff"); ! return( hidio_ff_send_ff_command( x, FFSFFC_SETACTUATORSOFF ) ); }
! t_int hidio_ff_setactuatorson( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_setactuatorson"); ! return( hidio_ff_send_ff_command( x, FFSFFC_SETACTUATORSON ) ); }
! t_int hidio_ff_stopall( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_stopall"); ! return( hidio_ff_send_ff_command( x, FFSFFC_STOPALL ) ); }
! t_int hidio_ff_motors( t_hidio *x, t_float value ) { if ( value > 0 ) { ! return ( hidio_ff_setactuatorson( x ) ); } else { ! return ( hidio_ff_setactuatorsoff( x ) ); } } --- 901,949 ---- }
! void hidio_ff_continue( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_continue"); ! hidio_ff_send_ff_command( x, FFSFFC_CONTINUE ); }
! void hidio_ff_pause( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_pause"); ! hidio_ff_send_ff_command( x, FFSFFC_PAUSE ); }
! void hidio_ff_reset( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_reset"); ! hidio_ff_send_ff_command( x, FFSFFC_RESET ); }
! void hidio_ff_setactuatorsoff( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_setactuatorsoff"); ! hidio_ff_send_ff_command( x, FFSFFC_SETACTUATORSOFF ); }
! void hidio_ff_setactuatorson( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_setactuatorson"); ! hidio_ff_send_ff_command( x, FFSFFC_SETACTUATORSON ); }
! void hidio_ff_stopall( t_hidio *x ) { debug_post(LOG_DEBUG,"hidio_ff_stopall"); ! hidio_ff_send_ff_command( x, FFSFFC_STOPALL ); }
! void hidio_ff_motors( t_hidio *x, t_float value ) { if ( value > 0 ) { ! hidio_ff_setactuatorson( x ); } else { ! hidio_ff_setactuatorsoff( x ); } } *************** *** 954,962 **** */
! t_int hidio_ff_fftest ( t_hidio *x, t_float value) { debug_post(LOG_DEBUG,"hidio_ff_fftest"); - return EXIT_SUCCESS; }
--- 954,961 ---- */
! void hidio_ff_fftest ( t_hidio *x, t_float value) { debug_post(LOG_DEBUG,"hidio_ff_fftest"); }
Index: hidio.h =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** hidio.h 2 Jan 2007 22:00:00 -0000 1.18 --- hidio.h 3 Jan 2007 06:33:25 -0000 1.19 *************** *** 3,6 **** --- 3,8 ----
#include <stdio.h> + #include <stdlib.h> + #ifdef _WIN32 #define LOG_DEBUG 7 *************** *** 9,12 **** --- 11,15 ---- #define LOG_ERR 3 #define vsnprintf _vsnprintf + #include <windows.h> #else #include <sys/syslog.h> *************** *** 40,43 **** --- 43,47 ---- #endif /* PD */
+ #define HIDIO_MAJOR_VERSION 0 #define HIDIO_MINOR_VERSION 0 *************** *** 72,80 ****
! /*------------------------------------------------------------------------------ ! * CLASS DEF ! */ ! typedef struct _hidio ! { t_object x_obj; --- 76,82 ----
! /* ----------------------------------------------------------------------------- ! * CLASS DEF */ ! typedef struct _hidio { t_object x_obj; *************** *** 130,145 **** #endif /* _WIN32 */ #ifdef __APPLE__ ! void *pHIDElement; // pRecElement on Mac OS X #endif /* __APPLE__ */ ! t_symbol *type; // Linux "type"; HID "usagePage", but using the hidio scheme ! t_symbol *name; // Linux "code"; HID "usage", but using the hidio scheme ! unsigned char polled; // is it polled or queued? ! 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 # (e.g. [absolute x 2 163( ) ! t_atom output_message[3]; // pre-generated message for hidio_output_event() ! 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;
--- 132,147 ---- #endif /* _WIN32 */ #ifdef __APPLE__ ! void *pHIDElement; /* pRecElement on Mac OS X */ #endif /* __APPLE__ */ ! t_symbol *type; /* Linux "type"; HID "usagePage", but using hidio scheme */ ! t_symbol *name; /* Linux "code"; HID "usage", but using hidio scheme */ ! unsigned char polled; /* is it polled or queued? */ ! 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 # (e.g. [absolute x 2 163( */ ! t_atom output_message[3]; /* pre-generated message for hidio_output_event */ ! 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;
*************** *** 196,209 ****
/* 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); ! extern t_int hidio_ff_pause(t_hidio *x); ! extern t_int hidio_ff_reset(t_hidio *x); ! extern t_int hidio_ff_stopall(t_hidio *x);
! // these are just for testing... ! extern t_int hidio_ff_fftest (t_hidio *x, t_float value); extern void hidio_ff_print(t_hidio *x);
--- 198,211 ----
/* 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 void hidio_ff_motors(t_hidio *x, t_float value); ! extern void hidio_ff_continue(t_hidio *x); ! extern void hidio_ff_pause(t_hidio *x); ! extern void hidio_ff_reset(t_hidio *x); ! extern void hidio_ff_stopall(t_hidio *x);
! /* these are just for testing... */ ! extern void hidio_ff_fftest (t_hidio *x, t_float value); extern void hidio_ff_print(t_hidio *x);
Index: hidio_linux.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_linux.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** hidio_linux.c 2 Jan 2007 05:37:07 -0000 1.6 --- hidio_linux.c 3 Jan 2007 06:33:25 -0000 1.7 *************** *** 595,637 ****
/* cross-platform force feedback functions */ ! t_int hidio_ff_autocenter( t_hidio *x, t_float value ) { ! return EXIT_SUCCESS; }
! t_int hidio_ff_gain( t_hidio *x, t_float value ) { ! return EXIT_SUCCESS; }
! t_int hidio_ff_motors( t_hidio *x, t_float value ) { ! return EXIT_SUCCESS; }
! t_int hidio_ff_continue( t_hidio *x ) { ! return EXIT_SUCCESS; }
! t_int hidio_ff_pause( t_hidio *x ) { ! return EXIT_SUCCESS; }
! t_int hidio_ff_reset( t_hidio *x ) { ! return EXIT_SUCCESS; }
! t_int hidio_ff_stopall( t_hidio *x ) { ! return EXIT_SUCCESS; }
--- 595,637 ----
/* cross-platform force feedback functions */ ! void hidio_ff_autocenter( t_hidio *x, t_float value ) { ! }
! void hidio_ff_gain( t_hidio *x, t_float value ) { ! }
! void hidio_ff_motors( t_hidio *x, t_float value ) { ! }
! void hidio_ff_continue( t_hidio *x ) { ! }
! void hidio_ff_pause( t_hidio *x ) { ! }
! void hidio_ff_reset( t_hidio *x ) { ! }
! void hidio_ff_stopall( t_hidio *x ) { ! }
*************** *** 639,645 ****
// these are just for testing... ! t_int hidio_ff_fftest ( t_hidio *x, t_float value) { ! return EXIT_SUCCESS; }
--- 639,645 ----
// these are just for testing... ! void hidio_ff_fftest ( t_hidio *x, t_float value) { ! }
Index: hidio.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** hidio.c 2 Jan 2007 22:00:00 -0000 1.18 --- hidio.c 3 Jan 2007 06:33:25 -0000 1.19 *************** *** 35,39 **** #endif /* _WIN32 */ #include <stdarg.h> - #include <stdlib.h> #include <string.h>
--- 35,38 ----
Index: hidio_windows.c =================================================================== RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_windows.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** hidio_windows.c 2 Jan 2007 22:00:00 -0000 1.6 --- hidio_windows.c 3 Jan 2007 06:33:25 -0000 1.7 *************** *** 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 [...1227 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 */