Linux-controlled USB binding/Unbinding

Source: Internet
Author: User

Linux-controlled USB binding/Unbinding

http://www.jianshu.com/p/57293f9be558

Today's work encountered a problem, to use the code to achieve the USB enable and disable. Google a little, finally find the ideal answer, I am here to do a short porting. Source: A blog outside the wall

  • Start by lsusb-t to view the USB port information:
    /: Bus 02.Port 1:dev 1, class= "Root_hub", driver=ehci-pci/3p, 480M |__ Port 1:dev 2, If 0, class= "hub", Driver =hub/8p, 480M |__ Port 6:dev, if 0, class= "Vend"., driver=, 480M |__ Port 6:dev, if 1, class= "Vend"., Dr IVER=USBFS, 480M |__ Port 6:dev, if 2, class= "Comm"., DRIVER=CDC_ACM, 480M |__ Port 6:dev, if 3, class= " Data ", DRIVER=CDC_ACM, 480M |__ Port 6:dev, if 4, class=" Comm "., DRIVER=CDC_ACM, 480M |__ Port 6:dev, if 5, class= "Data", DRIVER=CDC_ACM, 480M |__ Port 6:dev, If 6, class= "Comm"., DRIVER=CDC_ACM, 480M |__ Port 6: Dev, If 7, class= "Data", DRIVER=CDC_ACM, 480m/: Bus 01.Port 1:dev 1, class= "Root_hub", driver=ehci-pci/3p, 480M |__ Port 1:dev 2, if 0, class= "hub", driver=hub/6p, 480M |__ Port 1:dev 6, if 0, class= "HID", Driver=usbhid, 1.5M |__ Port 1:dev 6, if 1, class= "hid", Driver=usbhid, 1.5M |__ Port 3:dev 9, if 0, class= "hid", Driver=usbhid, 1.5m< /code>
    (Note: You can plug and unplug the USB you want to control to determine which port is which bus.)
    Here I want to operate Port 6 under port 1 of Bus 02.
  • Execute the following command to unbind this USB:
    echo ‘2-1.6‘ | sudo tee /sys/bus/usb/drivers/usb/unbind
    In fact, with no tee is OK, direct redirection can also. It is important to note that the string to echo is:"$bus_num"-"$port1_num"."$port2_num"
    This is probably the format.
  • To re-bind the command, simply change the command in the unbind to bind.
    echo ‘2-1.6‘ | sudo tee /sys/bus/usb/drivers/usb/bind

That ' s it.

Knowledge from work? Copyright belongs to author All report articles concern Edward_f0cus

Wrote 15596 words, was paid attention by 17 people, gained 34 likes

Sort of non-mainstream programmer. Like beauty and thinking.

If you feel that my article is useful to you, please feel free to appreciate it. Your support will encourage me to continue to create!



Edward_f0cus
Links: http://www.jianshu.com/p/57293f9be558
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

Linux control USB bindings/unbinding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.