All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: hot plug stable pci name or active pci name detection from /sys file system
       [not found] <CAEYgNqL8eceFdX_2FSk6oXg2J-7QmijD6oWwQMBS-kn8BwZfPg@mail.gmail.com>
@ 2011-09-28 15:14   ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2011-09-28 15:14 UTC (permalink / raw)
  To: Sudarshan Jagadale
  Cc: linux-pci, linux-kernel, linux-hotplug, linux-usb, Kay Sievers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: hot plug stable pci name or active pci name detection from /sys
@ 2011-09-28 15:14   ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2011-09-28 15:14 UTC (permalink / raw)
  To: Sudarshan Jagadale
  Cc: linux-pci, linux-kernel, linux-hotplug, linux-usb, Kay Sievers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-28 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAEYgNqL8eceFdX_2FSk6oXg2J-7QmijD6oWwQMBS-kn8BwZfPg@mail.gmail.com>
2011-09-28 15:14 ` hot plug stable pci name or active pci name detection from /sys file system Alan Stern
2011-09-28 15:14   ` hot plug stable pci name or active pci name detection from /sys Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.