xcp
xcp copied to clipboard
pusb-list not listing z-wave smarthome dongle
Z-wave dongle not detected by xe pusb-list, but is listed properly with lsusb as shown below.
Bus 003 Device 023: ID 0658:0200 Sigma Designs, Inc.
I need to pass this device through to a virtual machine running on the host.
You can get it to show up in 'xe pusb-list' by modifying the file located at /etc/xensource/usb-policy.conf and allowing it access (I dont remember off hand which device I had to allow....I believe it was one of the CDC devices).
I have not been able to get it to show up in my vm though. I see passthrough enabled and it attached to my vm, but no /dev/ttyACM* devices show up in the vm. I also tried allowing all devices in the usb-policy.conf file but still did not show up in my vm.
Tried this with 2 different Z-Wave usb sticks: Aeotec Z-Stick Gen 5, and Nortek HUSBZ-1 with the same results as above. Shows in xe pusb-list, but does not show up in guest vm. Both seem to use the Sigma Designs chips.
I have an issue with this type of usb device as well. It is a HUSBZB-1 Device manufacture link: https://www.nortekcontrol.com/products/2gig/husbzb-1-gocontrol-quickstick-combo/ The device appears on the host correctly. I can see the usb device in XCP Center and attach it to a VM, but the usb device is never available in the VM OS. I have tried Ubuntu 18 and Windows Server 2019. I have also tested this usb device with two different host hardware platforms, one is a home built PC and the other is a newish Dell server R610 I believe. Both hosts can identify the device and offer it in XCP Center for pass through, but neither hosts can successfully allow a VM to use the device. I also have a usb tv tuner that does pass through to a VM just fine, so I don't think it is the steps I'm taking causing the issue.
I have tried to edit the usb-policy.conf file to allow the device specifically and I also tried commenting out all of the deny statements.
Any advice would be appreciated.
Output of: lsusb -v -d 10c4:8a2a
Bus 001 Device 002: ID 10c4:8a2a Cygnal Integrated Products, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x10c4 Cygnal Integrated Products, Inc.
idProduct 0x8a2a
bcdDevice 1.00
iManufacturer 1 Silicon Labs
iProduct 2 HubZ Smart Home Controller
iSerial 5 61200BB1
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 55
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 3 HubZ Z-Wave Com Port
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 4 HubZ ZigBee Com Port
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
Contents of usb-policy.conf
# When you change this file, run 'xe pusb-scan' to confirm
# the file can be parsed correctly.
#
# Syntax is an ordered list of case insensitive rules where # is line comment
# and each rule is (ALLOW | DENY) : ( match )*
# and each match is (class|subclass|prot|vid|pid|rel) = hex-number
# Maximum hex value for class/subclass/prot is FF, and for vid/pid/rel is FFFF
#
# USB Hubs (class 09) are always denied, independently of the rules in this file
ALLOW:vid=10c4 pid=8a2a class=00
#DENY: vid=17e9 # All DisplayLink USB displays
#DENY: class=02 # Communications and CDC-Control
ALLOW:vid=056a pid=0315 class=03 # Wacom Intuos tablet
ALLOW:vid=056a pid=0314 class=03 # Wacom Intuos tablet
ALLOW:vid=056a pid=00fb class=03 # Wacom DTU tablet
#DENY: class=03 subclass=01 prot=01 # HID Boot keyboards
#DENY: class=03 subclass=01 prot=02 # HID Boot mice
#DENY: class=0a # CDC-Data
#DENY: class=0b # Smartcard
#DENY: class=e0 # Wireless controller
#DENY: class=ef subclass=04 # Miscellaneous network devices
ALLOW: # Otherwise allow everything else
First image of the usb device showing available and attached to the VM.
Second image showing no sign of the usb device in the VM.
I wanted to follow up with this. I worked around this issue by purchasing a pci USB card for the host and passing the entire card through to the VM. I could never get it to work by just passing the USB stick through and sharing the stick over the network from an rpi seemed a little unreliable. Hope this helps others!
thanks for the feedback!
Seems I am having the same issue as mrgoose2. I followed all the same steps. The two lines have been uncommented in the policy located at /etc/xensource/usb-policy.conf.
#DENY: class=02 # Communications and CDC-Control. #DENY: class=0a # CDC-Data
The device shows when running this command 'xe pusb-list' as readonly? (RO)
[root@hpe-xenserver ~]# xe pusb-list uuid ( RO) : e4a31443-22f6-97c8-82b3-d47696e350b9 path ( RO): 1-7 vendor-id ( RO): 0658 vendor-desc ( RO): Sigma Designs, Inc. product-id ( RO): 0200 product-desc ( RO): serial ( RO): version ( RO): 2.00 description ( RO): Sigma Designs, Inc.
Using the XCP-ng center, I have allowed passthrough on the host and attached it to a Hassio ubuntu vm. It shows in the graphical windows as allowed however no /dev/ttyACM* devices show up in the vm when using ls /dev/tty* at the command line.
I am having the same issue with the Nortek HUSBZB-1. I disabled denying those two devices classes, and I added the USB device to a group and that group to the VM, but the VM doesn't see it at all. I also have a Teensy 3.0 plugged in, and I was able to set it up the same way and the guest VM can itneract with it just fine. In the host, the Nortek shows up as /dev/ttyUSB0 and /dev/ttyUSB1. The Teensy shows up as /dev/ttyACM0. There is no trace of the Nortek USB device in the guest dmesg.
I wonder if it has something to do with the cp210x driver.
I think the issue is probably more related to how the device is presenting itself to the host. From the installation manual: "When plugged into computer or similar host device, it appears as two (2) serial ports." This isn't a typical USB device which is why I opted to just by a USB PCI card and pass the card through. You'll beat your head against the wall more than it's worth trying to get the regular pass-through methods to work. Or you can get a Raspberry Pie and do USB over the network.
@mrgoose2 :/ I have a tiny Dell Optiplex without PCI card slots. Is it safe to passthrough a system USB hub?
I'm not an expert, but I think people have had trouble passing through the system USB like that. Looks like you either need a different hypervisor, or you can try USB-over-IP from a raspberry pi. Or another option you could try would be an external PCIe enclosure like this https://www.amazon.com/StarTech-Express-Slot-Expansion-System/dp/B000UZL1GC. Though I would imagine you could end up in a similar situation. Lastly, you could consider a different method of getting Zwave and Zigbee in your smarthome. Maybe a Wink or Smartthings hub.
Yeah, system USB PCI passthrough did not work. While it is not ideal at all, I suppose I could make a host-guest-only network and install USB IP software on the host. I would like to know how to debug this issue most specifically if possible. I do have mini PCIe, but adapters like this seem a bit sketchy.
Sketchy or not I think you'll be much happier with the setup by passing a card through than trying to go with any of my other suggestions.
I connected to the USB dongle through ser2net.
I installed ser2net on my XCP host and then changed my host's /etc/ser2net.conf to be:
3020:raw:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT max-connections=1
3021:raw:0:/dev/ttyUSB1:57600 8DATABITS NONE 1STOPBIT max-connections=1
Added the following at the bottom of /lib/udev/rules.d/99-systemd.rules on both my host and guest so that I can make systemctl services wait for the devices (add before LABEL="systemd_end"):
KERNEL=="ttyUSB0", SYMLINK="ttyUSB0", TAG+="systemd"
KERNEL=="ttyUSB1", SYMLINK="ttyUSB1", TAG+="systemd"
Created a systemcl unit service for ser2net at /etc/systemd/system/ser2net.service:
[Unit]
Description=ser2net
After=syslog.target
After=network-online.target
Wants=dev-ttyUSB0.device
After=dev-ttyUSB0.device
Wants=dev-ttyUSB1.device
After=dev-ttyUSB1.device
[Service]
ExecStart=/usr/sbin/ser2net -n
Restart=on-failure
[Install]
WantedBy=multi-user.target
Opened firewall ports and enabled the service and restarted my host:
iptables -I INPUT -p tcp --dport 3020 --syn -j ACCEPT
iptables -I INPUT -p tcp --dport 3021 --syn -j ACCEPT
service iptables save
systemctl daemon-reload
systemctl enable ser2net.service
reboot
Created two unit files on my guest (for systemd systems, but the socat commands work anywhere):
/etc/systemctl/systemd/socat-z0.service:
[Unit]
Description=socat z 0
After=network-online.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/socat pty,link=/dev/ttyUSB0,raw,user=root,group=dialout,mode=660 tcp:HOST_IP:3020
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
/etc/systemctl/systemd/socat-z1.service:
[Unit]
Description=socat z 1
After=network-online.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/socat pty,link=/dev/ttyUSB1,raw,user=root,group=dialout,mode=660 tcp:HOST_IP:3021
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
If you are using Home Assistant, add the following under the [Unit] part of the service unit:
Wants=dev-ttyUSB0.device
After=dev-ttyUSB0.device
Wants=dev-ttyUSB1.device
After=dev-ttyUSB1.device
Enable the services and restart the guest:
systemctl daemon-reload
systemctl enable socat-z0.service
systemctl enable socat-z1.service
shutdown -r now
This requires the host and guest to share the same management network, and that isn't ideal, but this doesn't require any more hardware.
Just updated to xcp-ng 8.0 using a clean install and same issue persists. I am able to pass it through but the guest can't see it or interact with it. Just a fyi.
@mrgoose2 can you tell which chip the USB PCI expander card is using? I bought some offbrand thinking I would passthrough the card, but apparently the VL805 USB chip used doesn't like xen..
@mrgoose2 can you tell which chip the USB PCI expander card is using? I bought some offbrand thinking I would passthrough the card, but apparently the VL805 USB chip used doesn't like xen..
I have since moved away from xcp for my needs but this one worked on my cell r610 when I was running it. StarTech.com Dual Port USB 3.1 Card – 2X USB-A – 10Gbps per Port – Expansion Card – PCI Express USB Card – PCI-e to USB (PEXUSB312A2) https://www.amazon.com/dp/B072PVCDM9/ref=cm_sw_r_sms_apa_i_AsNeEb1VW20FV
Do we have a resolution for this issue? Having the same issue with zigbee2mqtt device, device shows up on XCP-ng host but is not actually showing up in the Linux VM. Could this be a driver issue on the VM or hypervisor level as its not truly passed through as a serial device?
We don't have a resolution nor a proper diagnostic at the moment.
@stormi what would you need for a "proper diagnostic"? I can run some commands if thats all.
@stormi just as @hayer has stated please let me know if you need anyone to run a few commands or test anything out as I would be more than happy to assist in any ways possible.
What we'd need is mostly time and an appropriate device to test :)
At the moment, this is not an issue that has affected users that take support, and my guess is that it mosty affects homelabs. This does not mean that we don't care about it, but at the moment the priority is lower than various other work. However, since it's one of the most popular issues on the bugtracker, I've added in my board to keep an eye on it and see if we can find a way to move forward.
I caress the secret hope that, due to the issue's popularity among the users from the community, someone will step up and do the analysis, which would bring us closer to a resolution.
Still no luck using PEXUSB312A2. Currently the card is visible in both dom0 and domU. lsusb in either of them show nothing. lspci -k in dom0 shows these lines;
03:00.0 USB controller: ASMedia Technology Inc. Device 2142
Subsystem: ASMedia Technology Inc. Device 2142
Kernel driver in use: pciback
so pciback is ok?
In the guest it just shows
00:05.0 USB controller: ASMedia Technology Inc. Device 2142
Subsystem: ASMedia Technology Inc. Device 2142
Kernel driver in use: xhci_hcd
But still nothing when I plug it in. Nothing when running dmesg -w either.
Edit: Then I found this
journalctl -b | grep -E "(xhci|\: usb)"
Jan 25 16:52:14 overwatch kernel: usbcore: registered new interface driver usbfs
Jan 25 16:52:14 overwatch kernel: usbcore: registered new interface driver hub
Jan 25 16:52:14 overwatch kernel: usbcore: registered new device driver usb
Jan 25 16:52:14 overwatch kernel: usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
Jan 25 16:52:14 overwatch kernel: usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Jan 25 16:52:14 overwatch kernel: usb usb1: Product: UHCI Host Controller
Jan 25 16:52:14 overwatch kernel: usb usb1: Manufacturer: Linux 4.15.0-74-generic uhci_hcd
Jan 25 16:52:14 overwatch kernel: usb usb1: SerialNumber: 0000:00:01.2
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: xHCI Host Controller
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: new USB bus registered, assigned bus number 2
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: hcc params 0x0200ef81 hci version 0x110 quirks 0x0000000000000010
Jan 25 16:52:14 overwatch kernel: usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
Jan 25 16:52:14 overwatch kernel: usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Jan 25 16:52:14 overwatch kernel: usb usb2: Product: xHCI Host Controller
Jan 25 16:52:14 overwatch kernel: usb usb2: Manufacturer: Linux 4.15.0-74-generic xhci-hcd
Jan 25 16:52:14 overwatch kernel: usb usb2: SerialNumber: 0000:00:05.0
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: xHCI Host Controller
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: new USB bus registered, assigned bus number 3
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: Host supports USB 3.1 Enhanced SuperSpeed
Jan 25 16:52:14 overwatch kernel: usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
Jan 25 16:52:14 overwatch kernel: usb usb3: New USB device found, idVendor=1d6b, idProduct=0003
Jan 25 16:52:14 overwatch kernel: usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Jan 25 16:52:14 overwatch kernel: usb usb3: Product: xHCI Host Controller
Jan 25 16:52:14 overwatch kernel: usb usb3: Manufacturer: Linux 4.15.0-74-generic xhci-hcd
Jan 25 16:52:14 overwatch kernel: usb usb3: SerialNumber: 0000:00:05.0
Jan 25 16:52:14 overwatch kernel: usb 1-2: new full-speed USB device number 2 using uhci_hcd
Jan 25 16:52:14 overwatch kernel: usb 1-2: New USB device found, idVendor=0627, idProduct=0001
Jan 25 16:52:14 overwatch kernel: usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Jan 25 16:52:14 overwatch kernel: usb 1-2: Product: QEMU USB Tablet
Jan 25 16:52:14 overwatch kernel: usb 1-2: Manufacturer: QEMU 0.10.2
Jan 25 16:52:14 overwatch kernel: usb 1-2: SerialNumber: 1
Jan 25 16:52:14 overwatch kernel: usbcore: registered new interface driver usbhid
Jan 25 16:52:14 overwatch kernel: usbhid: USB HID core driver
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: Error while assigning device slot ID
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: Max number of devices this xHCI host supports is 127.
Jan 25 16:52:14 overwatch kernel: usb usb2-port1: couldn't allocate usb_device
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: Error while assigning device slot ID
Jan 25 16:52:14 overwatch kernel: xhci_hcd 0000:00:05.0: Max number of devices this xHCI host supports is 127.
Jan 25 16:52:14 overwatch kernel: usb usb2-port2: couldn't allocate usb_device
0000:00:05.0: Max number of devices this xHCI host
Which seems interesting.. Don't know much about this stuff soo currently following that lead.
@DaAwesomeP I'm running into a similar issue, trying to get a Sigma zwave USB device mounted in a VM. I'm intrigued by your solution of running ser2net on the DOM0 and in the VM Host. But I don't see the /dev/ttyUSB0 detected in the DOM0.
Did your DOM0 already detect the USB device and list them in the /dev/ttyUSB0 /dev/ttyUSB1 before you added the 2 rules you added to 99-systemd.rules? If not, how did you force it to detect/mount it to the tty devices?
I see it in my lsusb output, but nothing appears in /dev/tty:
[root@xenserver ~]# lsusb
Bus 005 Device 002: ID 0658:0200 Sigma Designs, Inc.
[root@xenserver ~]# dmesg | grep tty
[ 0.000000] Command line: root=LABEL=root-olxolw ro nolvm hpet=disable xencons=hvc console=hvc0 console=tty0 quiet vga=785 splash plymouth.ignore-serial-consoles
[ 0.000000] Kernel command line: root=LABEL=root-olxolw ro nolvm hpet=disable xencons=hvc console=hvc0 console=tty0 quiet vga=785 splash plymouth.ignore-serial-consoles
[ 0.000000] console [tty0] enabled
[ 24.227831] 00:02: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 35.556488] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 35.556565] systemd[1]: Starting system-serial\x2dgetty.slice.
Did you have to do anything special to have it mounted as a device?
@benze Yes, the host already detected the devices as /dev/ttyUSB0 and /dev/ttyUSB1. It is possible yours may show up as /dev/ttyACM0 or something else, or they may not show up at all if the host lacks the required driver. Check dmesg to see what it does when you plug it in.
@DaAwesomeP Unfortunately, XenServer does not seem to have the driver for it, and is missing the cdc_acm module as I can't seem to find it in the /lib/modules/<>/kernel folder.
On a ubuntu system, it loads and maps to the /dev/ttyACM0, but on the XenServer, it doesn't show up at all. dmesg gives me no tremendous details either. Only the following:
[485789.854609] usb 5-2: new full-speed USB device number 3 using uhci_hcd
Do you know what kernel configuration option enables it?
@stormi Not sure. I looked quickly but I cannot see a specific kernel config option for it. According to a quick search, it seems there is a kernel module option called USB Modem (CDC ACM) support, but I haven't been able to confirm it.
After digging around for a bit, I found the kernel configuration for it:
CONFIG_USB_ACM=m
Is there a way to recompile the missing kernel module and just copy it over to the xenserver installation without needing the change the kernel itself? I've tried to follow instructions from the https://github.com/xcp-ng/xcp-ng-build-env repo, but trying to build the kernel module fails.
[root@543abc754417 4.4.0+10-x86_64]# make modules_prepare
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
HOSTCC scripts/selinux/genheaders/genheaders
scripts/selinux/genheaders/genheaders.c:13:22: fatal error: classmap.h: No such file or directory
#include "classmap.h"
^
compilation terminated.
make[3]: *** [scripts/selinux/genheaders/genheaders] Error 1
make[2]: *** [scripts/selinux/genheaders] Error 2
make[1]: *** [scripts/selinux] Error 2
make: *** [scripts] Error 2
[root@543abc754417 4.4.0+10-x86_64]#
@stormi I've opened a question on the xcp-ng dev forum as I wasn't sure which forum was better suited for the question.
Same issue here (also a Nortek HUSBZB-1)
I just wanted to link to https://xcp-ng.org/forum/topic/266/usb-passthrough-test-reports-in-7-5rc1/57?lang=en-GB&page=3 which might be interesting
Seems like some success via "xe vm-param-set uuid=**** platform:device-model=qemu-upstream-compat"
It's not the answer you guys are looking for, but passing through the usb controller using something like the pci to usb card I linked above was very reliable. I have since moved to a different hypervisor though so I am unable to provide further details. If you have the extra slots and ability to purchase a similar card you'd be much happier and have many hours of your day back.