[PD-cvs] externals/hcs ifeel.c,1.2,1.3 linuxhid.h,1.5,1.6 linuxevent.c,1.5,1.6 linuxjoystick.c,1.4,1.5 linuxmouse.c,1.3,1.4

Hans-Christoph Steiner eighthave at users.sourceforge.net
Thu Apr 15 01:50:46 CEST 2004


Update of /cvsroot/pure-data/externals/hcs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5091

Modified Files:
	ifeel.c linuxhid.h linuxevent.c linuxjoystick.c linuxmouse.c 
Log Message:
make objects be dummies on non-Linux

Index: linuxhid.h
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxhid.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** linuxhid.h	17 Nov 2003 21:09:45 -0000	1.5
--- linuxhid.h	14 Apr 2004 23:50:44 -0000	1.6
***************
*** 7,11 ****
--- 7,13 ----
  #endif
  
+ #ifdef __gnu_linux__
  #include <linux/input.h>
+ #endif
  
  #include <sys/stat.h>
***************
*** 19,24 ****
  
  
! //#define DEBUG(x)
! #define DEBUG(x) x 
  
  /*------------------------------------------------------------------------------
--- 21,26 ----
  
  
! #define DEBUG(x)
! //#define DEBUG(x) x 
  
  /*------------------------------------------------------------------------------
***************
*** 33,37 ****
  #define test_bit(bit, array)	((array[LONG(bit)] >> OFF(bit)) & 1)
  
! 
  char *events[EV_MAX + 1] = { "Reset", "Key", "Relative", "Absolute", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  NULL, NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", NULL, "ForceFeedbackStatus"};
--- 35,39 ----
  #define test_bit(bit, array)	((array[LONG(bit)] >> OFF(bit)) & 1)
  
! #ifdef __gnu_linux__
  char *events[EV_MAX + 1] = { "Reset", "Key", "Relative", "Absolute", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  NULL, NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", NULL, "ForceFeedbackStatus"};
***************
*** 81,84 ****
--- 83,88 ----
  NULL, NULL, leds, sounds, NULL, repeats, NULL, NULL, NULL };
  
+ #endif
+ 
  /*------------------------------------------------------------------------------
   */

Index: linuxevent.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxevent.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** linuxevent.c	16 Mar 2004 09:40:16 -0000	1.5
--- linuxevent.c	14 Apr 2004 23:50:44 -0000	1.6
***************
*** 18,22 ****
--- 18,24 ----
    int                 started;
    int                 x_delaytime;
+ #ifdef __gnu_linux__
    struct input_event  x_input_event; 
+ #endif
    t_outlet            *x_input_event_time_outlet;
    t_outlet            *x_input_event_type_outlet;
***************
*** 54,58 ****
--- 56,62 ----
  static int linuxevent_open(t_linuxevent *x, t_symbol *s) {
    int eventType, eventCode, buttons, rel_axes, abs_axes, ff;
+ #ifdef __gnu_linux__
    unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)];
+ #endif
    char devicename[256] = "Unknown";
    DEBUG(post("linuxevent_open");)
***************
*** 66,69 ****
--- 70,74 ----
      x->x_devname = s;
    
+ #ifdef __gnu_linux__
    /* open device */
    if (x->x_devname) {
***************
*** 149,152 ****
--- 154,158 ----
    post ("As I write cross-platform versions, the interface might have to change.");
    post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING\n");
+ #endif
    
    return 1;
***************
*** 156,159 ****
--- 162,166 ----
  	if (x->x_fd < 0) return 0;
  
+ #ifdef __gnu_linux__
  	while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1) {
  		outlet_float (x->x_input_event_value_outlet, (int)x->x_input_event.value);
***************
*** 163,166 ****
--- 170,174 ----
  		/*   outlet_float (x->x_input_event_time_outlet, x->x_input_event.time); */
  	}
+ #endif
    
  	if (x->started) {
***************
*** 218,221 ****
--- 226,234 ----
  
    post("[linuxevent] %s, written by Hans-Christoph Steiner <hans at eds.org>",version);  
+ #ifndef __linux__
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ 	post("     This is a dummy, since this object only works with a Linux kernel!");
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ #endif
  
    /* init vars */

Index: linuxjoystick.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxjoystick.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** linuxjoystick.c	16 Mar 2004 09:40:17 -0000	1.4
--- linuxjoystick.c	14 Apr 2004 23:50:44 -0000	1.5
***************
*** 18,22 ****
--- 18,24 ----
  		int                 started;
  		int                 x_delaytime;
+ #ifdef __gnu_linux__
  		struct input_event  x_input_event; 
+ #endif
  		t_outlet            *x_axis_out[LINUXJOYSTICK_AXES];
  		t_outlet            *x_button_num_out;
***************
*** 55,59 ****
--- 57,63 ----
  static int linuxjoystick_open(t_linuxjoystick *x, t_symbol *s) {
    int eventType, eventCode, buttons, rel_axes, abs_axes, ff;
+ #ifdef __linux__
    unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)];
+ #endif
    char devicename[256] = "Unknown";
    DEBUG(post("linuxjoystick_open");)
***************
*** 67,70 ****
--- 71,75 ----
      x->x_devname = s;
    
+ #ifdef __linux__
    /* open device */
    if (x->x_devname) {
***************
*** 150,153 ****
--- 155,159 ----
    post ("As I write cross-platform versions, the interface might have to change.");
    post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING\n");
+ #endif
    
    return 1;
***************
*** 161,164 ****
--- 167,171 ----
  	if (x->x_fd < 0) return 0;
  
+ #ifdef __linux__
  	while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1) {
  		if  ( x->x_input_event.type == EV_ABS ) {
***************
*** 260,263 ****
--- 267,271 ----
  		}
  	}
