[Plugin] USB_Manager


SimonF

Recommended Posts

13 minutes ago, SimonF said:

Looks like the additional USBIP package hasn't been installed. The vhcd are included in stock unraid.

 

You should be able to remove plugin and reinstall to fix.

As mentioned I tried uninstalling reinstalling. Now I let my unraid server rebooting (3 Times). Now everything seems to work again. I really dont know why or how this happend. 

I am sorry for posting my problems here, which are just away cuz of a few reboots xD 

 

Thank you for your help!

Link to comment
19 minutes ago, RiDDiX said:

As mentioned I tried uninstalling reinstalling. Now I let my unraid server rebooting (3 Times). Now everything seems to work again. I really dont know why or how this happend. 

I am sorry for posting my problems here, which are just away cuz of a few reboots xD 

 

Thank you for your help!

No worries. 

 

the USBIP package is kernel dependent and wasn't build at the time of the Unraid upgrade being released(but was about 6hrs after). Unraid are looking to build these as part of the release process for 6.10 so they should be ready when they release.

 

Just uninstalling and reloading should force the usbip-1 package to be downloaded for new kernel from ich777's repo. I assume you didnt have any internet issues will would stop the download.

Edited by SimonF
  • Like 1
Link to comment
21 minutes ago, SimonF said:

No worries. 

 

the USBIP package is kernel dependent and wasn't build at the time of the Unraid upgrade being released(but was about 6hrs after). Unraid are looking to build these as part of the release process for 6.10 so they should be ready when they release.

 

Just uninstalling and reloading should force the usbip-1 package to be downloaded for new kernel from ich777's repo. I assume you didnt have any internet issues will would stop the download.

Maybe but as I wrote here I am at the office (work) and connected via VPN to my Home-Network. Connection seems to be stable. xD 

Anyway maybe there hang something up I really dont know. But I am happy that it work again. 

Thank you for your effort 🙂 

Link to comment

Hi @SimonF

 

Im getting virsh error on my 6.9.2 machine. AFAIK, I'm not getting this error before.

Attached are 2 kb + 3 mouse.

 

1 of the kb and mouse is getting this error everytime :

 

Error: Failed to attach device from /tmp/libvirthotplugusbbybusLinuxMint 20.1.xml error: internal error: No free USB ports 

 

Y1WRMF.jpg

 

Under Device Log Information:

 

Apr 10 00:33:03 AORUSPROAC kernel: usb 1-6.1: USB disconnect, device number 5
Apr 10 00:33:03 AORUSPROAC kernel: usb 1-6.1: new low-speed USB device number 17 using xhci_hcd

 

No other error in unraid log.

Link to comment

@garydapogiEach VM has a limit on the number of Virtual USB ports, I think the default is 5. I think you can increase, not sure why it would have changed in 6.9.2.

 

You can sometimes clear by powering down VM and restarting. Not reboot has that doesnt release the virtual ports.

 

Also disconnects can sometimes leave devices connected and not freeing up ports..

 

This was the post for increasing ports.

 

 

 

You need to change USB type in template to 

 

image.png.bbbc99e9bebb2afa74a2879e1b338b0b.png

 

This will support 15 ports.

Edited by SimonF
Link to comment
5 hours ago, SimonF said:

@Fireblast3r

 

Could you attach the output of the following file for me. 

 

cat /usr/local/emhttp/state/usb.ini 

 

Here is the output.  I had tried both port mapping and device mapping and same result.  also tried qemu 3.0 usb controller.  currently have all mapping rules removed.  I have seen some post about creating a dev rule to lump all these devices into one "group" or device but that was for running htc vive natively on Arch linux.   seems interesting since the htc vive usb hub brings in 8 devices but it should be all considered one logic device.  

 

here is the usb insert event log from Unraid as well as usb.ini.

image.thumb.png.aebb6e0f3b67b0d6f26a6b68a6d63449.png

 

remove event

image.png.8aaf6a62c75ac88ed66dfba4f149c99b.png

 

root@Tower:~# cat /usr/local/emhttp/state/usb.ini 

[HTC_CB_USB2]
ishub = 1
connected = ""
bus = 001
dev = 073
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "CB_USB2"
ID_MODEL_ID = 2210

[SMSC_USB2137B]
ishub = 1
connected = ""
bus = 001
dev = 074
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "USB2137B"
ID_MODEL_ID = 2134

[Broadcom_Corp_BCM2045A0_404E3618003F]
ishub = ""
connected = ""
bus = 001
dev = 075
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "BCM2045A0"
ID_MODEL_ID = 0306

