Bug 234794

Summary: snd_uaudio: Quirks for Edirol UA-25EX in advanced driver mode
Product: Base System Reporter: Florian Walpen <dev>
Component: usbAssignee: Hans Petter Selasky <hselasky>
Status: Closed FIXED    
Severity: Affects Only Me CC: hselasky
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Add vendor class quirk and ignore missing Audio Control header. none

Description Florian Walpen 2019-01-09 17:52:31 UTC
Created attachment 200961 [details]
Add vendor class quirk and ignore missing Audio Control header.

The Edirol UA-25EX USB 1.1 audio interface has an advanced driver mode which
enables 24 bit operation at up to 96kHz. Unfortunately this mode is not class
compliant and needs some additional quirks to get it running.

How to reproduce:
1. Set the "ADVANCED DRIVER" switch on the back of the device to "ON".
2. Pull out the device and plug it in again (needed when changing switches).

The device will not be detected by snd_uaudio.

Analysis:
There are actually two problems that prevent proper device detection.
a) The USB descriptors indicate a vendor specific implementation.
b) The Audio Control header is completely omitted from the descriptors.

Issue a) is easy to circumvent with the UQ_AU_VENDOR_CLASS quirk. It can be
applied by adding the following line to /boot/loader.conf:

hw.usb.quirk.0="0x0582 0x00e6 0x0000 0xffff UQ_AU_VENDOR_CLASS"

While this will get the MIDI part detected, no audio stream channels are
considered due to the Audio Control header missing.

Patch:
The patch provided is based on FreeBSD CURRENT. In my basic tests it results in
a fully working device, for all settings of the physical sample rate switch. It
adds both the device quirk for a) and solves the channel detection for issue
b). The latter is achieved by matching the device specifically when being
attached, and setting a flag to make channel detection ignore the missing Audio
Control header.
Mixer detection is not an issue in this case since mixers are all hardware only.

I'm sure this is not the most elegant way to code it, and I am open for
suggestions. I could probably factor out the changes for issue b) into a
generic quirk, e.g. as UQ_AU_NO_AC_HEADER.

Also some quirks seem to be unimplemented, like UQ_AU_INP_ASYNC and UQ_BAD_ADC.
Did I miss something?
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2019-01-12 11:06:20 UTC
> Also some quirks seem to be unimplemented, like UQ_AU_INP_ASYNC and UQ_BAD_ADC.
> Did I miss something?

This is correct. I'll look into your patch.

--HPS
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2019-01-12 11:14:09 UTC
Modified your patch a bit. Please check that the committed version works still. Thank you!
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-01-12 11:16:01 UTC
A commit references this bug:

Author: hselasky
Date: Sat Jan 12 11:15:01 UTC 2019
New revision: 342961
URL: https://svnweb.freebsd.org/changeset/base/342961

Log:
  snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.

  Extend the vendor class USB audio quirk to cover devices without
  the USB audio control descriptor.

  PR:			234794
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Changes:
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/sound/usb/uaudioreg.h
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs
Comment 4 Florian Walpen 2019-01-12 18:14:31 UTC
(In reply to Hans Petter Selasky from comment #2)

Great, thank you!
Your modified commit does work with the UA-25EX - unfortunately I don't have any other device that needs the UQ_AU_VENDOR_CLASS quirk for cross-checking.
Anyway, looks fine to me.

Have a nice weekend!
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-03-26 13:52:48 UTC
A commit references this bug:

Author: hselasky
Date: Tue Mar 26 13:52:02 UTC 2019
New revision: 345544
URL: https://svnweb.freebsd.org/changeset/base/345544

Log:
  MFC r342961:
  snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.

  Extend the vendor class USB audio quirk to cover devices without
  the USB audio control descriptor.

  PR:			234794
  Sponsored by:		Mellanox Technologies

Changes:
_U  stable/12/
  stable/12/sys/dev/sound/usb/uaudio.c
  stable/12/sys/dev/sound/usb/uaudioreg.h
  stable/12/sys/dev/usb/quirk/usb_quirk.c
  stable/12/sys/dev/usb/usbdevs
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-03-26 13:53:53 UTC
A commit references this bug:

Author: hselasky
Date: Tue Mar 26 13:52:47 UTC 2019
New revision: 345545
URL: https://svnweb.freebsd.org/changeset/base/345545

Log:
  MFC r342961:
  snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.

  Extend the vendor class USB audio quirk to cover devices without
  the USB audio control descriptor.

  PR:			234794
  Sponsored by:		Mellanox Technologies

Changes:
_U  stable/11/
  stable/11/sys/dev/sound/usb/uaudio.c
  stable/11/sys/dev/sound/usb/uaudioreg.h
  stable/11/sys/dev/usb/quirk/usb_quirk.c
  stable/11/sys/dev/usb/usbdevs
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-03-26 13:53:56 UTC
A commit references this bug:

Author: hselasky
Date: Tue Mar 26 13:53:34 UTC 2019
New revision: 345546
URL: https://svnweb.freebsd.org/changeset/base/345546

Log:
  MFC r342961:
  snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.

  Extend the vendor class USB audio quirk to cover devices without
  the USB audio control descriptor.

  PR:			234794
  Sponsored by:		Mellanox Technologies

Changes:
_U  stable/10/
  stable/10/sys/dev/sound/usb/uaudio.c
  stable/10/sys/dev/sound/usb/uaudioreg.h
  stable/10/sys/dev/usb/quirk/usb_quirk.c
  stable/10/sys/dev/usb/usbdevs