1

Ubuntu Server 15.10

Having issues with 2 usb receivers with same serial number. My service mixes them up. But if I remove the usb plugs on reboot and then attach them in specific order it works fine.

Can I on boot disable all usb ports (port 1 - 8). Then on a delay enable only port 2 and later 4.

2
  • As an alternative, can't you use a single usb receiver instead of two?
    – Smile4ever
    Dec 30 '15 at 11:00
  • 1
    No. It's satellite receivers so one for each on the wall.
    – roady
    Dec 30 '15 at 11:17
3

I cannot guarantee this will work, but give it a try.

First, show all USB devices:

sudo lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 2: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 7: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 7: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
    |__ Port 8: Dev 5, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 8: Dev 5, If 1, Class=Video, Driver=uvcvideo, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

You can then disable the wanted USB port on the root hub.

Disabling a port on the root hub means I can disable my webcam (uvcvideo) like this (bus 3, port 8):

echo '3-8' |sudo tee /sys/bus/usb/drivers/usb/unbind

I can also re-enable it:

 echo '3-8' |sudo tee /sys/bus/usb/drivers/usb/bind

Do this with caution, as inputting wrong numbers can disable your keyboard. Ideally, make sure you can still type if USB is turned off (for example, on a laptop you have a built-in keyboard)

As you are saying you are using a server, you could setup SSH to the machine to be able to type if the keyboard gets disactivated while trying this.

A reboot can probably solve a disabled keyboard as well.

As for disabling it on the fly just after booting, put these commands in a script (adapt to your own situation):

sleep 20 #try if this is needed, needs an increase etc
echo '3-8' |sudo tee /sys/bus/usb/drivers/usb/unbind # detach device 1
echo '2-1' |sudo tee /sys/bus/usb/drivers/usb/unbind # detach device 2
sleep 5
echo '3-8' |sudo tee /sys/bus/usb/drivers/usb/bind # attach device 1
sleep 5
echo '2-1' |sudo tee /sys/bus/usb/drivers/usb/bind # attach device 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.