Error accessing /dev/ttyp0

Discussions related to using VirtualBox on Linux hosts.
Post Reply
cryolithic
Posts: 8
Joined: 7. Oct 2009, 20:43
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP, Ubuntu

Error accessing /dev/ttyp0

Post by cryolithic »

Running VirtualBox (non OSE) 3.0.8 r53138
I'm trying to get the com port in the guest os to access the pty slave ttyp0. I get the error Ioctl failed for serial host device '/dev/ttyp0' (VERR_INVALID_PARAMETER)

I can access the device locally with minicom, and it connects locally just fine. Permissions are set fine on the device for VirtualBox to access. Unfortunately there's not much else I can seem to find for information out there.

Any suggestions?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Error accessing /dev/ttyp0

Post by Perryg »

The only way to get access to the Com port is to set VBox (guest settings for ports) to use it and then set the guest to use the VBox adapter. Then use helper tools.
See 3.7.8. Serial ports of the users guide for the information on how to do this.
cryolithic
Posts: 8
Joined: 7. Oct 2009, 20:43
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP, Ubuntu

Re: Error accessing /dev/ttyp0

Post by cryolithic »

Maybe I'm missing something, or perhaps I wasn't clear enough?

In the settings for the VM, I have serial port 1 enabled, Port Number is COM1, port mode is Host Device, Port/File path is /dev/ttyp0 (this is a slave port under linux, with pttyp0 being the master, used for looping back to the host machine)

using that port (ttyp0) on the host machine with minicom, it connects as expected, so the device is setup correctly on the host. When setting the above values in the VM config, I get the error I listed above.

According to 3.7.8.2: You can connect the virtual serial port to a physical serial port on your host. (On a Windows host, this will be a name like COM1; on Linux or OpenSolaris hosts, it will be a device node like /dev/ttyS0). VirtualBox will then simply redirect all data received from and sent to the virtual serial port to the physical device.

This appears to be what I've done, yet VBox seems to be unable to access it.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Error accessing /dev/ttyp0

Post by Perryg »

Here is what I do.
Host=Ubuntu, Guest=Debian
Screenshot shows what I use to access it and dmesg shows [ 1.140102] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16450
Attachments
serial.jpg
serial.jpg (53.43 KiB) Viewed 3681 times
cryolithic
Posts: 8
Joined: 7. Oct 2009, 20:43
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP, Ubuntu

Re: Error accessing /dev/ttyp0

Post by cryolithic »

yup, that's how mine is set, but using ttyp0 rather than S0 as this machine doesn't have a real serial port. Basically I'm writing software that will communicate via serial port, and to test I'm connecting from the VM to the host via the slave/master pair.
cryolithic
Posts: 8
Joined: 7. Oct 2009, 20:43
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP, Ubuntu

Re: Error accessing /dev/ttyp0

Post by cryolithic »

absolute worst case scenario, I can create another vm, and have them connect to each other via piped ports, but that seems like it should be unnecessary.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Error accessing /dev/ttyp0

Post by Perryg »

Well I am not sure but I suspect the ttyP0 is what is confusing VBox. Native it will look for a real serial port. since it is going to test the hardware to see that it is there. Then there is the socat route to try but you read about that in the users guide so I don't know what else to tell you.
cryolithic
Posts: 8
Joined: 7. Oct 2009, 20:43
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP, Ubuntu

Re: Error accessing /dev/ttyp0

Post by cryolithic »

Actually, I completely missed the sentence with socat, giving that a shot. Though honestly, I still stand by that it should work with ttyp0 ;)
Post Reply