4

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

1
  • 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
2

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/

2
  • 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?
    – mackowiakp
    Dec 19 '13 at 8:56
  • 4
    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
    – mackowiakp
    Dec 19 '13 at 18:33
2

Correct answer (based on feedback from @mackowiakp) is actually this:

Add this line:

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

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

Differences from @user2438863's answer:

  • RUN= instead of RUN+=
  • echo 0 instead of echo 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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