[alsa-devel] [PATCH - Fix Fast Track Ultra series: 44.1/88.1 kHz 1/Fix playback/capture issues and related chrashes at 44100 Hz and 88200 Hz for M-Audio Fast Track Ultra series.
This fixes issues with M-Audio's Fast Track Ultra series:
* devices now work at 44100 and 88200 Hz * apparently, fixes some crashes, too
This is based on a patch posted by user 'dhubsith' on the M-Audio user forum.
Sorry for not sending via 'git send-email': I just don't get it...
Kind regards,
Felix
Hi,
Here's a slightly updated version of the patch. It does essentially the same as the former one but sets the capture endpoint attribute to 'async' and the playback endpoint to 'adaptive'.
Kind regards,
Felix
Am 06.07.2010 10:05, schrieb Felix Homann:
This fixes issues with M-Audio's Fast Track Ultra series:
- devices now work at 44100 and 88200 Hz
- apparently, fixes some crashes, too
Felix Homann wrote:
This fixes issues with M-Audio's Fast Track Ultra series:
- devices now work at 44100 and 88200 Hz
The descriptors already list these rates, so in theory, the existing code that sets UAC_EP_CS_ATTR_SAMPLE_RATE should already have enabled this. Didn't it? In other words, what is the difference in the explicitly specified audioformat?
(I have the suspicion that we don't actually need a AUDIO_FIXED_ENDPOINT quirk for these devices.)
- apparently, fixes some crashes, too
When do these crashes happen?
This is based on a patch posted by user 'dhubsith' on the M-Audio user forum.
If you don't have the exclusive copyright for the code in this patch, there needs to be a Signed-off-by line from him, too. OTOH, a table like this probably isn't copyrightable at all.
- USB_DEVICE(0x0763, 0x2080),
USB_DEVICE(0x0763, 0x2081),
...
This replaces the ID of the Ultra 8 ID with that of the Ultra 8R ...
USB_DEVICE(0x0763, 0x2081),
- .driver_info = ...
.driver_info = ...
... and this just changes the other 8R entry. So now the 8 doesn't have an entry.
Regards, Clemens
Am 07.07.2010 14:44, schrieb Clemens Ladisch:
The descriptors already list these rates, so in theory, the existing code that sets UAC_EP_CS_ATTR_SAMPLE_RATE should already have enabled this. Didn't it? In other words, what is the difference in the explicitly specified audioformat?
I can only tell you the difference to the behaviour of latest git Alsa before this patch:
44100 and 88200 Hz had already been enabled. But the device could not properly be used at these sampling rates. Everything would sound distorted. After a while of running the device at these sample rates, my systems had a tendency to crash/freeze.
(I have the suspicion that we don't actually need a AUDIO_FIXED_ENDPOINT quirk for these devices.)
Something must be in this AUDIO_FIXED_ENDPOINT quirk, since the device now works properly and stable @44.1/88.2 kHz. I don't know the exact reason, since I really don't understand all this stuff. I just have this device and try to fix it's behaviour.
- apparently, fixes some crashes, too
When do these crashes happen?
See above: System crashes occured when using the device at 44.1/88.2 kHz.
If you don't have the exclusive copyright for the code in this patch, there needs to be a Signed-off-by line from him, too. OTOH, a table like this probably isn't copyrightable at all.
If the patch is copyrightable then its copyright belongs to you: The patch I send some time ago to enable basic support for these devices was an updated version of *your* patch send some time ago to a mailing list. The patch dhubsith posted was explicitly based on existing code in quirks-table.h and the existing quirk.
Take a look at the entry for the Digidesign Mbox (credited to you): It's essentially the same.
- USB_DEVICE(0x0763, 0x2080),
USB_DEVICE(0x0763, 0x2081),
...
This replaces the ID of the Ultra 8 ID with that of the Ultra 8R ...
Ooops. I've messed it up... (I've just got the 8R version so I didn't notice...)
USB_DEVICE(0x0763, 0x2081),
- .driver_info = ...
.driver_info = ...
... and this just changes the other 8R entry. So now the 8 doesn't have an entry.
Actually both quirk blocks shoud be the same except for the USB_DEVICE lines:
USB_DEVICE(0x0763, 0x2080) <- Fast Track Ultra USB_DEVICE(0x0763, 0x2081) <- Fast Track Ultra 8R
(Actually there's no "Fast Track Ultra 8")
Sorry for having messed the patch up and sending it too soon. Shall I send a new patch, or would you consider manually editing it yourself before eventually putting it into git?
Kind regards,
Felix
Hi,
here's the hopefully corrected version of the patch.
Furthermore, I got notice from dhubsith that he would sign it of if needed. What do you think?
Kind regards,
Felix
Felix Homann wrote:
Am 07.07.2010 14:44, schrieb Clemens Ladisch:
(I have the suspicion that we don't actually need a AUDIO_FIXED_ENDPOINT quirk for these devices.)
Something must be in this AUDIO_FIXED_ENDPOINT quirk, since the device now works properly and stable @44.1/88.2 kHz. I don't know the exact reason, since I really don't understand all this stuff.
There must be some difference, and I'd really like to know what it is. Please load the driver with the patch below, with and without the AUDIO_FIXED_ENDPOINT patch, and show what it prints to the system log.
Regards, Clemens
--- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -196,6 +196,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof hwc_debug("All rates were zero. Skipping format!\n"); return -1; } + print_hex_dump_bytes("rates ", DUMP_PREFIX_OFFSET, fp->rates, sizeof(int) * nr_rates); } else { /* continuous rates */ fp->rates = SNDRV_PCM_RATE_CONTINUOUS; @@ -480,6 +481,7 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f fp->fmt_type = fmt->bFormatType; if (err < 0) return err; + print_hex_dump_bytes("format ", DUMP_PREFIX_OFFSET, fp, sizeof(*fp)); #if 1 /* FIXME: temporary hack for extigy/audigy 2 nx/zs */ /* extigy apparently supports sample rates other than 48k diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 9a9da09..6be2bfc 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -142,6 +142,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, } memcpy(rate_table, fp->rate_table, sizeof(int) * fp->nr_rates); fp->rate_table = rate_table; + print_hex_dump_bytes("rates ", DUMP_PREFIX_OFFSET, fp->rate_table, sizeof(int) * fp->nr_rates); }
stream = (fp->endpoint & USB_DIR_IN) @@ -161,6 +162,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, alts = &iface->altsetting[fp->altset_idx]; fp->datainterval = snd_usb_parse_datainterval(chip, alts); fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); + print_hex_dump_bytes("format ", DUMP_PREFIX_OFFSET, fp, sizeof(*fp)); usb_set_interface(chip->dev, fp->iface, 0); snd_usb_init_pitch(chip, fp->iface, alts, fp); snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max);
Building Alsa fails after applying your patch:
[...] make[2]: Entering directory `/home/felix/workspace/Alsa/Ladisch/alsa-driver/usb' copying file alsa-kernel/usb/quirks.c patching file quirks.c Hunk #2 FAILED at 159. Hunk #3 succeeded at 235 (offset 5 lines). Hunk #4 succeeded at 325 (offset 6 lines). Hunk #5 succeeded at 343 (offset 6 lines). Hunk #6 succeeded at 357 (offset 6 lines). Hunk #7 succeeded at 370 (offset 6 lines). 1 out of 7 hunks FAILED -- saving rejects to file quirks.c.rej make[2]: *** [quirks.c] Fehler 1 make[2]: Leaving directory `/home/felix/workspace/Alsa/Ladisch/alsa-driver/usb' make[1]: *** [dep] Fehler 1 make[1]: Leaving directory `/home/felix/workspace/Alsa/Ladisch/alsa-driver' make: *** [include/sndversions.h] Fehler 2
Am 07.07.2010 16:23, schrieb Clemens Ladisch:
There must be some difference, and I'd really like to know what it is. Please load the driver with the patch below, with and without the AUDIO_FIXED_ENDPOINT patch, and show what it prints to the system log.
Felix Homann wrote:
Building Alsa fails after applying your patch:
patching file quirks.c Hunk #2 FAILED at 159.
My patch was against the kernel source; the alsa-driver package needs this additional patch:
--- alsa-driver/usb/quirks.patch +++ alsa-driver/usb/quirks.patch @@ -15,9 +15,9 @@ +#else + fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; +#endif + print_hex_dump_bytes("format ", DUMP_PREFIX_OFFSET, fp, sizeof(*fp)); usb_set_interface(chip->dev, fp->iface, 0); snd_usb_init_pitch(chip, fp->iface, alts, fp); - snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max); @@ -228,7 +234,11 @@ fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
I've attached the excerpts from /var/log/syslog with and without the FIXED_ENDPOINT quirk.
Please, let me know if you need further information.
Kind regards,
Felix
Felix Homann wrote:
I've attached the excerpts from /var/log/syslog with and without the FIXED_ENDPOINT quirk.
BUG: unable to handle kernel NULL pointer dereference
Sorry, the call for the case without the fixed quirk is buggy. In line 199 of format.c, please change "fp->rates" to "fp->rate_table".
Regards, Clemens
Hmm,
I guess there's still something wrong with your debug patch (or me applying it...). Doesn't look like any valuable information in syslog this time (no fixed_endpoint quirk):
Jul 8 17:04:16 yerbouti kernel: [19340.109648] usb 2-3: config 1 interface 3 altsetting 0 bulk endpoint 0x7 has invalid maxpacket 8 Jul 8 17:04:16 yerbouti kernel: [19340.109653] usb 2-3: config 1 interface 3 altsetting 0 bulk endpoint 0x87 has invalid maxpacket 8 Jul 8 17:04:16 yerbouti kernel: [19340.110762] usb 2-3: New USB device found, idVendor=0763, idProduct=2081 Jul 8 17:04:16 yerbouti kernel: [19340.110765] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Jul 8 17:04:16 yerbouti kernel: [19340.110769] usb 2-3: Product: Fast Track Ultra 8R Jul 8 17:04:16 yerbouti kernel: [19340.110771] usb 2-3: Manufacturer: M-Audio Jul 8 17:04:16 yerbouti kernel: [19340.110916] usb 2-3: configuration #1 chosen from 1 choice
Regards,
Felix
Am 08.07.2010 15:10, schrieb Clemens Ladisch:
BUG: unable to handle kernel NULL pointer dereference
Sorry, the call for the case without the fixed quirk is buggy. In line 199 of format.c, please change "fp->rates" to "fp->rate_table".
Felix Homann wrote:
I guess there's still something wrong with your debug patch (or me applying it...). Doesn't look like any valuable information in syslog this time (no fixed_endpoint quirk):
But that part of parse_audio_format_rates_v1 definitely gets executed, or the kernel wouldn't have crashed previously.
Please make sure that the source code (in alsa-kernel) contains the print_hex_dump_bytes call, and that it is this driver that gets loaded.
Regards, Clemens
Sorry, I really thought I had double checked.
Here you go (without fixed endpoint quirk):
Jul 8 17:49:04 yerbouti kernel: [22027.924017] usb 2-3: new high speed USB device using ehci_hcd and address 6 Jul 8 17:49:04 yerbouti kernel: [22028.057581] usb 2-3: config 1 interface 3 altsetting 0 bulk endpoint 0x7 has invalid maxpacket 8 Jul 8 17:49:04 yerbouti kernel: [22028.057586] usb 2-3: config 1 interface 3 altsetting 0 bulk endpoint 0x87 has invalid maxpacket 8 Jul 8 17:49:04 yerbouti kernel: [22028.058445] usb 2-3: New USB device found, idVendor=0763, idProduct=2081 Jul 8 17:49:04 yerbouti kernel: [22028.058449] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Jul 8 17:49:04 yerbouti kernel: [22028.058452] usb 2-3: Product: Fast Track Ultra 8R Jul 8 17:49:04 yerbouti kernel: [22028.058454] usb 2-3: Manufacturer: M-Audio Jul 8 17:49:04 yerbouti kernel: [22028.058594] usb 2-3: configuration #1 chosen from 1 choice Jul 8 17:49:04 yerbouti kernel: [22028.149465] rates 00000000: 44 ac 00 00 80 bb 00 00 88 58 01 00 00 77 01 00 D........X...w.. Jul 8 17:49:04 yerbouti kernel: [22028.149471] format 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.149474] format 00000010: 00 00 00 00 01 00 00 00 08 00 00 00 01 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.149477] format 00000020: 00 00 00 00 01 00 00 00 01 01 01 01 05 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.149480] format 00000030: 38 01 00 00 c0 06 00 00 44 ac 00 00 00 77 01 00 8.......D....w.. Jul 8 17:49:04 yerbouti kernel: [22028.149483] format 00000040: 04 00 00 00 00 00 00 00 e8 87 61 50 00 88 ff ff ..........aP.... Jul 8 17:49:04 yerbouti kernel: [22028.149486] format 00000050: 00 00 00 00 00 00 00 00 ........ Jul 8 17:49:04 yerbouti kernel: [22028.152636] rates 00000000: 44 ac 00 00 80 bb 00 00 88 58 01 00 00 77 01 00 D........X...w.. Jul 8 17:49:04 yerbouti kernel: [22028.152640] format 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.152644] format 00000010: 00 00 00 00 01 00 00 00 08 00 00 00 01 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.152646] format 00000020: 00 00 00 00 02 00 00 00 01 01 01 81 05 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.152649] format 00000030: 38 01 00 00 c0 06 00 00 44 ac 00 00 00 77 01 00 8.......D....w.. Jul 8 17:49:04 yerbouti kernel: [22028.152652] format 00000040: 04 00 00 00 00 00 00 00 28 84 61 50 00 88 ff ff ........(.aP.... Jul 8 17:49:04 yerbouti kernel: [22028.152655] format 00000050: 00 00 00 00 00 00 00 00 ........ Jul 8 17:49:04 yerbouti kernel: [22028.154451] rates 00000000: 44 ac 00 00 80 bb 00 00 88 58 01 00 00 77 01 00 D........X...w.. Jul 8 17:49:04 yerbouti kernel: [22028.154455] format 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.154459] format 00000010: 00 00 00 00 01 00 00 00 08 00 00 00 01 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.154462] format 00000020: 00 00 00 00 02 00 00 00 02 02 01 81 05 00 00 00 ................ Jul 8 17:49:04 yerbouti kernel: [22028.154465] format 00000030: 38 01 00 00 c0 06 00 00 44 ac 00 00 00 77 01 00 8.......D....w.. Jul 8 17:49:04 yerbouti kernel: [22028.154468] format 00000040: 04 00 00 00 00 00 00 00 28 8d 61 50 00 88 ff ff ........(.aP.... Jul 8 17:49:04 yerbouti kernel: [22028.154472] format 00000050: 00 00 00 00 00 00 00 00 ........ Jul 8 17:49:04 yerbouti kernel: [22028.155656] ALSA clock.c:236: current rate 48000 is different from the runtime rate 96000 Jul 8 17:49:04 yerbouti kernel: [22028.157664] usbcore: registered new interface driver snd-usb-audio
Am 08.07.2010 17:19, schrieb Clemens Ladisch:
Felix Homann wrote:
I guess there's still something wrong with your debug patch (or me applying it...). Doesn't look like any valuable information in syslog this time (no fixed_endpoint quirk):
Am 07.07.2010 16:23, schrieb Clemens Ladisch:
There must be some difference, and I'd really like to know what it is. Please load the driver with the patch below, with and without the AUDIO_FIXED_ENDPOINT patch, and show what it prints to the system log.
Regards, Clemens
Hi Clemens,
Have you found what's making the AUDIO_FIXED_ENDPOINT necessary? What are the chances for the patch to make it into the git repositories otherwise?
Kind regards,
Felix
Dear Alsa developers,
almost 2 months ago I send a patch making the M-Audio Fast Track Ultra series audio interfaces work flawlessly in Linux except for missing mixer support:
Am 06.07.2010 10:05, schrieb Felix Homann:
This fixes issues with M-Audio's Fast Track Ultra series:
- devices now work at 44100 and 88200 Hz
- apparently, fixes some crashes, too
Unfortunately, the patch didn't make it into Alsa so far. Clemens Ladisch seemed reluctant to apply a fixed endpoint quirk since the device should have worked without in his opinion. I gave him all the requested information to see what was happening without the fixed endpoint quirk. I never heard back from him again.
So, could someone in charge kindly tell me why the patch didn't make it into Alsa? What's missing, what's wrong?
If it's just the fact that Clemens doesn't like the fixed endpoint quirk please find attached a different patch yielding the same result. (Against Linux 2.6.35. It's again from dhubsith who posted it on the M-Audio forum. He would sign it off if requested - on the other hand it is already derived work of the Alsa sources).
And please, if it's not going anywhere, please tell us "laymen, volunteer Alsa helpers" about the reasons.
The current situation is most frustrating: We know how to make the device work (much better than in Windows, btw) but we don't know why we have to patch alsa again and again.
Thanks in advance,
Felix
Dear Felix,
Am Dienstag, den 31.08.2010, 08:39 +0200 schrieb Felix Homann:
almost 2 months ago I send a patch making the M-Audio Fast Track Ultra series audio interfaces work flawlessly in Linux except for missing mixer support:
for people having subscribe later or deleted the last messages, you can find Felix’s message in the archive [1]. I could not download the attachment though, so please try [2] instead.
Am 06.07.2010 10:05, schrieb Felix Homann:
This fixes issues with M-Audio's Fast Track Ultra series:
- devices now work at 44100 and 88200 Hz
- apparently, fixes some crashes, too
Unfortunately, the patch didn't make it into Alsa so far. Clemens Ladisch seemed reluctant to apply a fixed endpoint quirk since the device should have worked without in his opinion. I gave him all the requested information to see what was happening without the fixed endpoint quirk. I never heard back from him again.
So, could someone in charge kindly tell me why the patch didn't make it into Alsa? What's missing, what's wrong?
If it's just the fact that Clemens doesn't like the fixed endpoint quirk please find attached a different patch yielding the same result. (Against Linux 2.6.35. It's again from dhubsith who posted it on the M-Audio forum.
Could you include the link to the forum post.
He would sign it off if requested - on the other hand it is already derived work of the Alsa sources).
I guess his signed-off-by line additionally to yours (Tested-by: is also good) would not hurt.
And please, if it's not going anywhere, please tell us "laymen, volunteer Alsa helpers" about the reasons.
The current situation is most frustrating: We know how to make the device work (much better than in Windows, btw) but we don't know why we have to patch alsa again and again.
Sorry, unfortunately I cannot tell you why your work has not been committed yet and I do understand your frustration. The reasons might be simple, that the developers were caught up by different things and your patch just fall through the cracks. So it is a good thing, that you come back and ask for the status.
So to ease work for the developers, could you please resend your patch. Do you know if it can be split up, so that the controversial parts can be left out at first?
Please use `git format-patch` with
1. a short commit summary line, 2. links to the respective Web pages where this patch was discussed.
You can just copy the lines from the resulting file into a normal message (delete the header fields and copy the subject manually marking it with [RESENT]). Just make sure the lines do not get wrapped.
Then make sure to CC the maintainers (I think Clemens, Takashi, Jaroslav) too so that they do not miss it.
I hope your patch will be included soon afterward.
Thanks and good luck,
Paul
[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2010-July/thread.html#2... [2] http://www.spinics.net/lists/alsa-devel/msg35372.html
Hi,
This is my second try to get support for all supported sample rates for the Fast Track Ultra (FTU) series into mainline alsa.
For clarification: Current Alsa already recognizes the supported sample rates. But it will sound very corrupted at 44.1000 Hz and 88.200 Hz. Without this patch your system will even probably freeze eventually when using the FTU at 44.100/88.200 Hz too long.
So the key idea in this patch is not to get 44.1 kHz and 88.2 kHz listed as supported sample rates (as they already are recognized) but to change the endpoint attributes.
Citing dhubsith on the M-Audio forum:
" The problem with using QUIRK_AUDIO_STANDARD_INTERFACE rather than QUIRK_AUDIO_FIXED_ENDPOINT is that ep_attr does not get set correctly. The device default for synchronization is async (0x05) for both capture and playback, but in fact it should be set to adaptive (0x09) on playback, so that playback follows capture, this way you don't get capture and playback using different sample rates.
Also, the Interface Class protocol for the device defaults to Vendor Specific Class, but the driver only recognizes Class 1 or 2. The device is really Class 1, so we have to force it to reflect this. There are 4 places that we need to set this."
The patch has been discussed starting here:
http://forums.m-audio.com/showthread.php?714-Not-a-problem.-FastTrack-on-lin...
The "key" has been found by dhubsith. Please read posts #79, #81, #84, #87, #97.
In post #102 of that forum you can even find an alternate patch by dhubsith which doesn't use a fixed endpoint quirk but sets
protocol = UAC_VERSION_1;
for the FTU devices in sound/usb/format .c. You might even consider that patch. (I've resend it to alsa-devel yesterday).
After all, either one of the above mentioned patches should go into alsa, as right now we can't use the FTU devices at 44.1 and 88.2 kHz.
Kind regards,
Felix
At Wed, 01 Sep 2010 10:48:54 +0200, Felix Homann wrote:
Hi,
This is my second try to get support for all supported sample rates for the Fast Track Ultra (FTU) series into mainline alsa.
For clarification: Current Alsa already recognizes the supported sample rates. But it will sound very corrupted at 44.1000 Hz and 88.200 Hz. Without this patch your system will even probably freeze eventually when using the FTU at 44.100/88.200 Hz too long.
So the key idea in this patch is not to get 44.1 kHz and 88.2 kHz listed as supported sample rates (as they already are recognized) but to change the endpoint attributes.
Citing dhubsith on the M-Audio forum:
" The problem with using QUIRK_AUDIO_STANDARD_INTERFACE rather than QUIRK_AUDIO_FIXED_ENDPOINT is that ep_attr does not get set correctly. The device default for synchronization is async (0x05) for both capture and playback, but in fact it should be set to adaptive (0x09) on playback, so that playback follows capture, this way you don't get capture and playback using different sample rates.
Also, the Interface Class protocol for the device defaults to Vendor Specific Class, but the driver only recognizes Class 1 or 2. The device is really Class 1, so we have to force it to reflect this. There are 4 places that we need to set this."
The patch has been discussed starting here:
http://forums.m-audio.com/showthread.php?714-Not-a-problem.-FastTrack-on-lin...
The "key" has been found by dhubsith. Please read posts #79, #81, #84, #87, #97.
In post #102 of that forum you can even find an alternate patch by dhubsith which doesn't use a fixed endpoint quirk but sets
protocol = UAC_VERSION_1;
for the FTU devices in sound/usb/format .c. You might even consider that patch. (I've resend it to alsa-devel yesterday).
After all, either one of the above mentioned patches should go into alsa, as right now we can't use the FTU devices at 44.1 and 88.2 kHz.
Thanks for the patch (and reposting it).
I myself find it's OK to apply since it's pretty local change. Clemens, what was your objection at that time?
thanks,
Takashi
Kind regards,
Felix
[2 0001-fix-sample-rates-ftu-v3.patch <text/x-patch (7bit)>]
From 1573e7e973e6adcfe39fbfdaae0be2d1a5e01501 Mon Sep 17 00:00:00 2001
From: Felix Homann fexpop@web.de Date: Wed, 7 Jul 2010 15:51:58 +0200 Subject: [PATCH - Fix Fast Track Ultra series 1/1] Fix 44.1/88.1 kHz 1/Fix playback/capture issues and related chrashes at 44100 Hz and 88200 Hz for M-Audio Fast Track Ultra series.
Signed-off-by: Felix Homann fexpop@web.de
diff --git a/usb/endpoint.c b/usb/endpoint.c index 1a701f1..bb9f938 100644 --- a/usb/endpoint.c +++ b/usb/endpoint.c @@ -404,8 +404,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) break; case USB_ID(0x041e, 0x3020): /* Creative SB Audigy 2 NX */ case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */
case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra 8 */
case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ /* doesn't set the sample rate attribute, but supports it */ fp->attributes |= UAC_EP_CS_ATTR_SAMPLE_RATE; break;
diff --git a/usb/quirks-table.h b/usb/quirks-table.h index f8797f6..4c1dc12 100644 --- a/usb/quirks-table.h +++ b/usb/quirks-table.h @@ -1827,10 +1827,10 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, {
- USB_DEVICE(0x0763, 0x2080),
- .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
USB_DEVICE(0x0763, 0x2080),
/* .vendor_name = "M-Audio", */.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
/* .product_name = "Fast Track Ultra 8", */
.ifnum = QUIRK_ANY_INTERFACE, .type = QUIRK_COMPOSITE, .data = & (const struct snd_usb_audio_quirk[]) {/* .product_name = "Fast Track Ultra", */
@@ -1840,11 +1840,51 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { .ifnum = 1,
.type = QUIRK_AUDIO_STANDARD_INTERFACE
.type = QUIRK_AUDIO_FIXED_ENDPOINT,
.data = & (const struct audioformat) {
.formats = SNDRV_PCM_FMTBIT_S24_3LE,
.channels = 8,
.iface = 1,
.altsetting = 1,
.altset_idx = 1,
.attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
.endpoint = 0x01,
.ep_attr = 0x09,
.rates = SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000,
.rate_min = 44100,
.rate_max = 96000,
.nr_rates = 4,
.rate_table = (unsigned int[]) {
44100, 48000, 88200, 96000
}
} }, { .ifnum = 2,
.type = QUIRK_AUDIO_STANDARD_INTERFACE
.type = QUIRK_AUDIO_FIXED_ENDPOINT,
.data = & (const struct audioformat) {
.formats = SNDRV_PCM_FMTBIT_S24_3LE,
.channels = 8,
.iface = 2,
.altsetting = 1,
.altset_idx = 1,
.attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
.endpoint = 0x81,
.ep_attr = 0x05,
.rates = SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000,
.rate_min = 44100,
.rate_max = 96000,
.nr_rates = 4,
.rate_table = (unsigned int[]) {
44100, 48000, 88200, 96000
}
} }, /* interface 3 (MIDI) is standard compliant */ {
@@ -1855,7 +1895,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { USB_DEVICE(0x0763, 0x2081),
- .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
/* .vendor_name = "M-Audio", */ /* .product_name = "Fast Track Ultra 8R", */ .ifnum = QUIRK_ANY_INTERFACE,.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
@@ -1867,11 +1907,51 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { .ifnum = 1,
.type = QUIRK_AUDIO_STANDARD_INTERFACE
.type = QUIRK_AUDIO_FIXED_ENDPOINT,
.data = & (const struct audioformat) {
.formats = SNDRV_PCM_FMTBIT_S24_3LE,
.channels = 8,
.iface = 1,
.altsetting = 1,
.altset_idx = 1,
.attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
.endpoint = 0x01,
.ep_attr = 0x09,
.rates = SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000,
.rate_min = 44100,
.rate_max = 96000,
.nr_rates = 4,
.rate_table = (unsigned int[]) {
44100, 48000, 88200, 96000
}
} }, { .ifnum = 2,
.type = QUIRK_AUDIO_STANDARD_INTERFACE
.type = QUIRK_AUDIO_FIXED_ENDPOINT,
.data = & (const struct audioformat) {
.formats = SNDRV_PCM_FMTBIT_S24_3LE,
.channels = 8,
.iface = 2,
.altsetting = 1,
.altset_idx = 1,
.attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
.endpoint = 0x81,
.ep_attr = 0x05,
.rates = SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 |
SNDRV_PCM_RATE_96000,
.rate_min = 44100,
.rate_max = 96000,
.nr_rates = 4,
.rate_table = (unsigned int[]) {
44100, 48000, 88200, 96000
}
} }, /* interface 3 (MIDI) is standard compliant */ {
-- 1.7.1
Takashi Iwai wrote:
I myself find it's OK to apply since it's pretty local change. Clemens, what was your objection at that time?
No objection per se, I wanted to find out what descriptor field is changed by the quirk, and where the crashes come from exactly. The latter is still unclear, but it seems a quirk like this is required.
I've committed the patch now.
Also, the Interface Class protocol for the device defaults to Vendor Specific Class, but the driver only recognizes Class 1 or 2. The device is really Class 1, so we have to force it to reflect this. There are 4 places that we need to set this."
Daniel, this seems to be a regression introduced with the UAC2 changes. The old driver accepted vendor-specific interfaces, if some quirk forced it to look at them.
Regards, Clemens
On Thu, Sep 02, 2010 at 11:12:59AM +0200, Clemens Ladisch wrote:
Takashi Iwai wrote:
I myself find it's OK to apply since it's pretty local change. Clemens, what was your objection at that time?
No objection per se, I wanted to find out what descriptor field is changed by the quirk, and where the crashes come from exactly. The latter is still unclear, but it seems a quirk like this is required.
I've committed the patch now.
Also, the Interface Class protocol for the device defaults to Vendor Specific Class, but the driver only recognizes Class 1 or 2. The device is really Class 1, so we have to force it to reflect this. There are 4 places that we need to set this."
Daniel, this seems to be a regression introduced with the UAC2 changes. The old driver accepted vendor-specific interfaces, if some quirk forced it to look at them.
Hmm, I don't follow. What's the problem, and why should that be caused by the UAC2 changes? Sorry, but I seem to have missed that thread.
Thanks, Daniel
Daniel Mack wrote:
On Thu, Sep 02, 2010 at 11:12:59AM +0200, Clemens Ladisch wrote:
Also, the Interface Class protocol for the device defaults to Vendor Specific Class, but the driver only recognizes Class 1 or 2. The device is really Class 1, so we have to force it to reflect this. There are 4 places that we need to set this."
Daniel, this seems to be a regression introduced with the UAC2 changes. The old driver accepted vendor-specific interfaces, if some quirk forced it to look at them.
Hmm, I don't follow. What's the problem, and why should that be caused by the UAC2 changes? Sorry, but I seem to have missed that thread.
I've got several reports that devices no longer work since UAC2 support got added. But I've just noticed this is not related to the interface class but to the interface protocol: the new code added checks for UAC_VERSION_1 or _2, but real devices apparently write just random junk into this field. (For vendor-specific interfaces, they are actually justified to do so.)
We need something like the following (untested), unless you have a better idea:
diff --git a/sound/usb/card.c b/sound/usb/card.c index 9feb00c..d5141a1 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -216,6 +216,10 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) }
switch (protocol) { + default: + snd_printdd(KERN_WARN "unknown interface protocol %#02x, assuming v1\n"); + /* fall through */ + case UAC_VERSION_1: { struct uac1_ac_header_descriptor *h1 = control_header;
@@ -253,10 +257,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
break; } - - default: - snd_printk(KERN_ERR "unknown protocol version 0x%02x\n", protocol); - return -EINVAL; }
return 0; diff --git a/sound/usb/clock.c b/sound/usb/clock.c index b853f8d..7754a10 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -295,12 +295,11 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
switch (altsd->bInterfaceProtocol) { case UAC_VERSION_1: + default: return set_sample_rate_v1(chip, iface, alts, fmt, rate);
case UAC_VERSION_2: return set_sample_rate_v2(chip, iface, alts, fmt, rate); } - - return -EINVAL; }
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index bb9f938..22589b5 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -275,6 +275,12 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
/* get audio formats */ switch (protocol) { + default: + snd_printdd(KERN_WARN "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n", + dev->devnum, iface_no, altno, protocol); + protocol = UAC_VERSION_1; + /* fall through */ + case UAC_VERSION_1: { struct uac1_as_header_descriptor *as = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); @@ -336,11 +342,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) dev->devnum, iface_no, altno, as->bTerminalLink); continue; } - - default: - snd_printk(KERN_ERR "%d:%u:%d : unknown interface protocol %04x\n", - dev->devnum, iface_no, altno, protocol); - continue; }
/* get format type */ diff --git a/sound/usb/format.c b/sound/usb/format.c index 4387f54..2ec73dd 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -49,7 +49,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, u64 pcm_formats;
switch (protocol) { - case UAC_VERSION_1: { + case UAC_VERSION_1: + default: { struct uac_format_type_i_discrete_descriptor *fmt = _fmt; sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubframeSize; @@ -64,9 +65,6 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, format <<= 1; break; } - - default: - return -EINVAL; }
pcm_formats = 0; @@ -385,6 +383,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, */ switch (protocol) { case UAC_VERSION_1: + default: fp->channels = fmt->bNrChannels; ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); break; @@ -434,7 +433,8 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, fp->channels = 1;
switch (protocol) { - case UAC_VERSION_1: { + case UAC_VERSION_1: + default: { struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; brate = le16_to_cpu(fmt->wMaxBitRate); framesize = le16_to_cpu(fmt->wSamplesPerFrame); diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index c166db0..0478fa3 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -365,7 +365,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) { - return (cval->mixer->protocol == UAC_VERSION_1) ? + return (cval->mixer->protocol != UAC_VERSION_2) ? get_ctl_value_v1(cval, request, validx, value_ret) : get_ctl_value_v2(cval, request, validx, value_ret); } @@ -415,7 +415,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, unsigned char buf[2]; int val_len, timeout = 10;
- if (cval->mixer->protocol == UAC_VERSION_1) { + if (cval->mixer->protocol != UAC_VERSION_2) { val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; } else { /* UAC_VERSION_2 */ /* audio class v2 controls are always 2 bytes in size */ @@ -642,7 +642,7 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ term->id = id; switch (hdr[2]) { case UAC_INPUT_TERMINAL: - if (state->mixer->protocol == UAC_VERSION_1) { + if (state->mixer->protocol != UAC_VERSION_2) { struct uac_input_terminal_descriptor *d = p1; term->type = le16_to_cpu(d->wTerminalType); term->channels = d->bNrChannels; @@ -1159,7 +1159,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void struct uac_feature_unit_descriptor *hdr = _ftr; __u8 *bmaControls;
- if (state->mixer->protocol == UAC_VERSION_1) { + if (state->mixer->protocol != UAC_VERSION_2) { csize = hdr->bControlSize; channels = (hdr->bLength - 7) / csize - 1; bmaControls = hdr->bmaControls; @@ -1198,7 +1198,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void else first_ch_bits = 0;
- if (state->mixer->protocol == UAC_VERSION_1) { + if (state->mixer->protocol != UAC_VERSION_2) { /* check all control types */ for (i = 0; i < 10; i++) { unsigned int ch_bits = 0; @@ -1865,13 +1865,13 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) return parse_audio_feature_unit(state, unitid, p1); case UAC1_PROCESSING_UNIT: /* UAC2_EFFECT_UNIT has the same value */ - if (state->mixer->protocol == UAC_VERSION_1) + if (state->mixer->protocol != UAC_VERSION_2) return parse_audio_processing_unit(state, unitid, p1); else return 0; /* FIXME - effect units not implemented yet */ case UAC1_EXTENSION_UNIT: /* UAC2_PROCESSING_UNIT_V2 has the same value */ - if (state->mixer->protocol == UAC_VERSION_1) + if (state->mixer->protocol != UAC_VERSION_2) return parse_audio_extension_unit(state, unitid, p1); else /* UAC_VERSION_2 */ return parse_audio_processing_unit(state, unitid, p1); @@ -1932,7 +1932,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
p = NULL; while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) { - if (mixer->protocol == UAC_VERSION_1) { + if (mixer->protocol != UAC_VERSION_2) { struct uac1_output_terminal_descriptor *desc = p;
if (desc->bLength < sizeof(*desc)) @@ -2070,7 +2070,7 @@ static void snd_usb_mixer_interrupt(struct urb *urb) if (urb->status != 0) goto requeue;
- if (mixer->protocol == UAC_VERSION_1) { + if (mixer->protocol != UAC_VERSION_2) { struct uac1_status_word *status;
for (status = urb->transfer_buffer; diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 3634ced..3b5135c 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -173,13 +173,12 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
switch (altsd->bInterfaceProtocol) { case UAC_VERSION_1: + default: return init_pitch_v1(chip, iface, alts, fmt);
case UAC_VERSION_2: return init_pitch_v2(chip, iface, alts, fmt); } - - return -EINVAL; }
/*
On Thu, Sep 02, 2010 at 01:13:48PM +0200, Clemens Ladisch wrote:
Daniel Mack wrote:
On Thu, Sep 02, 2010 at 11:12:59AM +0200, Clemens Ladisch wrote:
Also, the Interface Class protocol for the device defaults to Vendor Specific Class, but the driver only recognizes Class 1 or 2. The device is really Class 1, so we have to force it to reflect this. There are 4 places that we need to set this."
Daniel, this seems to be a regression introduced with the UAC2 changes. The old driver accepted vendor-specific interfaces, if some quirk forced it to look at them.
Hmm, I don't follow. What's the problem, and why should that be caused by the UAC2 changes? Sorry, but I seem to have missed that thread.
I've got several reports that devices no longer work since UAC2 support got added. But I've just noticed this is not related to the interface class but to the interface protocol: the new code added checks for UAC_VERSION_1 or _2, but real devices apparently write just random junk into this field. (For vendor-specific interfaces, they are actually justified to do so.)
Grr. So what about cases where this "random junk" is 0x20 by coincidence?
We need something like the following (untested), unless you have a better idea:
We could also fix up such devices with quirks tables, but your approach is probably better as it catches all devices right away.
Thanks, Daniel
diff --git a/sound/usb/card.c b/sound/usb/card.c index 9feb00c..d5141a1 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -216,6 +216,10 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) }
switch (protocol) {
- default:
snd_printdd(KERN_WARN "unknown interface protocol %#02x, assuming v1\n");
/* fall through */
- case UAC_VERSION_1: { struct uac1_ac_header_descriptor *h1 = control_header;
@@ -253,10 +257,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
break;
}
default:
snd_printk(KERN_ERR "unknown protocol version 0x%02x\n", protocol);
return -EINVAL;
}
return 0;
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index b853f8d..7754a10 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -295,12 +295,11 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
switch (altsd->bInterfaceProtocol) { case UAC_VERSION_1:
default: return set_sample_rate_v1(chip, iface, alts, fmt, rate);
case UAC_VERSION_2: return set_sample_rate_v2(chip, iface, alts, fmt, rate); }
- return -EINVAL;
}
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index bb9f938..22589b5 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -275,6 +275,12 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
/* get audio formats */ switch (protocol) {
default:
snd_printdd(KERN_WARN "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n",
dev->devnum, iface_no, altno, protocol);
protocol = UAC_VERSION_1;
/* fall through */
- case UAC_VERSION_1: { struct uac1_as_header_descriptor *as = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
@@ -336,11 +342,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) dev->devnum, iface_no, altno, as->bTerminalLink); continue; }
default:
snd_printk(KERN_ERR "%d:%u:%d : unknown interface protocol %04x\n",
dev->devnum, iface_no, altno, protocol);
continue;
}
/* get format type */
diff --git a/sound/usb/format.c b/sound/usb/format.c index 4387f54..2ec73dd 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -49,7 +49,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, u64 pcm_formats;
switch (protocol) {
- case UAC_VERSION_1: {
- case UAC_VERSION_1:
- default: { struct uac_format_type_i_discrete_descriptor *fmt = _fmt; sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubframeSize;
@@ -64,9 +65,6 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, format <<= 1; break; }
default:
return -EINVAL;
}
pcm_formats = 0;
@@ -385,6 +383,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, */ switch (protocol) { case UAC_VERSION_1:
- default: fp->channels = fmt->bNrChannels; ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); break;
@@ -434,7 +433,8 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, fp->channels = 1;
switch (protocol) {
- case UAC_VERSION_1: {
- case UAC_VERSION_1:
- default: { struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; brate = le16_to_cpu(fmt->wMaxBitRate); framesize = le16_to_cpu(fmt->wSamplesPerFrame);
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index c166db0..0478fa3 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -365,7 +365,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) {
- return (cval->mixer->protocol == UAC_VERSION_1) ?
- return (cval->mixer->protocol != UAC_VERSION_2) ? get_ctl_value_v1(cval, request, validx, value_ret) : get_ctl_value_v2(cval, request, validx, value_ret);
} @@ -415,7 +415,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, unsigned char buf[2]; int val_len, timeout = 10;
- if (cval->mixer->protocol == UAC_VERSION_1) {
- if (cval->mixer->protocol != UAC_VERSION_2) { val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; } else { /* UAC_VERSION_2 */ /* audio class v2 controls are always 2 bytes in size */
@@ -642,7 +642,7 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ term->id = id; switch (hdr[2]) { case UAC_INPUT_TERMINAL:
if (state->mixer->protocol == UAC_VERSION_1) {
if (state->mixer->protocol != UAC_VERSION_2) { struct uac_input_terminal_descriptor *d = p1; term->type = le16_to_cpu(d->wTerminalType); term->channels = d->bNrChannels;
@@ -1159,7 +1159,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void struct uac_feature_unit_descriptor *hdr = _ftr; __u8 *bmaControls;
- if (state->mixer->protocol == UAC_VERSION_1) {
- if (state->mixer->protocol != UAC_VERSION_2) { csize = hdr->bControlSize; channels = (hdr->bLength - 7) / csize - 1; bmaControls = hdr->bmaControls;
@@ -1198,7 +1198,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void else first_ch_bits = 0;
- if (state->mixer->protocol == UAC_VERSION_1) {
- if (state->mixer->protocol != UAC_VERSION_2) { /* check all control types */ for (i = 0; i < 10; i++) { unsigned int ch_bits = 0;
@@ -1865,13 +1865,13 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) return parse_audio_feature_unit(state, unitid, p1); case UAC1_PROCESSING_UNIT: /* UAC2_EFFECT_UNIT has the same value */
if (state->mixer->protocol == UAC_VERSION_1)
else return 0; /* FIXME - effect units not implemented yet */ case UAC1_EXTENSION_UNIT: /* UAC2_PROCESSING_UNIT_V2 has the same value */if (state->mixer->protocol != UAC_VERSION_2) return parse_audio_processing_unit(state, unitid, p1);
if (state->mixer->protocol == UAC_VERSION_1)
else /* UAC_VERSION_2 */ return parse_audio_processing_unit(state, unitid, p1);if (state->mixer->protocol != UAC_VERSION_2) return parse_audio_extension_unit(state, unitid, p1);
@@ -1932,7 +1932,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
p = NULL; while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) {
if (mixer->protocol == UAC_VERSION_1) {
if (mixer->protocol != UAC_VERSION_2) { struct uac1_output_terminal_descriptor *desc = p; if (desc->bLength < sizeof(*desc))
@@ -2070,7 +2070,7 @@ static void snd_usb_mixer_interrupt(struct urb *urb) if (urb->status != 0) goto requeue;
- if (mixer->protocol == UAC_VERSION_1) {
if (mixer->protocol != UAC_VERSION_2) { struct uac1_status_word *status;
for (status = urb->transfer_buffer;
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 3634ced..3b5135c 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -173,13 +173,12 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
switch (altsd->bInterfaceProtocol) { case UAC_VERSION_1:
default: return init_pitch_v1(chip, iface, alts, fmt);
case UAC_VERSION_2: return init_pitch_v2(chip, iface, alts, fmt); }
- return -EINVAL;
}
/*
Daniel Mack wrote:
On Thu, Sep 02, 2010 at 01:13:48PM +0200, Clemens Ladisch wrote:
I've got several reports that devices no longer work since UAC2 support got added. But I've just noticed this is not related to the interface class but to the interface protocol: the new code added checks for UAC_VERSION_1 or _2, but real devices apparently write just random junk into this field. (For vendor-specific interfaces, they are actually justified to do so.)
Grr. So what about cases where this "random junk" is 0x20 by coincidence?
Actually, it isn't too random: I've seen 0xff (obviously "vendor- specific") and 0x01/0x02 (interface subclass moved to protocol).
Regards, Clemens
Am 02.09.2010 11:12, schrieb Clemens Ladisch:
I've committed the patch now.
Thank you and Takashi!
Regards,
Felix
participants (5)
-
Clemens Ladisch
-
Daniel Mack
-
Felix Homann
-
Paul Menzel
-
Takashi Iwai