Page 1 of 1

Pass through of USB Serial device

Posted: 28. Oct 2015, 10:40
by geirgp
I have a USB Z-Wave stick from Sigma Designs that I want to use in a linux guest (debian).

In the OSX System Report it shows up in the USB Device Tree as "Communication Device":

Code: Select all

Communication Device:

  Product ID:	0x0200
  Vendor ID:	0x0658  (Sigma Designs, Inc.)
  Version:	0.00
  Speed:	Up to 12 Mb/sec
  Location ID:	0x14500000 / 28
  Current Available (mA):	500
  Current Required (mA):	100
I've also found that it creates a serial device at /dev/tty.usbmodem1411 which I've confirmed works by using it in z-wave applications.

I am however not able to pass the usb device through to my debian guest. I've tried both adding a USB filter for "Unknown device 0658:0200" and empty filter (which should match any device?).

In the linux guest I get the same output from lsusb -command with/without these filters active:

Code: Select all

root@core /dev# lsusb
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Any ideas?

Re: Pass through of USB Serial device

Posted: 28. Oct 2015, 10:52
by geirgp
Could it be that osx has already "grabbed" the usb device when it exposed it as a serial device? I remember having a similar issue with an older version of Virtualbox on a Linux host which auto-mounted a usb hard drive that I wanted to pass through. Back then I simply solved it by un-mounting the usb hard drive on the host. I don't know how to do the same for a serial device in osx though..

Re: Pass through of USB Serial device

Posted: 28. Oct 2015, 11:42
by geirgp
Found the virtualbox log file, and think it just confirmed my suspicion

Code: Select all

01:34:13.102331 nspr-6   USB: Device 'p=0x0200;v=0x0658;s=0x000033424e414afe;l=0x14100000' is being used by another process
As a workaround I tried passing through the serial port instead:

Code: Select all

Port Number: COM1 IRQ:4 I/O Port: 0x3F8
Post Mode: Host Device
Path/address: /dev/tty.usbmodem1411

But not much luck there either: The VM won't start, doesn't even show the VBox "bios", just stalls at "Starting virtual machine..". Log output:

Code: Select all

01:37:02.205779 nspr-3   Load [/Applications/VirtualBox.app/Contents/MacOS/ExtensionPacks/Oracle_VM_VirtualBox_Extension_Pack/darwin.amd64/VBoxHostWebcam.dylib] rc VINF_SUCCESS
01:37:02.291755 nspr-3   ERROR [COM]: aRC=VBOX_E_IPRT_ERROR (0x80bb0005) aIID={f30138d4-e5ea-4b3a-8858-a059de4c93fd} aComponent={SessionMachine} aText={Saved screenshot data is not available (VERR_NOT_SUPPORTED)}, preserve=false aResultDetail=0
I actually had to kill the VM process, nothing happened.


And just for the record:

Host
OSX 10.10.2
VirtualBox 5.0.8
VirtualBox Extention Pack 5.0.8r103449

Guest
Debian Jessie
VirtualBox Guest Addition

Re: Pass through of USB Serial device

Posted: 28. Oct 2015, 12:25
by loukingjr
I assume you know this but in case, USB filters are designed to capture USB devices before the host sees them. Which means a device cannt be plugged in until after the guest is running. It also means the device has to be unplugged once the guest is shutdown before it can be used again.

That being said, not all USB devices work in a virtual environment.

Re: Pass through of USB Serial device

Posted: 28. Oct 2015, 12:35
by geirgp
So I've managed to find a workaround by using the ser2net application.

1. First I installed ser2net and added this line to vi /usr/local/etc/ser2net.conf

Code: Select all

3001:raw:0:/dev/tty.usbmodem1411:115200 NONE 1STOPBIT LOCAL
make sure port 3001 is not in use, or select another one.

(find your serial device by executing "ls /dev/tty.*" - it changes id depending on what usb port I plug it into)

2. start ser2net

Code: Select all

/usr/local/opt/ser2net/sbin/ser2net -u
Note: without the -u flag it will have problems creating a lock file, even though running as root.

3. Configure serial port in VirtualBox
USB > Serial Ports
Check "Enable serial port"
Port Number: COM1
Port Mode: TCP
Path/address: localhost:3001

4. Start up the VM
/dev/tty.usbmodem1411 on host is now available as /dev/ttyS0 on the guest.

Re: Pass through of USB Serial device

Posted: 28. Oct 2015, 12:46
by michaln
You could possibly also prevent the host driver from loading. What is it, anyway? As in what does dmesg show on the host after you plug in the device?

Re: Pass through of USB Serial device

Posted: 29. Oct 2015, 00:04
by geirgp
dmesg output:

Code: Select all

0 [Level 5] [com.apple.message.domain com.apple.commssw.cdc.device] [com.apple.message.signature AppleUSBCDCACMData] [com.apple.message.signature2 0x658] [com.apple.message.signature3 0x200]
AppleUSBCDCACMData: Version number - 4.2.2b5, Input buffers 8, Output buffers 16
AppleUSBCDC: Version number - 4.2.2b5
not sure on how to unload that though, will have to read up a bit..

Re: Pass through of USB Serial device

Posted: 12. Sep 2017, 22:00
by Kelton
Hey everyone, I just created an Oracle account so I could respond to this thread because I think I encountered the same problem as geirgp but I was able to figure it out. I'm using a Cypress CY7C64225 based USB to serial adapter, but I'm guessing that this would apply to other cases as well.

So initially I tried to pass through the serial port with Path/Address: /dev/tty.usbmodem641
but this was crashing VirtualBox just like geirgp experienced.

I tried using a tool called "CoolTerm" to be sure that the serial port was working properly in Mac OS at all. When I opened CoolTerm, I found that it was not using /dev/tty.usbmodem641, but instead /dev/cu.usbmodem641.

After entering this new device path in the VirtualBox serial port configuration, the virtual machine started right up and the USB serial adapter worked perfectly.

Re: Pass through of USB Serial device

Posted: 12. Sep 2017, 22:57
by socratis
Thank you for registering just to post this, it might help others in the future!