On Wed, 24 Aug 2005, Singh, Brijeshkumar wrote:

> Alan thanks for quick response.
> 
> By index I mean local "index" variable in drive/usb/device.c [function
> usb_device_dump]. As if I understand, the below snippet from
> drive/usb/device.c writes topology;
> 
> static ssize_t usb_device_dump(char **buffer, size_t *nbytes, loff_t
> *skip_bytes, loff_t *file_offset, struct usb_device *usbdev, struct
> usb_bus *bus, int level, int index, int count)
> {
> .................
> .................
> data_end = pages_start + sprintf(pages_start, format_topo,
>                         bus->busnum, level, parent_devnum,
>                         index, count, usbdev->devnum,
>                         speed, usbdev->maxchild);
> .........
> }
> 
> I can access busnum,parent_devnum,devnum,maxchild,speed in
> driver/usb/storage/scsiglue.c as follows:
> static int proc_info (char *buffer, char **start, off_t offset, int
> length,int hostno, int inout)
> > {
> > ............
> > /* ADDING bus & prnt */
> >         SPRINTF("    Bus: %d\n",us->pusb_dev->bus->busnum);
> >       SPRINTF("    prnt: %d\n",us->pusb_dev->parent->devnum);
> >       SPRINTF("    prnt: %d\n",us->pusb_dev->devnum);
> >       SPRINTF("    prnt: %d\n",us->pusb_dev->maxchild);
> > /*ADDITION ENDS */ 
> .........
> }
> But I'm not able to access "level" "index" and "count" variable in
> proc_info function as they are local variables.
> 
> I have observed that first four fields (busno,lev,prnt,port) are always
> unique to each connected device. Please correct me if I'm wrong.

You are right.  However the bus number and device number are also unique.  
So you can use just those two and stop worrying about the level, parent, 
index, and count.

Alan Stern



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to