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

Hans-Christoph Steiner eighthave at users.sourceforge.net
Fri May 28 03:03:24 CEST 2004


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

Modified Files:
	linuxevent.c linuxjoystick.c linuxmouse.c linuxhid.h 
Log Message:
cleaned up code a bit following Miller's naming scheme

Index: linuxhid.h
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxhid.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** linuxhid.h	14 Apr 2004 23:50:44 -0000	1.6
--- linuxhid.h	28 May 2004 01:03:21 -0000	1.7
***************
*** 24,27 ****
--- 24,30 ----
  //#define DEBUG(x) x 
  
+ 
+ #define DEFAULT_DELAY 5
+ 
  /*------------------------------------------------------------------------------
   * from evtest.c from the ff-utils package

Index: linuxevent.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxevent.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** linuxevent.c	14 Apr 2004 23:50:44 -0000	1.6
--- linuxevent.c	28 May 2004 01:03:21 -0000	1.7
***************
*** 15,21 ****
    t_symbol            *x_devname;
    t_clock             *x_clock;
!   int                 read_ok;
!   int                 started;
!   int                 x_delaytime;
  #ifdef __gnu_linux__
    struct input_event  x_input_event; 
--- 15,21 ----
    t_symbol            *x_devname;
    t_clock             *x_clock;
!   int                 x_read_ok;
!   int                 x_started;
!   int                 x_delay;
  #ifdef __gnu_linux__
    struct input_event  x_input_event; 
***************
*** 34,41 ****
    DEBUG(post("linuxevent_stop"););
    
!   if (x->x_fd >= 0 && x->started) { 
  	  clock_unset(x->x_clock);
  	  post("linuxevent: polling stopped");
! 	  x->started = 0;
    }
  }
--- 34,41 ----
    DEBUG(post("linuxevent_stop"););
    
!   if (x->x_fd >= 0 && x->x_started) { 
  	  clock_unset(x->x_clock);
  	  post("linuxevent: polling stopped");
! 	  x->x_started = 0;
    }
  }
***************
*** 172,177 ****
  #endif
    
! 	if (x->started) {
! 		clock_delay(x->x_clock, x->x_delaytime);
  	}
  
--- 172,177 ----
  #endif
    
! 	if (x->x_started) {
! 		clock_delay(x->x_clock, x->x_delay);
  	}
  
***************
*** 190,196 ****
  /*	if the user sets the delay less than zero, reset to default */
  	if ( f > 0 ) {	
! 		x->x_delaytime = (int)f;
  	} else {
! 		x->x_delaytime = 5;
  	}
  }
--- 190,196 ----
  /*	if the user sets the delay less than zero, reset to default */
  	if ( f > 0 ) {	
! 		x->x_delay = (int)f;
  	} else {
! 		x->x_delay = DEFAULT_DELAY;
  	}
  }
***************
*** 199,206 ****
  	DEBUG(post("linuxevent_start"););
    
!    if (x->x_fd >= 0 && !x->started) {
! 		clock_delay(x->x_clock, 5);
  		post("linuxevent: polling started");
! 		x->started = 1;
  	} else {
  		post("You need to set a input device (i.e /dev/input/event0)");
--- 199,206 ----
  	DEBUG(post("linuxevent_start"););
    
!    if (x->x_fd >= 0 && !x->x_started) {
! 		clock_delay(x->x_clock, DEFAULT_DELAY);
  		post("linuxevent: polling started");
! 		x->x_started = 1;
  	} else {
  		post("You need to set a input device (i.e /dev/input/event0)");
***************
*** 234,240 ****
    /* init vars */
    x->x_fd = -1;
!   x->read_ok = 1;
!   x->started = 0;
!   x->x_delaytime = 5;
  
    x->x_clock = clock_new(x, (t_method)linuxevent_read);
--- 234,240 ----
    /* init vars */
    x->x_fd = -1;
!   x->x_read_ok = 1;
!   x->x_started = 0;
!   x->x_delay = DEFAULT_DELAY;
  
    x->x_clock = clock_new(x, (t_method)linuxevent_read);

Index: linuxjoystick.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxjoystick.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** linuxjoystick.c	14 Apr 2004 23:50:44 -0000	1.5
--- linuxjoystick.c	28 May 2004 01:03:21 -0000	1.6
***************
*** 15,21 ****
  		t_symbol            *x_devname;
  		t_clock             *x_clock;
! 		int                 read_ok;
! 		int                 started;
! 		int                 x_delaytime;
  #ifdef __gnu_linux__
  		struct input_event  x_input_event; 
--- 15,21 ----
  		t_symbol            *x_devname;
  		t_clock             *x_clock;
! 		int                 x_read_ok;
! 		int                 x_started;
! 		int                 x_delay;
  #ifdef __gnu_linux__
  		struct input_event  x_input_event; 
***************
*** 35,42 ****
    DEBUG(post("linuxjoystick_stop"););
    
!   if (x->x_fd >= 0 && x->started) { 
  	  clock_unset(x->x_clock);
  	  post("linuxjoystick: polling stopped");
! 	  x->started = 0;
    }
  }
--- 35,42 ----
    DEBUG(post("linuxjoystick_stop"););
    
!   if (x->x_fd >= 0 && x->x_started) { 
  	  clock_unset(x->x_clock);
  	  post("linuxjoystick: polling stopped");
! 	  x->x_started = 0;
    }
  }
