Skip to content

Commit

Permalink
ALSA: usb-audio: Change the semantics of the enable option
Browse files Browse the repository at this point in the history
This patch changes the semantics of the enable option for snd-usb-audio
in order to allow users to disable a device specified by either or both
of the vendor id and the product id.

Signed-off-by: Tamaki Nishino <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
otamachan authored and tiwai committed Nov 30, 2017
1 parent e8eb7c6 commit 108884e
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions sound/usb/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,24 @@ static int usb_audio_probe(struct usb_interface *intf,
* now look for an empty slot and create a new card instance
*/
for (i = 0; i < SNDRV_CARDS; i++)
if (enable[i] && ! usb_chip[i] &&
if (!usb_chip[i] &&
(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,
id, &chip);
if (err < 0)
if (enable[i]) {
err = snd_usb_audio_create(intf, dev, i, quirk,
id, &chip);
if (err < 0)
goto __error;
chip->pm_intf = intf;
break;
} else if (vid[i] != -1 || pid[i] != -1) {
dev_info(&dev->dev,
"device (%04x:%04x) is disabled\n",
USB_ID_VENDOR(id),
USB_ID_PRODUCT(id));
err = -ENOENT;
goto __error;
chip->pm_intf = intf;
break;
}
}
if (!chip) {
dev_err(&dev->dev, "no available usb audio device\n");
Expand Down

0 comments on commit 108884e

Please sign in to comment.