netlink怎么区分USB设备
时间: 2023-09-20 08:03:18 浏览: 75
QT界面,Linux下C语言来检测USB设备以及自动区分U盘和硬盘(点击系统设置,点击格式化并没有真正格式化,可以实现区分功能!)
回答: 在Linux设备驱动中,每个设备在/dev目录下都有一个对应的文件(节点),可以通过查看/proc/devices命令来获取已加载设备驱动程序的主设备号。\[1\]对于USB设备,可以通过查看设备路径来区分。例如,/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host6/target6:0:0/6:0:0:0/scsi_device/6:0:0:0中的usb2/2-1/2-1:1.0部分表示USB设备的路径。\[3\]此外,还可以通过其他方法,如查看设备的Vendor ID和Product ID来区分USB设备。
#### 引用[.reference_title]
- *1* [所谓设备驱动即驱使硬件设备行动,带你深入理解linux的设备驱动...](https://blog.csdn.net/weixin_28676181/article/details/116956190)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Netlink通信机制](https://blog.csdn.net/chylovecsd/article/details/125055727)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Netlink实现Linux内核与用户空间通信](https://blog.csdn.net/weixin_39824801/article/details/111719742)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文