Re: hot plug stable pci name or active pci name detection from /sysfile system

From: Alan Stern
Date: Wed Sep 28 2011 - 11:14:16 EST


On Tue, 27 Sep 2011, Sudarshan Jagadale wrote:

> Hi ,
>
> I want to create "dev->bus->bus_name" without using usb.h file/writting
> kenel module. is there any way to do this or read the active pci name from
> /sys/ diectory on linux os?
>
> i need to generate the bus info field as follows created by usb_make_path().
>
> please help to resolve this?

There's probably a way to do it using libudev, but I don't know
anything about it.

Another way to do it is to read the "serial" file in the sysfs
directory for the device's root hub. For example, suppose your USB
device has a sysfs name like 7-1.2. The bus number is the part before
the '-' character, in this example, 7. Then the file you should read
would be /sys/bus/usb/devices/usb7/serial. Replace the '7' with the
appropriate bus number for whatever device you're working on.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/