Solved How to pass a real serial port to bhyve guest?

aragats

Daemon

Reaction score: 701
Messages: 1,618

Using -l com1,/dev/cuau0 parameter with bhyve() doesn't seem to work.
I'm testing this with MS Windows 10 + PuTTY and getting garbage.
Thanks for directions!
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

It look that I have to set the port parameters explicitly in the host:
Code:
stty -f /dev/cuau0 -ixon -ixoff speed 115200
 

usdmatt

Daemon

Reaction score: 602
Messages: 1,543

Interesting to know.

Bit more hassle but if a serial port is a hard requirement, you may also be able to use a pci serial card and pass it to the guest of the host supports vt-d. Obviously requires getting a card, but if it works it would be no different than having physical ports in the guest (theoretically)
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

to use a pci serial card and pass it to the guest
That's a good idea, but so far I didn't have luck with PPT devices: always get "not page aligned" error...
Also, for flexibility a null-modem port nmdm() can be passed to the guest with -l com1,/dev/nmdm0A and then connected with net/socat to a real one:
Code:
socat /dev/cuau0,clocal=1,ispeed=115200,ospeed=115200,raw,echo=0, /dev/nmdm0B,clocal=1,ispeed=115200,ospeed=115200,raw,echo=0
 

usdmatt

Daemon

Reaction score: 602
Messages: 1,543

Ahh, ok. I haven’t used passthrough yet although I’ve heard it can be a bit hit and miss. Was just trying to think of a way of getting a com port into the guest that doesn’t require additional commands on the host before it can be used.
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

I'd prefer to pass through a USB controller ― it's a more universal solution with serial port as a subset. No luck so far...
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

Using -l com1,/dev/cuau0
For me the /dev/cuau* device nodes only seem to work with my cellular modems.

For what you are doing I would start with the /dev/ttyU* device nodes like I use with cu for a serial terminal.
I do have to pass the speed through with -s 115200
 
OP
aragats

aragats

Daemon

Reaction score: 701
Messages: 1,618

You're right, /dev/tty* work for me with direct connections to BBBs etc (I use it every day for that purpose), but in this case namely /dev/cuau0 is perfectly working. Also, I noticed when was playing with net/socat, sometimes the latter doesn't work with /dev/tty* (now I can't tell for sure in what situations).
 
Top