Menu

#1 Pyra wireless udev rules does not rebind device

closed
nobody
None
5
2012-08-26
2011-03-14
Jil Larner
No

Hi,

Configuration:
libroccat 0.5.3
xf86-input-pyra (renamed the package to be gentoo compliant) 0.3.2
udev 151
arch: amd64
kernel: 2.6.37-gentoo (configured by hand, pyra compiled as a module)

The problem:
60-roccat-pyra-wireless.rules is broken

  1. The module name is no longer pyra but hid-roccat-pyra, so the first udev command should be changed from:
    /sbin/modprobe pyra;
    to
    /sbin/modprobe hid-roccat-pyra;

  2. The unbind/bind command does not work by hand. To reproduce, I do:
    a. Remove all udev rules except the following:

SUBSYSTEM=="hid", DRIVER=="generic-usb", ATTRS{idVendor}=="1e7d", ATTRS{idProduct}=="2cf6", ACTION=="add", RUN+="/bin/sh -c 'echo %k >> /tmp/paf'"

b. # cat /tmp/paf
0003:1E7D:2CF6.0025
0003:1E7D:2CF6.0024

c. Check we still have Roccat HID plugged in as generic-usb (at this point, the mouse works well)

ls /sys/bus/hid/drivers/generic-usb/ | grep 1E7D

0003:1E7D:2CF6.0024
0003:1E7D:2CF6.0025

d. Unbind from generic-usb:

echo -n '0003:1E7D:2CF6.0024' > /sys/bus/hid/drivers/generic-usb/unbind

echo -n '0003:1E7D:2CF6.0025' > /sys/bus/hid/drivers/generic-usb/unbind

e. Attempt to bind them under pyra driver (as suggests the udev rule):

echo -n '0003:1E7D:2CF6.0024' > /sys/bus/hid/drivers/pyra/bind

bash: echo: erreur d'écriture : Aucun périphérique de ce type
(means no such device)

I’m not knowledgeable enough about udev to write a rule that can bind the mouse on the pyra driver. If you don’t know and probably won’t find time to fix it, please let me know. I’ll see when I can get a few hours to understand udev deeper. In case you already know what to do, I’d appreciate to test.
I packaged the installation into two ebuilds (one for the libroccat, the other for the pyracontrol and gui), so I can clean up easily and can try many things without breaking anything.

Thanks in advance

