+ alt = &iface->altsetting[0];
+ data->interface = alt->bInterfaceNumber;
+
+ for (i = 0; i < alt->bNumEndpoints; i++) {
+ const struct libusb_endpoint_descriptor *ep = &alt->endpoint[i];
+ bool out = false;
+
+ if (data->msg_endpoint && data->response_endpoint)
+ break;
+
+ if ((ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) !=
+ LIBUSB_TRANSFER_TYPE_BULK)
+ continue;
+
+ out = (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) ==
+ LIBUSB_ENDPOINT_OUT;
+
+ if (!data->msg_endpoint && out)
+ data->msg_endpoint = ep->bEndpointAddress;
+ if (!data->response_endpoint && !out)
+ data->response_endpoint = ep->bEndpointAddress;
+ }