Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question

migrated from serverfault.com Dec 18 '13 at 9:19

This question came from our site for professional system and network administrators.

    
you should edit your title to make it more general like how to ban a usb device with udev or something like this –  Kiwy Dec 18 '13 at 9:24

1 Answer 1

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/

share|improve this answer
    
Hmmm. It does not work for me. My device path is: /sys/devices/pci0000:00/0000:00:04.0/usb1/1-3/1-3:1.0/sound/card1 And suggested by You rule entry, does not create "authorized" file in such path. I think that some kind of default rule still activate my (unwanted) USB sound device, becuse in /usr/lib/udev/rules.d/ there is not any definition for such Vendor and Product ID. My system does not use /etc/udev as rules definition subdir. So some modification is necessary. What to do? –  user180586 Dec 19 '13 at 8:56
    
OK. You help me. But correct syntax should be ACTION=="add", ATTR{idVendor}=="0d8c", ATTR{idProduct}=="000c", RUN="/bin/sh -c 'echo 0 >/sys/\$devpath/authorized'" --- THX –  user180586 Dec 19 '13 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.