Discussion

  • Stefan Achatz

    Stefan Achatz - 2011-03-14

    As the comment in the rules file says, the first rule is only needed for externally compiled modules. Means modules built with my kmod-roccat package.
    The modules included in the kernel are called hid-roccat-*, while external ones are missing the hid-roccat- prefix.
    This lets me distinguish between the two and so the first udev rule catches only the external modules.
    The modules that are part of the kernel don't need the first udev rule because the device is blacklisted in the generic driver, so the specific driver is the only one to bind and the module loading also happens automatically.
    So I guess you have no problems, at least you didnt say so.
    If you want me to include your ebuild scripts in my packages, just comment them stating its your work and send them to me.

     
  • Stefan Achatz

    Stefan Achatz - 2011-03-15

    Sorry, I overread the fact that you are using the wireless variant of Pyra.
    Thats another case: As I don't have one to test, I couldn't blacklist this device in the generic driver. And I didn't think on doing a udev rule as workaround.
    I will add a new udev file to this tracker entry this evening for you to test.
    If you would please be so kind to approve if it works with the wireless, so that I can submit a patch into the kernel for the benefit of all. Also it would be great if you would volunteer on testing if the battery level can be read out over usb.
    Thanks in advance for your cooperation.

     
  • Stefan Achatz

    Stefan Achatz - 2011-03-15

    with additional rule to bind mouse to kernels own driver

     
  • Stefan Achatz

    Stefan Achatz - 2011-03-15

    Added rules file with one additional rule that tries to bind the wireless pyra to kernels own driver (hid-roccat-pyra). Hope this helps

     
  • Jil Larner

    Jil Larner - 2011-03-17

    Oh, my fault. Here’s the problem:

    1. modprobe hid-roccat-pyra
    2. plug the usb receiver
    3. first line of the udev file concerning only externally built modules is executed; as a consequence, the device gets disconnected

    So, I commented out the first line. If this is an intended behaviour, I’ll add a patch in my ebuild to remove the line for kernels >=2.6.37

    Yet, the problem is that the mouse doesn’t get attached to the pyra driver but to the generic-usb driver, as shown below:

    ls /sys/bus/hid/drivers/pyra/

    bind module new_id uevent unbind

    ls /sys/bus/hid/drivers/generic-usb/

    0003:046D:C03E.0001 0003:0E6A:6001.0003 0003:1E7D:2CF6.0011 module uevent
    0003:0E6A:6001.0002 0003:1E7D:2CF6.0010 bind new_id unbind

    Syslog:
    Mar 17 14:34:40 [kernel] [ 8584.228438] usb 1-1.5: new full speed USB device using ehci_hcd and address 10
    Mar 17 14:34:40 [kernel] [ 8584.588095] usb 1-1.5: New USB device found, idVendor=1e7d, idProduct=2cf6
    Mar 17 14:34:40 [kernel] [ 8584.588100] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Mar 17 14:34:40 [kernel] [ 8584.588104] usb 1-1.5: Product: ROCCAT Pyra W
    Mar 17 14:34:40 [kernel] [ 8584.588107] usb 1-1.5: Manufacturer: ROCCAT
    Mar 17 14:34:40 [kernel] [ 8584.591209] input: ROCCAT ROCCAT Pyra W as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0/input/input19
    Mar 17 14:34:40 [kernel] [ 8584.591613] generic-usb 0003:1E7D:2CF6.0012: input,hiddev0,hidraw3: USB HID v1.10 Mouse [ROCCAT ROCCAT Pyra W] on usb-0000:00:1a.0-1.5/input0
    Mar 17 14:34:40 [kernel] [ 8584.593221] input: ROCCAT ROCCAT Pyra W as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.1/input/input20
    Mar 17 14:34:40 [kernel] [ 8584.593572] generic-usb 0003:1E7D:2CF6.0013: input,hidraw4: USB HID v1.10 Keyboard [ROCCAT ROCCAT Pyra W] on usb-0000:00:1a.0-1.5/input1

    So, it’s no surprise pyracontrol says “No pyra found”. Any idea why?

    Thank you for your time

     
  • Jil Larner

    Jil Larner - 2011-03-17

    Gosh! Didn’t get the comments were in reverse order! I test the last rules and tell you.

     
  • Jil Larner

    Jil Larner - 2011-03-17

    No luck.

    I modified your udev rules, because if the module is called hid-roccat-pyra, the driver in the sysfs is still named pyra. And then I tested with the driver built in the kernel and no longer as a module, with no difference, as expected.

    The unbind part works well, as said before. I tried to play a bit with the sysfs to bind the device to the pyra driver, aided by a LWN article http://lwn.net/Articles/143397/

    When I unbind the two devices (that is, the mouse and the keyboard part of the mouse), it vanishes from generic-usb. Great. And I still can find the device in the sysfs under /sys/bus/hid/devices/0003:1E7D:2CF6.000{E,F}

    But when I # echo -n '0003:1E7D:2CF6.000E' > /sys/bus/hid/drivers/pyra/bind, it says the device doesn’t exist. So I though that it might still be attached to a driver. No luck either:

    tree /sys/bus/hid/devices/0003:1E7D:2CF6.000E

    /sys/bus/hid/devices/0003:1E7D:2CF6.000E
    ├── power
    │   ├── wakeup
    │   ├── wakeup_active
    │   ├── wakeup_active_count
    │   ├── wakeup_count
    │   ├── wakeup_hit_count
    │   ├── wakeup_last_time_ms
    │   ├── wakeup_max_time_ms
    │   └── wakeup_total_time_ms
    ├── subsystem -> ../../../../../../../../bus/hid
    └── uevent

    no driver symlink.

    I begin to think the pyra driver doesn’t want to accept the device and throws a generic error (or a mistranslated error), saying basically "write error: no such device". Any idea?

     
  • Stefan Achatz

    Stefan Achatz - 2011-03-17

    So, I took a closer look:
    I admit that my udev-rules-way to distinguish between kernel and external modules does not work as expected.
    I also admit that the pyra driver does not accept the wireless in its current state. Looking back, I don't know why I did this.
    But as you are compiling your own kernel thats no problem.
    I attach a patch against the 2.6.37 kernel source to this thread.
    This does two things: Blacklist the wireless in the generic driver and enable the pyra driver to accept the wireless.
    $ cd linux-2.6.37
    $ patch -p 1 <../pyra_wireless.patch
    Feel free to compile the pyra as module or built-in, that should make no difference. And keep the udev-rule-file unmodified as the troublesome rules don't apply anymore (as it was planned), and the others work as expected.
    Sorry for the inconvenience and I try to find a better solution for the wireless udev-rules.

     
  • Stefan Achatz

    Stefan Achatz - 2011-03-17

    Patch against 2.6.37 to enable pyra driver to use wireless variant

     
  • Jil Larner

    Jil Larner - 2011-03-18

    Great! Il workfs fine for the udev part once patched. Unfortunately, not for the pyragui or pyracontrol. I’m going to open another bug for this. Thank you for your time :)

    Mar 18 14:53:13 [kernel] [ 356.925495] usb 1-1.5: USB disconnect, address 4
    Mar 18 14:53:57 [kernel] [ 400.763695] usb 1-1.5: new full speed USB device using ehci_hcd and address 5
    Mar 18 14:53:58 [kernel] [ 401.028675] usb 1-1.5: New USB device found, idVendor=1e7d, idProduct=2cf6
    Mar 18 14:53:58 [kernel] [ 401.028679] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Mar 18 14:53:58 [kernel] [ 401.028684] usb 1-1.5: Product: ROCCAT Pyra W
    Mar 18 14:53:58 [kernel] [ 401.028687] usb 1-1.5: Manufacturer: ROCCAT
    Mar 18 14:53:58 [kernel] [ 401.032503] input: ROCCAT ROCCAT Pyra W as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0/input/input8
    Mar 18 14:53:58 [kernel] [ 401.032891] pyra 0003:1E7D:2CF6.0008: input,hiddev0,hidraw0: USB HID v1.10 Mouse [ROCCAT ROCCAT Pyra W] on usb-0000:00:1a.0-1.5/input0
    Mar 18 14:53:58 [kernel] [ 401.051467] input: ROCCAT ROCCAT Pyra W as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.1/input/input9
    Mar 18 14:53:58 [kernel] [ 401.051744] pyra 0003:1E7D:2CF6.0009: input,hidraw1: USB HID v1.10 Keyboard [ROCCAT ROCCAT Pyra W] on usb-0000:00:1a.0-1.5/input1

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB