[wdmaudiodev] Re: UAC2 on Creator's: locked to 44.1?

  • From: Børge Strand-Bergesen <borge.strand@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 13 Jul 2017 23:55:47 +0200

Hi guys,

long story short: I now have the hardware supported by the Win10 driver.

This was one h*** of a debug! I almost sacrificed a goat. (I did once
before, and it got the code right.) I got good help here, on Upwork and
from a friend of mine. Thank you for your advice!

What did I do?
- Temporarily removed an excess interface used by old user mode control
system. Will put it back in in the end
- Cut unused HID RX EP
- Added descriptive strings "Analog_L" and "Analog_R" for _AS_ interfaces
and terminal
- Redefined capabilities of input terminal and clock source
- Learned that the Win10 driver has a very hard time with sample rate
triplets with range
- Uninstalled Device on Win10 for each plug-in event
- Redefined the sample rates as 6 single-frequency triplets
- Applied code for size(descriptor) > size(EP0)


Best,
Børge



On Wed, Jul 12, 2017 at 6:53 PM, Børge Strand-Bergesen <
borge.strand@xxxxxxxxx> wrote:

I hope you can point me to a frequency triple definition which is accepted
by Win10.

I'm beginning to fear Win10 can't do frequency ranges at all, only single
frequencies. If that is the case I'll try to write two clock sources with
three frequencies each, and one clock selector. That'll take a bit of
coding effort but should be doable. But before I embark on it I hope you
can shed some light on my discoveries and the feasibility of doing it with
two sources.

Triplets which don't make sense to Win10:
- 48000-192000/48000 - interpreted as 48000 only
- 48000-96000/48000 - interpreted as 48000 only


Best,
Børge

On Wed, Jul 12, 2017 at 6:38 PM, Børge Strand-Bergesen <
borge.strand@xxxxxxxxx> wrote:

Hi Jerry,

The code is in github. This is where things get ugly in terms of rate
triplets. https://github.com/borgestrand/sdr-widget/blob/audio-widget-
experimental/src/uac2_usb_specific_request.c#L125

The basic challenge is to express 44.1, 48, 88.2, 96, 176.4 and 192 in a
maximum of 5 triplets parsable by Win10 C.U.

I've learned that:

- 6 triplets breaks the length of EP0.
- The triplet 44100-48000/3900 is interpreted as 44100 only by Win10
- The triplet 88200-96000/7800 is interpreted as 88200 only by Win10
- Three single-frequency triplets work fine for Win10

Børge



On Wed, Jul 12, 2017 at 5:25 PM, Jerry Evans <jerry@xxxxxxxxxxx> wrote:

Hi Borge,



Looks like much happier hunting. Is this stuff on Github (or somewhere
public?)



*From:* wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@fre
elists.org]
*Sent:* 12 July 2017 07:45
*To:* wdmaudiodev@xxxxxxxxxxxxx
*Subject:* [wdmaudiodev] Re: UAC2 on Creator's: locked to 44.1?



Hi guys,



I've had a lot of progress recently, and I can now change the sample
rate on Win10. I will give you a full report when I understand more about
it.



Can you please point me to a formal definition of sample rate triplets,
as accepted by the Win10 driver? I have to use ranges since my EP0 is 64
bytes and thus can't hold a table of 6 discrete rates.



What I see is that some rate triplets are OK while others are not. Three
discrete frequencies work well:

0x03, 0x00, //number of sample rate triplets

0x44,0xac,0x00,0x00, //44.1k Min

0x44,0xac,0x00,0x00, //44.1k Max

0x00,0x00,0x00,0x00, // 0 Res

0x88,0x58,0x01,0x00, //88.2k Min

0x88,0x58,0x01,0x00, //88.2k Max

0x00,0x00,0x00,0x00, // 0 Res

0x00,0x77,0x01,0x00, //96k Min

0x00,0x77,0x01,0x00, //96k Max

0x00,0x00,0x00,0x00, // 0 Res



But the three triplets 44100:3900:48000, 88200:7800:96000,
176400:15600:192000 only lets me choose from 44.1, 88.2 and 176.4 in
Windows. Mac interprets this correctly as the 6 desired rates.

0x03, 0x00, //number of sample rate triplets

0x44, 0xac, 0x00, 0x00, //44.1k Min

0x80, 0xbb, 0x00, 0x00, //48k Max

0x3c, 0x0f, 0x00, 0x00, //48-44.1k Res

