[PD-cvs] externals/iem/comport/comport comport-help.pd, 1.1, 1.2 comport.c, 1.12, 1.13
Hans-Christoph Steiner
eighthave at users.sourceforge.net
Sun May 21 15:35:23 CEST 2006
Update of /cvsroot/pure-data/externals/iem/comport/comport
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13238
Modified Files:
comport-help.pd comport.c
Log Message:
added serial port device name globbing for UNIX; added Piotr Majdak's Win32 improvements, they compile, but aren't tested yet; still need to update [devicename( message handling
Index: comport.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/comport/comport/comport.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** comport.c 1 May 2006 20:23:03 -0000 1.12
--- comport.c 21 May 2006 13:35:20 -0000 1.13
***************
*** 23,26 ****
--- 23,27 ----
#include <termios.h> /* for TERMIO ioctl calls */
#include <unistd.h>
+ #include <glob.h>
#define HANDLE int
#define INVALID_HANDLE_VALUE -1
***************
*** 29,32 ****
--- 30,34 ----
#include <string.h>
#include <errno.h>
+ #include <stdio.h>
***************
*** 40,53 ****
#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 */
#endif
!
short comport; /* holds the comport # */
! float baud; /* holds the current baud rate */
short rxerrors; /* holds the rx line errors */
--- 42,57 ----
#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 */
#endif
! t_symbol *serial_device;
! char serial_device_name[FILENAME_MAX];
!
short comport; /* holds the comport # */
! t_float baud; /* holds the current baud rate */
short rxerrors; /* holds the rx line errors */
***************
*** 79,99 ****
#define TXBUFOVERRUN -5
! #ifdef _WIN32
!
! #define COMPORT_MAX 40
! static char *sys_com_port[COMPORT_MAX] =
! {
! "COM1", "COM2", "COM3", "COM4",
! "COM5", "COM6", "COM7", "COM8",
! "COM9", "COM10", "COM11", "COM12",
! "COM13", "COM14", "COM15", "COM16",
! "COM17", "COM18", "COM19", "COM20",
! "COM21", "COM22", "COM23", "COM24",
! "COM25", "COM26", "COM27", "COM28",
! "COM29", "COM30", "COM31", "COM32",
! "COM33", "COM34", "COM35", "COM36",
! "COM37", "COM38", "COM39", "COM40"
! };
static
long baudspeedbittable[] =
--- 83,89 ----
#define TXBUFOVERRUN -5
! #define COMPORT_MAX 99
+ #ifdef _WIN32
static
long baudspeedbittable[] =
***************
*** 119,127 ****
#ifdef IRIX
- #define COMPORT_MAX 2
- static char *sys_com_port[COMPORT_MAX] =
- {
- "/dev/ttyd1", "/dev/ttyd2"
- };
#define OPENPARAMS (O_RDWR|O_NDELAY|O_NOCTTY)
#define TIONREAD FIONREAD /* re map the IOCTL function */
--- 109,112 ----
***************
*** 134,145 ****
#define BAUDRATE_14400 B19200 /* 14400 gibts nicht */
#else /* IRIX */
- #define COMPORT_MAX 16
- static char *sys_com_port[COMPORT_MAX] =
- {
- "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3",
- "/dev/ttyS4", "/dev/ttyS5", "/dev/ttyS6", "/dev/ttyS7",
- "/dev/ttyUSB0", "/dev/ttyUSB1", "/dev/ttyUSB2", "/dev/ttyUSB3",
- "/dev/ttyUSB4", "/dev/ttyUSB5", "/dev/ttyUSB6", "/dev/ttyUSB7"
- };
#define OPENPARAMS (O_RDWR|O_NDELAY|O_NOCTTY)
#define BAUDRATE_256000 -1
--- 119,122 ----
***************
*** 150,154 ****
#define BAUDRATE_38400 B38400
#define BAUDRATE_14400 B19200 /* 14400 gibts nicht */
-
#endif /* else IRIX */
--- 127,130 ----
***************
*** 323,345 ****
}
! static HANDLE open_serial(int com_nr, t_comport *x)
{
HANDLE fd;
-
COMMTIMEOUTS timeouts;
!
float *baud = &(x->baud);
!
! if(com_nr < 0 || com_nr >= COMPORT_MAX) {
! post("comport open %d, baud %d not valid (args: [portnum] [baud])",com_nr,*baud);
! return INVALID_HANDLE_VALUE;
}
!
! fd = CreateFile( sys_com_port[com_nr],
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
! 0,
0);
--- 299,323 ----
}
! static HANDLE open_serial(unsigned int com_num, t_comport *x)
{
HANDLE fd;
COMMTIMEOUTS timeouts;
! char buffer[MAX_PATH];
float *baud = &(x->baud);
!
! if(com_num < 1 || com_num >= COMPORT_MAX) {
! post("comport open %d, baud %d not valid (args: [portnum] [baud])",com_num,*baud);
! return INVALID_HANDLE_VALUE;
}
!
! sprintf(buffer, "%s%d", x->serial_device_name, com_num);
! x->serial_device = gensym(buffer);
! post("Opening %s",x->serial_device->s_name);
! fd = CreateFile( x->serial_device->s_name,
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
! FILE_FLAG_OVERLAPPED,
0);
***************
*** 347,351 ****
{
post("** ERROR ** could not open device %s:\n failure(%d): %s\n",
! sys_com_port[com_nr],errno,strerror(errno));
return INVALID_HANDLE_VALUE;
}
--- 325,329 ----
{
post("** ERROR ** could not open device %s:\n failure(%d): %s\n",
! x->serial_device->s_name,errno,strerror(errno));
return INVALID_HANDLE_VALUE;
}
***************
*** 354,359 ****
if (!GetCommState(fd, &(x->dcb_old))){
! post("** ERROR ** could not get old dcb of device %s\n",
! sys_com_port[com_nr]);
CloseHandle(fd);
--- 332,337 ----
if (!GetCommState(fd, &(x->dcb_old))){
! post("** ERROR ** could not get old dcb of device %s\n",
! x->serial_device->s_name);
CloseHandle(fd);
***************
*** 364,369 ****
if (!GetCommState(fd, &(x->dcb))){
! post("** ERROR ** could not get new dcb of device %s\n",
! sys_com_port[com_nr]);
CloseHandle(fd);
--- 342,347 ----
if (!GetCommState(fd, &(x->dcb))){
! post("** ERROR ** could not get new dcb of device %s\n",
! x->serial_device->s_name);
CloseHandle(fd);
***************
*** 393,397 ****
set_stopflag(x,0); /* ~CSTOPB */
set_ctsrts(x,0); /* ~CRTSCTS;*/
! set_xonxoff(x,1); /* (IXON | IXOFF | IXANY) */
set_baudrate(x,*baud);
--- 371,375 ----
set_stopflag(x,0); /* ~CSTOPB */
set_ctsrts(x,0); /* ~CRTSCTS;*/
! set_xonxoff(x,0); /* (IXON | IXOFF | IXANY) */
set_baudrate(x,*baud);
***************
*** 399,409 ****
if(set_serial(x))
! {
! post("Opened serial line device %s\n",sys_com_port[com_nr]);
! }
else
! {
! post("** ERROR ** could not set params to control dcb of device %s\n",
! sys_com_port[com_nr]);
CloseHandle(fd);
return INVALID_HANDLE_VALUE;
--- 377,388 ----
if(set_serial(x))
! {
! post("[comport] opened serial line device %d (%s)\n",
! com_num,x->serial_device->s_name);
! }
else
! {
! error("[comport] ** ERROR ** could not set params to control dcb of device %s\n",
! x->serial_device->s_name);
CloseHandle(fd);
return INVALID_HANDLE_VALUE;
***************
*** 413,417 ****
if (!GetCommTimeouts(fd, &(x->old_timeouts))){
! post("Couldnt get old timeouts for serial device");
};
--- 392,396 ----
if (!GetCommTimeouts(fd, &(x->old_timeouts))){
! post("[comport] Couldn't get old timeouts for serial device");
};
***************
*** 439,443 ****
{
post("** ERROR ** could not reset params to DCB of device %s\n",
! sys_com_port[x->comport]);
}
--- 418,422 ----
{
post("** ERROR ** could not reset params to DCB of device %s\n",
! x->serial_device->s_name);
}
***************
*** 452,468 ****
! static int write_serial(t_comport *x, unsigned char chr)
{
OVERLAPPED osWrite = {0};
DWORD dwWritten;
! DWORD dwRes;
!
! /* post("open send %d",chr); */
!
! if (!WriteFile(x->comhandle, &chr, 1, &dwWritten, &osWrite)) {
! if (GetLastError() != ERROR_IO_PENDING)
! post("WriteFile failed, but isn't delayed on serialdevice");
! return 0;
! }
return 1;
}
--- 431,461 ----
! static int write_serial(t_comport *x, unsigned char serial_byte)
{
OVERLAPPED osWrite = {0};
DWORD dwWritten;
! DWORD dwToWrite = 1;
! DWORD dwErr;
! char cErr[100];
!
! osWrite.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
! if (osWrite.hEvent == NULL)
! {
! post("Couldn't create event. Transmission aborted.");
! return 0;
! }
!
!
! if (!WriteFile(x->comhandle, &serial_byte, dwToWrite, &dwWritten, &osWrite))
! {
! dwErr = GetLastError();
! if (dwErr != ERROR_IO_PENDING)
! {
! sprintf(cErr, "WriteFile error: %d", (int)dwErr);
! post(cErr);
! return 0;
! }
! }
! CloseHandle(osWrite.hEvent);
return 1;
}
***************
*** 557,561 ****
}
! static int open_serial(int com_nr, t_comport *x)
{
HANDLE fd;
--- 550,554 ----
}
! static int open_serial(unsigned int com_num, t_comport *x)
{
HANDLE fd;
***************
*** 563,576 ****
struct termios *new = &(x->com_termio);
float *baud = &(x->baud);
! if(com_nr < 0 || com_nr >= COMPORT_MAX) {
! post("comport open %d, baud %d not valid (args: [portnum] [baud])");
! return INVALID_HANDLE_VALUE;
}
! if((fd = open(sys_com_port[com_nr], OPENPARAMS)) == INVALID_HANDLE_VALUE)
{
! post("** ERROR ** could not open device %s:\n failure(%d): %s\n",
! sys_com_port[com_nr],errno,strerror(errno));
return INVALID_HANDLE_VALUE;
}
--- 556,596 ----
struct termios *new = &(x->com_termio);
float *baud = &(x->baud);
+ glob_t glob_buffer;
! if(com_num >= COMPORT_MAX) {
! post("[comport] ** WARNING ** port %d not valid, must be between 0 and %d",
! com_num, COMPORT_MAX - 1);
! return INVALID_HANDLE_VALUE;
! }
! // post("[comport] globbing %s",x->serial_device_name);
! /* get the device path based on the com# and the glob pattern */
! 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;
! case GLOB_ABORTED:
! error("[comport] aborted \"%s\"",x->serial_device_name);
! break;
! case GLOB_NOMATCH:
! error("[comport] no serial devices found for \"%s\"",x->serial_device_name);
! break;
! }
! if(com_num < glob_buffer.gl_pathc)
! {
! x->serial_device = gensym(glob_buffer.gl_pathv[com_num]);
! }
! else
! {
! post("[comport] ** WARNING ** port #%d does not exist! (max == %d)",
! com_num,glob_buffer.gl_pathc - 1);
! return INVALID_HANDLE_VALUE;
}
+ globfree( &(glob_buffer) );
! if((fd = open(x->serial_device->s_name, OPENPARAMS)) == INVALID_HANDLE_VALUE)
{
! error("[comport] ** ERROR ** could not open device %s:\n failure(%d): %s\n",
! x->serial_device->s_name,errno,strerror(errno));
return INVALID_HANDLE_VALUE;
}
***************
*** 581,586 ****
/* Save the Current Port Configuration */
if(tcgetattr(fd, old) == -1 || tcgetattr(fd, new) == -1){
! post("** ERROR ** could not get termios-structure of device %s\n",
! sys_com_port[com_nr]);
close(fd);
return INVALID_HANDLE_VALUE;
--- 601,606 ----
/* Save the Current Port Configuration */
if(tcgetattr(fd, old) == -1 || tcgetattr(fd, new) == -1){
! error("[comport] ** ERROR ** could not get termios-structure of device %s\n",
! x->serial_device->s_name);
close(fd);
return INVALID_HANDLE_VALUE;
***************
*** 614,628 ****
set_stopflag(x,0); /* ~CSTOPB */
set_ctsrts(x,0); /* ~CRTSCTS;*/
! set_xonxoff(x,1); /* (IXON | IXOFF | IXANY) */
set_baudrate(x,*baud);
if(tcsetattr(fd, TCSAFLUSH, new) != -1)
{
! post("Opened serial line device %s\n",sys_com_port[com_nr]);
}
else
{
! post("** ERROR ** could not set params to ioctl of device %s\n",
! sys_com_port[com_nr]);
close(fd);
return INVALID_HANDLE_VALUE;
--- 634,649 ----
set_stopflag(x,0); /* ~CSTOPB */
set_ctsrts(x,0); /* ~CRTSCTS;*/
! set_xonxoff(x,0); /* (IXON | IXOFF | IXANY) */
set_baudrate(x,*baud);
if(tcsetattr(fd, TCSAFLUSH, new) != -1)
{
! post("[comport] opened serial line device %d (%s)\n",
! com_num,x->serial_device->s_name);
}
else
{
! error("[comport] ** ERROR ** could not set params to ioctl of device %s\n",
! x->serial_device->s_name);
close(fd);
return INVALID_HANDLE_VALUE;
***************
*** 653,660 ****
}
! static int write_serial(t_comport *x, unsigned char chr)
{
! return write(x->comhandle,(char *) &chr,1);
/* flush pending I/O chars */
--- 674,681 ----
}
! static int write_serial(t_comport *x, unsigned char serial_byte)
{
! return write(x->comhandle,(char *) &serial_byte,1);
/* flush pending I/O chars */
***************
*** 679,683 ****
static void comport_tick(t_comport *x)
{
- unsigned char chr;
int err;
HANDLE fd = x->comhandle;
--- 700,703 ----
***************
*** 691,727 ****
#ifdef _WIN32
{
! DWORD dwCommEvent;
DWORD dwRead;
!
err = 0;
!
! /*
! if (!SetCommMask(x->comhandle, EV_RXCHAR))
! post(" Error setting communications event mask for serial device");
!
! for ( ; ; ) {
! if (WaitCommEvent(x->comhandle, &dwCommEvent,NULL)) {
! */
! do {
!
! if(ReadFile(x->comhandle, &chr, 1, &dwRead, NULL))
! if(dwRead > 0)
! outlet_float(x->x_obj.ob_outlet, (t_float) chr);
! else{
! err = -1;
! break;
! }
! } while (dwRead);
! /*
}
! else{
! post("serial dev: Error in WaitCommEvent");
! break;
}
! }
! */
}
#else
{
fd_set com_rfds;
FD_ZERO(&com_rfds);
--- 711,741 ----
#ifdef _WIN32
{
! unsigned char serial_byte[1000];
DWORD dwRead;
! OVERLAPPED osReader = {0};
! DWORD dwX;
!
err = 0;
!
! osReader.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
! if(ReadFile(x->comhandle, serial_byte, 1000, &dwRead, &osReader))
! {
! if(dwRead > 0)
! {
! for(dwX=0;dwX<dwRead;dwX++)
! {
! outlet_float(x->x_obj.ob_outlet, (t_float) serial_byte[dwX]);
! }
! }
}
! else
! {
! err = -1;
}
! CloseHandle(osReader.hEvent);
}
#else
{
+ unsigned char serial_byte;
fd_set com_rfds;
FD_ZERO(&com_rfds);
***************
*** 730,737 ****
while((err=select(fd+1,&com_rfds,NULL,NULL,&null_tv)) > 0) {
! err = read(fd,(char *) &chr,1);
! /* while( (err = read(fd,(char *) &chr,1)) > 0){ */
! outlet_float(x->x_obj.ob_outlet, (t_float) chr);
};
--- 744,751 ----
while((err=select(fd+1,&com_rfds,NULL,NULL,&null_tv)) > 0) {
! err = read(fd,(char *) &serial_byte,1);
! /* while( (err = read(fd,(char *) &serial_byte,1)) > 0){ */
! outlet_float(x->x_obj.ob_outlet, (t_float) serial_byte);
};
***************
*** 750,756 ****
static void comport_float(t_comport *x, t_float f)
{
! unsigned char chr = ((int) f) & 0xFF; /* brutal conv */
! if (write_serial(x,chr) != 1)
{
post("Write error, maybe TX-OVERRUNS on serial line");
--- 764,770 ----
static void comport_float(t_comport *x, t_float f)
{
! unsigned char serial_byte = ((int) f) & 0xFF; /* brutal conv */
! if (write_serial(x,serial_byte) != 1)
{
post("Write error, maybe TX-OVERRUNS on serial line");
***************
*** 758,788 ****
}
! static void *comport_new(t_floatarg comnr, t_floatarg fbaud) {
!
t_comport test;
t_comport *x;
- int com_nr = comnr;
HANDLE fd;
/* Open the Comport for RD and WR and get a handle */
test.baud = fbaud;
! fd = open_serial(com_nr,&test);
!
/* Now nothing really bad could happen so we create the class */
-
x = (t_comport *)pd_new(comport_class);
if(fd == INVALID_HANDLE_VALUE ){
/* postings in open routine */
! x->comport = com_nr;
! x->baud = test.baud;
! x->comhandle = fd; /* holds the comport handle */
}
else {
- x->comport = com_nr;
- x->baud = test.baud;
- x->comhandle = fd; /* holds the comport handle */
-
#ifdef _WIN32
memcpy(&(test.dcb_old),&(x->dcb_old),sizeof(DCB)); /* save the old com config */
--- 772,815 ----
}
! static void *comport_new(t_floatarg com_num, t_floatarg fbaud)
! {
t_comport test;
t_comport *x;
HANDLE fd;
+ /* for UNIX, this is a glob pattern for matching devices */
+ #ifdef _WIN32
+ const char *serial_device_name = "COM";
+ #else
+ # ifdef __APPLE__
+ const char *serial_device_name = "/dev/tty.*";
+ # else
+ # ifdef IRIX
+ const char *serial_device_name = "/dev/ttyd*";
+ # else
+ const char *serial_device_name = "/dev/tty[SU]*";
+ # endif /* IRIX */
+ # endif /* __APPLE__ */
+ #endif /* _WIN32 */
+
+
/* Open the Comport for RD and WR and get a handle */
+ strncpy(test.serial_device_name,serial_device_name,strlen(serial_device_name)+1);
test.baud = fbaud;
! fd = open_serial((unsigned int)com_num,&test);
/* Now nothing really bad could happen so we create the class */
x = (t_comport *)pd_new(comport_class);
+ x->comport = (short)com_num;
+ strncpy(x->serial_device_name,serial_device_name,strlen(serial_device_name)+1);
+ x->baud = test.baud;
+ x->comhandle = fd; /* holds the comport handle */
+
if(fd == INVALID_HANDLE_VALUE ){
/* postings in open routine */
! post("[comport] invalid handle for %s",x->serial_device_name);
}
else {
#ifdef _WIN32
memcpy(&(test.dcb_old),&(x->dcb_old),sizeof(DCB)); /* save the old com config */
***************
*** 835,842 ****
if(set_serial(x) == 0){
! post("** ERROR ** could not set baudrate of device %s\n",
! sys_com_port[x->comport]);
}
! else post("set baudrate of %s to %f\n",sys_com_port[x->comport],x->baud);
}
--- 862,869 ----
if(set_serial(x) == 0){
! error("[comport] ** ERROR ** could not set baudrate of device %s\n",
! x->serial_device->s_name);
}
! else post("set baudrate of %s to %f\n",x->serial_device->s_name,x->baud);
}
***************
*** 848,855 ****
if(set_serial(x) == 0){
! post("** ERROR ** could not set bits of device %s\n",
! sys_com_port[x->comport]);
}
! else post("set bits of %s to %f\n",sys_com_port[x->comport],f);
}
--- 875,882 ----
if(set_serial(x) == 0){
! error("[comport] ** ERROR ** could not set bits of device %s\n",
! x->serial_device->s_name);
}
! else post("set bits of %s to %f\n",x->serial_device->s_name,f);
}
***************
*** 862,869 ****
if(set_serial(x) == 0){
! post("** ERROR ** could not set extra paritybit of device %s\n",
! sys_com_port[x->comport]);
}
! else post("set extra paritybit of %s to %f\n",sys_com_port[x->comport],f);
}
--- 889,896 ----
if(set_serial(x) == 0){
! error("[comport] ** ERROR ** could not set extra paritybit of device %s\n",
! x->serial_device->s_name);
}
! else post("[comport] set extra paritybit of %s to %f\n",x->serial_device->s_name,f);
}
***************
*** 875,882 ****
if(set_serial(x) == 0){
! post("** ERROR ** could not set extra stopbit of device %s\n",
! sys_com_port[x->comport]);
}
! else post("set extra stopbit of %s to %f\n",sys_com_port[x->comport],f);
}
--- 902,909 ----
if(set_serial(x) == 0){
! error("[comport] ** ERROR ** could not set extra stopbit of device %s\n",
! x->serial_device->s_name);
}
! else post("[comport] set extra stopbit of %s to %f\n",x->serial_device->s_name,f);
}
***************
*** 888,895 ****
if(set_serial(x) == 0){
! post("** ERROR ** could not set rts_cts of device %s\n",
! sys_com_port[x->comport]);
}
! else post("set rts-cts of %s to %f\n",sys_com_port[x->comport],f);
}
--- 915,922 ----
if(set_serial(x) == 0){
! error("[comport] ** ERROR ** could not set rts_cts of device %s\n",
! x->serial_device->s_name);
}
! else post("[comport] set rts-cts of %s to %f\n",x->serial_device->s_name,f);
}
***************
*** 901,909 ****
if(set_serial(x) == 0){
! post("** ERROR ** could not set xonxoff of device %s\n",
! sys_com_port[x->comport]);
}
else if(x->verbose > 0)
! post("set xonxoff of %s to %f\n",sys_com_port[x->comport],f);
}
--- 928,936 ----
if(set_serial(x) == 0){
! error("[comport] ** ERROR ** could not set xonxoff of device %s\n",
! x->serial_device->s_name);
}
else if(x->verbose > 0)
! post("[comport] set xonxoff of %s to %f\n",x->serial_device->s_name,f);
}
***************
*** 934,943 ****
{
if(x->comport >= 0 && x->comport < COMPORT_MAX){
! sys_com_port[x->comport] = s->s_name;
if(x->verbose > 0)
! post("comport %d: set devicename %s",x->comport,sys_com_port[x->comport]);
}
else if(x->verbose > 0)
! post("comport %d: could not set devicename %s",x->comport,s->s_name);
}
--- 961,970 ----
{
if(x->comport >= 0 && x->comport < COMPORT_MAX){
! x->serial_device->s_name = s->s_name;
if(x->verbose > 0)
! post("[comport] %d: set devicename %s",x->comport,x->serial_device->s_name);
}
else if(x->verbose > 0)
! post("[comport] %d: could not set devicename %s",x->comport,s->s_name);
}
***************
*** 963,967 ****
x->verbose = f;
if(f > 0)
! post("Comport Verbose is on: %d", (int) f);
}
--- 990,994 ----
x->verbose = f;
if(f > 0)
! post("[comport] verbose is on: %d", (int) f);
}
***************
*** 969,975 ****
static void comport_help(t_comport *x)
{
! post("Comport %d (baud %f):",x->comport,x->baud);
if(x->comport >= 0 && x->comport < COMPORT_MAX){
! post("devicename: %s",sys_com_port[x->comport]);
}
--- 996,1002 ----
static void comport_help(t_comport *x)
{
! post("[comport] serial port %d (baud %f):",x->comport,x->baud);
if(x->comport >= 0 && x->comport < COMPORT_MAX){
! post("\tdevicename: %s",x->serial_device->s_name);
}
Index: comport-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/iem/comport/comport/comport-help.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** comport-help.pd 13 Apr 2005 16:01:06 -0000 1.1
--- comport-help.pd 21 May 2006 13:35:20 -0000 1.2
***************
*** 1,7 ****
! #N canvas 199 244 693 475 10;
#X obj 97 231 comport 1 9600;
#X msg 13 213 66;
#X obj 88 361 print;
- #X floatatom 195 190 4 0 0 0 - - -;
#X msg 12 171 64;
#X text 12 191 point;
--- 1,6 ----
! #N canvas 199 244 697 479 10;
#X obj 97 231 comport 1 9600;
#X msg 13 213 66;
#X obj 88 361 print;
#X msg 12 171 64;
#X text 12 191 point;
***************
*** 17,81 ****
#X msg 109 298 1;
#X msg 143 299 0;
! #X msg 314 48 bits 8;
! #X msg 313 72 stopbit 0;
! #X msg 312 100 parity 0;
! #X msg 313 129 xonxoff 1;
! #X msg 313 155 rtscts 0;
! #X text 392 103 parity 1=even \, -1=odd \, 0=off;
! #X text 392 74 extra stopbit 1=on \, 0=off;
! #X text 394 49 databits 5 \, 6 \, 7 \, 8;
! #X text 393 20 use exact or higher baudrate;
! #X obj 94 200 r comctl;
! #X obj 271 294 s comctl;
! #X text 394 128 use handshake xon/off 1=on 0=off;
! #X text 392 154 cts/rts hardwarehandshake 1=on 0=off;
! #X msg 318 201 pollintervall 1;
! #X text 430 191 set pollintervall for read in ms;
! #X text 430 205 (default is 1 tick 1ms);
! #X msg 317 233 close;
! #X msg 317 259 open 1;
! #X msg 314 23 baud 10000;
! #X text 383 230 Close Serial port;
! #X text 381 263 Open seriel board Nr (0=COM1 \, 1=COM2 \, ...);
! #X msg 263 354 devicename /dev/ttyS1;
! #X text 257 375 Danger !!! you can open every file in your system and
maybe if suid is root damage the system.;
! #X text 258 336 set devicename for actuell port \, then close and open
! again;
! #X obj 195 165 spigot;
! #X msg 214 138 1;
! #X msg 247 143 0;
! #X obj 190 112 key;
! #X text 260 324 never should be needed except for sys admins (only
! unix);
! #X msg 309 0 baud 300;
#X text 3 -10 (C) 1998-2005 IEM Winfried Ritsch GPL (see LICENSE.txt)
;
! #X text 14 388;
! #X text 1 41 please improve...;
#X connect 0 0 13 0;
- #X connect 0 0 14 0;
#X connect 1 0 0 0;
#X connect 3 0 0 0;
! #X connect 4 0 0 0;
! #X connect 7 0 0 0;
#X connect 9 0 0 0;
! #X connect 10 0 0 0;
! #X connect 14 0 2 0;
! #X connect 15 0 14 1;
! #X connect 16 0 14 1;
! #X connect 17 0 27 0;
! #X connect 18 0 27 0;
! #X connect 19 0 27 0;
! #X connect 20 0 27 0;
! #X connect 21 0 27 0;
! #X connect 26 0 0 0;
! #X connect 30 0 27 0;
! #X connect 33 0 27 0;
! #X connect 34 0 27 0;
! #X connect 35 0 27 0;
! #X connect 41 0 3 0;
! #X connect 42 0 41 1;
! #X connect 43 0 41 1;
! #X connect 44 0 41 0;
! #X connect 46 0 27 0;
--- 16,76 ----
#X msg 109 298 1;
#X msg 143 299 0;
! #X msg 313 60 bits 8;
! #X msg 312 84 stopbit 0;
! #X msg 311 112 parity 0;
! #X msg 312 141 xonxoff 1;
! #X msg 312 167 rtscts 0;
! #X text 391 115 parity 1=even \, -1=odd \, 0=off;
! #X text 391 86 extra stopbit 1=on \, 0=off;
! #X text 393 61 databits 5 \, 6 \, 7 \, 8;
! #X text 392 32 use exact or higher baudrate;
! #X obj 115 196 r comctl;
! #X obj 219 389 s comctl;
! #X text 393 140 use handshake xon/off 1=on 0=off;
! #X text 391 166 cts/rts hardwarehandshake 1=on 0=off;
! #X msg 317 213 pollintervall 1;
! #X text 429 203 set pollintervall for read in ms;
! #X text 429 217 (default is 1 tick 1ms);
! #X msg 316 245 close;
! #X msg 316 271 open 1;
! #X msg 313 35 baud 10000;
! #X text 382 242 Close Serial port;
! #X msg 310 311 devicename /dev/ttyS1;
! #X text 256 411 Danger !!! you can open every file in your system and
maybe if suid is root damage the system.;
! #X msg 308 12 baud 300;
#X text 3 -10 (C) 1998-2005 IEM Winfried Ritsch GPL (see LICENSE.txt)
;
! #X text 14 388 comment;
! #X obj 84 135 clip 0 255;
! #X obj 87 89 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 8 -262144
! -1 -1 11300 1;
! #X floatatom 111 116 5 0 0 0 - - -;
! #X text 14 69 you can send bytes directly (0-255):;
! #X text 379 271 Open serial port by number;
! #X text 466 307 open the serial port by name;
! #X connect 0 0 12 0;
#X connect 0 0 13 0;
#X connect 1 0 0 0;
#X connect 3 0 0 0;
! #X connect 6 0 0 0;
! #X connect 8 0 0 0;
#X connect 9 0 0 0;
! #X connect 13 0 2 0;
! #X connect 14 0 13 1;
! #X connect 15 0 13 1;
! #X connect 16 0 26 0;
! #X connect 17 0 26 0;
! #X connect 18 0 26 0;
! #X connect 19 0 26 0;
! #X connect 20 0 26 0;
! #X connect 25 0 0 0;
! #X connect 29 0 26 0;
! #X connect 32 0 26 0;
! #X connect 33 0 26 0;
! #X connect 34 0 26 0;
! #X connect 36 0 26 0;
! #X connect 38 0 26 0;
! #X connect 41 0 0 0;
! #X connect 42 0 43 0;
! #X connect 42 0 41 0;
More information about the Pd-cvs
mailing list