简体   繁体   中英

how to know if a USB device is plugged into the embedded Linux system

I'm new to the embedded Linux world. I'm using Nvidia Jetson Nano as my embedded SOC. Now I need my application to do some specific thing, for example, show an icon, as long as a USB disk is plugged into the embedded board. How can I know if such a USB disk is plugged in?

I need to know the approach for knowing the as long as a USB disk is plugged in

You can check all USB devices that are plugged in with the commands:

$ lsusb

Or with the command:

$ ls /dev/ttyUSB

You could then check if one of the listed devices (/dev/ttyUSB0 for example) is in the list and do your action.

What programming language are you using for your application? There must be libraries that can help you check easily if a USB is connected/disconnected

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