ALSA: usb-audio: Fake also USB device id when alias is given
PATCH 1/1 ALSA: usb-audio: Fake also USB device id when alias is given
Recently snd-usb-audio driver received a new option, quirk_alias, to allow user to apply the existing quirk for a different device. This works for many quirks as is, but some still need more tune-ups:
namely, some quirks check the USB vendor/device IDs in various places, thus it doesn't work as long as the ID is different from the expected one.
With this patch, the driver stores the aliased USB ID, so that these rest quirks per device ID are applied. The transition to use the cached USB ID was already done in the past, so what we needed now is only to overwrite chip->usb_id.
--- sound/usb/card.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/usb/card.c +3 -3
@@ -332,6 +332,7 @@ static int snd_usb_audio_dev_free(struct snd_device *device)static int snd_usb_audio_create (struct usb_interface *intf,struct usb_device *dev,int idx,const struct snd_usb_audio_quirk *quirk, +unsigned int usb_id,struct snd_usb_audio **rchip) {struct snd_card *card;
@@ -381,8 +382,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,atomic_set (&chip->usage_count,0 );atomic_set (&chip->shutdown,0 ); - chip->usb_id =USB_ID (le16_to_cpu (dev->descriptor.idVendor), -le16_to_cpu (dev->descriptor.idProduct)); + chip->usb_id = usb_id;INIT_LIST_HEAD (&chip->pcm_list);INIT_LIST_HEAD (&chip->ep_list);INIT_LIST_HEAD (&chip->midi_list);
@@ -569,7 +569,7 @@ static int usb_audio_probe(struct usb_interface *intf, (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) { err =snd_usb_audio_create (intf, dev, i, quirk, - &chip); + id, &chip);if (err <0 ) goto __error; chip->pm_intf = intf;
Signature · 1 line
2.11.1
Hi Takashi,
Quoted 8 lines · Takashi Iwai
Recently snd-usb-audio driver received a new option,
quirk_alias, to allow user to apply the existing quirk for a different device. This works for many quirks as is, but some still need more tune-ups:
namely, some quirks check the USB vendor/device IDs in various places,
thus it doesn't work as long as the ID is different from the expected one.
Quoted 5 lines
With this patch, the driver stores the aliased USB ID, so that these rest quirks per device ID are applied. The transition to use the cached USB ID was already done in the past, so what we needed now is only to overwrite
chip->usb_id.
Sounds interesting. Would this work forsnd_usb_interface_dsd_format_quirks() ?
Regards,
Jurgen
Quoted 41 lines
Signed-off-by Takashi Iwai <[email protected]>---
sound/usb/card.c | 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)sound/usb/card.c +0
-0@@ -332,6 +332,7 @@ static int snd_usb_audio_dev_free(struct snd_device *device) static int snd_usb_audio_create(struct usb_interface *intf, struct usb_device *dev, int idx,const struct
snd_usb_audio_quirk*quirk,sound/usb/card.c +1
-0+ unsigned int usb_id,struct
snd_usb_audio**rchip) {
structsnd_card*card;sound/usb/card.c +0
-0@@ -381,8 +382,7 @@ static int snd_usb_audio_create(structusb_interface *intf, atomic_set(&chip->usage_count, 0); atomic_set(&chip->shutdown, 0);sound/usb/card.c +0
-2- chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), - le16_to_cpu(dev-Quoted 1 line
descriptor.idProduct));
sound/usb/card.c +1
-0+ chip->usb_id = usb_id;
INIT_LIST_HEAD(&chip->pcm_list);
INIT_LIST_HEAD(&chip->ep_list);
INIT_LIST_HEAD(&chip->midi_list);sound/usb/card.c +0
-0@@ -569,7 +569,7 @@ static int usb_audio_probe(struct usb_interface *intf,(vid[i] == -1 || vid[i] ==
USB_ID_VENDOR(id)) &&
(pid[i] == -1 || pid[i] ==USB_ID_PRODUCT(id))) {
err = snd_usb_audio_create(intf, dev, i, quirk,sound/usb/card.c +1
-1- &chip); + id,
Quoted 4 lines
&chip);
if (err < 0) goto__error;chip->pm_intf= intf;
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 12 lines · Jurgen Kramer
Hi Takashi,
Quoted 8 lines · Takashi Iwai
Recently snd-usb-audio driver received a new option,
quirk_alias, to allow user to apply the existing quirk for a different device. This works for many quirks as is, but some still need more tune-ups:
namely, some quirks check the USB vendor/device IDs in various places,
thus it doesn't work as long as the ID is different from the expected one.
Quoted 8 lines
Quoted 5 lines
With this patch, the driver stores the aliased USB ID, so that these rest quirks per device ID are applied. The transition to use the cached USB ID was already done in the past, so what we needed now is only to overwrite
chip->usb_id.Sounds interesting. Would this work for
snd_usb_interface_dsd_format_quirks()?
Yes, as long as chip->usb_id is checked, this hack should take effect.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel