Re: Sysfs Device Attributes: Subdirectory under subdirectory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 29, 2010 at 06:15:04AM -0800, Greg KH wrote:
> On Fri, Jan 29, 2010 at 09:41:21AM +0530, Himanshu Chauhan wrote:
> > On Thu, Jan 28, 2010 at 01:11:36PM -0800, Greg KH wrote:
> > > On Fri, Jan 29, 2010 at 12:12:31AM +0530, Himanshu Chauhan wrote:
> > > > Dear all,
> > > > 
> > > > I want to create subdirectory under subdirectory in sysfs
> > > > for a device.
> > > 
> > > Ick, don't.
> > > 
> > > > For example, if vhci_hcd is my device I want
> > > > the following hierarchy:
> > > > 
> > > > vhci_hcd
> > > >     |
> > > >     +--> status
> > > >            |
> > > >            +--->0
> > > >            |    |
> > > >            |    +--> status
> > > >            |    |
> > > >            |    +--> speed
> > > >            |    |
> > > >            |    +--> device id
> > > >            |    |
> > > >            |    +--> socket
> > > >            |    |
> > > >            |    +--> busid
> > > >         ....
> > > >         ....
> > > >         ....
> > > >            |
> > > >            +--->N
> > > >                 |
> > > >                 +--> status
> > > >                 |
> > > >                 +--> speed
> > > >                 |
> > > >                 +--> device id
> > > >                 |
> > > >                 +--> socket
> > > >                 |
> > > >                 +--> busid
> > > 
> > > No, you really do not want this.  Why do you feel that you would want to
> > > create something that does not fit into the current driver/device model
> > > of the kernel?
> > > 
> > > In short, what specifically are you trying to convey here?
> > 
> > There are 8 ports exported by VHCI.
> 
> What is 'vhci'?
> 
> What do you do with a "port"?
> 
> > So I want to group the attributes of each port together. 0 to N are
> > the port numbers.  All attributes of port zero will be under 0 and all
> > attributes of port 1 will be under 1 and so on.
> 
> So then make each "port" a device on your bus.  Then the topology
> automatically happens for you, no need to mess with "raw" kobjects at
> all (which you shouldn't be doing in the first place.)
> 
> Can devices be plugged into ports?
> 
> > > > So, how do I create subdirectories 0 to N under
> > > > status? I created attribute groups from 0 to N,
> > > > how do I attach it to status and then in turn,
> > > > status to vhci_hcd?
> > > 
> > > What does these 0-N subdirectories represent?
> > > 
> > > What does 'status' represent?  Why would status have subdirectories?
> > 
> > status under VHCI should rather be port_status. So hierarcy would be
> > VHCI_HCD->port_status->port_number[0-8]-><attributes>
> 
> Why put the port number below the status?
> 
> > > And why in that subdirectory would you have another file called status?
> > Status is the status of the port if its connected to the stub on the server.
> > 
> > If this is not good, what would be the best layout?
> 
> 
> HCD->port[N]->attributes
> 
> where you have a bus for your HCD, and then port[N] are devices attached
> to that bus.
> 
> Sound reasonable?

Hi Greg,

Sorry, I am not quite able to digest this :( 
Do the USB ports on a system have representation in sysfs? If they do,
does each port has a subdirectory of its own? When I say VHCI ports,
I am refering to same kind of USB ports that we have on a system to which
USB devices can connect. The difference being the devices attached on VHCI
ports are over IP.

The following is the output of "/sys/devices/platform/vhci_hcd/status" file.

prt sta spd bus dev socket           local_busid
000 004 000 000 000 0000000000000000 0-0
001 004 000 000 000 0000000000000000 0-0
002 004 000 000 000 0000000000000000 0-0
003 004 000 000 000 0000000000000000 0-0
004 004 000 000 000 0000000000000000 0-0
005 004 000 000 000 0000000000000000 0-0
006 004 000 000 000 0000000000000000 0-0
007 004 000 000 000 0000000000000000 0-0

As you can see, I am trying to divide this output in a way that I can
group sta, spd, bus, dev, socket, local_busid as files under ports[N]
directory under /sys/devices/platform/vhci_hcd/status

I think ports cannot be taken as "devices" and have their representation
in sysfs. But I believe they can very well be put under vhci_hcd
directory as /sys/devices/platform/vhci_hcd/status/port[N]/<attributes>

Regards
Himanshu

> 
> thanks,
> 
> greg k-h

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux