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.

Thanks,
Brijesh
-----Original Message-----
From: Alan Stern [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 24, 2005 7:29 AM
To: Singh, Brijeshkumar
Cc: linux-usb-devel@lists.sourceforge.net
Subject: Re: [linux-usb-devel] RE: how to distinguish two device if they does 
not provide serial number!

On Tue, 23 Aug 2005, Singh, Brijeshkumar wrote:

> Hi, 
>  
> Two CD-ROM's (from same vendor) are connected on Linux machine, running 
> 2.4.20 kernel. I am not able to relate the topology  of individual CD-ROMs. 
>  
> #  cat /proc/bus/usb/devices
>  
> T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0        
> D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> P:  Vendor=05e3 ProdID=0701 Rev= 0.33
> S:  Manufacturer=Genesyslogic
> S:  Product=USB Mass Storage Device
> C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  4mA
> I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=02 Prot=50 Driver=usb-storage
> E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  2 Spd=12  MxCh= 0
> D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> P:  Vendor=05e3 ProdID=0701 Rev= 0.02
> S:  Manufacturer=Genesyslogic
> S:  Product=USB Mass Storage Device
> C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  4mA
> I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=02 Prot=50 Driver=usb-storage
> E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
>  
> [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
>  
> [EMAIL PROTECTED] usb]# cat /proc/scsi/usb-storage-2/3
>    Host scsi3: usb-storage
>        Vendor: Genesyslogic
>       Product: USB Mass Storage Device
> Serial Number: None
>      Protocol: 8020i
>     Transport: Bulk
>          GUID: 05e307010000000000000000
>      Attached: Yes
>  
> I am not able to understand which topology field belong to which storage 
> device. 
>  
> Please guide me how to relate the /proc/bus/usb/devices file with 
> /proc/scsi/usb-storage-?/?

In this case you can tell because the usb-storage index numbers are 
allocated in increasing order, as are the SCSI host numbers and the USB 
device numbers.

In /proc/scsi/usb-storage-A/B, A is the usb-storage index number and B is
the SCSI host number.  In /proc/bus/usb/devices, the Dev# field on the T
line is the USB device number.  Hence the entry with Dev#=2 goes with
usb-storage-1/2 and Dev#=3 goes with usb-storage-2/3.

This scheme won't work if you have more than one USB bus, because device 
numbers are allocated independently for the separate buses.  Ultimately 
the only way to match the entries up is by looking at the information in 
the system log.

Incidentally, the whole process is a lot easier with Linux 2.6.

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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to