[PD] comport & port 0 ?

IOhannes m zmölnig zmoelnig at iem.at
Fri Aug 26 00:31:50 CEST 2016


On 08/26/2016 12:00 AM, rolfm at dds.nl wrote:
> hi,
> 
> in another thread i explained that my Raspberry situates the Arduino on
> port 0.
> 
> when comport is defined like [comport 0 115200]
> there's a message in the Pd console:
> port number out of range (1-99).
> 
> but comport will connect with port 0.
> and it seems to work, at least the sending from Pd to the Arduino.
> 
> my question: can i trust it?

trust what?

on w32 all comports are available as COM%d (e.g. COM1,COM2,...)

on unix things are a bit different: a serial device is (like any other
device) just a file, usually one that goes by the name /dev/ttyS* or
similar.
since there is no "natural" numbering of serial devices (unlike on w32),
comport does a little trick: when given a numeric device specification
(e.g. 3), it will enumerate some known device names (/dev/ttyA*,
/dev/ttyS*, /dev/ttyU*) and the first device in this enumeration will
get the number 0 assigned (so device '3' is the 4th device found by this
method).

so you cannot trust that '0' is the device that you used to connect your
Arduino board to.

> because i suppose the message means that the code is written for 1-99.

well, no - not necessarily.
i guess the reason why it mentions 1-99, is that the error method was
copied between w32 and un*x implementation.
(otoh, skimming through the code¹, it seems that this error message only
gets triggered in the w32 code section, so i wonder how you manage to
get it on the raspi).

fmgdsar
IOhannes

¹ pd-svn rev.17625

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160826/25ff0475/attachment.sig>


More information about the Pd-list mailing list