4

The example code that Atmel gives for USB devices has an interface with two alternate settings. The first one has no endpoints, the second has 6 endpoints. Is there any reason for this - why not just have one alternate setting with all the endpoints?

I found a vague post somewhere on the internet suggesting it might be something to do with power saving. Does anyone have any idea?

Timmmm
  • 68,359
  • 51
  • 283
  • 367

2 Answers2

4

Ah so it seems like it is because an interface with isochronous endpoints reserves bandwidth on the USB bus. But having a default alternate with no isochronous endpoints you avoid that issue.

Sources:

http://www.makelinux.net/ldd3/chp-13-sect-1

The initial state of a interface is in the first setting, numbered 0. Alternate settings can be used to control individual endpoints in different ways, such as to reserve different amounts of USB bandwidth for the device. Each device with an isochronous endpoint uses alternate settings for the same interface.

https://msdn.microsoft.com/en-us/library/windows/hardware/jj124028(v=vs.85).aspx

This test verifies that when any device has an interface that consumes isochronous bandwidth, that device supports multiple alternate settings for that interface, and that alternate setting 0 (zero) does not consume isochronous bandwidth.

Timmmm
  • 68,359
  • 51
  • 283
  • 367
  • 1
    And this one: https://msdn.microsoft.com/en-us/library/windows/hardware/hh968309(v=vs.85).aspx Read the chapter that starts with "For example...:" – Elmue Sep 24 '16 at 02:13
1

For audio, you must always provide a zero bandwidth alternate setting for when the device is not in use:

Whenever an AudioStreaming interface requires an isochronous data endpoint, it shall at least provide the default Alternate Setting (Alternate Setting 0) with zero bandwidth requirements (no isochronous data endpoint defined) and an additional Alternate Setting that contains the actual isochronous data endpoint.

From UAC 3.0

Same for video:

All devices that transfer isochronous video data must incorporate a zero-bandwidth alternate setting for each VideoStreaming interface that has an isochronous video endpoint, and it must be the default alternate setting (alternate setting zero). A device offers to the Host software the option to temporarily relinquish USB bandwidth by switching to this alternate setting. The zero-bandwidth alternate setting does not contain a VideoStreaming isochronous data endpoint descriptor.

From UVC 1.5

endolith
  • 21,410
  • 30
  • 114
  • 183