Update of /cvsroot/pure-data/externals/hcs/hid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11301
Modified Files: Makefile hid-help.pd hid.c hid.h hid_linux.c make-arrays-from-input.h.pl Log Message: got everything running under GNU/Linux again, time to switch back to MacOS X
Index: hid-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/hid-help.pd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hid-help.pd 20 Oct 2004 02:55:12 -0000 1.2 --- hid-help.pd 23 Oct 2004 03:40:39 -0000 1.3 *************** *** 1,9 **** #N canvas 124 73 911 579 10; ! #X msg 382 241 ev_rel rel_x 5 1.09824e+09; #X obj 382 220 prepend set; #X obj 144 386 route rel_x rel_y; #X floatatom 144 406 5 0 0 0 - - -; #X floatatom 201 406 5 0 0 0 - - -; - #X obj 222 255 print; #X msg 148 77 start; #X msg 167 96 stop; --- 1,8 ---- #N canvas 124 73 911 579 10; ! #X msg 382 241 ev_rel rel_y 2 1.0985e+09; #X obj 382 220 prepend set; #X obj 144 386 route rel_x rel_y; #X floatatom 144 406 5 0 0 0 - - -; #X floatatom 201 406 5 0 0 0 - - -; #X msg 148 77 start; #X msg 167 96 stop; *************** *** 11,24 **** #X floatatom 486 360 12 0 0 1 time - -; #X obj 393 340 unpack s s f f; ! #X msg 264 81 open /dev/input/event1; ! #X msg 256 58 open /dev/input/event0; ! #X msg 280 103 open /dev/input/event2; ! #X msg 292 124 open /dev/input/event3; ! #X msg 304 144 open /dev/input/event4; #X obj 85 321 route ev_key ev_rel ev_abs; #X floatatom 203 367 7 0 0 0 - - -; #X floatatom 261 367 7 0 0 0 - - -; #X obj 203 346 route abs_x abs_y; ! #X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 1; #X floatatom 455 377 12 0 0 1 value - -; #X symbolatom 423 394 10 0 0 1 eventcode - -; --- 10,23 ---- #X floatatom 486 360 12 0 0 1 time - -; #X obj 393 340 unpack s s f f; ! #X msg 248 57 open /dev/input/event1; ! #X msg 240 34 open /dev/input/event0; ! #X msg 264 79 open /dev/input/event2; ! #X msg 276 100 open /dev/input/event3; ! #X msg 288 120 open /dev/input/event4; #X obj 85 321 route ev_key ev_rel ev_abs; #X floatatom 203 367 7 0 0 0 - - -; #X floatatom 261 367 7 0 0 0 - - -; #X obj 203 346 route abs_x abs_y; ! #X obj 86 81 tgl 35 0 empty empty empty 0 -6 0 8 -24198 -1 -1 1 1; #X floatatom 455 377 12 0 0 1 value - -; #X symbolatom 423 394 10 0 0 1 eventcode - -; *************** *** 47,76 **** #X text 710 85 Event Types:; #X text 710 136 Event Codes:; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 2 1 4 0; ! #X connect 6 0 8 0; ! #X connect 7 0 8 0; ! #X connect 8 0 5 0; ! #X connect 8 0 1 0; ! #X connect 8 0 10 0; ! #X connect 8 0 16 0; ! #X connect 8 0 28 0; ! #X connect 10 0 23 0; ! #X connect 10 1 22 0; ! #X connect 10 2 21 0; ! #X connect 10 3 9 0; ! #X connect 11 0 8 0; ! #X connect 12 0 8 0; ! #X connect 13 0 8 0; ! #X connect 14 0 8 0; ! #X connect 15 0 8 0; ! #X connect 16 0 26 0; ! #X connect 16 1 2 0; ! #X connect 16 2 19 0; ! #X connect 19 0 17 0; ! #X connect 19 1 18 0; ! #X connect 20 0 8 0; ! #X connect 26 0 24 0; ! #X connect 26 1 25 0; ! #X connect 26 2 27 0; --- 46,85 ---- #X text 710 85 Event Types:; #X text 710 136 Event Codes:; + #X msg 304 146 delay 2; + #X obj 200 278 print INPUT_EVENT; + #X obj 200 257 spigot; + #X obj 237 239 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 + 1; + #X msg 373 147 delay 200; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 2 1 4 0; ! #X connect 5 0 7 0; ! #X connect 6 0 7 0; ! #X connect 7 0 1 0; ! #X connect 7 0 9 0; ! #X connect 7 0 15 0; ! #X connect 7 0 27 0; ! #X connect 7 0 46 0; ! #X connect 9 0 22 0; ! #X connect 9 1 21 0; ! #X connect 9 2 20 0; ! #X connect 9 3 8 0; ! #X connect 10 0 7 0; ! #X connect 11 0 7 0; ! #X connect 12 0 7 0; ! #X connect 13 0 7 0; ! #X connect 14 0 7 0; ! #X connect 15 0 25 0; ! #X connect 15 1 2 0; ! #X connect 15 2 18 0; ! #X connect 18 0 16 0; ! #X connect 18 1 17 0; ! #X connect 19 0 7 0; ! #X connect 25 0 23 0; ! #X connect 25 1 24 0; ! #X connect 25 2 26 0; ! #X connect 44 0 7 0; ! #X connect 46 0 45 0; ! #X connect 47 0 46 1; ! #X connect 48 0 7 0;
Index: make-arrays-from-input.h.pl =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/make-arrays-from-input.h.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** make-arrays-from-input.h.pl 22 Oct 2004 18:49:16 -0000 1.4 --- make-arrays-from-input.h.pl 23 Oct 2004 03:40:39 -0000 1.5 *************** *** 182,185 **** --- 182,186 ----
# print array of arrays + print(HEADER "char **event_names[",$#EV+1,"];\n\n"); print(ARRAYS "char **event_names[",$#EV+1,"] = {"); for($i = 0; $i < $#EV; $i++)
Index: hid_linux.c =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/hid_linux.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hid_linux.c 22 Oct 2004 18:49:16 -0000 1.1 --- hid_linux.c 23 Oct 2004 03:40:39 -0000 1.2 *************** *** 1,5 **** --- 1,7 ---- #ifdef __linux__
+ #include <linux/input.h> + #include <sys/ioctl.h>
*************** *** 7,14 **** //#define DEBUG(x) x
- - - - /*------------------------------------------------------------------------------ * from evtest.c from the ff-utils package --- 9,12 ---- *************** *** 24,27 **** --- 22,31 ----
+ /* The application reading the device is supposed to queue all events up to */ + /* the SYN_REPORT event, and then process them, so that a mouse pointer */ + /* will move diagonally instead of following the sides of a rectangle, */ + /* which would be very annoying. */ +
#endif /* #ifdef __linux__ */ +
Index: hid.c =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/hid.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hid.c 22 Oct 2004 18:49:16 -0000 1.5 --- hid.c 23 Oct 2004 03:40:39 -0000 1.6 *************** *** 27,33 **** --- 27,44 ----
#include "input_arrays.h" + + /* this should be removed once things are ported to hid_linux.c */ #include "../linuxhid.h"
/*------------------------------------------------------------------------------ + * LOCAL DEFINES + */ + + #define DEBUG(x) + //#define DEBUG(x) x + + #define DEFAULT_DELAY 300 + + /*------------------------------------------------------------------------------ * IMPLEMENTATION */ *************** *** 57,60 **** --- 68,72 ---- }
+ static t_int hid_close(t_hid *x) { *************** *** 71,74 **** --- 83,87 ---- }
+ static t_int hid_open(t_hid *x, t_symbol *s) { *************** *** 79,83 **** /* counts for various event types */ t_int synCount,keyCount,relCount,absCount,mscCount,ledCount,sndCount,repCount,ffCount,pwrCount,ff_statusCount; ! #ifdef __gnu_linux__ struct input_event hid_input_event; unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)]; --- 92,96 ---- /* counts for various event types */ t_int synCount,keyCount,relCount,absCount,mscCount,ledCount,sndCount,repCount,ffCount,pwrCount,ff_statusCount; ! #ifdef __linux__ struct input_event hid_input_event; unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)]; *************** *** 93,97 **** x->x_devname = s;
! #ifdef __gnu_linux__ /* open device */ if (x->x_devname) --- 106,110 ---- x->x_devname = s;
! #ifdef __linux__ /* open device */ if (x->x_devname) *************** *** 205,213 **** post("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING"); post("================================= [hid] =================================\n"); ! #endif /* #ifdef __gnu_linux__ */
! return 1; }
static t_int hid_read(t_hid *x,int fd) { --- 218,227 ---- post("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING"); post("================================= [hid] =================================\n"); ! #endif /* #ifdef __linux__ */
! return 1; /* why is this return 1? */ }
+ static t_int hid_read(t_hid *x,int fd) {
Index: Makefile =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 22 Oct 2004 18:49:16 -0000 1.4 --- Makefile 23 Oct 2004 03:40:39 -0000 1.5 *************** *** 44,48 ****
.o.pd_linux: ! ld $(LDFLAGS) -o $*.pd_linux $*.o -lc -lm strip --strip-unneeded $*.pd_linux # rm $*.o --- 44,48 ----
.o.pd_linux: ! ld $(LDFLAGS) -o $*.pd_linux *.o -lc -lm strip --strip-unneeded $*.pd_linux # rm $*.o
Index: hid.h =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/hid.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hid.h 22 Oct 2004 18:49:16 -0000 1.2 --- hid.h 23 Oct 2004 03:40:39 -0000 1.3 *************** *** 29,36 ****
/*------------------------------------------------------------------------------ ! * FUNCTION PROTOTYPES FOR APPLE HID MANAGER */ #ifdef __APPLE__ ! void releaseHIDDevices (void); int prHIDBuildElementList(void); int prHIDBuildDeviceList(void); --- 29,53 ----
/*------------------------------------------------------------------------------ ! * GLOBALS ! */ ! ! char *deviceList[64]; ! char *typeList[256]; ! char *codeList[256]; ! ! /*------------------------------------------------------------------------------ ! * FUNCTION PROTOTYPES FOR DIFFERENT PLATFORMS */ + + #ifdef __linux__ + void releaseDevices(void); + void buildDeviceList(void); + void buildTypeList(void); + + #endif + + #ifdef __APPLE__ ! void releaseHIDDevices(void); int prHIDBuildElementList(void); int prHIDBuildDeviceList(void); *************** *** 38,45 **** void PushQueueEvents_RawValue(void); void PushQueueEvents_CalibratedValue(void); - //static pascal void IdleTimer(EventLoopTimerRef inTimer, void* userData); int prHIDReleaseDeviceList(void); - //static EventLoopTimerUPP GetTimerUPP(void); - //void callback(void * target, IOReturn result, void * refcon, void * sender); int prHIDRunEventLoop(void); int prHIDQueueDevice(void); --- 55,59 ----