Author Topic: Composite Device - Device Speeds  (Read 14465 times)

FoxTrot

  • Member
  • ***
  • Posts: 2
Composite Device - Device Speeds
« on: June 22, 2012, 08:22:11 am »
I have a question regarding building a composite device.

My composite device would contain : a HID (e.g. keyboard) device and a Mass Storage (e.g. disk) device.

Current understanding:
==============

The composite device could have a single configuration with two interfaces :
Interface 0 - Keyboard
Interface 1 - Mass Storage

Two separate endpoints could be defined for the HID and the Mass Storage device.
Endpoint 0 - Keyboard
   IN Endpoint
   bmAttributes = Interrupt
   wMaxPacketSize = 8
   bInterval = 1
Endpoint 1 - Mass Storage
   IN Endpoint (just an assumption)
   bmAttributes = Bulk
   wMaxPacketSize = 50 (just a dummy value : not decided yet)
   bInterval = 8 (just a dummy value : not decided yet)

Hence the keyboard is intended to be used as a low-speed,interrupt-based HID class device
And the disk storage is intended to be used as a full-speed, bulk-based Mass-Storage class device.

When the composite device is connected to the host,
By observing which line is pulled high (D+ or D-) , the host can identify if the connected device is a low-speed device OR a full-speed device.
The host also obtains the endpoints descriptors from the composite device and determines the bandwidth requirement for the HID and the mass storage devices. The host is able to receive low-speed data and full-speed data over the same USB 2.0 bus from the composite device.

In theory, it appears that by using separate endpoints, data from the low-speed end-point(keyboard) and data from the full-speed end-point (disk) can be sent/received over the physical USB link.

Question :
=======

The composite device is expected to identify itself as a low-speed OR a full-speed device to the host, by pulling lines D+ or D-. In this case where the composite device is supporting both a low-speed(keyboard) and a full-speed (disk), how should the D+/D- be configured.

Is it possible to construct a composite device with endpoints having two separate speeds (low and full) ?

Any information would be greatly helpful.






Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Composite Device - Device Speeds
« Reply #1 on: June 22, 2012, 01:57:44 pm »
A device can only have one speed. This device would have to be full speed as low speed does not support bulk. The keyboard would work just as well as a full speed device, and given that you already have to have full speed drivers making the keyboard low speed gains you nothing (if it were possible at all).

Also:

If the keyboard were a low speed device, you couldn't have interval 1. 10 is the minimum interval for low speed. I know stacks which enforce this limitation because lower periods interfere with a controller workaround.

50 is not a good value for the bulk endpoint's max packet size (even as a dummy), the only legal values are 8, 16, 32 and 64. 64 is best if the hardware can support it.

The mass storage device likely needs more than just one endpoint. Bulk only requires a bulk in, the other transports also require other endpoints.

The bInterval of a full speed bulk must be set to zero. It has no meaning for full speed bulk.

FoxTrot

  • Member
  • ***
  • Posts: 2
Re: Composite Device - Device Speeds
« Reply #2 on: June 25, 2012, 05:07:27 am »
Thank you for your comments, Barry.

Does this place a restriction on a composite device - that all the functions (e.g.  keyboard and disk) contained within the composite device should operate at the same speed ?

It seems that there is no mention of such a constraint (on composite devices) in the USB specification.

Do host controllers provide a special implementation for composite devices (such that the composite devices can contain functions with different speeds of low or high) which are connected on the USB bus ?


Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Composite Device - Device Speeds
« Reply #3 on: June 26, 2012, 08:12:17 pm »
A composite device is one USB device. One device can only have one speed. Therefore all functions within a composite device must work at the same speed. I don't think its spelt out anywhere, but no one has even thought to ask the question before, because its obvious.

Next question, do you really mean composite, not compound. A composite device is one device (with one of more functions), a compound device consists of a hub and several different USB devices in one box. In a compound device each function can be a different speed.