LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > number22
User Name
Password

Notices


Rate this Entry

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)

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.

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'"
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.

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


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}=""
Posted in Uncategorized
Views 1789 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 04:54 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration