Get the USB bus physical topology
#include <sys/usbdi.h> int usbd_topology( struct usbd_connection *connection, usbd_bus_topology_t *tp ) int usbd_topology_ext( struct usbd_connection *connection, uint8_t busno, usbd_bus_topology_t *tp )
libusbdi
You can use the usbd_topology() or usbd_topology_ext() function to get the USB bus physical topology.
For more information on USB bus topology, see sections 4.1.1 and 5.2.3 in the USB Specification v1.1. |
If your system has more than one bus, you can call usbd_topology_ext() to get information about a specific one. The usbd_topology() function gets information about the first bus; calling it is the same as calling usbd_topology() with a bus argument of 0.
The usbd_bus_topology_t structure is defined as follows:
typedef struct usbd_port_attachment { uint8_t upstream_devno; uint8_t upstream_port; uint8_t upstream_port_speed; uint8_t upstream_hc; uint8_t _reserved[4]; } usbd_port_attachment_t; typedef struct usbd_bus_topology { usbd_port_attachment_t ports[64]; } usbd_bus_topology_t;
The structure contains an array of usb_port_attachment_t structures, one per device. The usb_port_attachment_t structure contains at least the following:
The upstream_devno field will contain a value other than 0xff to indicate a valid attachment. |
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |