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.

USB On/Off While VMs Down

Featured Replies

Running Version "6.4.0-rc9f"

 

Seat 0, Config & Monitoring Tools

Seat 1, Main Gaming PC

Seat 2, 2nd Gaming PC or Updates / Distro Previewing

 

So my current setup is a working Win 10 VM for seat 1

- XFX 480 GPU & Sound pass-through

 - Had an issue in the beginning were I had to use seabios to pass-through the GPU , Fixed by adding a low profile GPU for unRAID to grab.

- MB Sound pass-through

- Going to get a M.2 to replace the current SSD cache drive, my option are...

     - Get a 1TB M.2 to carry all caching and vdisks

     - Use the 1TB M.2 for cache only, and use a SSD or M.2 partitioned into 3

     - Use the 1TB M.2 for cache only, and use dedicated SSDs or M.2 for each seat

 - Going to be adding a 3rd GPU for seat 2

 

So back to the topic...

So at the end of my day...

I would like to turn off the devices that don't need to be on unless the VM it's assigned to is running.

All these devices have screens and LEDs consuming power and illuminating, NOT ideal.

So I created a script that turns them off... Well 1 for now.

The script grabs the id for the USB device that I want off and executes unbind, script is run manually... and the device startups automatically on VM boot.

Is there a "HOOK" for VM e.g. startup, restart, shutdown that can be used to call scripts?

 

Now I'd like this to work for Keyboard and mouse too, but with my current script it makes the device inaccessible until reboot, will be testing further...

Is there a sleep function in unRAID, for keyboard and mouse?

  • Author

So I made a work around for the moment.

 

I setup a batch file in windows to ssh into unRAID and call my usb_off script when windows is shutdown.

Execute gpedit.msc

Computer Configuration -> Windows settings -> Scripts -> Shutdown -> Properties -> Add

 

It cycles through all usb devices until it gets a name match, then grabs the id for the device and executes the unbind cmd.

 

sh /boot/config/plugins/user.scripts/scripts/cia_usb_off_var/script "%Device Name%"

#!/bin/bash
for device in $(ls /sys/bus/usb/devices/*/product)
do
name=$( cat $device )
if [[ "$name" == "$1" ]]; then
     id=$( echo $device | awk -v FS="(devices/|/product)" '{print $2}')
     echo "$id" > /sys/bus/usb/drivers/usb/unbind
     echo "0" > "/sys/bus/usb/devices/$id/power/autosuspend_delay_ms"
     echo "auto" > "/sys/bus/usb/devices/$id/power/control"
fi
done

It's setup this way to future-proof the coding, this way I can call it and turn off multiple devices.

 

As I stated this is a work around, cause...

All devices turn off, they do not turn back on at the moment, requiring you to unplug and plug back in to reinitialize

One device turns back on if you press a button, but not the others.

Archived

This topic is now archived and is closed to further replies.

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.