[HTC_HTC_Vive_2075397F5250]
ishub = ""
connected = ""
bus = 001
dev = 076
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "HTC_Vive"
ID_MODEL_ID = "2c87"

[Valve_Software_Watchman_Dongle_D6373D9514]
ishub = ""
connected = ""
bus = 001
dev = 077
ID_VENDOR_FROM_DATABASE = ""
ID_VENDOR_ID = "28de"
ID_MODEL = "Watchman_Dongle"
ID_MODEL_ID = 2101

[Valve_Software_Lighthouse_FPGA_RX_LHR-27B63959]
ishub = ""
connected = ""
bus = 001
dev = 079
ID_VENDOR_FROM_DATABASE = ""
ID_VENDOR_ID = "28de"
ID_MODEL = "Lighthouse_FPGA_RX"
ID_MODEL_ID = 2000

[Alpha_Imaging_Tech_HTC_Vive]
ishub = ""
connected = ""
bus = 001
dev = 080
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "HTC_Vive"
ID_MODEL_ID = "2c87"root@Tower:~# 

Edited by Fireblast3r
missing event
Link to comment
7 minutes ago, Fireblast3r said:

[HTC_CB_USB2]
ishub = 1
connected = ""
bus = 001
dev = 073
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "CB_USB2"
ID_MODEL_ID = 2210

[SMSC_USB2137B]
ishub = 1
connected = ""
bus = 001
dev = 074
ID_VENDOR_FROM_DATABASE = "HTC (High Tech Computer Corp.)"
ID_VENDOR_ID = "0bb4"
ID_MODEL = "USB2137B"
ID_MODEL_ID = 2134

These two devices are classed as HUBs, and will not show in my plugin as you cannot connect hubs in this way. Please share a link to the doc and I will take a look.

 

I use these UDEV Rules for adding USB devices.

 

ACTION=="bind",SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",RUN+="/usr/local/emhttp/plugins/unraid.usbip-gui/scripts/rc.unraid.usbip-gui usb_add >/dev/null 2>&1 & disown"
ACTION=="remove",SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",RUN+="/usr/local/emhttp/plugins/unraid.usbip-gui/scripts/rc.unraid.usbip-gui usb_remove >/dev/null 2>&1 & disown"

 

 

Link to comment

Nevermind.  thanks for your help.  I think I've reach the end of the road here.  my mobo cannot create an isolated IOMMU group for the 2nd usb controller card.  and it seems like this is a requirement for HTC Vive to vm passthrough.  your plugin seems to be closer than anything I've seen to getting around this requirements but the folks at lime tech have say so in this post...

 

 

Link to comment

You will need the usb3 as there any not enough ports onthe 2.0 one.

 

Looks like one of the devices is a bluetooth adapter which I am guessing is required.

 

Can you provide me a lsusb -t with the vive connected.

Edited by SimonF
Link to comment
13 hours ago, Fireblast3r said:

 I think I've reach the end of the road here.

If you want to try a simple hack to get all the hub devices to show in the GUI, I am not sure if you will be to attach the Bluetooth device.

 

edit the following file

 

nano /usr/local/emhttp/plugins/unraid.usbip-gui/include/lib_usbip.php

 

Goto line 434 and put a # in front of the continue on line 436. So should look like below.

 

#busid=3-1#usbid=0781:5571#
#busid=3-2#usbid=1c4f:0016#
#busid=3-5.1#usbid=cd12:ef18#
#busid=3-5.4#usbid=0204:6025#
#busid=3-6#usbid=054c:05bf#
#busid=3-7.1#usbid=0557:2419#

#1D6Bp0002
#8087p8008
#1D6Bp0002
#8087p8000
#1D6Bp0002
#05E3p0606
#0557p7000
#1D6Bp0003
#1D6Bp0002
#1D6Bp0003

	// Get a list of all usb hubs so we can blacklist them
	exec("cat /sys/bus/usb/drivers/hub/*/modalias | grep -Po 'usb:v\K\w{9}' | tr 'p' ':'", $arrAllUSBHubs);

	exec("lsusb 2>/dev/null", $arrAllUSBDevices);

	foreach ($arrAllUSBDevices as $strUSBDevice) {
		#if (preg_match('/^.+: ID (?P<id>\S+)(?P<name>.*)$/', $strUSBDevice, $arrMatch)) {
			if (preg_match('/^Bus (?P<bus>\S+) Device (?P<dev>\S+): ID (?P<id>\S+)(?P<name>.*)$/', $strUSBDevice, $arrMatch)) {
			#if (stripos($GLOBALS['var']['flashGUID'], str_replace(':', '-', $arrMatch['id'])) === 0) {
			#	// Device id matches the unraid boot device, skip device
			#	continue;
				
			#}

			if (in_array(strtoupper($arrMatch['id']), $arrAllUSBHubs)) {
				// Device class is a Hub, skip device
				#continue;
			}

 

Link to comment

wow! passing in the usb hub actually works.   steamvr can see headset. setup and calibration pass.  it works but there is a weird blur or jittery view when looking around in the headset.  like some kind of video lag.  i think the video lag might be parsec since... this is a headless unraid server.  I will have to experiment with direct attached monitor.

 

image.thumb.png.fad3aa6b51544238a9b0fc28f8209f4a.png

  • Like 1
Link to comment

Update 22.04.21.

 

Added Roothubs and Hubs into the view. Also an additional selector at the top to un-hide empty ports( This can make the list very long).

 

Additional function to process hubs will be added in a future release. This means tagging of a hub and all connected devices will be attach to the host. It will not connect a hub to the VM as this is not supported in QEMU.

 

Additional Leveling/indentation will be added for the hierarchy if future releases.

 

image.thumb.png.bc80bda30ca0fe5f17231362152d409d.png

Link to comment
On 12/25/2020 at 2:10 AM, SimonF said:

if ($argv[2] == 'prepare' || $argv[2] == 'stopped'){ shell_exec("/usr/local/emhttp/plugins/unraid.usbip-gui/scripts/rc.unraid.usbip-gui vm_action '{$argv[1]}' {$argv[2]} {$argv[3]} {$argv[4]} >/dev/null 2>&1 & disown") ; } before if (!isset($argv[2]) || $argv[2] != 'start') {

I have the plug-in installed but in the USB menu VM attach is greyed out. 
where do I add the code above?

I put it right at the beginning of the qemu file in the place mentioned in this thread. 

Link to comment
1 hour ago, SavageAUS said:

I have the plug-in installed but in the USB menu VM attach is greyed out. 
where do I add the code above?

I put it right at the beginning of the qemu file in the place mentioned in this thread. 

VM attach button will only show if you have a mapping and the VM is started.

 

The two icons on the left create the mappings either for the USB port or the USB Device.

 

The code you added is used if you set the Mapping option to Auto Connect at VM Start.

image.thumb.png.9af1393bc712efa154ba1c6be0c8524d.png

 

image.png.ec601586568f901570cad86843fbf622.png

Link to comment

Hi, I am installing the Unraid USBip GUI and it generates the following output for me.

 

Removing previous versons now upgrade has completed.

+==============================================================================
| WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
|
| Don't close this window with the red 'X' in the top right corner until the 'DONE' button is displayed!
|
| WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
+==============================================================================
---------------------Downloading usbip, please wait...!------------------------
-----------This could take some time, please don't close this window!----------
-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------
----------------------------Can't download usbip--------------------------------
-----------------------Installing usbip, please wait...!-----------------------
Verifying package usbip-1.txz.
Unable to install /boot/config/plugins/unraid.usbip-gui/packages/4.19.107/usbip-1.txz: tar archive is corrupt (tar returned error code 2)
Starting rsyslogd daemon:
/usr/sbin/rsyslogd -i /var/run/rsyslogd.pid

-----------------------------------------------------------
unraid.usbip-gui has been installed.

Copyright 2016-2020, SimonFair
Version: 2021.04.22

 

 

additional when I go to configure it, the screen goes blank

 

image.png.ae90da75fd49f3110fa84163e9eb8204.png

image.thumb.png.84a1035ab11da1dd0f6014f03cba3211.png

Link to comment
5 minutes ago, JhonScript said:

Hi, I am installing the Unraid USBip GUI and it generates the following output for me.

 

Removing previous versons now upgrade has completed.

+==============================================================================
| WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
|
| Don't close this window with the red 'X' in the top right corner until the 'DONE' button is displayed!
|
| WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING
+==============================================================================
---------------------Downloading usbip, please wait...!------------------------
-----------This could take some time, please don't close this window!----------
-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------
----------------------------Can't download usbip--------------------------------
-----------------------Installing usbip, please wait...!-----------------------
Verifying package usbip-1.txz.
Unable to install /boot/config/plugins/unraid.usbip-gui/packages/4.19.107/usbip-1.txz: tar archive is corrupt (tar returned error code 2)
Starting rsyslogd daemon:
/usr/sbin/rsyslogd -i /var/run/rsyslogd.pid

-----------------------------------------------------------
unraid.usbip-gui has been installed.

Copyright 2016-2020, SimonFair
Version: 2021.04.22

 

 

additional when I go to configure it, the screen goes blank

 

image.png.ae90da75fd49f3110fa84163e9eb8204.png

image.thumb.png.84a1035ab11da1dd0f6014f03cba3211.png

Looks like you are on pre 6.9 so usbip part wont be loaded. Click on usb next to main.

Link to comment
28 minutes ago, SimonF said:

Looks like you are on pre 6.9 so usbip part wont be loaded. Click on usb next to main.

Yes, since USB together with MAIN works fine in UnRaid 6.8.3, it just seemed weird for that to happen.

 

Okay, now doing a pretty strange test I found this. I have a device (Mouse) that the provider actually put 0000 as VID, this device is not possible to connect it by any means and when trying with USBip GUI, the following was generated.

 

image.thumb.png.545aee61da5ffd25683a9e3e6591fbcf.png

 

Warning: parse_ini_file(/boot/config/domain.cfg): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php on line 466

 

detect multiple devices like UNRAID FLASH

 

Apr 25 11:53:13 Gaming kernel: usb 1-4: new low-speed USB device number 7 using xhci_hcd
Apr 25 11:53:13 Gaming kernel: input: Dell Dell USB Keyboard as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-4/1-4:1.0/0003:413C:2003.0002/input/input3
Apr 25 11:53:13 Gaming unraid.usbip-gui: Info: rc.unraid.usbip-gui Autoconnect No Mapping found Dell_Dell_USB_Keyboard /dev/bus/usb/001/007 001 007 port 1-4
Apr 25 12:00:47 Gaming kernel: usb 1-4: reset low-speed USB device number 7 using xhci_hcd
Apr 25 12:00:48 Gaming kernel: input: Dell Dell USB Keyboard as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-4/1-4:1.0/0003:413C:2003.0003/input/input4
Apr 25 12:01:46 Gaming kernel: usb 1-4: reset low-speed USB device number 7 using xhci_hcd
Apr 25 12:01:47 Gaming kernel: input: Dell Dell USB Keyboard as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-4/1-4:1.0/0003:413C:2003.0004/input/input5
Apr 25 12:02:31 Gaming unraid.usbip-gui: Removing configuration 'Port:1-4'.
Apr 25 12:05:28 Gaming kernel: usb 1-4: USB disconnect, device number 7
Apr 25 12:05:49 Gaming kernel: usb 1-4: new full-speed USB device number 9 using xhci_hcd
Apr 25 12:05:50 Gaming unraid.usbip-gui: Info: rc.unraid.usbip-gui Autoconnect No Mapping found ZhiXu_Controller_1187A89 /dev/bus/usb/001/009 001 009 port 1-4
Apr 25 12:11:11 Gaming kernel: usb 1-4: USB disconnect, device number 9
Apr 25 12:12:37 Gaming kernel: usb 1-4: new full-speed USB device number 11 using xhci_hcd
Apr 25 12:12:39 Gaming unraid.usbip-gui: Info: rc.unraid.usbip-gui Autoconnect No Mapping found ZhiXu_Controller_1187A89 /dev/bus/usb/001/011 001 011 port 1-4
Apr 25 12:13:01 Gaming kernel: usb 1-4: USB disconnect, device number 11
Apr 25 12:15:01 Gaming kernel: usb 1-4: new low-speed USB device number 17 using xhci_hcd
Apr 25 12:15:01 Gaming kernel: input: USB OPTICAL MOUSE as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-4/1-4:1.0/0003:0000:3825.0007/input/input7
Apr 25 12:15:01 Gaming unraid.usbip-gui: Info: rc.unraid.usbip-gui Autoconnect No Mapping found 0000_USB_OPTICAL_MOUSE /dev/bus/usb/001/017 001 017 port 1-4

 

nevertheless, very good work. Thank you so much

 

I forgot to mention that before testing with the VID 0000 Mouse, I had two xbox 360 controls connected and then I forcibly disconnected them. do not disassociate them

Edited by JhonScript
Link to comment
30 minutes ago, JhonScript said:

Warning: parse_ini_file(/boot/config/domain.cfg): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php on line 466

This is a function from VM Manager, I haven't tested on 6.8.3 with VMs disabled so not seen this message before.

 

It may be causing the issue of multiple Unraid devices as should only be one.

 

Will look into this issue.  Do you get the same issue without the VID Mouse Connected?

 

Are VMs enabled on your system?

 

image.thumb.png.837805bd68741fa8dc8075b7ea9329f8.png

 

Edited by SimonF
Link to comment
  • SimonF changed the title to [Plugin] USB_Manager/USBIP commands and GUI
  • SimonF changed the title to [Plugin] USB_Manager

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.