+ #endif
  	
  	if (x->started) {
***************
*** 288,291 ****
--- 296,300 ----
  	DEBUG(post("linuxjoystick_start"););
    
+ #ifdef __linux__
     if (x->x_fd >= 0 && !x->started) {
  		clock_delay(x->x_clock, 5);
***************
*** 295,298 ****
--- 304,308 ----
  		post("You need to set a input device (i.e /dev/input/event0)");
  	}
+ #endif
  }
  
***************
*** 315,318 ****
--- 325,333 ----
  
    post("[linuxjoystick] %s, written by Hans-Christoph Steiner <hans at eds.org>",version);  
+ #ifndef __linux__
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ 	post("     This is a dummy, since this object only works with a Linux kernel!");
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ #endif
  
    /* init vars */
***************
*** 338,342 ****
    
    if (!linuxjoystick_open(x,s)) return x;
!   
    return (x);
  }
--- 353,357 ----
    
    if (!linuxjoystick_open(x,s)) return x;
! 
    return (x);
  }

Index: linuxmouse.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxmouse.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** linuxmouse.c	17 Nov 2003 21:09:45 -0000	1.3
--- linuxmouse.c	14 Apr 2004 23:50:44 -0000	1.4
***************
*** 17,21 ****
--- 17,23 ----
    int                 read_ok;
    int                 started;
+ #ifdef __gnu_linux__
    struct input_event  x_input_event; 
+ #endif
    t_outlet            *x_axis_out[LINUXMOUSE_AXES];
    t_outlet            *x_button_num_out;
***************
*** 33,36 ****
--- 35,39 ----
  	DEBUG(post("linuxmouse_stop"););
  
+ #ifdef __gnu_linux__
     if (x->x_fd >= 0 && x->started) { 
  		sys_rmpollfn(x->x_fd);
***************
*** 38,41 ****
--- 41,45 ----
  		x->started = 0;
  	} 
+ #endif
  }
  
***************
*** 58,63 ****
  static int linuxmouse_open(t_linuxmouse *x, t_symbol *s) {
  	int eventType, eventCode;
- 	unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)];
  	char devicename[256] = "Unknown";
  	
  	DEBUG(post("linuxmouse_open"););
--- 62,69 ----
  static int linuxmouse_open(t_linuxmouse *x, t_symbol *s) {
  	int eventType, eventCode;
  	char devicename[256] = "Unknown";
+ #ifdef __gnu_linux__
+ 	unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)];
+ #endif
  	
  	DEBUG(post("linuxmouse_open"););
***************
*** 75,79 ****
  	 */  
  	if (s != &s_) x->x_devname = s;
! 	
  	/* open device */
  	if (x->x_devname) {
--- 81,86 ----
  	 */  
  	if (s != &s_) x->x_devname = s;
! 
! #ifdef __gnu_linux__	
  	/* open device */
  	if (x->x_devname) {
***************
*** 91,95 ****
  	}
  	
- 	
  /* read input_events from the LINUXMOUSE_DEVICE stream 
   * It seems that is just there to flush the event input buffer?
--- 98,101 ----
***************
*** 139,142 ****
--- 145,149 ----
  	post ("As I write cross-platform versions, the interface might have to change.");
  	post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING\n");
+ #endif
  	
  	return 1;
***************
*** 149,152 ****
--- 156,160 ----
  	if (x->x_fd < 0) return 0;
  	
+ #ifdef __gnu_linux__
  	while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1) {
  		if  ( x->x_input_event.type == EV_REL ) {
***************
*** 193,198 ****
  			outlet_float (x->x_button_num_out, button_num);
  		}
!  	}	 
! 	
  	return 1;    
  }
--- 201,207 ----
  			outlet_float (x->x_button_num_out, button_num);
  		}
!  	}
! #endif
! 
  	return 1;    
  }
***************
*** 201,204 ****
--- 210,214 ----
  	DEBUG(post("linuxmouse_start"););
  
+ #ifdef __gnu_linux__
     if (x->x_fd >= 0 && !x->started) {
  		sys_addpollfn(x->x_fd, (t_fdpollfn)linuxmouse_read, x);
***************
*** 208,211 ****
--- 218,222 ----
  		post("You need to set a input device (i.e /dev/input/event0)");
  	}
+ #endif
  }
  
***************
*** 226,229 ****
--- 237,245 ----
  	
  	post("[linuxmouse] %s, written by Hans-Christoph Steiner <hans at eds.org>",version);  
+ #ifndef __gnu_linux__
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ 	post("     This is a dummy, since this object only works with a Linux kernel!");
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ #endif
  	
  	/* init vars */

Index: ifeel.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/ifeel.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ifeel.c	7 Jun 2003 15:02:59 -0000	1.2
--- ifeel.c	14 Apr 2004 23:50:44 -0000	1.3
***************
*** 67,70 ****
--- 67,71 ----
  /*   struct timespec *remaining; */
  
+ #ifdef __linux__
    if (ioctl(x->x_fd, USB_IFEEL_BUZZ_IOCTL, &x->x_ifeel_command) < 0) {
      post("x->x_fd: %d",x->x_fd);
***************
*** 73,76 ****
--- 74,78 ----
      close(x->x_fd);  
    }
+ #endif
  
    DEBUG(
***************
*** 170,173 ****
--- 172,180 ----
    post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
    post("");
+ #ifndef __linux__
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ 	post("     This is a dummy, since this object only works with a Linux kernel!");
+ 	post("    !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!");
+ #endif
    
    /* 





More information about the Pd-cvs mailing list