usb获取bus号和端口号
摘自:http://libusb.sourceforge.net/api-1.0/group__libusb__dev.html#gaf2718609d50c8ded2704e4051b3d2925
uint8_t libusb_get_bus_number | ( | libusb_device * | dev | ) |
Get the number of the bus that a device is connected to.
- Parameters
-
dev a device
- Returns
- the bus number
◆ libusb_get_port_number()
uint8_t libusb_get_port_number | ( | libusb_device * | dev | ) |
Get the number of the port that a device is connected to. Unless the OS does something funky, or you are hot-plugging USB extension cards, the port number returned by this call is usually guaranteed to be uniquely tied to a physical port, meaning that different devices plugged on the same physical port should return the same port number.
But outside of this, there is no guarantee that the port number returned by this call will remain the same, or even match the order in which ports have been numbered by the HUB/HCD manufacturer.
- Parameters
-
dev a device
- Returns
- the port number (0 if not available)
◆ libusb_get_port_numbers()
int libusb_get_port_numbers | ( | libusb_device * | dev, |
uint8_t * | port_numbers, | ||
int | port_numbers_len | ||
) |
Get the list of all port numbers from root for the specified device
Since version 1.0.16, LIBUSB_API_VERSION >= 0x01000102
- Parameters
-
dev a device port_numbers the array that should contain the port numbers port_numbers_len the maximum length of the array. As per the USB 3.0 specs, the current maximum limit for the depth is 7.
- Returns
- the number of elements filled
- LIBUSB_ERROR_OVERFLOW if the array is too small
◆ libusb_get_port_path()
int libusb_get_port_path | ( | libusb_context * | ctx, |
libusb_device * | dev, | ||
uint8_t * | port_numbers, | ||
uint8_t | port_numbers_len | ||
) |
Deprecated please use libusb_get_port_numbers instead.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)