Catch dynamically connected serial port

Discussions related to using VirtualBox on Windows hosts.
Post Reply
tY Software
Posts: 15
Joined: 25. Aug 2013, 19:07

Catch dynamically connected serial port

Post by tY Software »

Hi,

the title says all. Is there any way to catch serial port connected while vm is running?

Thanks in advance
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: Catch dynamically connected serial port

Post by mpack »

On what host?

On Windows hosts: No solution that I know of, I'm afraid. I happen to know from personal experience that unplugging/replugging a USB serial port kills host serial apps too, unless they implement special code to detect the port handle being invalidated. Very awkward if you had a background event handler waiting on that handle.

Linux and Mac hosts: for someone else to answer.
jorgensen
Posts: 589
Joined: 20. Oct 2009, 01:22
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows

Re: Catch dynamically connected serial port

Post by jorgensen »

There are various software programs that can handle sharing of a serial port.
Google "serial over ethernet" or "share serial port" - hints 1 2
tY Software
Posts: 15
Joined: 25. Aug 2013, 19:07

Re: Catch dynamically connected serial port

Post by tY Software »

Hi,

Thanks for your help. Unfortunately this doesn't seem to meet my requirements, as I need the aerial port to be displayed and behave exactly the same way it would do in the host.

Yes, I'm talking about Windows hosts. I've got some TeamCity Build Agents on the host which execute unit tests. The application (c#) listenes to WMI events and try to detect a arduino board (in best case by capition, but I needed to change it to ClassGuid, because caption is not displayed the same way it is on the host, but this is no big problem).
But I really need to be able to dynamically plug and unplug the device.

At the moment serial port must be connected before starting the guest. And if it's disconnected while running, this information is not shared with the guest machine.
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: Catch dynamically connected serial port

Post by mpack »

Moved to "Windows Hosts" since the guest is largely irrelevant to your question (virtualization of the serial port works the same way regardless of which guest OS is involved).
tY Software wrote: At the moment serial port must be connected before starting the guest. And if it's disconnected while running, this information is not shared with the guest machine.
In that case, bypassing the virtual RS232 port and accessing it over a network instead might be worth looking at, perhaps such an app might be able to handle plugins/replugs better, and it will certainly remove the requirement to attach the serial port before launching the VM.

Of course, another possibility would be to add a USB filter and detect the Arduino USB device being plugged in. Have the VM grab it directly. In fact that might be more reliable than attempting fast serial comms (current Arduino bootloaders default to 115200bps) over a virtual UART.
tY Software
Posts: 15
Joined: 25. Aug 2013, 19:07

Re: Catch dynamically connected serial port

Post by tY Software »

Hi mpack,

thank you very much for this hint about USB filter! If this works, it would be perfect (because this is exactly the way it will have to work in production environment).
I already tried this some time ago, but it didn't work (maybe caused by an other issue). I'll give it another try.

I wanted to create this thread in "Windows Hosts" anyway. Seems like this was an accident.
Post Reply