博文

目前显示的是 九月, 2024的博文

Disable MSI monitor driver drive for Macos/Linux

 Shell script #!/bin/bash DEV_DESP="MS MSI Gaming Controller" UHUB_CMD="/opt/homebrew/bin/uhubctl -s \"$DEV_DESP\"" DEV_USB_INFO=`eval "$UHUB_CMD"` LOCATION=`echo $DEV_USB_INFO | sed 's/^.*\([0-9]-[0-9]\).*$/\1/'` PORT=`echo $DEV_USB_INFO | sed 's/^.*\] Port \([0-9]\).*$/\1/' ` echo Target Device: $DEV_DESP if [ -z "$LOCATION"   ] || [ -z "$PORT" ]; then   echo "Device cannot be found."   exit 0 fi echo Location: $LOCATION echo Port: $PORT UHUB_ACT_CMD="/opt/homebrew/bin/uhubctl -a off -l $LOCATION -p $PORT" echo Running cmd: $UHUB_ACT_CMD eval $UHUB_ACT_CMD

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.