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.

Thanks,
Brijesh


-----Original Message-----
From: Alan Stern [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 24, 2005 10:37 AM
To: Singh, Brijeshkumar
Cc: [email protected]
Subject: RE: [linux-usb-devel] RE: how to distinguish two device if they
does not provide serial number!

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

> Hi Alan,
> 
> Thanks for help.
> 
> Unfortunately my system has four USB bus. Hence I am not to use the
method you suggested. I was exploring possibility of adding little
additional information in /proc/scsi/usb-storage-A/B. The information
should be something like:
>  [EMAIL PROTECTED] usb]# cat /proc/scsi/usb-storage-1/2
>     Host scsi2: usb-storage
>         Vendor: Genesyslogic
>        Product: USB Mass Storage Device
>  Serial Number: None
>       Protocol: 8020i
>      Transport: Bulk
>           GUID: 05e307010000000000000000
>       Attached: Yes 
>           Bus : 1 
>           Lev : 1 
>           Prnt: 1 
>           Port: 0 
> [EMAIL PROTECTED] usb]#
> 
> The above file will solve my entire problem. 
> 
> I have added few lines in drive/usb/storage/scsiglue.c 
> 
>   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);
> /*ADDITION ENDS */
> }
> 
> But don't know how to get other filed ("level" and "index"). 
> Please guide me how to solve this problem.

By "index", I assume you mean the Dev# field.  It's enough to know the
Dev# and the Bus, because they uniquely determine a USB device.  You
don't
need the level, port, or parent fields, since you can read them from 
/proc/bus/usb/devices.

The Dev# is us->pusb_dev->devnum.

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