Compare commits

..

No commits in common. "9078fabbd3a1af0e27ad1b90111205342aefba5a" and "3f7af74b31b742d9a8ff623f198afaf9e6a73bb5" have entirely different histories.

11 changed files with 39 additions and 72 deletions

View file

@ -1,15 +1,3 @@
--- ---
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}

View file

@ -1,17 +0,0 @@
#!/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,18 +1,3 @@
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
iem - Institute of Electronic Music and Acoustics Institute for 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,13 +6,6 @@ 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)
iem - Institute of Electronic Music - Graz Institute for 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.
iem -- Institute of Electronic Music and Acoustics Institute for 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)
iem -- Institute of Electronic Music - Graz Institute for 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)
iem -- Institute of Electronic Music - Graz Institute for 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.3; #X text 10 10 VERSION 1.2;
#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)
iem -- Institute of Electronic Music - Graz Institute for 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,11 +26,6 @@ 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"
@ -970,6 +965,34 @@ 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;
@ -1339,8 +1362,7 @@ 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 */
@ -2053,11 +2075,7 @@ 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 - access the serial port from within Pd\n" logpost(0, PD_DEBUG, "comport - Pd external for unix/windows\n"
#ifdef VERSION "LGPL-2.1+ 1998-2022, Winfried Ritsch and others (see LICENSE.txt)\n"
" version : " VERSION "\n" "Institute for Electronic Music - Graz");
#endif
" license : LGPL-2.1+\n"
" copyright: 1998-2024, Winfried Ritsch and others (see LICENSE.txt)\n"
" Institute of Electronic Music - Graz");
} }