diff options
author | Jun Yan <juyan@nvidia.com> | 2014-03-24 19:10:32 -0700 |
---|---|---|
committer | Harry Hong <hhong@nvidia.com> | 2014-06-26 16:45:08 -0700 |
commit | 30991f95fb9b6a29b7165396956f80103e793ab4 (patch) | |
tree | ea21f104faee807617933642eea716dab8436c66 | |
parent | f97258264752500ce7a49ad0bca1f8b1afafa9f1 (diff) |
sound: Add blacklist for audio devices
Prevent specified audio devices from sending
uevents upon connection/disconnection.
Bug 1474213
Bug 1466757
Bug 200013027
Change-Id: I532968ed9717dc18db62671deedd60bb4a38463e
Signed-off-by: Jun Yan <juyan@nvidia.com>
Reviewed-on: http://git-master/r/385931
(cherry picked from commit 553636416a0700b354385d7a508d67653814272d)
Signed-off-by: Kenneth Kwak <kkwak@nvidia.com>
Reviewed-on: http://git-master/r/428777
Reviewed-by: Alvin Park <apark@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Harry Hong <hhong@nvidia.com>
-rw-r--r-- | sound/usb/card.c | 24 | ||||
-rw-r--r-- | sound/usb/nonswitch-table.h | 24 |
2 files changed, 46 insertions, 2 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index c77ab9d5ecd0..ebb011590806 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -88,6 +88,7 @@ static int nrpacks = 8; /* max. number of packets per urb */ static bool async_unlink = 1; static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ static bool ignore_ctl_error; +static int usb_nonswitch_match(struct usb_device* udev); module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); @@ -557,7 +558,8 @@ snd_usb_audio_probe(struct usb_device *dev, } #ifdef CONFIG_SWITCH - switch_set_state(&usb_switch_dev, STATE_CONNECTED); + if (!usb_nonswitch_match(dev)) + switch_set_state(&usb_switch_dev, STATE_CONNECTED); #endif usb_chip[chip->index] = chip; @@ -601,7 +603,8 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, chip->num_interfaces--; #ifdef CONFIG_SWITCH - switch_set_state(&usb_switch_dev, STATE_DISCONNECTED); + if (!usb_nonswitch_match(dev)) + switch_set_state(&usb_switch_dev, STATE_DISCONNECTED); #endif if (chip->num_interfaces <= 0) { @@ -746,6 +749,23 @@ static struct usb_device_id usb_audio_ids [] = { MODULE_DEVICE_TABLE (usb, usb_audio_ids); +#ifdef CONFIG_SWITCH +static struct usb_device_id usb_nonswitch_ids [] = { +#include "nonswitch-table.h" + { } +}; + +static int usb_nonswitch_match(struct usb_device* udev) { + int i; + for(i = 0; i < sizeof(usb_nonswitch_ids); i++) { + if ((usb_nonswitch_ids[i].idVendor == udev->descriptor.idVendor) && + (usb_nonswitch_ids[i].idProduct == udev->descriptor.idProduct)) + return 1; + } + return 0; +} +#endif + /* * entry point for linux usb interface */ diff --git a/sound/usb/nonswitch-table.h b/sound/usb/nonswitch-table.h new file mode 100644 index 000000000000..518055885dbb --- /dev/null +++ b/sound/usb/nonswitch-table.h @@ -0,0 +1,24 @@ +/* + * USB nonswitch table + * + * Copyright (c) 2014, NVIDIA Corporation. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* Some USB Sound device depends on other conditions to prempt sound play/acquire. + * Prevent them from sending uevent upon connection/disconnection + */ +{ + USB_DEVICE(0x0955, 0x7210),//This is the VID and PID for Blake device +}, |