diff mbox

ALSA: usb-audio: Add a quirk for Nura's first gen headset

Message ID 20180114160553.15445-1-martin.peres@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Peres Jan. 14, 2018, 4:05 p.m. UTC
The capture interface does not work, and the playback interface
actually supports only 48kHz unlike what is advertised (44.1, 32, 22,
16, 8).

The only unknown here is if there are other devices that use the same
product ID, but given that this ID is currently unknown, I would assume
it is specially allocated for the nura headset.

Signed-off-by: Martin Peres <martin.peres@free.fr>
---
 sound/usb/quirks-table.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comments

Takashi Iwai Jan. 15, 2018, 1:15 p.m. UTC | #1
On Sun, 14 Jan 2018 17:05:53 +0100,
Martin Peres wrote:
> 
> The capture interface does not work, and the playback interface
> actually supports only 48kHz unlike what is advertised (44.1, 32, 22,
> 16, 8).
> 
> The only unknown here is if there are other devices that use the same
> product ID, but given that this ID is currently unknown, I would assume
> it is specially allocated for the nura headset.
> 
> Signed-off-by: Martin Peres <martin.peres@free.fr>

Applied, thanks.


Takashi

> ---
>  sound/usb/quirks-table.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
> index 8a59d4782a0f..50252046b01d 100644
> --- a/sound/usb/quirks-table.h
> +++ b/sound/usb/quirks-table.h
> @@ -3277,4 +3277,52 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
>  	}
>  },
>  
> +{
> +	/*
> +	 * Nura's first gen headphones use Cambridge Silicon Radio's vendor
> +	 * ID, but it looks like the product ID actually is only for Nura.
> +	 * The capture interface does not work at all (even on Windows),
> +	 * and only the 48 kHz sample rate works for the playback interface.
> +	 */
> +	USB_DEVICE(0x0a12, 0x1243),
> +	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
> +		.ifnum = QUIRK_ANY_INTERFACE,
> +		.type = QUIRK_COMPOSITE,
> +		.data = (const struct snd_usb_audio_quirk[]) {
> +			{
> +				.ifnum = 0,
> +				.type = QUIRK_AUDIO_STANDARD_MIXER,
> +			},
> +			/* Capture */
> +			{
> +				.ifnum = 1,
> +				.type = QUIRK_IGNORE_INTERFACE,
> +			},
> +			/* Playback */
> +			{
> +				.ifnum = 2,
> +				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
> +				.data = &(const struct audioformat) {
> +					.formats = SNDRV_PCM_FMTBIT_S16_LE,
> +					.channels = 2,
> +					.iface = 2,
> +					.altsetting = 1,
> +					.altset_idx = 1,
> +					.attributes = UAC_EP_CS_ATTR_FILL_MAX |
> +						UAC_EP_CS_ATTR_SAMPLE_RATE,
> +					.endpoint = 0x03,
> +					.ep_attr = USB_ENDPOINT_XFER_ISOC,
> +					.rates = SNDRV_PCM_RATE_48000,
> +					.rate_min = 48000,
> +					.rate_max = 48000,
> +					.nr_rates = 1,
> +					.rate_table = (unsigned int[]) {
> +						48000
> +					}
> +				}
> +			},
> +		}
> +	}
> +},
> +
>  #undef USB_DEVICE_VENDOR_SPEC
> -- 
> 2.15.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Martin Peres Jan. 16, 2018, 8:58 a.m. UTC | #2
On 14/01/18 18:05, Martin Peres wrote:
> The capture interface does not work, and the playback interface
> actually supports only 48kHz unlike what is advertised (44.1, 32, 22,
> 16, 8).
> 
> The only unknown here is if there are other devices that use the same
> product ID, but given that this ID is currently unknown, I would assume
> it is specially allocated for the nura headset.
> 
> Signed-off-by: Martin Peres <martin.peres@free.fr>

Cc: Stable <stable@vger.kernel.org>

Is there anything else I need to do? Get more testers maybe? I have
reported bugs here before (and had a nice interaction with Takashi Iwai)
but this is my first patch to this subsystem (I am an Intel/Nouveau/DRM
developer).

For more information on how I got to this patch:
http://www.mupuf.org/blog/2018/01/14/nura-headphones-on-linux/

> ---
>  sound/usb/quirks-table.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
> index 8a59d4782a0f..50252046b01d 100644
> --- a/sound/usb/quirks-table.h
> +++ b/sound/usb/quirks-table.h
> @@ -3277,4 +3277,52 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
>  	}
>  },
>  
> +{
> +	/*
> +	 * Nura's first gen headphones use Cambridge Silicon Radio's vendor
> +	 * ID, but it looks like the product ID actually is only for Nura.
> +	 * The capture interface does not work at all (even on Windows),
> +	 * and only the 48 kHz sample rate works for the playback interface.
> +	 */
> +	USB_DEVICE(0x0a12, 0x1243),
> +	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
> +		.ifnum = QUIRK_ANY_INTERFACE,
> +		.type = QUIRK_COMPOSITE,
> +		.data = (const struct snd_usb_audio_quirk[]) {
> +			{
> +				.ifnum = 0,
> +				.type = QUIRK_AUDIO_STANDARD_MIXER,
> +			},
> +			/* Capture */
> +			{
> +				.ifnum = 1,
> +				.type = QUIRK_IGNORE_INTERFACE,
> +			},
> +			/* Playback */
> +			{
> +				.ifnum = 2,
> +				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
> +				.data = &(const struct audioformat) {
> +					.formats = SNDRV_PCM_FMTBIT_S16_LE,
> +					.channels = 2,
> +					.iface = 2,
> +					.altsetting = 1,
> +					.altset_idx = 1,
> +					.attributes = UAC_EP_CS_ATTR_FILL_MAX |
> +						UAC_EP_CS_ATTR_SAMPLE_RATE,
> +					.endpoint = 0x03,
> +					.ep_attr = USB_ENDPOINT_XFER_ISOC,
> +					.rates = SNDRV_PCM_RATE_48000,
> +					.rate_min = 48000,
> +					.rate_max = 48000,
> +					.nr_rates = 1,
> +					.rate_table = (unsigned int[]) {
> +						48000
> +					}
> +				}
> +			},
> +		}
> +	}
> +},
> +
>  #undef USB_DEVICE_VENDOR_SPEC
>
Martin Peres Jan. 16, 2018, 1:59 p.m. UTC | #3
On 15/01/18 15:15, Takashi Iwai wrote:
> On Sun, 14 Jan 2018 17:05:53 +0100,
> Martin Peres wrote:
>>
>> The capture interface does not work, and the playback interface
>> actually supports only 48kHz unlike what is advertised (44.1, 32, 22,
>> 16, 8).
>>
>> The only unknown here is if there are other devices that use the same
>> product ID, but given that this ID is currently unknown, I would assume
>> it is specially allocated for the nura headset.
>>
>> Signed-off-by: Martin Peres <martin.peres@free.fr>
> 
> Applied, thanks.

Thanks!

Sorry for the second email I sent. I recently switched to another email
sorter, and I redirected the alsa emails to the wrong folder, so I did
not see this email.

Anyway, a colleague has the same problem with his headset, so I guess
he'll be sending a similar patch soon. Maybe pulseaudio should just use
the default sampling rate of USB interfaces if they are all garbage.

Cheers,
Martin
diff mbox

Patch

diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 8a59d4782a0f..50252046b01d 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -3277,4 +3277,52 @@  AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
 	}
 },
 
+{
+	/*
+	 * Nura's first gen headphones use Cambridge Silicon Radio's vendor
+	 * ID, but it looks like the product ID actually is only for Nura.
+	 * The capture interface does not work at all (even on Windows),
+	 * and only the 48 kHz sample rate works for the playback interface.
+	 */
+	USB_DEVICE(0x0a12, 0x1243),
+	.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = (const struct snd_usb_audio_quirk[]) {
+			{
+				.ifnum = 0,
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
+			},
+			/* Capture */
+			{
+				.ifnum = 1,
+				.type = QUIRK_IGNORE_INTERFACE,
+			},
+			/* Playback */
+			{
+				.ifnum = 2,
+				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
+				.data = &(const struct audioformat) {
+					.formats = SNDRV_PCM_FMTBIT_S16_LE,
+					.channels = 2,
+					.iface = 2,
+					.altsetting = 1,
+					.altset_idx = 1,
+					.attributes = UAC_EP_CS_ATTR_FILL_MAX |
+						UAC_EP_CS_ATTR_SAMPLE_RATE,
+					.endpoint = 0x03,
+					.ep_attr = USB_ENDPOINT_XFER_ISOC,
+					.rates = SNDRV_PCM_RATE_48000,
+					.rate_min = 48000,
+					.rate_max = 48000,
+					.nr_rates = 1,
+					.rate_table = (unsigned int[]) {
+						48000
+					}
+				}
+			},
+		}
+	}
+},
+
 #undef USB_DEVICE_VENDOR_SPEC