usb获取bus号和端口号

Posted liuyanygz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了usb获取bus号和端口号相关的知识,希望对你有一定的参考价值。

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.

以上是关于usb获取bus号和端口号的主要内容,如果未能解决你的问题,请参考以下文章

怎么获取服务器上的ip地址和端口号

如何使用javascript获取运行应用程序的主机IP和端口号

wcf客户端怎么获取自身使用的端口号?

Websocket-Sharp获取客户端IP地址和端口号

IP地址和端口号的组合叫啥?

如何检查和设置 JBoss 5 的 URL 和端口号?