Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Disable specific USB ports

  1. #1
    Join Date
    Sep 2011
    Beans
    2

    Disable specific USB ports

    Hello,

    I need to disable specific USB ports (not all), but could not find any useful information so far. What do I need to do?

    Thank you!

  2. #2
    Join Date
    Oct 2009
    Location
    Scotland
    Beans
    217
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Disable specific USB ports

    What type of machine? WHY do you want to disable them? If it's to prevent people from plugging removable drives into the front of a PC (in corporate setting, for example) then the only sure way is to physically disconnect the ports, otherwise they can just insert a boot USB stick, run ubuntu (or puppy, or one of many other OS's) and carry on unrestricted.
    AMD Phenom Quad 9650, 8Gb RAM, (2 x 1) +(1 x 1.5)Tb HDDs; 64-bit Lucid (ʍoʃs ʎpooʃq ooʇ sɐʍ ʇı ʇnq ʎʇʇɐᴎ pǝıɹʇ I); Dual-boot Win XP Pro 32-bit (although mainly use WINE or VirtualBox). HP t5730 with 1GB RAM and 160GB HDD running xubuntu 10.10.

  3. #3
    Join Date
    Sep 2011
    Beans
    2

    Re: Disable specific USB ports

    Hi,

    I've got a USB UMTS modem and it's not working properly. Now I would like to disable all the other USB ports, to run tests.

  4. #4
    Join Date
    May 2010
    Location
    uk
    Beans
    9,299
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Disable specific USB ports

    Hi

    At the terminal type

    Code:
    for device in $(ls /sys/bus/usb/devices/*/product); do echo $device;cat $device;done
    This will get you a list of usb devices. You can then turn the power off and on to them like so.


    Turn it off.

    Code:
    echo suspend | sudo tee /sys/bus/usb/devices/XXXX/power/level
    Turn it on

    Code:
    echo on | sudo tee /sys/bus/usb/devices/XXXX/power/level
    Where XXXX is the device to switch off.

    Here is an example from my machine.

    Code:
    matthew@matthew-laptop:/sys/bus/usb$ for device in $(ls /sys/bus/usb/devices/*/product); do echo $device;cat $device;done
    /sys/bus/usb/devices/2-5/product
    Video WebCam
    /sys/bus/usb/devices/usb1/product
    EHCI Host Controller
    /sys/bus/usb/devices/usb2/product
    EHCI Host Controller
    /sys/bus/usb/devices/usb3/product
    OHCI Host Controller
    /sys/bus/usb/devices/usb4/product
    OHCI Host Controller
    /sys/bus/usb/devices/usb5/product
    OHCI Host Controller
    /sys/bus/usb/devices/usb6/product
    OHCI Host Controller
    matthew@matthew-laptop:/sys/bus/usb$ echo suspend | sudo tee /sys/bus/usb/devices/4-1/power/level
    tee: /sys/bus/usb/devices/4-1/power/level: No such file or directory
    suspend
    matthew@matthew-laptop:/sys/bus/usb$ echo suspend | sudo tee /sys/bus/usb/devices/2-5/power/level
    suspend
    matthew@matthew-laptop:/sys/bus/usb$ echo on | sudo tee /sys/bus/usb/devices/2-5/power/level 
    on
    matthew@matthew-laptop:/sys/bus/usb$
    It turns off and on my web cam.

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  5. #5
    Join Date
    Jan 2007
    Beans
    74

    Re: Disable specific USB ports

    That was a useful answer!
    I don't need it but I'm writing that bit down in case someday I do.

  6. #6
    Join Date
    Jan 2008
    Beans
    81

    Re: Disable specific USB ports

    i am trying to this and can't figure out which one to disable.
    i have a 24 usb hub connected to one usb port. I want to disable and enable on the fly via the command prompt


    ls /sys/bus/usb/devices
    1-0:1.0 1-3.5.1:1.0 1-3.6.1:1.0 1-3.7.1:1.0 1-7:1.0 3-2.3:1.0
    1-3 1-3.5.2 1-3.6.2 1-3.7.2 2-0:1.0 4-0:1.0
    1-3.1 1-3.5.2:1.0 1-3.6.2:1.0 1-3.7.2:1.0 2-1 5-0:1.0
    1-3:1.0 1-3.5.3 1-3.6.4 1-3.7.3 2-1:1.0 usb1
    1-3.1:1.0 1-3.5.3:1.0 1-3.6.4:1.0 1-3.7.3:1.0 2-2 usb2
    1-3.2 1-3.5.4 1-3.6.5 1-3.7.4 2-2:1.0 usb3
    1-3.2:1.0 1-3.5.4:1.0 1-3.6.5:1.0 1-3.7.4:1.0 3-0:1.0 usb4
    1-3.3 1-3.5.6 1-3.6.6 1-3.7.6 3-2 usb5
    1-3.3:1.0 1-3.5.6:1.0 1-3.6.6:1.0 1-3.7.6:1.0 3-2:1.0
    1-3.5 1-3.6 1-3.7 1-3.7.7 3-2.2
    1-3.5.1 1-3.6.1 1-3.7.1 1-3.7.7:1.0 3-2.2:1.0
    1-3.5:1.0 1-3.6:1.0 1-3.7:1.0 1-7 3-2.3

  7. #7
    Join Date
    Jan 2008
    Beans
    81

    Re: Disable specific USB ports

    Sorry but if I would like to shut disable a usb port

    issues this command

    echo suspend | sudo tee /sys/bus/usb/devices/USB1/power/level

    to shutdown usb1

    tHE PORT I WANT TO SHUTDOWN IS 1-3
    Last edited by VVAW; January 29th, 2012 at 06:46 PM.

  8. #8
    Join Date
    May 2010
    Location
    uk
    Beans
    9,299
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Disable specific USB ports

    Hi

    Can you post the output of

    Code:
    lsusb -t
    Can you post it between code tags

    [code]like this[/code]

    to make it easier to read.

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  9. #9
    Join Date
    Jan 2008
    Beans
    81

    Re: Disable specific USB ports

    ~$ lsusb -t
    /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    |__ Port 2: Dev 2, If 0, Class=hub, Driver=hub/4p, 12M
    |__ Port 2: Dev 3, If 0, Class=vend., Driver=pl2303, 12M
    |__ Port 3: Dev 4, If 0, Class=vend., Driver=pl2303, 12M
    /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    |__ Port 1: Dev 2, If 0, Class=vend., Driver=pl2303, 12M
    |__ Port 2: Dev 3, If 0, Class=vend., Driver=pl2303, 12M
    /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/8p, 480M
    |__ Port 7: Dev 6, If 0, Class=stor., Driver=usb-storage, 480M

  10. #10
    Join Date
    Jul 2012
    Beans
    319
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: Disable specific USB ports

    Sorry to drag this one up, but has something changed in 12.04?

    If I run the suspend command for my webcam which is on 3-5

    Code:
    echo suspend | sudo tee /sys/bus/usb/devices/3-5/power/level
    I get

    Code:
    Invalid Argument
    Same with other devices. Just try to turning off annoying blue light on webcam when not in use
    The best things in life are free, so what are we paying for?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •