Allow to specify the serial_device_prefix as the first arg to [comport]

this probably makes patches non-cross-platform.

Closes: https://git.iem.at/pd/comport/-/issues/1
This commit is contained in:
IOhannes m zmölnig 2022-03-21 10:58:54 +01:00
parent e093e5c1f7
commit 5f1f1ef3e1

View file

@ -25,6 +25,7 @@ JZ 20210321 purge error() in favour of pd_error()
JZ 20210321 cleanup t_comport struct JZ 20210321 cleanup t_comport struct
JZ 20210321 use (int) instead of t_float for members where applicable JZ 20210321 use (int) instead of t_float for members where applicable
JZ 20210321 allow the user to turn ON input processing (again) JZ 20210321 allow the user to turn ON input processing (again)
JZ 20210321 allow the user to specify a device pattern as creation argument
*/ */
#include "m_pd.h" #include "m_pd.h"
@ -1351,10 +1352,14 @@ allows COM port numbers to be specified. */
serial_device_prefix = "/dev/tty[ASU]*"; serial_device_prefix = "/dev/tty[ASU]*";
#endif /* __linux__ */ #endif /* __linux__ */
if(argc > 0 && argv->a_type == A_FLOAT) if(argc > 0) {
com_num = atom_getfloatarg(0,argc,argv); if (argv->a_type == A_FLOAT)
com_num = atom_getfloatarg(0, argc, argv);
else
serial_device_prefix = atom_getsymbol(argv)->s_name;
}
if(argc > 1) if(argc > 1)
ibaud = atom_getfloatarg(1,argc,argv); ibaud = atom_getfloatarg(1, argc, argv);
/* Open the Comport for RD and WR and get a handle */ /* Open the Comport for RD and WR and get a handle */
/* this line should use a real serial device */ /* this line should use a real serial device */