XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    USB passthrough test reports in 7.5RC1

    Scheduled Pinned Locked Moved Development
    58 Posts 21 Posters 37.0k Views 10 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      fjen @olivierlambert
      last edited by fjen

      @olivierlambert

      For me, I basically followed the instructions on Citrix's docs regarding USB Passthrough.

      Interesting now, I'm getting an error trying to boot the VM of:

      INTERNAL_ERROR(xenopsd internal error: Call to usb reset failed: Forkhelpers.Spawn_internal_error("usage: usb_reset.py attach [-h] -d DOMID -p PID [-r RESET_ONLY] device\nusb_reset.py attach: error: argument -r: expected one argument\n", "", _))

      The VM will actually finish its boot, but it won't look like it to XO or XCP-ng Center for a few seconds.

      I can test with XS7.5 instead but it seems like it's an enterprise only feature? Also, would the revert to XS simply involve inserting the ISO and doing an "upgrade" or would it need to be fresh?

      X 1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by olivierlambert

        Please post your exact procedure with xe here please.

        I have both XS 7.5 with license AND XCP-ng 7.5 RC1 to test in my lab.

        edit: tomorrow obviously, it's already 9PM here ⏲

        F 1 Reply Last reply Reply Quote 0
        • F Offline
          fjen @olivierlambert
          last edited by

          @olivierlambert Sure thing!

          Because I was passing through a USB Bluetooth dongle, I had to specifically create an "allow" entry in /etc/xensource/usb-policy.conf.

          1. Run lsusb and identify the device to be passed through.
          Bus 001 Device 002: ID 1b70:100f
          Bus 001 Device 003: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
          Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
          Bus 001 Device 005: ID 0557:7000 ATEN International Co., Ltd Hub
          Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
          Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
          Bus 001 Device 006: ID 0557:2419 ATEN International Co., Ltd
          

          I happened to want to pass through the Cambridge Silicon Radio entry. Note the ID of 0a12:0001. The format is vid:pid that will come in handy later.

          1. Run /opt/xensource/libexec/usb_scan.py -d and run cat /var/log/user.log | grep "'idVendor': '<vid>'". I found the line that had:
          Aug  1 11:56:24 ascension usb_scan.py DEBUG: UsbDevice: (u'1-12', {'idVendor': '0a12', 'ID_VENDOR_FROM_DATABASE': u'Cambridge Silicon Radio, Ltd', 'bConfigurationValue': '1', 'bDeviceClass': 'e0', 'ID_MODEL_FROM_DATABASE': u'Bluetooth Dongle (HCI mode)', 'version': ' 2.00', 'idProduct': '0001', 'bNumInterfaces': ' 2', 'serial': '', 'bcdDevice': '8891'})#012#011|__ UsbInterface: (u'1-12:1.0', {'bInterfaceNumber': '00', 'bInterfaceClass': 'e0', 'bInterfaceProtocol': '01', 'bInterfaceSubClass': '01'})#012#011|__ UsbInterface: (u'1-12:1.1', {'bInterfaceNumber': '01', 'bInterfaceClass': 'e0', 'bInterfaceProtocol': '01', 'bInterfaceSubClass': '01'})
          

          but a different device would have a different line but similar content. Note down the 'bDeviceClass'.

          1. Edit the /etc/xensource/usb-policy.conf file and add
          ALLOW:vid=<vid> pid=<pid> class=<bDeviceClass>
          

          using the values from earlier.

          1. Rerun /opt/xensource/libexec/usb_scan.py -d and the USB Device should now be added.

          Now to actually pass through the USB to the VM.

          1. Run xe pusb-list. My output is:
          uuid ( RO)            : f20850de-c998-5541-4d16-f06eccf87b40
                      path ( RO): 1-12
                 vendor-id ( RO): 0a12
               vendor-desc ( RO): Cambridge Silicon Radio, Ltd
                product-id ( RO): 0001
              product-desc ( RO): Bluetooth Dongle (HCI mode)
                    serial ( RO):
                   version ( RO): 2.00
               description ( RO): Cambridge Silicon Radio, Ltd_Bluetooth Dongle (HCI mode)
          
          
          uuid ( RO)            : 8560df9a-d712-687b-1f36-3ecd1c84dad1
                      path ( RO): 1-2
                 vendor-id ( RO): 0764
               vendor-desc ( RO): Cyber Power System, Inc.
                product-id ( RO): 0501
              product-desc ( RO): CP1500 AVR UPS
                    serial ( RO):
                   version ( RO): 1.10
               description ( RO): Cyber Power System, Inc._CP1500 AVR UPS
          
          

          I actually have 2 USB devices but I didn't want to pass through the UPS. Note the UUID of the USB device: f20850de-c998-5541-4d16-f06eccf87b40.

          1. Run xe pusb-param-set uuid=<uuid> passthrough-enabled=true with the UUID from earlier.

          2. Shutdown the target VM.

          3. Run xe usb-group-list PUSB-uuids=<uuid>. For me, output is:

          uuid ( RO)                : 316ac764-39fe-4120-0d6a-759ecb81a1ea
                    name-label ( RW): Group of 0a12 0001 USBs
              name-description ( RW):
          
          

          Note the group UUID of 316ac764-39fe-4120-0d6a-759ecb81a1ea.

          1. Run xe vusb-create usb-group-uuid=<group_uuid> vm-uuid=<vm_uuid>

          2. Run xe vm-start uuid=<vm_uuid>

          Those are the exact procedures I followed to try to get my USB passed through. 🙂 Hope it will help troubleshoot!

          For most devices, you probably don't have to do the first section. My UPS showed up perfect fine without the first section.

          olivierlambertO 1 Reply Last reply Reply Quote 1
          • A Offline
            Aimdev @fjen
            last edited by

            @fjen said in XCP-ng 7.5.0 Release Candidate:

            @aimdev

            Just wanted to chime in here and say that USB Passthrough is also non-functional for me. Can't pass through a USB Bluetooth dongle, even though I added an allow run to the usb-policy.conf file and it shows up fine in the CLI and XCP-ng Center.

            Hi

            Thanks for the info.

            My /etc/xensource/usb-policy.conf contained a DENY for class 2 devices

            DENY: vid=17e9 # All DisplayLink USB displays
            #DENY: class=02 # Communications and CDC-Control
            ALLOW: class=02 subclass=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:vid=1546 pid=01a8 class=02 # Ublox
            ALLOW: # Otherwise allow everything else

            My device is a class 2 device.
            Aug 2 06:02:38 localhost usb_scan.py DEBUG: UsbDevice: (u'3-2', {'idVendor': '1546', 'ID_VENDOR_FROM_DATABASE': u'U-Blox AG', 'bConfigurationValue': '1', 'bDeviceClass': '02', 'ID_MODEL_FROM_DATABASE': '', 'version': ' 1.10', 'idProduct': '01a8', 'bNumInterfaces': ' 2', 'serial': '', 'bcdDevice': '0301'})#012#011|__ UsbInterface: (u'3-2:1.0', {'bInterfaceNumber': '00', 'bInterfaceClass': '02', 'bInterfaceProtocol': '01', 'bInterfaceSubClass': '02'})#012#011|__ UsbInterface: (u'3-2:1.1', {'bInterfaceNumber': '01', 'bInterfaceClass': '0a', 'bInterfaceProtocol': 'ff', 'bInterfaceSubClass': '00'})

            I commented out the DENY, added an ALLOW for class 2, added the line for the UBLOX, which basically is a serial
            device (its a gps receiver I am going to use as the source for a time server)

            Rebooted

            The result of the /opt/xensource/libexec/usb_scan.py -d command does not show the UBLOX, only the UPS.

            Not sure if I have got the configuration correct.
            I looked at the citrix docs, but until the scan shows the device, I cannot proceed any further.
            I will take a look at the usb_scan.py to try and determine the rules.

            Thanks

            Aimee

            A 1 Reply Last reply Reply Quote 0
            • olivierlambertO Offline
              olivierlambert Vates 🪐 Co-Founder CEO @fjen
              last edited by

              @fjen If I try your procedure, I can't boot the VM when it's attached to the vUSB device. I got:

              # xe vm-start uuid=71700117-2d3f-1d99-9d3f-a2e106ac701a 
              The value given is invalid
              field: platform:device-model when vm has VUSBs
              value: undefined
              

              What did I miss?

              F 1 Reply Last reply Reply Quote 0
              • F Offline
                fjen @olivierlambert
                last edited by

                @olivierlambert

                Actually, re-doing the procedure on a fresh VM, I actually got the same error... This doesn't happen with XCP-ng Center though.

                I can resolve it though by specifying the platform:device-model parameter.

                xe vm-param-set uuid=<uuid> platform:device-model=qemu-upstream-compat

                1 Reply Last reply Reply Quote 0
                • olivierlambertO Offline
                  olivierlambert Vates 🪐 Co-Founder CEO
                  last edited by

                  @fjen

                  So I tried USB passthrough with a simple USB stick, and it worked perfectly. The stick is passed to my Windows VM without any issue, from both XCP-ng 7.5 RC1 and XenServer 7.5

                  You can see the "Vates (E:)" USB key dislayed here:

                  0_1533241328309_usbpass.png

                  VM is a Windows 2012 R2 64 Bits. Followed the xe CLI instruction with success.

                  F D 2 Replies Last reply Reply Quote 0
                  • F Offline
                    fjen @olivierlambert
                    last edited by

                    @olivierlambert Ah thanks for the test! Guess the feature just doesn't play well with my Bluetooth dongle and mouse. 😞

                    1 Reply Last reply Reply Quote 0
                    • olivierlambertO Offline
                      olivierlambert Vates 🪐 Co-Founder CEO
                      last edited by olivierlambert

                      I'll try tomorrow with a wireless dongle for keyboard/mouse.

                      F 1 Reply Last reply Reply Quote 0
                      • F Offline
                        fjen @olivierlambert
                        last edited by

                        @olivierlambert Thank you! 😄

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          Aimdev @Aimdev
                          last edited by Aimdev

                          @aimdev

                          Update

                          I removed all the rules except the allow all in /etc/xensource/usb-policy.conf
                          The U-blox device was present when running /opt/xensource/libexec/usb_scan.py -d 🙂
                          The device is present when running xe pusb-list 🙂
                          The device is present using xcp-ng centre 🙂
                          The configuration file clearly has an issue for me to resolve. 😞
                          Followed instructions from @fjen , thanks for your efforts.
                          got this on vm startup
                          The value given is invalid
                          field: platform:device-model when vm has VUSBs
                          value: qemu-trad

                          issued command
                          xe vm-param-set uuid=<uuid> platform:device-model=qemu-upstream-compat
                          Started vm
                          cat /dev/ttyACM0 present and seeing gps messages. 🙂

                          It appears the only way to get this to work is via the cli.

                          Doing a reboot test next, fingers crossed, yes ok 🙂

                          Thanks

                          Aimee

                          A 1 Reply Last reply Reply Quote 0
                          • A Offline
                            Aimdev @Aimdev
                            last edited by

                            @aimdev said in USB passthrough test reports in 7.5RC1:

                            @aimdev

                            Update

                            I removed all the rules except the allow all in /etc/xensource/usb-policy.conf
                            The U-blox device was present when running /opt/xensource/libexec/usb_scan.py -d 🙂
                            The device is present when running xe pusb-list 🙂
                            The device is present using xcp-ng centre 🙂
                            The configuration file clearly has an issue for me to resolve. 😞
                            Followed instructions from @fjen , thanks for your efforts.
                            got this on vm startup
                            The value given is invalid
                            field: platform:device-model when vm has VUSBs
                            value: qemu-trad

                            issued command
                            xe vm-param-set uuid=<uuid> platform:device-model=qemu-upstream-compat
                            Started vm
                            cat /dev/ttyACM0 present and seeing gps messages. 🙂

                            It appears the only way to get this to work is via the cli.

                            Doing a reboot test next, fingers crossed, yes ok 🙂

                            Thanks

                            Aimee

                            Hi

                            Didn't survive the 7.5 RC1 to 7.5 upgrade, had to re configure it.
                            All working ok.

                            Aimee

                            1 Reply Last reply Reply Quote 0
                            • olivierlambertO Offline
                              olivierlambert Vates 🪐 Co-Founder CEO
                              last edited by

                              Yes that's normal config file are changed 🙂

                              1 Reply Last reply Reply Quote 0
                              • JianghuawJ Offline
                                Jianghuaw
                                last edited by

                                I met the same issue after upgrading my host to 7.5. The information at here is helpful. Thanks.

                                BTW I guess xcp-ng doesn't support vUSB hotplug. Is there anyone know if there is any plan to support hot plug/unplug? Maybe depend on Citrix's plan on XenServer? Is there any workaround to support that with qemu?

                                1 Reply Last reply Reply Quote 0
                                • D Offline
                                  DustinB @olivierlambert
                                  last edited by

                                  @olivierlambert said in USB passthrough test reports in 7.5RC1:

                                  @fjen

                                  So I tried USB passthrough with a simple USB stick, and it worked perfectly. The stick is passed to my Windows VM without any issue, from both XCP-ng 7.5 RC1 and XenServer 7.5

                                  You can see the "Vates (E:)" USB key dislayed here:

                                  0_1533241328309_usbpass.png

                                  VM is a Windows 2012 R2 64 Bits. Followed the xe CLI instruction with success.

                                  Just an odd question. . .

                                  Is that USB device available to just this one VM or to every VM?

                                  1 Reply Last reply Reply Quote 0
                                  • olivierlambertO Offline
                                    olivierlambert Vates 🪐 Co-Founder CEO
                                    last edited by olivierlambert

                                    Not an odd question 🙂 You assign the USB device to one VM only. IDK if it's possible to assign it to multiple VMs, but it sounds unlikely!

                                    D 1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      DustinB @olivierlambert
                                      last edited by

                                      @olivierlambert the reason I ask is I recall considering this option back on XS6.5 and simply opt'd to not use USB devices any longer.

                                      It was just more of a headache using USB than it was using network attached storage.

                                      Now for USB license fobs etc it could be an issue, but I would get a USB to network adapter in that scenario.

                                      1 Reply Last reply Reply Quote 0
                                      • olivierlambertO Offline
                                        olivierlambert Vates 🪐 Co-Founder CEO
                                        last edited by

                                        Back in 6.5, it was probably passing through the whole USB controller, which is different with USB passthrough on 7.5 (just release since this version), where you can pass one specific device without taking the whole USB controller 🙂

                                        1 Reply Last reply Reply Quote 0
                                        • C Offline
                                          cowboy
                                          last edited by

                                          First off, thanks to @Aimdev and @fjen for providing a good write up of the steps taken to get USB passthrough to work.

                                          I followed them all pretty much with out any difficulty and with no errors on anything for a Broadcom Bluetooth USB card (Broadcom Corp._BCM2045B) that's built into my laptop I'd like to pass through to a Linux VM.

                                          And I get all the way up to where the USB device is correctly presented in the XCP-ng Centre application, but the device doesn't [seem to] appear at the OS level in dmesg | grep usbcore or lusb outputs in my guest OS VM.

                                          However, since I didn't any failure to start the vm or other errors, I had not executed the final command: xe vm-param-set uuid=<VM UUID> platform:device-model=qemu-upstream-compat

                                          But since the Broadcom chip still didn't appear in the guest Linux VM, I shutdown the VM and then executed the above command with the VM UUID.

                                          But after a restart, the VM still doesn't see the Broadcom USB device.

                                          Any idea what could be up or suggestions where I need to dig?

                                          1 Reply Last reply Reply Quote 0
                                          • X Offline
                                            xiaolou86 @fjen
                                            last edited by xiaolou86

                                            @fjen I also got the same error...

                                            INTERNAL_ERROR(xenopsd internal error: Call to usb reset failed: Forkhelpers.Spawn_internal_error("usage: usb_reset.py attach [-h] -d DOMID -p PID [-r RESET_ONLY] device\nusb_reset.py attach: error: argument -r: expected one argument\n", "", _))

                                            A 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post