0x88,0x58,0x01,0x00, //88.2k Min

0x00,0x77,0x01,0x00, //96k Max

0x78,0x1e,0x00,0x00, //96-88.2 Res

0x10,0xb1,0x02,0x00, //176.4k Min

0x00,0xee,0x02,0x00, //192k Max

0xf0,0x3c,0x00,0x00, //192-176.4 Res



Best,

Børge









On Thu, Jul 6, 2017 at 11:38 AM, Børge Strand-Bergesen <
borge.strand@xxxxxxxxx> wrote:

Yesterday I checked which audio class specific requests are executed by
Linux and Mac OS but not by Win10 C.U. The probably most revealing one was
that AUDIO_CS_CONTROL_CLOCK_VALID was never requested.



With this in mind I tried to go through the clock source descriptors and
found out the device was missing an AC Clock Selector Descriptor. Is that
considered critical?



I tried to put one in, and now we're on the "Other Devices" list. One
step forward and one step back I guess :-) Hopefully I'll get there with a
bit more digging. Present descriptor below.



Best,

Børge







Information for device Henry Audio USB DAC 128 mkII (VID=0x16D0
PID=0x075D):



Connection Information:

------------------------------

Connection status: Device connected

Device actual bus speed: HighSpeed

Device supports USB 1.1 specification

Device supports USB 2.0 specification

Device is hub: No

Device address: 0x0009

Current configuration value: 0x01

Number of open pipes: 2



Device Descriptor:

------------------------------

0x12 bLength

0x01 bDescriptorType

0x0200 bcdUSB

0xEF bDeviceClass   (Miscellaneous device)

0x02 bDeviceSubClass

0x01 bDeviceProtocol

0x40 bMaxPacketSize0   (64 Bytes)

0x16D0 idVendor

0x075D idProduct

0x1000 bcdDevice

0x01 iManufacturer   "Audio-Widget"

0x02 iProduct   "Henry Audio USB DAC 128 mkII"

0x03 iSerialNumber   "2017042900BSB"

0x01 bNumConfigurations



Device Qualifier Descriptor:

------------------------------

0x0A bLength

0x06 bDescriptorType

0x0200 bcdUSB

0xEF bDeviceClass   (Miscellaneous device)

0x02 bDeviceSubClass

0x01 bDeviceProtocol

0x40 bMaxPacketSize0   (64 Bytes)

0x01 bNumConfigurations

0x00 bReserved



Configuration Descriptor:

------------------------------

0x09 bLength

0x02 bDescriptorType

0x00C9 wTotalLength   (201 Bytes)

0x04 bNumInterfaces

0x01 bConfigurationValue

0x00 iConfiguration

0xC0 bmAttributes   (Self-powered Device)

0x05 bMaxPower   (10 mA)



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x00 bInterfaceNumber

0x00 bAlternateSetting

0x00 bNumEndPoints

0x00 bInterfaceClass

0x00 bInterfaceSubClass

0x00 bInterfaceProtocol

0x00 iInterface



Interface Association Descriptor:

------------------------------

0x08 bLength

0x0B bDescriptorType

0x01 bFirstInterface

0x02 bInterfaceCount

0x01 bFunctionClass   (Audio Device Class)

0x00 bFunctionSubClass

0x20 bFunctionProtocol

0x00 iFunction



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x01 bInterfaceNumber

0x00 bAlternateSetting

0x00 bNumEndPoints

0x01 bInterfaceClass   (Audio Device Class)

0x01 bInterfaceSubClass   (Audio Control Interface)

0x20 bInterfaceProtocol

0x07 iInterface   "Henry Audio USB DAC 128 mkII"



AC Interface Header Descriptor:

------------------------------

0x09 bLength

0x24 bDescriptorType

0x01 bDescriptorSubtype

0x0200 bcdADC

0x04 bCategory   (HEADSET)

0x0048 wTotalLength   (72 Bytes)

0x00 bmControls



AC Clock Source Descriptor:

------------------------------

0x08 bLength

0x24 bDescriptorType

0x0A bDescriptorSubtype

0x05 bClockID

0x02 bmAttributes

0x07 bmControls

0x03 bAssocTerminal

0x05 iClockSource   "Clock 2"



AC Clock Selector Descriptor:

------------------------------

0x08 bLength

0x24 bDescriptorType

0x0B bDescriptorSubtype

0x05 bClockID

0x01 bNrInPins

0x05 baCSourceID(1)

0x07 bmControls

0x05 iClockSelector   "Clock 2"



AC Input Terminal Descriptor:

------------------------------

0x11 bLength

0x24 bDescriptorType

0x02 bDescriptorSubtype

0x11 bTerminalID

0x0101 wTerminalType   (USB Streaming)

0x00 bAssocTerminal

0x05 bCSourceID

0x02 bNrChannels   (2 Channels)

0x00000003 bmChannelConfig

0x00 iChannelNames

0x00 bmControls

0x08 iTerminal   "Audio-widget"



AC Feature Unit Descriptor:

------------------------------

0x12 bLength

0x24 bDescriptorType

0x06 bDescriptorSubtype

0x12 bUnitID

0x11 bSourceID

0x00000003 bmaControls(0)

0x0000000C bmaControls(1)

0x0000000C bmaControls(2)

0x00 iFeature



AC Output Terminal Descriptor:

------------------------------

0x0C bLength

0x24 bDescriptorType

0x03 bDescriptorSubtype

0x13 bTerminalID

0x0602 wTerminalType   (Digital audio interface)

0x00 bAssocTerminal

0x12 bSourceID

0x05 bCSourceID

0x0000 bmControls

0x00 iTerminal



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x02 bInterfaceNumber

0x00 bAlternateSetting

0x00 bNumEndPoints

0x01 bInterfaceClass   (Audio Device Class)

0x02 bInterfaceSubClass   (Audio Streaming Interface)

0x20 bInterfaceProtocol

0x00 iInterface



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x02 bInterfaceNumber

0x01 bAlternateSetting

0x02 bNumEndPoints

0x01 bInterfaceClass   (Audio Device Class)

0x02 bInterfaceSubClass   (Audio Streaming Interface)

0x20 bInterfaceProtocol

0x00 iInterface



AS Interface Descriptor:

------------------------------

0x10 bLength

0x24 bDescriptorType

0x01 bDescriptorSubtype

0x11 bTerminalLink

0x07 bmControls

0x01 bFormatType   (FORMAT_TYPE_1)

0x00000001 bmFormats

0x02 bNrChannels   (2 Channels)

0x00000003 bmChannelConfig

0x00 iChannelNames



AS Format Type 1 Descriptor:

------------------------------

0x06 bLength

0x24 bDescriptorType

0x02 bDescriptorSubtype

0x01 bFormatType   (FORMAT_TYPE_1)

0x04 bSubslotSize

0x18 bBitResolution   (24 Bits/sample)



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x02 bEndpointAddress   (OUT Endpoint)

0x05 bmAttributes (Transfer: Isochronous / Synch: Asynchronous / Usage:
Data)

0x0188 wMaxPacketSize   (392 Bytes)

0x02 bInterval



AS Isochronous Data Endpoint Descriptor:

------------------------------

0x08 bLength

0x25 bDescriptorType

0x01 bDescriptorSubtype

0x00 bmAttributes

0x00 bmControls

0x00 bLockDelayUnits   (Undefined)

0x0000 wLockDelay



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x81 bEndpointAddress   (IN Endpoint)

0x11 bmAttributes (Transfer: Isochronous / Synch: None / Usage:
Feedback)

0x0004 wMaxPacketSize   (4 Bytes)

0x04 bInterval



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x03 bInterfaceNumber

0x00 bAlternateSetting

0x02 bNumEndPoints

0x03 bInterfaceClass   (Human Interface Device Class)

0x00 bInterfaceSubClass

0x00 bInterfaceProtocol

0x00 iInterface



HID Descriptor:

------------------------------

0x09 bLength

0x21 bDescriptorType

0x0111 bcdHID

0x00 bCountryCode

0x01 bNumDescriptors

0x22 bDescriptorType   (Report descriptor)

0x0043 bDescriptorLength



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x84 bEndpointAddress   (IN Endpoint)

0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)

0x0008 wMaxPacketSize   (8 Bytes)

0x05 bInterval



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x05 bEndpointAddress   (OUT Endpoint)

0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)

0x0008 wMaxPacketSize   (8 Bytes)

0x05 bInterval



Other Speed Configuration Descriptor:

------------------------------

0x09 bLength

0x07 bDescriptorType

0x00C9 wTotalLength   (201 Bytes)

0x04 bNumInterfaces

0x01 bConfigurationValue

0x00 iConfiguration

0xC0 bmAttributes   (Self-powered Device)

