lkml.org 
[lkml]   [2011]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: hot plug stable pci name or active pci name detection from /sys file system
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



\
 
 \ /
  Last update: 2011-09-28 17:17    [W:0.077 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site