On Sun, Aug 09, 2009 at 11:19:20PM +0200, Stephen Kitt wrote:
> On Sun, 09 Aug 2009 09:33:50 -0700, Josh Triplett <j...@joshtriplett.org>
> wrote:
> > Saving and restoring joystick calibration in an init script doesn't make
> > sense.  It assumes that the joystick remains attached when shutting
> > down, remains attached when booting up, and (in the case of multiple
> > joysticks) always gets assigned to the same js device.
> 
> It made sense to me at the time, because the package has to cater for
> different varieties of joysticks, not just USB devices!

True, though all such devices can still go through udev once configured;
they just won't get set up without manual configuration.  (I certainly
don't expect anything to automatically detect hand-wired
gamepad-to-parallel-port adapters, for instance, which I have used
successfully in the past.)

> I do realise it isn't
> perfect, and I was working on some mechanism to store calibration data other
> than by device name. I also hadn't reckoned on so many users connecting and
> disconnecting their joysticks regularly, but that is rather short-sighted of
> me.
> 
> > Instead, how about providing a udev script?  On joystick insertion,
> > check for a file
> > "/etc/jscal/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}", and if present
> > run jscal with it.  The user can store calibration data there manually,
> > or you could provide some script to do so automatically for a given
> > joystick (something like "jscal-persistent").
> 
> Something like that would work for a fair amount of USB joysticks, thanks.
> Could you send me the output of
>       /sbin/udevadm info -a -p $(/sbin/udevadm info -q path -n /dev/input/js0)
> with your joystick connected?

Sure!  Attached.

- Josh Triplett
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:1a.0/usb2/2-1/2-1:1.0/input/input17/js0':
    KERNEL=="js0"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device 
'/devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1:1.0/input/input17':
    KERNELS=="input17"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="RetroUSB.com SNES RetroPort"
    ATTRS{phys}=="usb-0000:00:1a.0-1/input0"
    ATTRS{uniq}==""
    
ATTRS{modalias}=="input:b0003vF000p00F1e0100-e0,1,3,4,k130,131,132,133,134,135,136,137,ra0,1,m4,lsfw"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1:1.0':
    KERNELS=="2-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{modalias}=="usb:vF000p00F1d0000dc00dsc00dp00ic03isc00ip00"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{interface}=="EP10In"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb2/2-1':
    KERNELS=="2-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}=="Cfg1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="80"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{urbnum}=="62"
    ATTRS{idVendor}=="f000"
    ATTRS{idProduct}=="00f1"
    ATTRS{bcdDevice}=="0000"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{speed}=="1.5"
    ATTRS{busnum}=="2"
    ATTRS{devnum}=="2"
    ATTRS{version}==" 1.00"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="RetroUSB.com"
    ATTRS{product}=="SNES RetroPort"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb2':
    KERNELS=="usb2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="29"
    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}=="2"
    ATTRS{devnum}=="1"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="2"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.30-1-amd64 uhci_hcd"
    ATTRS{product}=="UHCI Host Controller"
    ATTRS{serial}=="0000:00:1a.0"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1a.0':
    KERNELS=="0000:00:1a.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="uhci_hcd"
    ATTRS{vendor}=="0x8086"
    ATTRS{device}=="0x2937"
    ATTRS{subsystem_vendor}=="0x17aa"
    ATTRS{subsystem_device}=="0x20f0"
    ATTRS{class}=="0x0c0300"
    ATTRS{irq}=="20"
    
ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003"
    ATTRS{local_cpulist}=="0-1"
    ATTRS{modalias}=="pci:v00008086d00002937sv000017AAsd000020F0bc0Csc03i00"
    ATTRS{numa_node}=="0"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Reply via email to