Connect virtual serial port to physical serial port

Discussions related to using VirtualBox on Linux hosts.
stagnette
Posts: 15
Joined: 27. Apr 2016, 15:30

Re: Connect virtual serial port to physical serial port

Post by stagnette »

Yes, that's it. I can wait for Don as well.

But if there is another way to install Windows, using virtualisation or not, I'm in!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Connect virtual serial port to physical serial port

Post by mpack »

Configuring a serial port in the guest should be quite straightforward. You enable it in the VM settings, the main thing you need to provide is the name of the host port (e.g. "/dev/tty0" or whatever your Linux distro calls it).

Beyond that, I'm unsure of what your question is. I assume you have some kind of USB-RS232 adapter and want to use it to talk to the device. Unfortunately RS232 is 1960s tech and very far from plug and play. You kind of need to know how to use it. What year does the device come from? How about a photo of the connector it has on it, and do you still have the user manual for the device?
stagnette
Posts: 15
Joined: 27. Apr 2016, 15:30

Re: Connect virtual serial port to physical serial port

Post by stagnette »

The thing is that I don't have a clue about how to know the name of the host port, and what "port mode" I have to choose.
Here is a photo of the port (https://framadrive.org/index.php/s/X8uuvCgrqt9V2qS) I want to connect to the computer (via the proper cable). I think the device dates back to the 1990s. I do have the user manual but they are in French so I don't think it could help you helping me. It only says that I have to use COM1 and PORT A.

Documentation:
User manual: https://framadrive.org/index.php/s/UJPuzV1joZfXnQW
Serial Port: https://framadrive.org/index.php/s/TKufkBaYGxkkXOQ
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Connect virtual serial port to physical serial port

Post by mpack »

stagnette wrote:The thing is that I don't have a clue about how to know the name of the host port, and what "port mode" I have to choose.
I can't tell you how to find out what ports are available on your host - I don't use Linux hosts. Frankly, tuition on how to operate your host OS is beyond my remit. I can show you how I do it on my XP host, which is that I open the device manager, find the "Ports" branch, and note the name of any available serial ports.
Image1.png
Image1.png (41.25 KiB) Viewed 2515 times
Looking at your photograph, I see two 9 pin male D connectors. That's a bad sign, as normally the PC (DTE) end has a male connector, the other (DCE) end has a female connector, and you would use a "straight through" cable to connect the two ends (pin 1 to pin 1, pin 2 to pin 2 etc). Looking at the port description from the user manual it looks like the device is wired as a DCE but only has the wrong gender connector. Hence you'll need a straight though 9 pin cable and a "gender bender" for the device end of the cable.

In the VM settings the "Port Mode" should be "Host Device", and the "Path/Address" should be set to the name of whatever host serial port you want the VM to use, e.g. "/dev/ttyS0". Tick the enable checkbox then leave all the other settings alone. The port will be seen as "COM1" inside a Windows guest OS.

DTE = Data Terminal Equipment. In the 1960s this was a terminal or teletype, but these days its the PC.
DCE = Data Communications Equipment - a modem or other device that the terminal communicates through or with.
stagnette
Posts: 15
Joined: 27. Apr 2016, 15:30

Re: Connect virtual serial port to physical serial port

Post by stagnette »

The path seems to be /dev/ttyS0 but Virtualbox reacts as if I didn't have the permissions needed... (https://framadrive.org/index.php/s/iK2AADnrwZvnQq9)

Concerning the cable, I already have the right one!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Connect virtual serial port to physical serial port

Post by Perryg »

As the warning shows you must have the group added to your user to be able to use it. IIRC that would be the dialout group.

Code: Select all

usermod -aG dialout <USER_NAME>
But look it up to be sure.
stagnette
Posts: 15
Joined: 27. Apr 2016, 15:30

Re: Connect virtual serial port to physical serial port

Post by stagnette »

It returns "Permission denied"...
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Connect virtual serial port to physical serial port

Post by Perryg »

Permissions do not change until you log out or reboot.
stagnette
Posts: 15
Joined: 27. Apr 2016, 15:30

Re: Connect virtual serial port to physical serial port

Post by stagnette »

I know, and I already did it (after writing "sudo usermod -a -G vboxusers manivelles"). But maybe there is something else to do? (I'm quite a novice)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Connect virtual serial port to physical serial port

Post by Perryg »

Well this error is host based and you should travel to the forum of the host OS to get this part sorted out. Like I said I don't have/use serial ports these days and the dialout group may not be the only one you need. Perhaps the tty group as well but not sure. Once you resolve the permissions it should work as far as I remember. But don't just add groups willy-nilly. It can cause security issues and it would be better to do it right the first time.
Post Reply