Compare commits
12 commits
3f7af74b31
...
9078fabbd3
| Author | SHA1 | Date | |
|---|---|---|---|
| 9078fabbd3 | |||
|
|
da2e52badc | ||
|
|
c40f42313c | ||
|
|
723deda4a5 | ||
|
|
539521fccc | ||
|
|
452cc52da0 | ||
|
|
a3109e59f1 | ||
|
|
d2bb6cda09 | ||
|
|
acc5469c23 | ||
|
|
80f8dc2fa3 | ||
|
|
6469552ae2 | ||
|
|
4bbbf25b12 |
11 changed files with 72 additions and 39 deletions
|
|
@ -1,3 +1,15 @@
|
|||
---
|
||||
include:
|
||||
- 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
17
.git-ci/version2meta.sh
Executable 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
|
||||
|
||||
15
CHANGES.txt
15
CHANGES.txt
|
|
@ -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
|
||||
|
||||
* fix building with Pd>=0.52
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
© 2005-2012 Hans-Christoph Steiner
|
||||
© 2006-2015 Martin Peach
|
||||
|
|
|
|||
7
Makefile
7
Makefile
|
|
@ -6,6 +6,13 @@ with-bird=no
|
|||
|
||||
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 = \
|
||||
comport-help.pd \
|
||||
comport-meta.pd \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
comport - Pd external for unix/windows to use the serial ports
|
||||
|
||||
(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
|
||||
under Unix devices /dev/ttyS0, /dev/ttyS1, ...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
bird - PD external for unix/windows to use the flock of birds
|
||||
|
||||
(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.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
Date: 16.01.97
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
#N canvas 25 49 420 300 META 1;
|
||||
#X text 13 41 NAME comport;
|
||||
#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;
|
||||
|
|
|
|||
48
comport.c
48
comport.c
|
|
@ -1,7 +1,7 @@
|
|||
/* comport - PD external for unix/windows
|
||||
|
||||
(c) 1998-2005 Winfried Ritsch (see LICENCE.txt)
|
||||
Institute for Electronic Music - Graz
|
||||
iem -- Institute of Electronic Music - Graz
|
||||
|
||||
V 1.0
|
||||
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 allow the user to turn ON input processing (again)
|
||||
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"
|
||||
|
|
@ -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)
|
||||
{
|
||||
int fd;
|
||||
|
|
@ -1362,7 +1339,8 @@ endsendevent:
|
|||
err = write(x->comhandle,(char *)x->x_outbuf, 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*/
|
||||
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_usec = 0;
|
||||
#endif /* NOT _WIN32 */
|
||||
logpost(0, PD_DEBUG, "comport - Pd external for unix/windows\n"
|
||||
"LGPL-2.1+ 1998-2022, Winfried Ritsch and others (see LICENSE.txt)\n"
|
||||
"Institute for Electronic Music - Graz");
|
||||
logpost(0, PD_DEBUG, "comport - access the serial port from within Pd\n"
|
||||
#ifdef VERSION
|
||||
" 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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue