[PATCH] ALSA: usb-audio: allow -EPIPE errors for some v2 messages

From: Greg Kroah-Hartman
Date: Sun Oct 10 2021 - 08:22:47 EST


The Schiit Hel device does not like to respond to all get_ctl_value_v2()
requests for some reason. This used to work in older kernels, but now
with more strict checking, this failure causes the device to fail to
work.

Cc: Jaroslav Kysela <perex@xxxxxxxx>
Cc: Takashi Iwai <tiwai@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---

This fixes the Shiit Hel device that I have. It used to work on older
kernels (a year ago?), but stopped working for some reason and I didn't
take the time to track it down. This change fixes the issue for me, but
feels wrong for some reason. At least now I can use the device as a
headphone driver, much better than the built-in one for my current
machine...

If needed, I can take the time to do bisection to track down the real
issue here, it might be due to stricter endpoint checking in the USB
core, but that feels wrong somehow.

Here's the debugfs USB output for this device, showing the endpoints:

T: Bus=07 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 5 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=30be ProdID=0101 Rev=01.02
S: Manufacturer=Schiit Audio
S: Product=Schiit Hel
C: #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=01(audio) Sub=01 Prot=20 Driver=snd-usb-audio
E: Ad=8f(I) Atr=03(Int.) MxPS= 6 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio
E: Ad=05(O) Atr=05(Isoc) MxPS= 104 Ivl=125us
E: Ad=85(I) Atr=11(Isoc) MxPS= 4 Ivl=1ms
I: If#= 2 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio
E: Ad=88(I) Atr=05(Isoc) MxPS= 156 Ivl=125us
I: If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=1ms

Any other suggestions to fix this are welcome.

sound/usb/mixer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index a2ce535df14b..37d3d697776b 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -371,11 +371,11 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
validx, idx, buf, size);
snd_usb_unlock_shutdown(chip);

- if (ret < 0) {
+ if ((ret < 0) && (ret != -EPIPE)) {
error:
usb_audio_err(chip,
- "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
- request, validx, idx, cval->val_type);
+ "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, ret = %d\n",
+ request, validx, idx, cval->val_type, ret);
return ret;
}

--
2.33.0