On Fri, 13 Nov 2009, Nicholas Van Orton wrote: > Hello, > > Like to thank Henry Gebhardt, Greg KH and Alan Stern for > helping me out with answering the USB > questions that I posed to this list. Continuing with my learning USB, > I have the following doubt... > > On connecting a USB pendrive and viewing the /proc/bus/usb/devices I get > the endpoint addresses assigned as > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > Here the OUT endpoint is address 1 and IN is address 2, this I can > understand because the endpoints have been assigned different addresses. > > But on connecting another USB mass storage device, I get this > > T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#= 6 Spd=480 MxCh= 0 > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > P: Vendor=0bc2 ProdID=2000 Rev= 0.00 > S: Manufacturer=Seagate > S: Product=FreeAgent Go > S: SerialNumber= 5MA7YVCP > C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA > I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 > Driver=usb-storage > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > Here both OUT and IN endpoints have been assigned the address 1 !! No, they haven't. The OUT endpoint has been assigned address 0x01 = 1 and the IN endpoint has been assigned address 0x81 = 129. > Is > this normal behavior? Yes, it is. > When a packet is sent by the host to the device > with address 6, with just one interface, can both endpoints be assigned > the same address? Not the same _address_ -- the same _number_. There's no conflict; endpoints with different directions can share the same number. According to the USB 2.0 specification (section 5.3.1): Each endpoint on a device is given at design time a unique device-determined identifier called the endpoint number. Each endpoint has a device-determined direction of data flow. The combination of the device address, endpoint number, and direction allows each endpoint to be uniquely referenced. You really should look through the specification. It's freely available from www.usb.org, much of it is highly readable, and it explains numerous issues like this one. > I also read that we can have a total of 16 endpoints (hard limit 30) for > a single interface. Where did you read that? Interfaces can have up to 30 endpoints. On a full-speed or high-speed device, that is; low-speed devices are limited to 2 endpoints. > With just OUT and IN being the only endpoints a > particular interface can possibly have, what is the need for the other > 14 endpoints? Your question doesn't make sense. An interface could have endpoints 1-OUT, 1-IN, 2-OUT, 2-IN, ..., 15-OUT, 15-IN. That's 30 endpoints. Why have multiple IN endpoints, like 1-IN and 2-IN? Well, a device might want to transfer different information using the different endpoints. For example, 1-IN might be used for status info while 2-IN carries bulk data. Or the device might be a USB-serial converter with multiple serial ports; then 1-IN could carry data for port 1 while 2-IN carries data for port 2, and so on. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html