Jump to content

USB passthrough for Startech 4-port USB Serial Adapter


Tim Long

Recommended Posts

I have a Startech 4-port USB-to-Serial adapter abd I would like to pass the 4 serial ports through to a Windows 10 VM.

 

The 4 ports show up in the list of USB devices in the VM settings anbd I can select them. Then when I try to start the vm, I get:

 

Quote

Execution error. Operation Failed. Multiple USB devices for 14b0:3410, use to select one

 

A slightly confusing error message. I would appreciate any guidance on wht this means and how I can achieve my goal of passing through the 4 serial ports.

 

Best regards,

Tim Long

Link to comment
5 hours ago, Tim Long said:

I have a Startech 4-port USB-to-Serial adapter abd I would like to pass the 4 serial ports through to a Windows 10 VM.

 

The 4 ports show up in the list of USB devices in the VM settings anbd I can select them. Then when I try to start the vm, I get:

 

 

A slightly confusing error message. I would appreciate any guidance on wht this means and how I can achieve my goal of passing through the 4 serial ports.

 

Best regards,

Tim Long

Within the VM template it connects via vendor and product and doesnt support multiple of the same vendor product.

 

My usb manager plugin supports multiple devices of same vendor product. search usb in CA

  • Like 1
Link to comment

I'm not sure it's not possible; it should be possible if we specify in the source the address bus and device.

Never tried, but something like this:

https://access.redhat.com/solutions/479683

 

host# lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 004: ID 0781:5530 SanDisk Corp. Cruzer                      ## this is the device to pass through

 

    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x0781'/>
        <product id='0x5530'/>
        <address bus='2' device='4'/>
      </source>
      <address type='usb' bus='1' port='2'/>
    </hostdev>

 

so if we have two devices with same product/vendor id, let's say both at bus 2, device 3 and 4, I would try this to have them in the same guest both at bus 1, port 2 and 3:

    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x0781'/>
        <product id='0x5530'/>
        <address bus='2' device='3'/>
      </source>
      <address type='usb' bus='1' port='2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x0781'/>
        <product id='0x5530'/>
        <address bus='2' device='4'/>
      </source>
      <address type='usb' bus='1' port='3'/>
    </hostdev>

 

Edited by ghost82
Link to comment
1 hour ago, SimonF said:

if you unplug and replug in a device it will be allocated a new dev on the bus.

Good to know, thank you!

Without knowing this I have my mice passed through with that additional line and I remember I detached and reattached several times to the same usb port and never had an issue.

Maybe I was only lucky, anyway if one day will stop to work I will know where to check :D

Link to comment
4 minutes ago, ghost82 said:

Good to know, thank you!

Without knowing this I have my mice passed through with that additional line and I remember I detached and reattached several times to the same usb port and never had an issue.

Maybe I was only lucky, anyway if one day will stop to work I will know where to check :D

Do you use more than one of same vendor and product?

Link to comment
15 minutes ago, ghost82 said:

No, only one, in fact I hoped the op would have test it, I wasn't/am not sure it worked or not.

I can try it out for you over the next weekend.

 

I have 3 Cruzers if I unplug one ending in 4410 its initially on 001:007 but then changes to 001:009

 

If you are using Vendor/Prod in the XML it will still be unique and use it for the mapping, I think it will ignore bus and hub. 

 

I use BUS and DEV in my code.

 

function virsh_device_by_bus($action, $vmname, $usbbus, $usbdev)
{
	$usbstr = '';
	if (!empty($usbbus)) 
	{
		$usbbus=ltrim($usbbus, "0");
		$usbdev=ltrim($usbdev, "0") ;
		$usbstr .= "<hostdev mode='subsystem' type='usb'>
	<source>
	<address bus='${usbbus}' device='${usbdev}' />
	</source>
	</hostdev>";
	}
	$filename = '/tmp/libvirthotplugusbbybus'.$vmname.'.xml';
	file_put_contents($filename,$usbstr);
	
	$cmdreturn=shell_exec("/usr/sbin/virsh $action-device '$vmname' '".$filename."' 2>&1");
	usb_manager_log("usb_manager virsh called ".$vmname." ".$usbbus." ".$usbdev." ".$cmdreturn);
	unlink($filename) ;
return $cmdreturn ;
#return shell_exec("/usr/sbin/virsh $action-device '$vmname' '".$filename."' 2>&1");


#echo "Running virsh ${COMMAND} ${DOMAIN} for USB bus=${BUSNUM} device=${DEVNUM}:" >&2
#virsh "${COMMAND}" "${DOMAIN}" /dev/stdin <<END
#<hostdev mode='subsystem' type='usb'>
#  <source>
#    <address bus='${BUSNUM}' device='${DEVNUM}' />
#  </source>
#</hostdev>
#END
}

 

 

 

image.thumb.png.fc07808b0bd845152a0f6a2c66797e66.png

 

root@computenode:~# lsusb 
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1c04:0015 QNAP System Inc. QNAP QNA-UC5G1T USB to 5GbE Adapter
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 004: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 005: ID 1c4f:0016 SiGma Micro USB Keyboard
Bus 001 Device 003: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 007: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 002: ID 048d:04d2 Integrated Technology Express, Inc. UDisk           
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@computenode:~# lsusb -vs 001:007 | grep 4C530000190606214410
  iSerial                 3 4C530000190606214410
root@computenode:~# lsusb 
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1c04:0015 QNAP System Inc. QNAP QNA-UC5G1T USB to 5GbE Adapter
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 004: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 005: ID 1c4f:0016 SiGma Micro USB Keyboard
Bus 001 Device 003: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 009: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 002: ID 048d:04d2 Integrated Technology Express, Inc. UDisk           
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@computenode:~# lsusb -vs 001:009 | grep 4C530000190606214410
  iSerial                 3 4C530000190606214410
root@computenode:~# 

 

  • Thanks 1
Link to comment
On 9/3/2021 at 5:34 PM, ghost82 said:

so if we have two devices with same product/vendor id, let's say both at bus 2, device 3 and 4, I would try this to have them in the same guest both at bus 1, port 2 and 3:

I can confirm this works, but if I unplug the device it will change the Device number and the VM wont find the device. Also after a reboot device may be renumbered.

 

 <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0781'/>
        <product id='0x5567'/>
        <address bus='1' device='22'/>
      </source>
      <alias name='hostdev0'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0781'/>
        <product id='0x5567'/>
        <address bus='1' device='21'/>
      </source>

 

root@computenode:~# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1c04:0015 QNAP System Inc. QNAP QNA-UC5G1T USB to 5GbE Adapter
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 004: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 024: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 023: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 022: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 021: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 020: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 010: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 002: ID 048d:04d2 Integrated Technology Express, Inc. UDisk           
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@computenode:~# 

Unplugin hub with four usb devices 20 thru 24

 

Spoiler

root@computenode:~# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1c04:0015 QNAP System Inc. QNAP QNA-UC5G1T USB to 5GbE Adapter
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 004: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 029: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 028: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 027: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 026: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 025: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 010: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 002: ID 048d:04d2 Integrated Technology Express, Inc. UDisk           
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

image.png.3865d85871f5a7cd43769cd897ee1c4a.png

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...