http://forum.linuxmce.org/index.php/topic,12645.msg90246.html#msg90246
refers...
The issue is this- the gamepad detection and install scripts use the existence of /dev/js0 as the trigger for adding this device. Unfortunately /dev/js0 is also added for at least one other device (internal notebook accelerometer as per above post).
I would like to modify the detection and install scripts to use another method to find the gamepad. I'm thinking the output of lsusb for example... but I don't have a gamepad to test. If anyone has one, please can they assist with testing and post the output of
lsusb -v
(obviously this will be executed after sshing into the media director to which the gamepad is connected) for me.
Ta.
PS, if anyone else with actual skills wants to take this over, feel free ;-)
I would probably talk to udev to get usb joystick devices.
-Thom
What's wrong with a notebooks accelerometer to be used as a game pad?
Quote from: posde on July 02, 2012, 06:55:42 PM
What's wrong with a notebooks accelerometer to be used as a game pad?
My daughter asked the same question.
Quote from: tschak909 on July 02, 2012, 06:44:10 PM
I would probably talk to udev to get usb joystick devices.
-Thom
Alright,
*after much reading*
Someone that has a USB gamepad that they would like to continue using in the next release of the next snapshot of the next update of the wonderful and all-powerful LinuxMCE 10.04, please post their output from
udevadm info --query property --name /dev/input/js0
Non-joystick:
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1:1.1/inpu t/input6/js0
MAJOR=13
MINOR=0
DEVNAME=/dev/input/js0
SUBSYSTEM=input
ID_INPUT=1
ID_INPUT_MOUSE=1
ID_VENDOR=American_Megatrends_Inc.
ID_VENDOR_ENC=American\x20Megatrends\x20Inc.
ID_VENDOR_ID=046b
ID_MODEL=Virtual_Keyboard_and_Mouse
ID_MODEL_ENC=Virtual\x20Keyboard\x20and\x20Mouse
ID_MODEL_ID=ff10
ID_REVISION=0100
ID_SERIAL=American_Megatrends_Inc._Virtual_Keyboard_and_Mouse_serial
ID_SERIAL_SHORT=serial
ID_TYPE=hid
ID_BUS=usb
ID_USB_INTERFACES=:030101:030102:
ID_USB_INTERFACE_NUM=01
ID_USB_DRIVER=usbhid
ID_PATH=pci-0000:00:1a.0-usb-0:1.5.1:1.1
DEVLINKS=/dev/char/13:0 /dev/input/by-id/usb-American_Megatrends_Inc._Virtual_Ke yboard_and_Mouse_serial-mouse /dev/input/by-path/pci-0000:00:1a.0-usb-0:1.5.1:1. 1-mouse
Joystick:
root@moon36:~# udevadm info --query property --name /dev/input/js0
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/input/input4/js0
MAJOR=13
MINOR=0
DEVNAME=/dev/input/js0
SUBSYSTEM=input
ID_INPUT=1
ID_INPUT_JOYSTICK=1
ID_VENDOR=Logitech
ID_VENDOR_ENC=Logitech
ID_VENDOR_ID=046d
ID_MODEL=Logitech_Cordless_RumblePad_2
ID_MODEL_ENC=Logitech\x20Cordless\x20RumblePad\x202
ID_MODEL_ID=c219
ID_REVISION=0305
ID_SERIAL=Logitech_Logitech_Cordless_RumblePad_2
ID_TYPE=hid
ID_BUS=usb
ID_USB_INTERFACES=:030000:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=usbhid
ID_PATH=pci-0000:00:1d.3-usb-0:2:1.0
ACL_MANAGE=1
note the ID_INPUT_JOYSTICK=1 property.
-Thom
Thanks. I may be getting somewhere on the AVWizard_Gamepad_Detect part but now for the polling script... Gamepad_Detect....
Thom, would you mind posting the output of
udevadm info --attribute-walk --name /dev/input/js0
from your joystick machine?
Ta
Edit: Almost forgot- please also check that the following script returns what you expect from your two machines-
http://pastebin.com/r1bsRXNt
root@moon36:~# udevadm info --attribute-walk --name /dev/input/js0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/input/input4/js0':
KERNEL=="js0"
SUBSYSTEM=="input"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/input/input4':
KERNELS=="input4"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="Logitech Logitech Cordless RumblePad 2"
ATTRS{phys}=="usb-0000:00:1d.3-2/input0"
ATTRS{uniq}==""
ATTRS{modalias}=="input:b0003v046DpC219e0111-e0,1,3,4,15,k130,131,132,133,134,135,136,137,138,139,13A,13B,ra0,1,2,5,10,11,m4,lsf50,51,58,59,5A,60,w"
looking at parent device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0':
KERNELS=="5-2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="usbhid"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bNumEndpoints}=="02"
ATTRS{bInterfaceClass}=="03"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{modalias}=="usb:v046DpC219d0305dc00dsc00dp00ic03isc00ip00"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2':
KERNELS=="5-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}=="PACER-X03.05_A"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bMaxPower}==" 98mA"
ATTRS{urbnum}=="21"
ATTRS{idVendor}=="046d"
ATTRS{idProduct}=="c219"
ATTRS{bcdDevice}=="0305"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{speed}=="12"
ATTRS{busnum}=="5"
ATTRS{devnum}=="3"
ATTRS{version}==" 2.00"
ATTRS{maxchild}=="0"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="Logitech"
ATTRS{product}=="Logitech Cordless RumblePad 2"
looking at parent device '/devices/pci0000:00/0000:00:1d.3/usb5':
KERNELS=="usb5"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}==""
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bMaxPower}==" 0mA"
ATTRS{urbnum}=="59"
ATTRS{idVendor}=="1d6b"
ATTRS{idProduct}=="0001"
ATTRS{bcdDevice}=="0206"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="12"
ATTRS{busnum}=="5"
ATTRS{devnum}=="1"
ATTRS{version}==" 1.10"
ATTRS{maxchild}=="2"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="Linux 2.6.32-41-generic uhci_hcd"
ATTRS{product}=="UHCI Host Controller"
ATTRS{serial}=="0000:00:1d.3"
ATTRS{authorized_default}=="1"
looking at parent device '/devices/pci0000:00/0000:00:1d.3':
KERNELS=="0000:00:1d.3"
SUBSYSTEMS=="pci"
DRIVERS=="uhci_hcd"
ATTRS{vendor}=="0x8086"
ATTRS{device}=="0x27cb"
ATTRS{subsystem_vendor}=="0x19da"
ATTRS{subsystem_device}=="0xa140"
ATTRS{class}=="0x0c0300"
ATTRS{irq}=="16"
ATTRS{local_cpus}=="ff"
ATTRS{local_cpulist}=="0-7"
ATTRS{modalias}=="pci:v00008086d000027CBsv000019DAsd0000A140bc0Csc03i00"
ATTRS{enable}=="1"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
Thom... I need some help here, buddy. The breadcrumb trail has got me this far only.
Here's the install and detect system as I understand it:
At Boot Time:
==========
AVWizard_Run.sh (which runs every boot if I recall):
calls: AVWizard_Gamepad_Detect.sh, which, in turn:
1. installs lmce-usb-gamepad (if it thinks it's needed)
2. returns "/usr/pluto/bin/USB_Game_Pad -l /var/log/pluto/avremote.log -r dcerouter -d -1003 -H localhost -P " or something to that effect.
AVWizard_Run.sh then sets the returned value in 2) to the environment variable GamepadCmd.
OK, so the package is installed if required, but I can't see why the GamepadCmd variable is set because I can't figure out where/if it's ever used?
Every 5 seconds:
=============
Gamepad_Detect.sh
1. If gamepad not already running but it is detected, send appropriate message to dcerouter.
----------------------------------
So what I'm thinking is that instead of polling every 5 seconds, we just setup a rule in the udev system that detects the gamepad either on boot or on plug in and fires off a script that does the whole shebang- installs the package (if not installed) and sends the message to the router.
The only snag is... that "GamepadCmd" bit... what is that used for and where does it come in. Is it a necessary step I'm missing out?
2 gamepads
XBox Wireless
[57094.440019] usb 2-1: new full speed USB device using ohci_hcd and address 7
[57094.657316] input: Generic X-Box pad as /devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/input/input11
[57094.657594] input: Generic X-Box pad as /devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.2/input/input12
[57094.657840] input: Generic X-Box pad as /devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.4/input/input13
[57094.658084] input: Generic X-Box pad as /devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.6/input/input14
-----
# udevadm info --query property --name /dev/input/js0
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/input/input11/js0
MAJOR=13
MINOR=0
DEVNAME=/dev/input/js0
SUBSYSTEM=input
ID_INPUT=1
ID_INPUT_JOYSTICK=1
ID_VENDOR=045e
ID_VENDOR_ENC=045e
ID_VENDOR_ID=045e
ID_MODEL=0291
ID_MODEL_ENC=0291
ID_MODEL_ID=0291
ID_REVISION=0107
ID_SERIAL=045e_0291
ID_TYPE=generic
ID_BUS=usb
ID_USB_INTERFACES=:ff5d81:ff5d82:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=xpad
ID_PATH=pci-0000:00:02.0-usb-0:1:1.0
ACL_MANAGE=1
DEVLINKS=/dev/char/13:0 /dev/input/by-id/usb-045e_0291-joystick /dev/input/by-path/pci-0000:00:02.0-usb-0:1:1.0-joystick
Logitech rumblepad 2
[58408.244021] usb 2-1: new low speed USB device using ohci_hcd and address 8
[58408.512541] input: Logitech Logitech RumblePad 2 USB as /devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/input/input15
[58408.512782] logitech 0003:046D:C218.0004: input,hidraw3: USB HID v1.10 Joystick [Logitech Logitech RumblePad 2 USB] on usb-0000:00:02.0-1/input0
[58408.512797] logitech 0003:046D:C218.0004: Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <anssi.@gmail.com>
-----
# udevadm info --query property --name /dev/input/js0
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/input/input15/js0
MAJOR=13
MINOR=0
DEVNAME=/dev/input/js0
SUBSYSTEM=input
ID_INPUT=1
ID_INPUT_JOYSTICK=1
ID_VENDOR=Logitech
ID_VENDOR_ENC=Logitech
ID_VENDOR_ID=046d
ID_MODEL=Logitech_RumblePad_2_USB
ID_MODEL_ENC=Logitech\x20RumblePad\x202\x20USB
ID_MODEL_ID=c218
ID_REVISION=0100
ID_SERIAL=Logitech_Logitech_RumblePad_2_USB
ID_TYPE=hid
ID_BUS=usb
ID_USB_INTERFACES=:030000:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=usbhid
ID_PATH=pci-0000:00:02.0-usb-0:1:1.0
ACL_MANAGE=1
DEVLINKS=/dev/char/13:0 /dev/input/by-id/usb-Logitech_Logitech_RumblePad_2_USB-joystick /dev/input/by-path/pci-0000:00:02.0-usb-0:1:1.0-joystick
Quote from: jamo on July 03, 2012, 09:50:26 PM
OK, so the package is installed if required, but I can't see why the GamepadCmd variable is set because I can't figure out where/if it's ever used?
...
snag is... that "GamepadCmd" bit... what is that used for and where does it come in. Is it a necessary step I'm missing out?
The GamepadCmd environment variable is read by the actual AVWizard (a C++ program) and it's contents are executed by AVWizard to start the GamePad device. It also takes care of removing the device when the AVWizard completes.
When AVWizard completes, the GamePad Radar (Gamead_Detect.sh) takes over detection..
It seems to me that the easiest way to implement this might be to simply alter the existing detection scripts. Run 'udevadm info --query property --name /dev/input/js0' on each detected device and grep it for 'ID_INPUT_JOYSTICK=1', if that returns a value then activate the gamepad. Likewise don't activate the device in the radar (or set GamepadCmd) if the grep returns nothing. The udev rule would likely be more efficient on cpu resources.
J.
To illustrate my previous e-mail, and as tschak pointed out earlier, devices will either have or not have ID_INPUT_JOYSTICK=1.
Here is the udev output from the mouse in my VirtualBox Virtual Machine that is consistently detected as a joystick, notice there is no ID_INPUT_JOYSTICK=1, it has ID_INPUT_MOUSE=1 instead. Why it is mapped to /dev/input/js0 as well as the normal mouse input I have no idea.
# udevadm info --query property --name /dev/input/js0
UDEV_LOG=3
DEVPATH=/devices/pci0000:00/0000:00:06.0/usb2/2-1/2-1:1.0/input/input4/js0
MAJOR=13
MINOR=0
DEVNAME=/dev/input/js0
SUBSYSTEM=input
ID_INPUT=1
ID_INPUT_MOUSE=1
ID_VENDOR=VirtualBox
ID_VENDOR_ENC=VirtualBox
ID_VENDOR_ID=80ee
ID_MODEL=USB_Tablet
ID_MODEL_ENC=USB\x20Tablet
ID_MODEL_ID=0021
ID_REVISION=0100
ID_SERIAL=VirtualBox_USB_Tablet
ID_TYPE=hid
ID_BUS=usb
ID_USB_INTERFACES=:030000:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=usbhid
ID_PATH=pci-0000:00:06.0-usb-0:1:1.0
DEVLINKS=/dev/char/13:0 /dev/input/by-id/usb-VirtualBox_USB_Tablet-mouse /dev/input/by-path/pci-0000:00:06.0-usb-0:1:1.0-mouse
J.
awesome. patch it :)
-Thom
Quote from: tschak909 on February 02, 2013, 10:20:45 PM
awesome. patch it :)
-Thom
Working on it. :) Here's a Gamepad_Detect.sh and AVWizard_Gamepad_Detect.sh that are no longer detecting my mouse as a game pad. I'll submit to svn if I can get confirmation that it works for someone else with a gamepad and for someone who has always had the issue of improper detection of non joystick devices.
http://pastebin.com/VYAVp97U <- Gamepad_Detect.shhttp://pastebin.com/nJuvWJFu <- AVWizard_Gamepad_Detect.shJ.
Alright, after conversation with tschak on irc I understand the issue a little bit more and it will require a bit more refactoring of the detection scripts and of the USB_Game_Pad device to function the way it needs too. I'm am first fixing the detection scripts to detect ANY joystick existing on /dev/input/js?. Then (hopefully) figure out USB_Game_Pad so that it will ignore non-joystick devices that present at /dev/input/js?.
J.
Fixes are in svn for erroneous detection issues.
I also fixed an issue where the detection radar only functioning properly if a joystick was plugged in, for the first time, after bootup. It would not function correctly on a core if the joystick was first plugged in prior to, or during, boot. Basically the radar is starts before dcerouter which prevents the detection message from reaching the dcerouter during boot. The radar then would not fire any additional detection messages and the joystick was never detected.
http://svn.linuxmce.org/trac.cgi/attachment/ticket/1675/
I'm not sure when these will be rolled in, everything is working well.
J.
Hi Phenigma
Thanks for having a look at this. I will try to apply and test your patches on my false positives (hp6710b notebooks accelerometer) and let you know. Will be great if this is addressed.
Oops- spoke too soon. I will test after all is rolled in. I thought it was a script fix, not a c++ program fix. I can't test that without doing an update once the change has been merged. Will keep an eye on the ticket and try it once merged.
There are two 'fixes' to repair the issue. The first is script based only and will fix improper initial detection. The USB_Game_Pad (c++) fixes the same issues AFTER a game pad has been detected. USB_Game_Pad and the detection radars are independent. All is working great here so I'm hopeful it will be rolled in soon. I can provide copies of the scripts which, after you delete the existing GamePad devices in webadmin, will no longer detect and add new game pad devices. Once a joystick device is plugged in it would create the game pad device and USB_Game_Pad takes over at that point.
If your issue is solely that you have erroneous detection and want that to stop. You can use the following scripts as replacements then reboot the core/md in question (to reload the detection radar) and delete the existing game_pad devices from webadmin. As long as you don't plug in anything that presents as a joystick then USB_Game_Pad should not run after this.
http://pastebin.com/nLSpwphr <- Gamepad_Detect.sh
http://pastebin.com/FbW50EiH <- AVWizard_Gamepad_Detect.sh
J.
Quote from: jamo on February 04, 2013, 08:07:30 AM
Thanks for having a look at this. I will try to apply and test your patches on my false positives (hp6710b notebooks accelerometer) and let you know. Will be great if this is addressed.
You're welcome, it's been buggin the crap out of me too :). Just for completeness, could you post the output of:
udevadm info --query property --name /dev/input/js0
for your accelerometer device. (Accelerometer in my laptop doesn't present at /dev/input/js?) I know it will not mis-detect a mouse device now but I'm not sure what the accelerometer presents as.
J.
Sure, here it is on the accelerometer machine (hp6710b):
root@moon34:~# udevadm info --query property --name /dev/input/js0
UDEV_LOG=3
DEVPATH=/devices/platform/lis3lv02d/input/input7/js0
MAJOR=13
MINOR=0
DEVNAME=/dev/input/js0
SUBSYSTEM=input
ID_INPUT=1
ID_PATH=platform-lis3lv02d
DEVLINKS=/dev/char/13:0
I really want to beat whomever did the udev rules for these devices to a fucking pulp...
-Thom
Quote from: jamo on February 06, 2013, 05:53:30 AM
Sure, here it is on the accelerometer machine (hp6710b):
Thanks jamo! You're device does not present ID_INPUT_JOYSTICK=1. Your device will not be erroneously detected after the next snapshot is released.
J.
Quote from: tschak909 on February 06, 2013, 05:55:16 AM
I really want to beat whomever did the udev rules for these devices to a fucking pulp...
-Thom
Agreed.
J.
apt-get upgrade will bring it into the system.
Thanks posde! I wasn't sure if it was in the repo yet or not.
J.