gabriel
gabriel

Reputation: 255

How to disable a specific usb port permanently in linux?

Is it possible to permanently disable a usb port in linux?

I have already figured out how to disable it:

echo -n "0000:00:12.0" > /sys/bus/pci/drivers/ohci_hcd/unbind

BUT after restart it is enabled.

I have placed this script :

#!/bin/sh
case "$1" in
    resume|thaw)
            echo -n "0000:00:12.0" > /sys/bus/pci/drivers/ohci_hcd/unbind
            ;;
esac

in /etc/pm/sleep.d/0_disable_usb2

But again without success. I also thought that i could disable it through bios but as i could see i can disable the whole pci.

Is there any way of doing this?

.. My Operating system is Debian 7.7 64bit. The reason i want to do this is I am trying to configure my system for realtime capabilities and my usb soundcard sharing the same IRQ with this port.

Upvotes: 2

Views: 20545

Answers (3)

Ken Hu
Ken Hu

Reputation: 1

echo "0" > /sys/bus/usb/devices/usb{x}/authorized

Upvotes: 0

Mansur Ul Hasan
Mansur Ul Hasan

Reputation: 3606

For me usb mounting is handle by a service udisk2.service if you would like to stop usb mounting then stop below service

root@mahasan-Inspiron-5537:~# systemctl start udisks2.service
root@mahasan-Inspiron-5537:~# systemctl disable udisks2.service

Upvotes: 1

muradin
muradin

Reputation: 1277

First of all you should find your USB number of your device, Simply by using lsusb.

And in Linux everything is a file, So you can manage all of your hardware using the files.

As it describes Here if your kernel is > 2.6.38 you should use this keywords:

echo "0" > "/sys/bus/usb/devices/usb2/power/autosuspend_delay_ms"
Then:

echo "auto" > "/sys/bus/usb/devices/usb1/power/control"

Upvotes: 0

Related Questions