[PD-cvs] externals/iem/comport/comport comport.c, 1.19, 1.20 makefile, 1.4, 1.5

Hans-Christoph Steiner eighthave at users.sourceforge.net
Sat Aug 26 22:30:35 CEST 2006


Update of /cvsroot/pure-data/externals/iem/comport/comport
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22722

Modified Files:
	comport.c makefile 
Log Message:
added quick function to display the available ports using the [info( message.  Yes, this is a quick hack

Index: comport.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/comport/comport/comport.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** comport.c	24 Aug 2006 16:48:49 -0000	1.19
--- comport.c	26 Aug 2006 20:30:32 -0000	1.20
***************
*** 44,53 ****
      t_object       x_obj;
      long           n; /* the state of a last input */
-     HANDLE         comhandle; /* holds the comport handle */
  #ifdef _WIN32
      DCB            dcb; /* holds the comm pars */
      DCB            dcb_old; /* holds the comm pars */
      COMMTIMEOUTS   old_timeouts;
  #else
      struct termios oldcom_termio; /* save the old com config */
      struct termios com_termio; /* for the new com config */
--- 44,54 ----
      t_object       x_obj;
      long           n; /* the state of a last input */
  #ifdef _WIN32
+     HANDLE         comhandle; /* holds the comport handle */
      DCB            dcb; /* holds the comm pars */
      DCB            dcb_old; /* holds the comm pars */
      COMMTIMEOUTS   old_timeouts;
  #else
+     int            comhandle; /* holds the comport handle */
      struct termios oldcom_termio; /* save the old com config */
      struct termios com_termio; /* for the new com config */
***************
*** 701,705 ****
  static int open_serial(unsigned int com_num, t_comport *x)
  {
!     HANDLE         fd;
      struct termios *old = &(x->oldcom_termio);
      struct termios *new = &(x->com_termio);
--- 702,706 ----
  static int open_serial(unsigned int com_num, t_comport *x)
  {
!     int            fd;
      struct termios *old = &(x->oldcom_termio);
      struct termios *new = &(x->com_termio);
***************
*** 884,889 ****
  static void comport_tick(t_comport *x)
  {
      int          err;
-     HANDLE       fd = x->comhandle;
  
      x->x_hit = 0;
--- 885,894 ----
  static void comport_tick(t_comport *x)
  {
+ #ifdef _WIN32
+ 	HANDLE       fd = x->comhandle;
+ #else
+ 	int  fd = x->comhandle;
+ #endif /* _WIN32 */
      int          err;
  
      x->x_hit = 0;
***************
*** 1037,1041 ****
  static void comport_free(t_comport *x)
  {
!     post("free serial...");
      clock_unset(x->x_clock);
      clock_free(x->x_clock);
--- 1042,1046 ----
  static void comport_free(t_comport *x)
  {
!     post("[comport] free serial...");
      clock_unset(x->x_clock);
      clock_free(x->x_clock);
***************
*** 1232,1235 ****
--- 1237,1278 ----
  }
  
+ static void comport_output_print(t_comport *x)
+ {
+ 	unsigned int i;
+ 
+ 	post("[comport]: available serial ports:");
+ #ifdef _WIN32
+ 	post("\t0 - COM1");
+ 	for(i=1; i<COMPORT_MAX; i++)
+ 	{
+ 		/* TODO: this should actually probe ports */
+ 		post("\t%d - COM%s", i, i);
+ 	}
+ #else	
+     glob_t         glob_buffer;
+ 	switch( glob( x->serial_device_name, 0, NULL, &glob_buffer ) )
+ 	{
+ 	case GLOB_NOSPACE:
+ 		error("[comport] out of memory for \"%s\"",x->serial_device_name);
+ 		break;
+ # ifdef GLOB_ABORTED
+ 	case GLOB_ABORTED:
+ 		error("[comport] aborted \"%s\"",x->serial_device_name);
+ 		break;
+ # endif /* GLOB_ABORTED */
+ # ifdef GLOB_NOMATCH
+ 	case GLOB_NOMATCH:
+ 		error("[comport] no serial devices found for \"%s\"",x->serial_device_name);
+ 		break;
+ # endif /* GLOB_NOMATCH */
+ 	}
+ 	for(i=0; i<glob_buffer.gl_pathc; i++)
+ 	{
+ 		post("\t%d\t%s", i, glob_buffer.gl_pathv[i]);
+ 	}
+ #endif  /* _WIN32 */
+ }
+ 
+ 
  static void comport_output_status(t_comport *x, t_symbol *selector, t_float output_value)
  {
***************
*** 1296,1299 ****
--- 1339,1343 ----
      comport_output_rtscts(x);
      comport_output_xonxoff(x);
+ 	comport_output_print(x);
  }
  

Index: makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/comport/comport/makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** makefile	29 Jul 2006 14:18:23 -0000	1.4
--- makefile	26 Aug 2006 20:30:32 -0000	1.5
***************
*** 74,78 ****
      -Wno-unused -Wno-parentheses -Wno-switch
  
! LINUXINCLUDE =  -I../../src
  
  .c.pd_linux:
--- 74,78 ----
      -Wno-unused -Wno-parentheses -Wno-switch
  
! LINUXINCLUDE =  -I../../src -I../../../../pd/src
  
  .c.pd_linux:





More information about the Pd-cvs mailing list