keyboard or mouse mounted as ghost joystick
Posted 09-14-2016 at 12:15 PM by number22
Updated 09-15-2016 at 06:58 PM by number22 (spelling, format)
Updated 09-15-2016 at 06:58 PM by number22 (spelling, format)
Mouse cursor jumps randomly and having a hard time in some steam games. This problem is fixed by udev rules. find this link by google: udev keyboard joystick
https://github.com/denilsonsa/udev-joystick-blacklist
Modified its rules so the ghost joystick is unbinded from usbhid driver.
I have tried to use bInterfaceNumber, but it didn't work for me.
When you're doing test, try comment out rm line first; so you can use udevadm to find out exactly joystick interface number is; example is 1.1.
Change idProduct and idVendor to suit your hardware.
note: check usbhid driver is unbinded from joystick interface, but not from keyboard interface, you still need it for keyboard function.
note: mouse's power control can change to "on" instead "auto" which will disable power saving feature as autosuspend.
update: bInterfaceNumber works as ID_USB_INTERFACE_NUM: it only takes hex number. "01" will not work. Now it will only deletes joystick event and keep keyboard alone.
https://github.com/denilsonsa/udev-joystick-blacklist
Modified its rules so the ghost joystick is unbinded from usbhid driver.
Code:
#Microsoft Corp. Basic Optical Mouse v2.0 power ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0x045e", ATTR{idProduct}=="0x00cb", TEST=="power/control", ATTR{power/control}="auto" #Microsoft Corp. Wired Keyboard 600 not joysticks #using ENV{ID_INPUT_JOYSTICK}=="1" SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", ENV{ID_INPUT_JOYSTICK}=="?*" ENV{ID_INPUT_JOYSTICK}="" SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", KERNEL=="js[0-9]*", MODE="0000", ENV{ID_INPUT_JOYSTICK}="" SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", KERNEL=="js[0-9]*", RUN+="/bin/rm %E{DEVNAME} %E{DEVLINKS}", ENV{ID_INPUT_JOYSTICK}="" SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", KERNEL=="event[0-9]", MODE="0000", ENV{ID_INPUT_JOYSTICK}="" SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", KERNEL=="event[0-9]", RUN+="/bin/rm %E{DEVNAME} %E{DEVLINKS}" ,ENV{ID_INPUT_JOYSTICK}="" SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", KERNEL=="*:1.1", RUN+="/bin/sh -c '/bin/echo -n %k >/sys${DEVPATH}/driver/unbind'"
When you're doing test, try comment out rm line first; so you can use udevadm to find out exactly joystick interface number is; example is 1.1.
Change idProduct and idVendor to suit your hardware.
Quote:
#>lsusb -t
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
|__ Port 1: Dev 5, 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=, 1.5M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 6: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/3p, 12M
|__ Port 1: Dev 5, 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=, 1.5M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 6: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
note: check usbhid driver is unbinded from joystick interface, but not from keyboard interface, you still need it for keyboard function.
note: mouse's power control can change to "on" instead "auto" which will disable power saving feature as autosuspend.
update: bInterfaceNumber works as ID_USB_INTERFACE_NUM: it only takes hex number. "01" will not work. Now it will only deletes joystick event and keep keyboard alone.
Code:
SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0750", KERNEL=="event[0-9]*", ENV{ID_USB_INTERFACE_NUM}=="0x01", RUN+="/bin/rm %E{DEVNAME} %E{DEVLINKS}", ENV{ID_INPUT_JOYSTICK}=""
Total Comments 0