ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

usb获取bus号和端口号

2020-02-21 19:05:21  阅读:738  来源: 互联网

标签:usb get bus number libusb numbers device port 端口号


摘自: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.

标签:usb,get,bus,number,libusb,numbers,device,port,端口号
来源: https://www.cnblogs.com/LiuYanYGZ/p/12342579.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有