From 5f1f1ef3e15f5d14c48960fa33cfd1d4c65cd26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Mon, 21 Mar 2022 10:58:54 +0100 Subject: [PATCH] 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 --- comport.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/comport.c b/comport.c index 81d95e0..9d78c6b 100644 --- a/comport.c +++ b/comport.c @@ -25,6 +25,7 @@ JZ 20210321 purge error() in favour of pd_error() JZ 20210321 cleanup t_comport struct 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 specify a device pattern as creation argument */ #include "m_pd.h" @@ -1351,10 +1352,14 @@ allows COM port numbers to be specified. */ serial_device_prefix = "/dev/tty[ASU]*"; #endif /* __linux__ */ - if(argc > 0 && argv->a_type == A_FLOAT) - com_num = atom_getfloatarg(0,argc,argv); + if(argc > 0) { + 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) - ibaud = atom_getfloatarg(1,argc,argv); + ibaud = atom_getfloatarg(1, argc, argv); /* Open the Comport for RD and WR and get a handle */ /* this line should use a real serial device */