Restart USB mouse driver?
Try Ctrl+Alt+F1 to text mode and immediately Ctrl+Alt+F7 to graphical mode.
The optical mouse on my laptop running Ubuntu 18.04 on the 4.15.0-51-generic kernel just quit working for some reason. First I tried the normal quick remedies that is unplugging and re-plugging first on the same port and then on the other two unused ports; the mouse still didn't work. I have to point out that I still had power on the USB ports. So I was puzzled and decided to check what was happening on my terminal. Here are my interactions with the system.
dmesg
I found the following entries in the system log.
usb 1-1.2: USB disconnect, device number 16
[50687.847220] usb 1-1.2: new low-speed USB device number 17 using ehci-pci
[50687.959081] usb 1-1.2: New USB device found, idVendor=0000, idProduct=0538
[50687.959084] usb 1-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[50687.959085] usb 1-1.2: Product: USB OPTICAL MOUSE
[50687.961754] input: USB OPTICAL MOUSE as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:0000:0538.0004/input/input18
[50688.019546] hid-generic 0003:0000:0538.0004: input,hidraw0: USB HID v1.11 Mouse [ USB OPTICAL MOUSE] on usb-0000:00:1a.0-1.2/input0
I then tried unloading and re-loading usbhid
sudo modprobe -r usbhid && sudo modprobe usbhid
That did not work. However I did notice a new error in the logs
usb usb3-port2: connect-debounce failed
At this point I decided to do a web search to see what that specific error means and that's how I landed on this page. I however felt that the solutions provided needed too much work and instead opted to see what else I could do with the Kernel modules to solve the problem. First I checked what specific kernel modules were loaded by running
sudo modprobe -r Tab
Please note that the proper way of getting loaded modules is by running lsmod but I prefer the method I used above for minute tasks for which I have no use for lsmod's much more verbose output
A module name psmouse caught my eye and I decided to test whether reloading both both usbhid and psmouse resurrects my mouse.
sudo modprobe -r usbhid && sudo modprobe -r psmouse
sudo modprobe usbhid && sudo modprobe psmouse
And just like that the functions of my optical mouse were restored.
This USB reloading helped me: http://davidjb.com/blog/2012/06/restartreset-usb-in-ubuntu-12-04-without-rebooting/
The original article suggests this:
echo -n "0000:00:1a.0" | tee /sys/bus/pci/drivers/ehci_hcd/unbind
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci_hcd/unbind
echo -n "0000:00:1a.0" | tee /sys/bus/pci/drivers/ehci_hcd/bind
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci_hcd/bind
But on my Debian I need to replace ehci_hcd
by ehci-pci
.
Also you may have different IDs, they can be obtained by executing:
lspci | grep USB