Dont fail if no serial device, but dont open.
svn path=/trunk/externals/iem/comport/; revision=2758
This commit is contained in:
parent
00ec6a88ca
commit
c4ca15f444
1 changed files with 14 additions and 15 deletions
|
|
@ -752,29 +752,31 @@ static void *comport_new(t_floatarg comnr, t_floatarg fbaud) {
|
||||||
test.baud = fbaud;
|
test.baud = fbaud;
|
||||||
fd = open_serial(com_nr,&test);
|
fd = open_serial(com_nr,&test);
|
||||||
|
|
||||||
if(fd == INVALID_HANDLE_VALUE ){
|
|
||||||
/* postings in open routine */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now nothing really bad could happen so we create the class */
|
/* Now nothing really bad could happen so we create the class */
|
||||||
|
|
||||||
x = (t_comport *)pd_new(comport_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->comport = com_nr;
|
||||||
x->baud = test.baud;
|
x->baud = test.baud;
|
||||||
x->comhandle = fd; /* holds the comport handle */
|
x->comhandle = fd; /* holds the comport handle */
|
||||||
|
|
||||||
#ifdef NT
|
#ifdef NT
|
||||||
|
|
||||||
memcpy(&(test.dcb_old),&(x->dcb_old),sizeof(DCB)); // save the old com config
|
memcpy(&(test.dcb_old),&(x->dcb_old),sizeof(DCB)); // save the old com config
|
||||||
memcpy(&(test.dcb),&(x->dcb),sizeof(DCB)); // for the new com config
|
memcpy(&(test.dcb),&(x->dcb),sizeof(DCB)); // for the new com config
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* save the old com and new com config */
|
/* save the old com and new com config */
|
||||||
bcopy(&(test.oldcom_termio),&(x->oldcom_termio),sizeof(struct termios));
|
bcopy(&(test.oldcom_termio),&(x->oldcom_termio),sizeof(struct termios));
|
||||||
bcopy(&(test.com_termio),&(x->com_termio),sizeof(struct termios));
|
bcopy(&(test.com_termio),&(x->com_termio),sizeof(struct termios));
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
x->rxerrors = 0; /* holds the rx line errors */
|
x->rxerrors = 0; /* holds the rx line errors */
|
||||||
|
|
||||||
|
|
@ -944,12 +946,9 @@ void comport_setup(void)
|
||||||
/*
|
/*
|
||||||
class_addbang(comport_class, comport_bang
|
class_addbang(comport_class, comport_bang
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class_addmethod(comport_class, (t_method)comport_baud, gensym("baud"),
|
class_addmethod(comport_class, (t_method)comport_baud, gensym("baud"),
|
||||||
A_FLOAT, 0);
|
A_FLOAT, 0);
|
||||||
|
|
||||||
|
|
||||||
class_addmethod(comport_class, (t_method)comport_bits, gensym("bits"),
|
class_addmethod(comport_class, (t_method)comport_bits, gensym("bits"),
|
||||||
A_FLOAT, 0);
|
A_FLOAT, 0);
|
||||||
class_addmethod(comport_class, (t_method)comport_stopbit, gensym("stopbit"),
|
class_addmethod(comport_class, (t_method)comport_stopbit, gensym("stopbit"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue