简体   繁体   中英

How to detect USB driver enable/disable

We have USB device on FPGA and we can enable and disable it by setting a bit. Once we enable the device it will take some time (less than 1 second) to detect USB is enabled. So immediately after enabling the bit and check /dev/ path I am not able to find my device. Is there any way I can get an event when USB driver is loaded successfully and USB is ready to serve?

Below are the console output I am getting when we enable the port.

[  101.285945] usb 1-1.1: new high-speed USB device number 5 using ci_hdrc
[  101.386462] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[  101.395559] scsi host0: usb-storage 1-1.1:1.0
[  102.470375] scsi 0:0:0:0: Direct-Access SanDisk Cruzer Blade 8.02 PQ: 0 ANSI: 0 CCS
[  102.502029] sd 0:0:0:0: [sda] 7856127 512-byte logical blocks: (4.02 GB/3.75 GiB)
[  102.503125] sd 0:0:0:0: [sda] Write Protect is off
[  102.504547] sd 0:0:0:0: [sda] No Caching mode page found
[  102.504555] sd 0:0:0:0: [sda] Assuming drive cache: write through

I would like to monitor the above events, is there any way to monitor USB driver status?

您可以使用udevdm实用程序监视事件,如下所示

udevadm monitor --subsystem-match=usb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM