Turn on/off a specific usb port on Macos/Linux by command

Tool needed: uhubctl

Github: https://github.com/mvp/uhubctl

For Linux or Macos, sometimes we need to turn off  a usb device from command line. This is very useful when there is a faulty device but hard to remove or when testing certain usb devices.

For linux, please refer to the Github readme for installation.

For Macos, we can install uhubctl using brew:

brew tap mvp/uhubctl https://github.com/mvp/uhubctl

brew install uhubctl    

To list all the current usb devices, use the command:

uhubctl


To turn of a certain device, use the following command:

uhubctl -l {location} -p {port} -a off


The {location} means the hub number (e.g. 1-1, 2-2, 2-1, etc.). The {port} means the port number. In the example above, the {location} is 1-1 and the {port} is 3.

评论

此博客中的热门博文

Openwrt路由器上配置shadowsocks透明代理+gfwlist(PAC)

Configure shadowsocks transparent proxy + gfwlist(PAC) on OpenWRT Router

Using Haproxy + shadowsocks (ha + ss) to setup multi ss backend and load balance