Webcam Microphone not working
Adam Baker
linux at baker-net.org.uk
Fri Oct 2 00:07:32 CEST 2020
Hi,
I've recently acquired a couple of different cheap webcams and on both
of them the microphone is not working under Linux but works under Windows.
Both cameras appear to use the same chip
ID 1b3f:2002 Generalplus Technology Inc. 808 Camera
which on one endpoint provides a UAC V1 audio signal.
Comparing wireshark USB captures between Windows and Linux I saw that
windows is using much larger URBs than Linux so as a quick hack added to
endpoint.c
+++ sound/usb/endpoint.c 2020-10-01 22:46:30.191648731 +0100
@@ -687,6 +687,10 @@ static int data_ep_set_params(struct snd
ep->freqmax = (data_maxsize / (frame_bits >> 3))
<< (16 - ep->datainterval);
}
+ if (maxsize < 128)
+ maxsize = 128;
+ dev_info(&ep->chip->dev->dev, "max: %d, epmax : %d, frq: %d\n",
+ maxsize, ep->maxpacksize, ep->freqmax);
if (ep->fill_max)
ep->curpacksize = ep->maxpacksize;
This was enough to make the microphone work suggesting that I am at
least looking in the right area.
The code in endpoint.c appears to be attempting to optimise the size of
the URB based upon the sample frequency, sample size and the maximum
rate at which packets can be sent in order to minimise latency and allow
accurate start / stop timing. Looking at the packet capture however I
suspect that that calculation is failing to account for some fixed
header sizes.
Before I delve into understanding this code and isochronous USB better
I'd like to know if anyone has quick answers to the following questions:
1) Has this already been addressed in a newer kernel, I'm currently
using Debian 4.19 because that is where I first found the problem?
2) What is the preferred kernel against which patches to this subsystem
should be provided, is it the latest released kernel on Linus' git tree,
the latest RC or a subsystem tree?
3) The sellers of these cameras both claimed they work under Linux. Do I
need to try to find if there was a time in the past when they did work
and if so provide a fixes tag against the commit that broke support?
Would doing so affect the chances of a fixes making it to stable kernels?
4) Is there any documentation other than code comments indicating how
the URB size calculation is supposed to work that I should read?
5) Are there any specific gotchas in this driver that I should be aware of?
Thanks
Adam Baker
P.S. I do realise that once I have a properly tested patch you will want
to see it sent with git-send-email and a signed off by line.
More information about the Alsa-devel
mailing list