Re: Can a particular interface have same Endpoint addresses?

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

 



On Sat, Nov 14, 2009 at 12:56 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 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.

I was thinking along the lines that actual address is found by doing a
bEndpointAddress & USB_ENDPOINT_NUMBER_MASK and hence we would arrive
at IN and OUT endpoints having the same address. But your explanation
below does answer my question, which is both IN and OUT can have the
same address and the device differentiates it using their PID values.
This could also explain why even though the Endpoint field in the
Token packet is 4 bits wide (16 possible endpoints), actual endpoints
can be upto a max of 30, because a single address like above can be
used to represent both IN and OUT.

>
>>  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.

Yes, makes perfect sense to me now. Thank you very much for caring to explain.

Regards,
Nicholas
--
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux