1

I have a custom board using the imx536. The board has two USB devices, one wired to the OTG core and one wired to the Host1 core on the ixm53. Using the Linux BSP, kernel 2.6.35, and udev version 167 I'm not able to use "udevadm info" to determine which device is connected to which hub/port. During boot Linux enumerates the devices differently depending on which one it sees first. How can I get udevadm info to trace the USB chain further? I'm comparing this to a TI am3352 where I am able to trace back to which hub/port each USB device is connected to so I can create a custom udev rule.

Running 'udevadm info' on the two devices on my imx53 custom board:

# udevadm info -a -n /dev/sda1

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 '/block/sda/sda1':
KERNEL=="sda1"
SUBSYSTEM=="block"
DRIVER==""
ATTR{partition}=="1"
ATTR{start}=="2048"
ATTR{size}=="3909632"
ATTR{alignment_offset}=="0"
ATTR{discard_alignment}=="4293918720"
ATTR{stat}=="       6        0       42        7        1        0        8       64        0       71       71"
ATTR{inflight}=="       0        0"

looking at parent device '/block/sda':
KERNELS=="sda"
SUBSYSTEMS=="block"
DRIVERS==""
ATTRS{range}=="16"
ATTRS{ext_range}=="256"
ATTRS{removable}=="1"
ATTRS{ro}=="0"
ATTRS{size}=="3911680"
ATTRS{alignment_offset}=="0"
ATTRS{discard_alignment}=="0"
ATTRS{capability}=="51"
ATTRS{stat}=="       7        0       50       24        1        0        8       64        0       88       88"
ATTRS{inflight}=="       0        0"

# udevadm info -a -n /dev/sdb1

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 '/block/sdb/sdb1':
KERNEL=="sdb1"
SUBSYSTEM=="block"
DRIVER==""
ATTR{partition}=="1"
ATTR{start}=="20480"
ATTR{size}=="681984"
ATTR{alignment_offset}=="0"
ATTR{discard_alignment}=="4284481536"
ATTR{stat}=="       0        0        0        0        0        0        0        0        0        0        0"
ATTR{inflight}=="       0        0"

looking at parent device '/block/sdb':
KERNELS=="sdb"
SUBSYSTEMS=="block"
DRIVERS==""
ATTRS{range}=="16"
ATTRS{ext_range}=="256"
ATTRS{removable}=="1"
ATTRS{ro}=="0"
ATTRS{size}=="15523840"
ATTRS{alignment_offset}=="0"
ATTRS{discard_alignment}=="0"
ATTRS{capability}=="51"
ATTRS{stat}=="       1        0        8        2        0        0        0        0        0        2        2"
ATTRS{inflight}=="       0        0"

Thanks.

EDIT: With a little guessing I wrote the following rules file which successfully recognizes the two USB devices, however, when it creates the device node the file is a char file and not a block file. So 'mount' can't use the device. Any ideas on this? Is it maybe finding the controller and not the block device?

  • 1
    With newer kernels/udevadm, udevadm info /dev/sda1 gives you the DEVPATH information, containing the USB info. If that does not help, try udevadm info -q path -n /dev/sda, this should work with kernels from 2.6 upwards (see "Background investigation" in hackaday.com/2009/09/18/how-to-write-udev-rules). Another way could be to look at the links in /dev/disk/by-path (ls -l /dev/disk/by-path) – ridgy Jun 28 '17 at 13:25
  • 1
    As I just read in beagle.s3.amazonaws.com/esc/sysfs-esc-chicago-2010.pdf, the virtual FS /sys/devices is available since kernel version 2.6. So you could find the needed information by find /sys/devices -name 'sd[a|b]' (if your device nodes are sda and sdb, e.g.) – ridgy Jun 28 '17 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.