Compare commits

...

12 commits

Author SHA1 Message Date
9078fabbd3 redirected some error msg. to debug log 2025-10-09 23:47:39 +09:00
IOhannes m zmölnig
da2e52badc [ci] call the correct script to inject version 2024-12-16 17:59:30 +01:00
IOhannes m zmölnig
c40f42313c [ci] update version in comport-meta.pd 2024-12-16 17:58:10 +01:00
IOhannes m zmölnig
723deda4a5 [ci] version2meta 2024-12-16 17:47:04 +01:00
IOhannes m zmölnig
539521fccc Bump version in comport-meta to 1.3
Closes: https://git.iem.at/pd/comport/-/issues/12
2024-12-16 17:46:42 +01:00
IOhannes m zmölnig
452cc52da0 parse version information from comport-meta.pd 2024-12-16 17:39:48 +01:00
IOhannes m zmölnig
a3109e59f1 more boilerplate 2024-12-16 17:39:19 +01:00
IOhannes m zmölnig
d2bb6cda09 fix fullname of "iem" 2024-12-16 17:36:52 +01:00
Antoine Rousseau
acc5469c23 update CHANGES.txt and changes-list in comport.c 2024-10-10 15:34:34 +02:00
IOhannes m zmölnig
80f8dc2fa3 Merge remote-tracking branch 'ant1r/lock' 2024-10-09 13:12:03 +02:00
Antoine Rousseau
6469552ae2 update help patch: document [lock( and localize $0-comctl 2024-10-09 12:48:59 +02:00
Antoine Rousseau
4bbbf25b12 on Linux and Mac, allow to lock the device with flock(), if it's already locked elsewhere then close it 2024-10-09 12:48:15 +02:00
11 changed files with 72 additions and 39 deletions

View file

@ -1,3 +1,15 @@
--- ---
include: include:
- https://git.iem.at/pd/iem-ci/raw/main/pd-lib-builder/gitlab-iem.yml - https://git.iem.at/pd/iem-ci/raw/main/pd-lib-builder/gitlab-iem.yml
version:
image: alpine:latest
stage: prepare
script:
- apk add git
- .git-ci/version2meta.sh
artifacts:
paths:
- comport-meta.pd
when: always
name: ${CI_JOB_NAME}

17
.git-ci/version2meta.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
metafile="comport-meta.pd"
test -e "${metafile}" || exit 1
version="$1"
if [ "${version}" = "" ]; then
version=$(git describe 2>/dev/null)
fi
version="${version#v}"
if [ "${version}" != "" ]; then
sed -e "s|^\(#X text [0-9+-]* [0-9+-]* VERSION\) .*;|\1 ${version};|" -i.bak "${metafile}"
rm -fv "${metafile}.bak"
fi

View file

@ -1,3 +1,18 @@
1.3 - 2024-10-10
* update pd-lib-builder
* extend valid baudrates
* negative port-numbers at creation time indicate not-to-open
* help patch update
* allow to query only USB devices or ports
(reduce risks of hanging when trying to open other types of device)
* allow to lock the opened device, to avoid conflicts with other comports
1.2 - 2022-03-21 1.2 - 2022-03-21
* fix building with Pd>=0.52 * fix building with Pd>=0.52

View file

@ -1,6 +1,6 @@
comport - PD External for the serial Ports comport - PD External for the serial Ports
Institute for Electronic Music and Acoustics iem - Institute of Electronic Music and Acoustics
Copyright (C) 1998-2005 Winfried Ritsch Copyright (C) 1998-2005 Winfried Ritsch
© 2005-2012 Hans-Christoph Steiner © 2005-2012 Hans-Christoph Steiner
© 2006-2015 Martin Peach © 2006-2015 Martin Peach

View file

@ -6,6 +6,13 @@ with-bird=no
class.sources = comport.c class.sources = comport.c
comport.version := $(shell sed -n \
's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' \
comport-meta.pd)
cflags = -DVERSION='"$(comport.version)"'
datafiles = \ datafiles = \
comport-help.pd \ comport-help.pd \
comport-meta.pd \ comport-meta.pd \

View file

@ -1,7 +1,7 @@
comport - Pd external for unix/windows to use the serial ports comport - Pd external for unix/windows to use the serial ports
(c) 1998-2005 Winfried Ritsch (see LICENCE.txt) (c) 1998-2005 Winfried Ritsch (see LICENCE.txt)
Institute for Electronic Music - Graz iem - Institute of Electronic Music - Graz
on Windows the COM0, COM1, ... are used and on Windows the COM0, COM1, ... are used and
under Unix devices /dev/ttyS0, /dev/ttyS1, ... under Unix devices /dev/ttyS0, /dev/ttyS1, ...

View file

@ -1,6 +1,6 @@
bird - PD External for interfacing the flock of birds tracker. bird - PD External for interfacing the flock of birds tracker.
Institute for Electronic Music and Acoustics iem -- Institute of Electronic Music and Acoustics
Copyright (C) 1998-2005 Winfried Ritsch Copyright (C) 1998-2005 Winfried Ritsch

View file

@ -1,7 +1,7 @@
bird - PD external for unix/windows to use the flock of birds bird - PD external for unix/windows to use the flock of birds
(c) 1998-2005 Winfried Ritsch (see LICENCE.txt) (c) 1998-2005 Winfried Ritsch (see LICENCE.txt)
Institute for Electronic Music - Graz iem -- Institute of Electronic Music - Graz
the external comport is also needed for interfacing. the external comport is also needed for interfacing.

View file

@ -5,7 +5,7 @@
Date: 16.01.97 Date: 16.01.97
Author: Winfried Ritsch (see LICENCE.txt) Author: Winfried Ritsch (see LICENCE.txt)
Institute for Electronic Music - Graz iem -- Institute of Electronic Music - Graz
Desc.: put the object in a correct parse state and send commands Desc.: put the object in a correct parse state and send commands

View file

@ -2,5 +2,5 @@
#N canvas 25 49 420 300 META 1; #N canvas 25 49 420 300 META 1;
#X text 13 41 NAME comport; #X text 13 41 NAME comport;
#X text 10 25 AUTHOR Winfried Ritsch and others; #X text 10 25 AUTHOR Winfried Ritsch and others;
#X text 10 10 VERSION 1.2; #X text 10 10 VERSION 1.3;
#X restore 10 10 pd META; #X restore 10 10 pd META;

View file

@ -1,7 +1,7 @@
/* comport - PD external for unix/windows /* comport - PD external for unix/windows
(c) 1998-2005 Winfried Ritsch (see LICENCE.txt) (c) 1998-2005 Winfried Ritsch (see LICENCE.txt)
Institute for Electronic Music - Graz iem -- Institute of Electronic Music - Graz
V 1.0 V 1.0
MP 20060603 memset and memcpy arguments were backwards for Windows version. close_serial doesn't crash now. MP 20060603 memset and memcpy arguments were backwards for Windows version. close_serial doesn't crash now.
@ -26,6 +26,11 @@ 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 JZ 20210321 allow the user to specify a device pattern as creation argument
JZ 20240926 extend valid baudrates
JZ 20240926 negative port-numbers at creation time indicate not-to-open
AR 20241008 allow to query only USB devices or ports
AR 20241008 allow to lock the opened device (Linux / MacOS)
*/ */
#include "m_pd.h" #include "m_pd.h"
@ -965,34 +970,6 @@ static void check_lock(t_comport *x)
} }
} }
#if 0
t_bool check_file_availability(const char *device_name)
{
FILE *fp;
int status;
char buffer[256];
snprintf(buffer, sizeof(buffer), "fuser %s", device_name);
fp = popen(buffer, "r");
if (fp == NULL) return 0;
/*while (fgets(buffer, sizeof(buffer), fp) != NULL)
{
//printf("%s", buffer);
}*/
status = pclose(fp);
if (status == -1) {
/* Error reported by pclose() */
} else {
/* Use macros described under wait() to inspect `status' in order
to determine success/failure of command executed by popen() */
}
return 1;
}
#endif
static int open_serial(unsigned int com_num, t_comport *x) static int open_serial(unsigned int com_num, t_comport *x)
{ {
int fd; int fd;
@ -1362,7 +1339,8 @@ endsendevent:
err = write(x->comhandle,(char *)x->x_outbuf, x->x_outbuf_wr_index); err = write(x->comhandle,(char *)x->x_outbuf, x->x_outbuf_wr_index);
if (err != x->x_outbuf_wr_index) if (err != x->x_outbuf_wr_index)
{ {
pd_error(x,"[comport]: Write failed for %d bytes, error is %d",err,errno); //pd_error(x,"[comport]: Write failed for %d bytes, error is %d",err,errno);
logpost(x,PD_DEBUG,"[comport]: Write failed for %d bytes, error is %d",err,errno);
} }
#endif /*_WIN32*/ #endif /*_WIN32*/
x->x_outbuf_wr_index = 0; /* for now we just drop anything that didn't send */ x->x_outbuf_wr_index = 0; /* for now we just drop anything that didn't send */
@ -2075,7 +2053,11 @@ void comport_setup(void)
null_tv.tv_sec = 0; /* no wait */ null_tv.tv_sec = 0; /* no wait */
null_tv.tv_usec = 0; null_tv.tv_usec = 0;
#endif /* NOT _WIN32 */ #endif /* NOT _WIN32 */
logpost(0, PD_DEBUG, "comport - Pd external for unix/windows\n" logpost(0, PD_DEBUG, "comport - access the serial port from within Pd\n"
"LGPL-2.1+ 1998-2022, Winfried Ritsch and others (see LICENSE.txt)\n" #ifdef VERSION
"Institute for Electronic Music - Graz"); " version : " VERSION "\n"
#endif
" license : LGPL-2.1+\n"
" copyright: 1998-2024, Winfried Ritsch and others (see LICENSE.txt)\n"
" Institute of Electronic Music - Graz");
} }