获取当前连接的 USB 设备列表及其在 BASH 中的开发文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3245015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get list of USB devices connected currently and their dev file in BASH
提问by Mohit Deshpande
What is the bash command for detecting all currently connected USB devices and getting the /dev/tty... file that corresponds to the USB device.
检测所有当前连接的USB设备并获取USB设备对应的/dev/tty...文件的bash命令是什么。
回答by Alberto Zaccagni
Give lsusb
a try; for the corresponding file I plug in the device and use dmesg
, but there sure is a better way...
给lsusb
一试; 对于我插入设备并使用的相应文件dmesg
,但肯定有更好的方法......
回答by vudduu
This can show all USB devices, including devices that you don't have drivers.
这可以显示所有 USB 设备,包括您没有驱动程序的设备。
system_profiler SPUSBDataType
回答by Sergi Mayordomo
Try this:
尝试这个:
lsblk -p -S -o NAME,TRAN | grep usb
回答by MattyV
dmesg | grep ttyUSB | grep -v grep | grep -o ttyUSB[0-9]