npat-efault/picocom

FreeBSB: Manual controlling rts and dtr won't work

Closed this issue · 7 comments

As I tested with my FreeBSD 11 installation, the current implementation in term.c via tcsetattr() won't properly. E.g. trying C+a+p results in:

*** pulse DTR ***
*** FAILED

C+a+t always prints:

*** DTR: up ***

and C+a+g always:

*** RTS: down ***

I'd tried out the alternate ioctl() which is currently in use for Linux and macOS and this also works for FreeBSD. So the fix seems as simple as just changing some #if by adding defined(__FreeBSD__).

I'll also test the term_get_mctl() implementation about this.

I'll wait for #77 / #79 before providing a PR, because it conflicted elseware.

Merged previous PRs, thanks... Please try to keep source code line-lenghts to 80 chars or less (for conformity with the rest of the code)...

It is possible that commit 59fc43e fixes the issue of pulse-DTR not working on FreeBSD with the tcsetattr() method. Anyway, using the respective ioctls (instead of temporarily setting the baudrate to zero) is always preferable, since it allows the pulse-DTR as well as the toggle-DTR command to work reliably. The tcsetattr() method is only a fallback for systems we do not know or cannot use the respective ioctls.

@JoeMerten If you find some time, without it being a priority, check if this is the case. That is: on FreeBsd, temporarily #undef USE_IOCTL in term.c, recompile, and try to use the pulse-DTR (C-a, C-p) command.

Ok, I'll do the check within the next days, just to improve our knowledge about this and comment the result here.

Yes, that's the point. No hurry...

Tested with #undef USE_IOCTL.

On my linux, [C-p] works but pulses both dtr and rts.

Tested on FreeBsd 11 (native installation, no VM), I got *** FAILED. Tried both Ftdi and Prolific adapters with the same result.

Yes, on Linux this is correct...

I guess the BSD drivers are buggy in this respect...

(A very superficial browse of the code, seems to verify this...)

Anyway, there's nothing we can do about it...