Re: serial port question

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 06 Oct 2023 00:37:00 UTC
On 10/5/23 19:28, paul beard wrote:
> Not strictly FreeBSD-based but adjacent, surely…
> 
> I have a 3D printer that has a serial port connection through USB but 
> it's not working through the various apps that obscure the details in 
> the name of "convenience." You know what I mean. I like convenience as 
> much as anyone but sometimes I just have to get on with it. Does anyone 
> have experience in communicating with really simple machines over a 
> serial connection? It's not always easy to ID the serial device but 
> that's a separate problem. Allegedly I can communicate up to 115k but 
> I'll settle for a lot less to send simple commands like M502 or M500.
> 

Right, I've had to hack a good amount of related software to handle the 
BSD-convention of naming serial lines. Unfortunately a lot of them like 
to filter through /dev looking specifically for ttyUSB* and thus, won't 
notice the cuaU* devices that we use. Usually it's as simple as that; 
they'll generally just use termios and it all basically just works if 
you can change the pattern or explicitly specify the /dev/path.

IIRC there's one caveat that they're usually used to the Linux way of 
configuring baud rate and really want a B* constant for the baud rate 
they're trying to set, but we're a little more casual and explicitly 
guarantee in tcsetattr(3) that we're just mapping those constants 1:1 -- 
i.e., some of the constants they use in Linux can just be defined to the 
integer equivalent and they'll likely Just Work(TM).

Thanks,

Kyle Evans