***************
*** 269,274 ****
  #endif
  	
! 	if (x->started) {
! 		clock_delay(x->x_clock, x->x_delaytime);
  	}
  
--- 269,274 ----
  #endif
  	
! 	if (x->x_started) {
! 		clock_delay(x->x_clock, x->x_delay);
  	}
  
***************
*** 287,293 ****
  /*	if the user sets the delay less than zero, reset to default */
  	if ( f > 0 ) {	
! 		x->x_delaytime = (int)f;
  	} else {
! 		x->x_delaytime = 5;
  	}
  }
--- 287,293 ----
  /*	if the user sets the delay less than zero, reset to default */
  	if ( f > 0 ) {	
! 		x->x_delay = (int)f;
  	} else {
! 		x->x_delay = DEFAULT_DELAY;
  	}
  }
***************
*** 297,304 ****
    
  #ifdef __linux__
!    if (x->x_fd >= 0 && !x->started) {
! 		clock_delay(x->x_clock, 5);
  		post("linuxjoystick: polling started");
! 		x->started = 1;
  	} else {
  		post("You need to set a input device (i.e /dev/input/event0)");
--- 297,304 ----
    
  #ifdef __linux__
!    if (x->x_fd >= 0 && !x->x_started) {
! 		clock_delay(x->x_clock, DEFAULT_DELAY);
  		post("linuxjoystick: polling started");
! 		x->x_started = 1;
  	} else {
  		post("You need to set a input device (i.e /dev/input/event0)");
***************
*** 333,339 ****
    /* init vars */
    x->x_fd = -1;
!   x->read_ok = 1;
!   x->started = 0;
!   x->x_delaytime = 5;
    x->x_clock = clock_new(x, (t_method)linuxjoystick_read);
    
--- 333,339 ----
    /* init vars */
    x->x_fd = -1;
!   x->x_read_ok = 1;
!   x->x_started = 0;
!   x->x_delay = DEFAULT_DELAY;
    x->x_clock = clock_new(x, (t_method)linuxjoystick_read);
    

Index: linuxmouse.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/linuxmouse.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** linuxmouse.c	14 Apr 2004 23:50:44 -0000	1.4
--- linuxmouse.c	28 May 2004 01:03:21 -0000	1.5
***************
*** 15,20 ****
    t_int               x_fd;
    t_symbol            *x_devname;
!   int                 read_ok;
!   int                 started;
  #ifdef __gnu_linux__
    struct input_event  x_input_event; 
--- 15,20 ----
    t_int               x_fd;
    t_symbol            *x_devname;
!   int                 x_read_ok;
!   int                 x_started;
  #ifdef __gnu_linux__
    struct input_event  x_input_event; 
***************
*** 36,43 ****
  
  #ifdef __gnu_linux__
!    if (x->x_fd >= 0 && x->started) { 
  		sys_rmpollfn(x->x_fd);
  		post("[linuxmouse] stopped");
! 		x->started = 0;
  	} 
  #endif
--- 36,43 ----
  
  #ifdef __gnu_linux__
!    if (x->x_fd >= 0 && x->x_started) { 
  		sys_rmpollfn(x->x_fd);
  		post("[linuxmouse] stopped");
! 		x->x_started = 0;
  	} 
  #endif
***************
*** 211,218 ****
  
  #ifdef __gnu_linux__
!    if (x->x_fd >= 0 && !x->started) {
  		sys_addpollfn(x->x_fd, (t_fdpollfn)linuxmouse_read, x);
  		post("[linuxmouse] started");
! 		x->started = 1;
  	} else {
  		post("You need to set a input device (i.e /dev/input/event0)");
--- 211,218 ----
  
  #ifdef __gnu_linux__
!    if (x->x_fd >= 0 && !x->x_started) {
  		sys_addpollfn(x->x_fd, (t_fdpollfn)linuxmouse_read, x);
  		post("[linuxmouse] started");
! 		x->x_started = 1;
  	} else {
  		post("You need to set a input device (i.e /dev/input/event0)");
***************
*** 245,250 ****
  	/* init vars */
  	x->x_fd = -1;
! 	x->read_ok = 1;
! 	x->started = 0;
  	
  	/* create outlets for each axis */
--- 245,250 ----
  	/* init vars */
  	x->x_fd = -1;
! 	x->x_read_ok = 1;
! 	x->x_started = 0;
  	
  	/* create outlets for each axis */





More information about the Pd-cvs mailing list