0x05 bMaxPower   (10 mA)



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x00 bInterfaceNumber

0x00 bAlternateSetting

0x00 bNumEndPoints

0x00 bInterfaceClass

0x00 bInterfaceSubClass

0x00 bInterfaceProtocol

0x00 iInterface



Interface Association Descriptor:

------------------------------

0x08 bLength

0x0B bDescriptorType

0x01 bFirstInterface

0x02 bInterfaceCount

0x01 bFunctionClass   (Audio Device Class)

0x01 bFunctionSubClass   (Audio Control Interface)

0x20 bFunctionProtocol

0x07 iFunction   "Henry Audio USB DAC 128 mkII"



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x01 bInterfaceNumber

0x00 bAlternateSetting

0x00 bNumEndPoints

0x01 bInterfaceClass   (Audio Device Class)

0x01 bInterfaceSubClass   (Audio Control Interface)

0x20 bInterfaceProtocol

0x07 iInterface   "Henry Audio USB DAC 128 mkII"



AC Interface Header Descriptor:

------------------------------

0x09 bLength

0x24 bDescriptorType

0x01 bDescriptorSubtype

0x0200 bcdADC

0x04 bCategory   (HEADSET)

0x0048 wTotalLength   (72 Bytes)

0x00 bmControls



AC Clock Source Descriptor:

------------------------------

0x08 bLength

0x24 bDescriptorType

0x0A bDescriptorSubtype

0x05 bClockID

0x02 bmAttributes

0x07 bmControls

0x01 bAssocTerminal

0x05 iClockSource   "Clock 2"



AC Clock Selector Descriptor:

------------------------------

0x08 bLength

0x24 bDescriptorType

0x0B bDescriptorSubtype

0x05 bClockID

0x01 bNrInPins

0x05 baCSourceID(1)

0x07 bmControls

0x05 iClockSelector   "Clock 2"



AC Input Terminal Descriptor:

------------------------------

0x11 bLength

0x24 bDescriptorType

0x02 bDescriptorSubtype

0x11 bTerminalID

0x0101 wTerminalType   (USB Streaming)

0x00 bAssocTerminal

0x05 bCSourceID

0x02 bNrChannels   (2 Channels)

0x00000003 bmChannelConfig

0x00 iChannelNames

0x00 bmControls

0x00 iTerminal



AC Feature Unit Descriptor:

------------------------------

0x12 bLength

0x24 bDescriptorType

0x06 bDescriptorSubtype

0x12 bUnitID

0x11 bSourceID

0x00000003 bmaControls(0)

0x0000000C bmaControls(1)

0x0000000C bmaControls(2)

0x00 iFeature



AC Output Terminal Descriptor:

------------------------------

0x0C bLength

0x24 bDescriptorType

0x03 bDescriptorSubtype

0x13 bTerminalID

0x0602 wTerminalType   (Digital audio interface)

0x00 bAssocTerminal

0x12 bSourceID

0x05 bCSourceID

0x0000 bmControls

0x00 iTerminal



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x02 bInterfaceNumber

0x00 bAlternateSetting

0x00 bNumEndPoints

0x01 bInterfaceClass   (Audio Device Class)

0x02 bInterfaceSubClass   (Audio Streaming Interface)

0x20 bInterfaceProtocol

0x00 iInterface



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x02 bInterfaceNumber

0x01 bAlternateSetting

0x02 bNumEndPoints

0x01 bInterfaceClass   (Audio Device Class)

0x02 bInterfaceSubClass   (Audio Streaming Interface)

0x20 bInterfaceProtocol

0x00 iInterface



AS Interface Descriptor:

------------------------------

0x10 bLength

0x24 bDescriptorType

0x01 bDescriptorSubtype

0x11 bTerminalLink

0x07 bmControls

0x01 bFormatType   (FORMAT_TYPE_1)

0x00000001 bmFormats

0x02 bNrChannels   (2 Channels)

0x00000003 bmChannelConfig

0x00 iChannelNames



AS Format Type 1 Descriptor:

------------------------------

0x06 bLength

0x24 bDescriptorType

0x02 bDescriptorSubtype

0x01 bFormatType   (FORMAT_TYPE_1)

0x04 bSubslotSize

0x18 bBitResolution   (24 Bits/sample)



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x02 bEndpointAddress   (OUT Endpoint)

0x05 bmAttributes (Transfer: Isochronous / Synch: Asynchronous / Usage:
Data)

