Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Plugin] USB_Manager

Featured Replies

Hello, thanks for this awesome plugin !

However I have an issue with Home Assistant and the new Sonoff ZigBee bridge USB Key.

Each time my Unraid server comes out of sleep, I get a Virsh error on this USB device.
I originally wanted to script a disconnection and reconnection of the key but your plugin provide a simpler way to do it than on the VM page.

I just have to do VM detach and VM attach to some the error :).

 

Would there be a way for me to script this, simpler, using your plugin ?
If I could externally call your functions, it would be a neat way to do it.

Thanks.

Edited by dboris

  • Replies 583
  • Views 125k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • I have started to add support for mapping devices as a Serial connection to a VM. So you wont have to use the XML fix.   Function works for starting/stopping VM, hotplug removal but doesnt w

  • Option added in 2022.08.20  

  • What output do you get if you hover over the virsh error?   The port number is only used if you enable connect as serial via the slider which is required for map Conbee II correctly above 6.

Posted Images

  • Author
22 minutes ago, dboris said:

Hello, thanks for this awesome plugin !

However I have an issue with Home Assistant and the new Sonoff ZigBee bridge USB Key.

Each time my Unraid server comes out of sleep, I get a Virsh error on this USB device.
I originally wanted to script a disconnection and reconnection of the key but your plugin provide a simpler way to do it than on the VM page.

I just have to do VM detach and VM attach to some the error :).

 

Would there be a way for me to script this, simpler, using your plugin ?
If I could externally call your functions, it would be a neat way to do it.

Thanks.

Are you using the S3 sleep plugin?

 

Another users was doing something similar in the early days. Example of commands to run.

 

rc.usb_manager is the name of the functions now the below was before the plugin was renamed.

 

image.png

I edited these commands by replacing and name of the VM with "HomeAssistant"... But somehow it calls a halt of the system and shut my sytem off when I wake it from sleep. Ah ah ah. I will investigate :).

Edited by dboris

1 hour ago, dboris said:

I edited these commands by replacing and name of the VM with "HomeAssistant"... But somehow it calls a halt of the system and shut my sytem off when I wake it from sleep. Ah ah ah. I will investigate :).

 

unraid.usbip-gui is not installed. Seems that's a common issue.
I tried reinstalling the plugin and rebooting without success.

  • Author
1 minute ago, dboris said:

 

unraid.usbip-gui is not installed. Seems that's a common issue.
I tried reinstalling the plugin and rebooting without success.

unraid.usbip-gui was the original name for usb_manager.

 

replace rc.unraid.usbip-gui with rc.usb_manager 

It works. Reboot bug was because somehow virsh wasn't interpreting the VM name when using parenthesis.

So the script part for sleep is : 

virsh suspend HomeAssistant
rc.usb_manager vm_action HomeAssistant disconnect


And wake up :

rc.usb_manager vm_action HomeAssistant prepare
virsh resume HomeAssistant

Hello i am trying to add my rtl 433 USB device to my home assistant VM .

 

I am getting some virsh errors. 

 

root@Tower:~# cat /usr/local/emhttp/state/usb.ini | grep error
virsherror = ""
virsherror = 1
virsh = "error: Failed to attach device from /tmp/libvirthotplugusbbybusHassio-003-004.xml
error: unable to stat: /dev/serial/by-id/: No such file or directory

 

And the weirdest thing 

 

root@Tower:~# cd /dev/serial/by-id/.
bash: cd: /dev/serial/by-id/.: No such file or directory

 

I am at a lost in here , any advice on how to proceed ????

  • Author

Are you trying to connect as serial? Try with just these two

 

image.png

On 10/12/2023 at 5:57 AM, SimonF said:

Are you trying to connect as serial? Try with just these two

 

image.png

 

Yeah i am trying to add my usb-rtl dongle to my home assistant VM , from what i read , it is required to connect as serial for home assistant. 

 

  • Author
6 minutes ago, shremi said:

 

Yeah i am trying to add my usb-rtl dongle to my home assistant VM , from what i read , it is required to connect as serial for home assistant. 

 

As far as I know only conbee ii needs to be connected as serial in HA.

 

Your dev does not have a serial option hence the path is missing on the host.

  • 4 weeks later...

I know this is really for VM's but it would be awesome if it could show the correct mappings that can be copied into docker configs.

 

It's easy enough to go to /bus/usb/001/009 but its not as easy to find the /dev/ttly84575 type code

Also bus numbers seem to change on reboots.

 

What do you guys do for docker usb passthroughs?

 

I guess this is why folks run home assistant as a VM lol.

 

Trying to add the motherboard's intel bluetooth chip & a zigbee usb stick..

 

Strange though as frigate docker using google coral usb was handsfree working.

Edited by dopeytree

  • Author
14 hours ago, dopeytree said:

I know this is really for VM's but it would be awesome if it could show the correct mappings that can be copied into docker configs.

 

It's easy enough to go to /bus/usb/001/009 but its not as easy to find the /dev/ttly84575 type code

Also bus numbers seem to change on reboots.

 

What do you guys do for docker usb passthroughs?

 

I guess this is why folks run home assistant as a VM lol.

 

Trying to add the motherboard's intel bluetooth chip & a zigbee usb stick..

 

Strange though as frigate docker using google coral usb was handsfree working.

Is it the serial port mappings you are looking for?

 

This will show links to tty dev.

 

root@computenode:~# ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Nov 10 07:33 usb-0658_0200-if00 -> ../../ttyACM0
lrwxrwxrwx 1 root root 13 Nov 10 11:55 usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_-if00 -> ../../ttyACM1

1648385179_Screenshot2023-11-10at12_50_50.thumb.png.bf0cfbd3762437ca78bcd54a7034fb6f.png

  • Author
1 hour ago, dopeytree said:

1648385179_Screenshot2023-11-10at12_50_50.thumb.png.bf0cfbd3762437ca78bcd54a7034fb6f.png

Do you have an example type of device and how you find the mapping? This is one of the ways I get info. adding -a will walk up the tree.

 

udevadm info -q  property -n /dev/bus/usb/001/012

 

root@computenode:~# udevadm info  -q property -n /dev/bus/usb/001/012
BUSNUM=001
DEVNAME=/dev/bus/usb/001/012
DEVNUM=012
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.4
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=0200
ID_MODEL_ENC=0200
ID_MODEL_ID=0200
ID_REVISION=0000
ID_SERIAL=0658_0200
ID_USB_INTERFACES=:020201:0a0000:
ID_VENDOR=0658
ID_VENDOR_ENC=0658
ID_VENDOR_ID=0658
MAJOR=189
MINOR=11
PRODUCT=658/200/0
SUBSYSTEM=usb
TYPE=2/0/0
USEC_INITIALIZED=42627407

 

Love the plug, and it works great.

 

Is there a way to run a script when it detects a device? I have a KVM that has a USB hub that passes a USB keyboard/mouse dongle. I would like it to start a VM if it is not already running. Is it possible to add the option in the plugin to start the VM when a USB device is detected?

  • Author
15 minutes ago, jzhvymetal said:

Love the plug, and it works great.

 

Is there a way to run a script when it detects a device? I have a KVM that has a USB hub that passes a USB keyboard/mouse dongle. I would like it to start a VM if it is not already running. Is it possible to add the option in the plugin to start the VM when a USB device is detected?

I did start to look at adding option to run a script but have not implemented as yet. But if it is just starting the VM if not started that should be a simple-ish add. Or option to run a user script from squids plugin may also be do-able.

  • Author
7 hours ago, jzhvymetal said:

Love the plug, and it works great.

 

Is there a way to run a script when it detects a device? I have a KVM that has a USB hub that passes a USB keyboard/mouse dongle. I would like it to start a VM if it is not already running. Is it possible to add the option in the plugin to start the VM when a USB device is detected?

Add a switch to the settings to start vm when a device is connect if shutdown.

 

release 2023.11.17

 

image.png

 

Thanks you work fast.  I tried it but does not seem to start the VM.  Is at the start of the Plugin or when the USB device is plugged in and discovered?

image.thumb.png.74c2de19c7707fa6bfe9e10fa710359b.png

Edited by jzhvymetal

  • Author
12 minutes ago, jzhvymetal said:

 

Thanks you work fast.  I tried it but does not seem to start the VM.  Is at the start of the Plugin or when the USB device is plugged in and discovered?

I will be when the device is plugin. How have you set up the mapping?

 

also what usb manager messages do you have in the log?

13 minutes ago, SimonF said:

I will be when the device is plugin. How have you set up the mapping?

 

also what usb manager messages do you have in the log?  

Mapping in post above.  Logs are below.  I just updated the usb plugin do I need to restart Unraid?

 

image.thumb.png.f59c820f8c1bd958d11597e120a7cdf2.png

  • Author
9 minutes ago, jzhvymetal said:

Mapping in post above.  Logs are below.  I just updated the usb plugin do I need to restart Unraid?

 

image.thumb.png.f59c820f8c1bd958d11597e120a7cdf2.png

No need to restart unraid. 

 

sorry just seen the mapping.

 

I will need to test with a vm with a space in name tomorrow as late here now.

 

 

 

 

3 minutes ago, SimonF said:

No need to restart unraid. Have you set the switch in the device mappings as per my screen shot you will need to enable start vm switch.

 

 

Yes I did.....see below.  The KVM switches in a USB hub that the dongle is connected.   Switching KVM port, It works perfect when the VM is on.  When VM is off it does not start the VM. 

 

image.thumb.png.299fc4c052876744195d2e5028bc11a3.png

  • Author
1 minute ago, jzhvymetal said:

Yes I did.....see below.  The KVM switches in a USB hub that the dongle is connected.   Switching KVM port, It works perfect when the VM is on.  When VM is off it does not start the VM. 

 

image.thumb.png.299fc4c052876744195d2e5028bc11a3.png

I updated my post above. Will do some more testing tomorrow

Just now, SimonF said:

I updated my post above. Will do some more testing tomorrow

Ok thanks.   No rush.  I have my Unraid server 20m away in basement but I have my work laptop to start the VM.   Most say to leave the VM running but I notice there is 40w less draw when it is sleeping.  The goal is to start the VM remotely by just switching the KVM.

 

In case others want a simular setup below is the hardware I'm using.  Addional hub is not required but I use it be able to mount external storage without KVM on the Unriad port.

 

KVM

https://www.amazon.com/dp/B0C5WMSRSC?psc=1&ref=ppx_yo2ov_dt_b_product_details

 

This USB Hub 

https://www.amazon.com/dp/B0BMFDLRSQ?psc=1&ref=ppx_yo2ov_dt_b_product_details

 

Usb Extension Cable

https://www.amazon.com/dp/B00AA0U08M?psc=1&ref=ppx_yo2ov_dt_b_product_details

 

 

54 minutes ago, SimonF said:

No need to restart unraid. 

 

sorry just seen the mapping.

 

I will need to test with a vm with a space in name tomorrow as late here now.

 

 

 

 

Again no rush......I tried renaming the VM to "Windows_11" and remapping the dongle and sitll does not start.  It might be that the device is casecaded with multiple USB hubs?    Let me know if there anything else needed for testing.  BR

 

Here is my setup

 

Unraid Server -> Active USB cable -> Powered USB Hub -> Powered KVM with switched USB HUB -> Logitech Keyboard/Mouse Dongle

image.thumb.png.051aaa1b992c651847d4ac805c5fd010.png

Edited by jzhvymetal

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.