How to reset USB port remotely
Posted by vitich on Monday, 29 January 2018
#!/bin/bash
usb=`dmesg | grep "New USB device found, idVendor=1058, idProduct=0820"|cut -f1 -d':'| awk '{print $4}' | tail -1`
sudo sh -c "echo $usb > /sys/bus/usb/drivers/usb/unbind"
sudo sh -c "echo $usb > /sys/bus/usb/drivers/usb/bind"
Замінюйте параметри grep на те що вам потрібно.
В моєму випадку результат має бути ось такий:
# dmesg | grep "New USB device found, idVendor=1058, idProduct=0820"|cut -f1 -d':'| awk '{print $4}' | tail -1
1-6