0x0188 wMaxPacketSize   (392 Bytes)

0x01 bInterval



AS Isochronous Data Endpoint Descriptor:

------------------------------

0x08 bLength

0x25 bDescriptorType

0x01 bDescriptorSubtype

0x00 bmAttributes

0x00 bmControls

0x00 bLockDelayUnits   (Undefined)

0x0000 wLockDelay



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x81 bEndpointAddress   (IN Endpoint)

0x11 bmAttributes (Transfer: Isochronous / Synch: None / Usage:
Feedback)

0x0004 wMaxPacketSize   (4 Bytes)

0x01 bInterval



Interface Descriptor:

------------------------------

0x09 bLength

0x04 bDescriptorType

0x03 bInterfaceNumber

0x00 bAlternateSetting

0x02 bNumEndPoints

0x03 bInterfaceClass   (Human Interface Device Class)

0x00 bInterfaceSubClass

0x00 bInterfaceProtocol

0x00 iInterface



HID Descriptor:

------------------------------

0x09 bLength

0x21 bDescriptorType

0x0111 bcdHID

0x00 bCountryCode

0x01 bNumDescriptors

0x22 bDescriptorType   (Report descriptor)

0x0043 bDescriptorLength



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x84 bEndpointAddress   (IN Endpoint)

0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)

0x0008 wMaxPacketSize   (8 Bytes)

0x05 bInterval



Endpoint Descriptor:

------------------------------

0x07 bLength

0x05 bDescriptorType

0x05 bEndpointAddress   (OUT Endpoint)

0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)

0x0008 wMaxPacketSize   (8 Bytes)

0x05 bInterval



Microsoft OS Descriptor is not available. Error code: 0x0000001F



String Descriptor Table

--------------------------------

Index  LANGID  String

0x00   0x0000  0x0409

0x01   0x0409  "Audio-Widget"

0x02   0x0409  "Henry Audio USB DAC 128 mkII"

0x03   0x0409  "2017042900BSB"

0x07   0x0409  "Henry Audio USB DAC 128 mkII"

0x05   0x0409  "Clock 2"

0x08   0x0409  "Audio-widget"



------------------------------



Connection path for device:

USB xHCI Compliant Host Controller

Root Hub

Henry Audio USB DAC 128 mkII (VID=0x16D0 PID=0x075D) Port: 4



Running on: Windows 10 or greater



Brought to you by TDD v1.84.0, Dec 14 2015, 09:19:38









On Wed, Jul 5, 2017 at 2:40 PM, Børge Strand-Bergesen <
borge.strand@xxxxxxxxx> wrote:

Thanks Tim,



I simplified the descriptor to only supporting 44.1 and 48. Mac OS has
no problem with interpreting it and presenting the valid rates.



Win10 reads the descriptor but does not give me a choice of sample rate.
It stays fixed at 44.1. It asks for 0x0100 bytes or descriptor, and I send
it 0x0E. That transaction looks perfectly fine. (Any attempts with funny
descriptor lengths failed, as expected, but I had to try.)



So the story remains the same. Something prevents Win10 C.U. from
attempting to change my sample rate. The frequency rate descriptor looks
perfectly fine.



Is the UAC2 driver code available? Or are there people here who could
help me access a verbose log from it?





Best,

Børge





On Wed, Jul 5, 2017 at 9:29 AM, Tim Roberts <timr@xxxxxxxxx> wrote:

On Jul 4, 2017, at 12:24 PM, Børge Strand-Bergesen <
borge.strand@xxxxxxxxx> wrote:

Yes, the Device code looks at the 16 bit value and tries to serve up
256 bytes. That doesn't seem to make the driver very happy.

You don't actually have 256 bytes of descriptor, do you?


I don't know why the driver requests 0x0100 bytes of frequency
definition. For flesh-and-blood beings it would however make sense to first
ask for one bytes and use that to determine the number of triplets.
Although the number of triplets, too, is a 16-bit number.

It's an optimization.  You assume the descriptor will not be more than
256 bytes, so you allocate 256 and try that.  If it fails, you allocate
larger and try again.  Same way you fetch the configuration descriptor.


Now, I'm not saying there is a bug in the driver. I'd just very much
like to know what I should give it when it asks for 0x0100 bytes. And I'd
like to know if it asks for that because of some other bug in my
descriptors.

You deliver min( actual descriptor length, what they asked for ).


Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.










Other related posts: