Block/blacklist USB device from proxmox host, allow only passthrough

logan893

Member
Mar 23, 2022
8
0
6
I have a USB receiver for a wireless remote, which has a power button on it. I use this in a VM with a media player.
Hitting the power button from within the VM will trigger a VM power-down. Once the VM is powered off, hitting the power button on the remote again will trigger a power-down of the proxmox host. (I could swear also once it even triggered a power off of both the VM and the host with a single button press.)

How do I block the USB device in the proxmox host while allowing passthrough?

Alternatively, can I intercept the input from the remote and rebind it to e.g. issue a VM-start if the VM it is intended for is not running?
 
Last edited:
Find out what drier is loader for the button and blacklist it? This requires that the driver is only used for this particular device.

Thanks for the suggestion. The driver is very generic (hid_generic and/or usbhid), and blocking hid would prevent use of any USB keyboard on the host, I believe. I don't usually need this, but it's good to have the option available.

One way so far that I have found to disable the keyboard power button is via systemd-logind (HandlePowerKey=ignore), which however also disables shutdown via the hardware power button on the PC.

Is there a way to block this specific device type, perhaps in systemd which seems to be "watching the system buttons" on the device once connected? Would be great to only block shutdown from keyboards generally, while allowing the physical hardware button to still work.


Code:
Dec 13 09:36:22 pvemini kernel: usb 1-1: new full-speed USB device number 4 using xhci_hcd
Dec 13 09:36:22 pvemini kernel: usb 1-1: New USB device found, idVendor=a604, idProduct=0715, bcdDevice= 2.00
Dec 13 09:36:22 pvemini kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Dec 13 09:36:22 pvemini kernel: usb 1-1: Product: Wireless Devic
Dec 13 09:36:22 pvemini kernel: usb 1-1: Manufacturer: 2.4G Composite Devic
Dec 13 09:36:22 pvemini kernel: usb 1-1: Warning! Unlikely big volume range (=8192), cval->res is probably wrong.
Dec 13 09:36:22 pvemini kernel: usb 1-1: [3] FU [Mic Capture Volume] ch = 1, val = -8192/0/1
Dec 13 09:36:22 pvemini kernel: input: 2.4G Composite Devic Wireless Devic as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.2/0003:A604:0715.0005/input/input18
Dec 13 09:36:22 pvemini kernel: hid-generic 0003:A604:0715.0005: input,hidraw0: USB HID v1.01 Keyboard [2.4G Composite Devic Wireless Devic] on usb-0000:00:14.0-1/input2
Dec 13 09:36:22 pvemini kernel: input: 2.4G Composite Devic Wireless Devic Mouse as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.3/0003:A604:0715.0006/input/input19
Dec 13 09:36:22 pvemini kernel: input: 2.4G Composite Devic Wireless Devic Consumer Control as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.3/0003:A604:0715.0006/inpu>
Dec 13 09:36:22 pvemini kernel: input: 2.4G Composite Devic Wireless Devic System Control as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.3/0003:A604:0715.0006/input/>
Dec 13 09:36:22 pvemini kernel: hid-generic 0003:A604:0715.0006: input,hidraw1: USB HID v1.01 Mouse [2.4G Composite Devic Wireless Devic] on usb-0000:00:14.0-1/input3
Dec 13 09:36:22 pvemini systemd-logind[1476]: Watching system buttons on /dev/input/event5 (2.4G Composite Devic Wireless Devic Consumer Control)
Dec 13 09:36:22 pvemini systemd-logind[1476]: Watching system buttons on /dev/input/event6 (2.4G Composite Devic Wireless Devic System Control)
Dec 13 09:36:22 pvemini systemd-logind[1476]: Watching system buttons on /dev/input/event3 (2.4G Composite Devic Wireless Devic)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!