USB input device interfaces compete for the same symlink name in 60-persistent-input.rules

Bug #1057824 reported by Richard Hansen
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Fix Released
High
Martin Pitt
Precise
Fix Released
Undecided
Unassigned
Quantal
Fix Released
High
Martin Pitt

Bug Description

The current rules in 60-persistent-input.rules do not produce a usable symlink for the interface 0 device in multi-interface USB input devices.

These are the problematic rules:

KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}"
KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}"

The above rules can be matched by multiple devices if a USB input device has multiple USB interfaces (such as the Microsoft Wired Keyboard 600, which has two keyboard interfaces). Because the generated symlink names do not include the USB interface number, the multiple devices will compete over the same symlink name. According to the udev man page, the device that wins is undefined unless the devices are assigned different link_priority values (which they are not).

There are other rules in 60-persistent-input.rules that do produce per-interface symlinks. These rules were introduced in git commit 5e9eb15 [1] for bug #626449. Unfortunately, due to git commit 32567f8 [2], a symlink for interface 0 is not produced by these per-interface rules. Thus, if an interface other than 0 wins the competition for the colliding symlink names, there won't be a persistent symlink for the interface 0 device. Even if device 0 does win the competition, it may change, going against the intended persistence.

It seems like the correct fix is to give interface 0 a higher link_priority value than the other interfaces. This would guarantee that interface 0 always wins the competition.

[1] http://cgit.freedesktop.org/systemd/systemd/commit/?id=5e9eb156c003dc7f8f92287bfad0251d6c5d0ef9
[2] http://cgit.freedesktop.org/systemd/systemd/commit/?id=32567f8c95290a8819c0bc7d57849b8abfba9554

$ lsb_release -rd
Description: Ubuntu 12.04.1 LTS
Release: 12.04
$ apt-cache policy udev
udev:
  Installed: 175-0ubuntu9.1
  Candidate: 175-0ubuntu9.1
  Version table:
 *** 175-0ubuntu9.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     175-0ubuntu9 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Revision history for this message
Richard Hansen (rhansen) wrote :

I'm attaching a debdiff for Quantal that contains a patch for this bug. This version has been uploaded to my PPA (<https://launchpad.net/~a7x/+archive/bug1057824>) and will be done building in a few hours. To install:

    sudo apt-add-repository ppa:a7x/bug1057824
    sudo apt-get update
    sudo apt-get upgrade

tags: added: patch quantal
Revision history for this message
Richard Hansen (rhansen) wrote :

And here is the Precise debdiff. This version has also been uploaded to my PPA and should be done building in a few hours.

Revision history for this message
Richard Hansen (rhansen) wrote :

Martin: Would you mind reviewing the attached debdiff? You applied my udev patch for bug #626449 so I thought you would be a good person to take a look at this.

Thanks!

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "debdiff for quantal" of this bug report has been identified as being a patch in the form of a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

Micah Gersten (micahg)
tags: added: rls-q-incoming
Changed in udev (Ubuntu):
importance: Undecided → High
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, good catch! However, wouldn't it be cleaner to just do this?

-KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}"
+KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="|00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}"

-KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}"
+KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="|00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}"

This will result in two rules each responsible for exactly one of the cases (interface 00 or empty, and the other for > 00). Can you please verify that this works?

Thanks!

Revision history for this message
Richard Hansen (rhansen) wrote :

Oooh, nice -- I didn't know that syntax was possible. Yes, I'll try it out and get back to you. Thanks!

Changed in udev (Ubuntu):
status: New → Incomplete
Revision history for this message
Richard Hansen (rhansen) wrote :

Attached is the new debdiff for quantal. I have uploaded this version to my PPA; it should finish building in a few minutes.

Revision history for this message
Richard Hansen (rhansen) wrote :

And here is the new debdiff for precise, also uploaded to my PPA.

Revision history for this message
Richard Hansen (rhansen) wrote :

@Martin: Your proposed diff works for me.

Before:

/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-event-kbd -> ../event7
/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-if01-event-kbd -> ../event7
/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-if01-kbd -> ../js0
/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-kbd -> ../js0

After:

/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-event-kbd -> ../event6
/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-if01-event-kbd -> ../event7
/dev/input/by-id/usb-Microsoft_Wired_Keyboard_600-if01-kbd -> ../js0

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

Thanks for testing! I submitted the patch to upstream for review. Unsubscribed sponsors, I'll handle this.

Changed in udev (Ubuntu Precise):
status: New → Triaged
Changed in udev (Ubuntu Quantal):
status: New → Triaged
assignee: nobody → Martin Pitt (pitti)
status: Triaged → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded to quantal-proposed.

Changed in udev (Ubuntu Quantal):
assignee: Martin Pitt (pitti) → nobody
status: In Progress → Fix Committed
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded to precise-proposed queue. Now both uploads need -release/-sru team review.

Changed in udev (Ubuntu Precise):
status: Triaged → Fix Committed
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello a7x, or anyone else affected,

Accepted udev into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/udev/175-0ubuntu9.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 175-0ubuntu13

---------------
udev (175-0ubuntu13) quantal-proposed; urgency=low

  * Add persistent-input-symlinks-iface00.patch: Fix persistent input symlinks
    for interface 00. Thanks to a7x for pointing this out! (LP: #1057824)
 -- Martin Pitt <email address hidden> Thu, 11 Oct 2012 09:14:52 +0200

Changed in udev (Ubuntu Quantal):
status: Fix Committed → Fix Released
Revision history for this message
Richard Hansen (rhansen) wrote :

oops, forgot to set verification-done (it works for me)

tags: added: verification-done
removed: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

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

This bug was fixed in the package udev - 175-0ubuntu9.2

---------------
udev (175-0ubuntu9.2) precise-proposed; urgency=low

  * Add persistent-input-symlinks-iface00.patch: Fix persistent input symlinks
    for interface 00. Thanks to a7x for pointing this out! (LP: #1057824)
 -- Martin Pitt <email address hidden> Thu, 11 Oct 2012 09:17:05 +0200

Changed in udev (Ubuntu Precise):
status: Fix Committed → Fix Released
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.