udev: /dev/input/js0 is created but no joystick attached

Bug #1458631 reported by Thomas Andersen
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Expired
Medium
Unassigned
systemd (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

With ubuntu vivid i see a /dev/input/js0. I do not have a joystick or gamepad attached. This invalid input device cause a game in steam "Crypt of the necrodancer" to crash during start. The game works fine when I delete it.

This appears to be a ubuntu specific bug as it does not show up on fedora 22.

It goes away if I unplug the mouse/keyboard usb dongle I use. If I attach a wired keyboard only it does not show up. I tried adding a wired mouse too, but that causes js0 to appear too. The output of udevadm changes depending on what mouse I have attached. The following output is from using the dongle for my wireless mouse/keyboard (both microsoft products)

$sudo udevadm info /dev/input/js0
P: /devices/pci0000:00/0000:00:1a.2/usb5/5-1/5-1:1.2/0003:045E:0745.0003/input/input7/js0
N: input/js0
S: input/by-id/usb-Microsoft_Microsoft®_2.4GHz_Transceiver_v6.0-if02-joystick
S: input/by-path/pci-0000:00:1a.2-usb-0:1:1.2-joystick
E: DEVLINKS=/dev/input/by-id/usb-Microsoft_Microsoft®_2.4GHz_Transceiver_v6.0-if02-joystick /dev/input/by-path/pci-0000:00:1a.2-usb-0:1:1.2-joystick
E: DEVNAME=/dev/input/js0
E: DEVPATH=/devices/pci0000:00/0000:00:1a.2/usb5/5-1/5-1:1.2/0003:045E:0745.0003/input/input7/js0
E: ID_BUS=usb
E: ID_FOR_SEAT=input-pci-0000_00_1a_2-usb-0_1_1_2
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_MODEL=Microsoft®_2.4GHz_Transceiver_v6.0
E: ID_MODEL_ENC=Microsoft®\x202.4GHz\x20Transceiver\x20v6.0
E: ID_MODEL_ID=0745
E: ID_PATH=pci-0000:00:1a.2-usb-0:1:1.2
E: ID_PATH_TAG=pci-0000_00_1a_2-usb-0_1_1_2
E: ID_REVISION=0251
E: ID_SERIAL=Microsoft_Microsoft®_2.4GHz_Transceiver_v6.0
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030101:030102:030000:
E: ID_USB_INTERFACE_NUM=02
E: ID_VENDOR=Microsoft
E: ID_VENDOR_ENC=Microsoft
E: ID_VENDOR_ID=045e
E: MAJOR=13
E: MINOR=0
E: SUBSYSTEM=input
E: TAGS=:seat:uaccess:
E: USEC_INITIALIZED=117298
---
ApportVersion: 2.17.2-0ubuntu1.1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: phomes 1442 F.... pulseaudio
CurrentDesktop: Unity
DistroRelease: Ubuntu 15.04
HibernationDevice: RESUME=UUID=fde58bd6-316d-4a14-bc85-41d8f26cec02
InstallationDate: Installed on 2015-03-13 (91 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Alpha amd64 (20150306)
MachineType: Hewlett-Packard HP Z400 Workstation
NonfreeKernelModules: nvidia
Package: linux (not installed)
ProcFB:

ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.19.0-20-generic root=UUID=0fad5f38-47ef-4b98-b2ac-1ff9fc3244be ro quiet splash
ProcVersionSignature: Ubuntu 3.19.0-20.20-generic 3.19.8
RelatedPackageVersions:
 linux-restricted-modules-3.19.0-20-generic N/A
 linux-backports-modules-3.19.0-20-generic N/A
 linux-firmware 1.143.1
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
Tags: vivid
Uname: Linux 3.19.0-20-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 07/15/2013
dmi.bios.vendor: Hewlett-Packard
dmi.bios.version: 786G3 v03.57
dmi.board.asset.tag: CZC94164B9
dmi.board.name: 0AE4h
dmi.board.vendor: Hewlett-Packard
dmi.board.version: C
dmi.chassis.asset.tag: CZC94164B9
dmi.chassis.type: 6
dmi.chassis.vendor: Hewlett-Packard
dmi.modalias: dmi:bvnHewlett-Packard:bvr786G3v03.57:bd07/15/2013:svnHewlett-Packard:pnHPZ400Workstation:pvr:rvnHewlett-Packard:rn0AE4h:rvrC:cvnHewlett-Packard:ct6:cvr:
dmi.product.name: HP Z400 Workstation
dmi.sys.vendor: Hewlett-Packard

Revision history for this message
Martin Pitt (pitti) wrote :

Hey Thomas,

can you pleae copy&paste the output of

  udevadm test-builtin input_id /class/input/js0 ?

This will show the precise capabilities that the device reports.

From your udevadm info output it appears that this isn't just an input_id mis-interpretation though, but that the usbhid kernel driver itself finds/creates a joystick device? "dmesg | grep -i hid" might also be helpful, can you please include that too?

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
Thomas Andersen (phomes) wrote :
  • a1 Edit (1.7 KiB, text/plain)

Hi Martin.

I have attached the output. Case a is with a combined wireless usb dongle for a microsoft keyboard. Case b is for a wired usb keyboard (logitech) and wired mouse (hp). Case c is with just the mouse. The js0 is not created for the last case.

I am of course interested in getting the bug fixed, but even more in learning how to debug and fix it. So any details about what you think is wrong would be much appreciated :)

Revision history for this message
Thomas Andersen (phomes) wrote :
  • a2 Edit (681 bytes, text/plain)
Revision history for this message
Thomas Andersen (phomes) wrote :
  • b1 Edit (1.5 KiB, text/plain)
Revision history for this message
Thomas Andersen (phomes) wrote :
  • b2 Edit (609 bytes, text/plain)
Revision history for this message
Thomas Andersen (phomes) wrote :
  • c1 Edit (633 bytes, text/plain)
Revision history for this message
Thomas Andersen (phomes) wrote :
  • c2 Edit (322 bytes, text/plain)
Revision history for this message
Thomas Andersen (phomes) wrote :

Just a note that I also get the invalid js0 on a live image of 15.10 (from 10th June) and one Jessie 8.1

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1458631

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Martin Pitt (pitti) wrote :

Adding a kernel task, as the /dev/input/js0 is created by the kernel driver (usbhid) itself. udev does not create device nodes, it just adds additional properties, runs extra programs on the device nodes, etc.

So cases a/ vs. b/ is interesting -- in both cases you get three HID devices, just that in the wireless USB dongle case the "hid-generic" driver grabs them as it just sees the transceiver, while in the wired USB case it's the "logitech" driver as it sees the devices directly.

input_id only actually sees a joystick with the wireless transceiver (see a1), there you see that the js0 device claims to have tons of absolute axes:

capabilities/abs decoded bit map:
  bit 0: FFFFFF01000701FF

while in the b/ case capabilities/abs is zero, i. e. no axes.

input_id is here: https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c

In test_pointers() you see that has_joystick_axes_or_buttons is determined by buttons/axes which are typical for a joystick:

        /* joysticks don't necessarily have buttons; e. g.
         * rudders/pedals are joystick-like, but buttonless; they have
         * other fancy axes */
        has_joystick_axes_or_buttons = test_bit(BTN_TRIGGER, bitmask_key) ||
                                       test_bit(BTN_A, bitmask_key) ||
                                       test_bit(BTN_1, bitmask_key) ||
                                       test_bit(ABS_RX, bitmask_abs) ||
                                       test_bit(ABS_RY, bitmask_abs) ||
                                       test_bit(ABS_RZ, bitmask_abs) ||
                                       test_bit(ABS_THROTTLE, bitmask_abs) ||
                                       test_bit(ABS_RUDDER, bitmask_abs) ||
                                       test_bit(ABS_WHEEL, bitmask_abs) ||
                                       test_bit(ABS_GAS, bitmask_abs) ||
                                       test_bit(ABS_BRAKE, bitmask_abs);

This needs to be checked against the decoded capabilities/key (for the buttons) and capabilities/abs (for the absolute axes), the numerical values of the evdev constants are in /usr/include/linux/input.h. The above is just a heuristic of course which has been refined over time, and might need more refinement.

Revision history for this message
Martin Pitt (pitti) wrote :

For example, we have

#define BTN_TRIGGER…………………………………0x120

I. e. the capability bit mask whether the device claims to have a BTN_TRIGGER is the 0x120th bit in capabilities/key, or IOW, the 32th bit in
  bit 256: 0C00000000000001

which is zero. Likewise there's no BTN_A, nor BTN_1. Interestingly there *is* a BTN_MISC aka BTN_0:

#define BTN_MISC…………………………………………0x100
#define BTN_0…………………………………………………0x100

and the 0x100 == 256th bit in the above mask is 1. So it's not the buttons, but the axes. We see from the abs mask FFFFFF01000701FF that the device claims to have all of ABS_X to ABS_GAS, and a whole lot of others and even undefined ones. This may simply just be an uninitialized value in the kernel driver?

Revision history for this message
Martin Pitt (pitti) wrote :

On that grounds I close the systemd/udev task, as this really needs to be fixed in the hid-generic (or maybe other) kernel driver.

Changed in systemd (Ubuntu):
status: Incomplete → Invalid
penalvch (penalvch)
Changed in linux (Ubuntu):
importance: Undecided → Low
Revision history for this message
Thomas Andersen (phomes) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected vivid
description: updated
Revision history for this message
Thomas Andersen (phomes) wrote : CRDA.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : IwConfig.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : JournalErrors.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : Lspci.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : Lsusb.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : ProcEnviron.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : ProcModules.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : PulseList.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : UdevDb.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : UdevLog.txt

apport information

Revision history for this message
Thomas Andersen (phomes) wrote : WifiSyslog.txt

apport information

Revision history for this message
penalvch (penalvch) wrote :

Thomas Andersen, could you please test the latest upstream kernel available from the very top line at the top of the page (the release names are irrelevant for testing, and please do not test the daily folder) following https://wiki.ubuntu.com/Kernel/MainlineBuilds ? It will allow additional upstream developers to examine the issue.

If the test did not allow you to test to the issue (ex. you couldn't boot into the OS) please make a comment in your report about this, and continue to test the next most recent kernel version until you can test to the issue. Once you've tested the upstream kernel, please comment on which kernel version specifically you tested. If this bug is fixed in the mainline kernel, please add the following tags by clicking on the yellow circle with a black pencil icon, next to the word Tags, located at the bottom of the report description:
kernel-fixed-upstream
kernel-fixed-upstream-X.Y-rcZ

Where XY and Z are numbers corresponding to the kernel version.

If the mainline kernel does not fix this bug, please add the following tags:
kernel-bug-exists-upstream
kernel-bug-exists-upstream-X.Y-rcZ

Please note, an error to install the kernel does not fit the criteria of kernel-bug-exists-upstream.

Once testing of the upstream kernel is complete, please mark this bug's Status as Confirmed. Please let us know your results.

Thank you for your understanding.

tags: added: latest-bios-3.57
Changed in linux (Ubuntu):
importance: Low → Medium
Revision history for this message
Thomas Andersen (phomes) wrote :

I still see the invalid /dev/input/js0 with the latest kernel (4.1 rc7). It is strange that this problem does not exist on fedora 22 which has 4.0.

tags: added: kernel-bug-exists-upstream kernel-bug-exists-upstream-4.1-rc7
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Thomas Andersen (phomes) wrote :

I tested again with some fedora live images and found that the same problem existed in fedora 19 and 20. In 21 and 22 I do not see the /dev/input/js0.

Is there anything further that I can do to help?

penalvch (penalvch)
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Thomas Andersen (phomes) wrote :

I tested with both 4.1.1 and 4.2rc1. Neither fixed the problem

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
penalvch (penalvch)
tags: added: kernel-bug-exists-upstream-4.2-rc1
removed: kernel-bug-exists-upstream-4.1-rc7
Revision history for this message
penalvch (penalvch) wrote :

Thomas Andersen, did this problem not occur in a Ubuntu release prior to Vivid?

tags: added: wily
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Hans Deragon (deragon) wrote :

I have this problem on Ubuntu 14.04 LTS Trusty Thar. Despite unplugging my joystick, /dev/input/js0 remains and any other joystick attached takes /dev/input/js1.

Kernel info: 3.13.0-62-generic #102-Ubuntu SMP Tue Aug 11 14:29:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for linux (Ubuntu) because there has been no activity for 60 days.]

Changed in linux (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.