Linux – How to disable a usb sound device with udev

audiolinuxudev

How can I disable USB device by Vendor ID? So I have:

[root@piotr ~]# lsusb
Bus 001 Device 002: ID 058f:9254 Alcor Micro Corp. Hub
Bus 001 Device 003: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 006: ID 0bc2:3320 Seagate RSS LLC SRD00F2 [Expansion Desktop Drive]

I want to disable

Bus 001 Device 003: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter

I need this unit in Windows environment but it disturb me Skype input (and only Skype). As temporary solution I just included snd_usb_audio in modprobe blacklist. But it is only workaround.
Or, (maybe better) is it possible to exclude this particular USB device from udev rules? But in /usr/lib/udev/rules.d there is not definition for this device. I mean about VendorID.

So my questions are:
Why it is working at all and can be seen by ALSA?
How can I exclude such VendorID and ProductID fron udev rules?
Any idea wanted

Best Answer

Add this line:

ACTION=="add", ATTR{idVendor}=="0d8c", ATTR{idProduct}=="000c", RUN+="/bin/sh -c 'echo 1 >/sys/\$devpath/authorized'"

to a new file (ex: my.rules) in /etc/udev/rules.d/

Related Question