/* ... */
/* USB device */
struct usb_device *udevice;
/* ... */
struct usb_device_descriptor u_d_desc = udevice->descriptor;
/* Device's active configuration */
struct usb_host_config *uconfig;
struct usb_config_desriptor u_c_desc;
/* Interfaces in the active configuration */
struct usb_interface *uinterface;
/* Alternate Setting for this interface */
struct usb_host_interface *ualtsetting;
struct usb_interface_descriptor u_i_desc;
/* Endpoints for this altsetting */
struct usb_host_endpoint *uendpoint;
struct usb_endpoint_descriptor u_e_desc;
uconfig = udevice->actconfig;
u_c_desc = uconfig->desc;
for (i = 0; i < u_c_desc.bNumInterfaces;
i++) {
uinterface = udevice->actconfig->interface[i];
for (j = 0; j < uinterface->num_altsetting; j++) {
ualtsetting = &uinterface->altsetting[j];
u_i_desc = ualtsetting->desc;
for (k = 0; k < u_i_desc.bNumEndpoints; k++) {
uendpoint = &ualtsetting->endpoint[k];
u_e_desc = uendpoint->desc;
printk ("Endpoint Address = %d\n",
u_e_desc.bEndpointAddress);
}
}
/* ... */
}
syntax highlighted by Code2HTML, v. 0.9.1