UsbBtDevice.setUsbDevice(dev);
final USBConfiguration conf = dev.getConfiguration(0);
final USBInterface intf = conf.getInterface(0);
final InterfaceDescriptor iDesc = intf.getDescriptor();
USBEndPoint bulkInEndpoint[] = new USBEndPoint[8];
USBEndPoint bulkOutEndpoint[] = new USBEndPoint[8];
USBEndPoint intrInEndpoint[] = new USBEndPoint[8];
int num_bulk_in = 0;
int num_bulk_out = 0;
int num_bulk_intr = 0;
USBEndPoint ep = null;
for (int i = 0; i < iDesc.getNumEndPoints(); i++) {
ep = intf.getEndPoint(i);
// Is it a bulk endpoint ?
if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
// In or Out ?
if ((ep.getDescriptor().getEndPointAddress() & USB_DIR_IN) == 0) {
bulkInEndpoint[num_bulk_in] = ep;
num_bulk_in++;
log.debug("*** Set bulk in endpoint");
} else {
bulkOutEndpoint[num_bulk_out] = ep;
num_bulk_out++;
log.debug("*** Set bulk out endpoint");
}
} else if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) {
intrInEndpoint[num_bulk_intr] = ep;
num_bulk_intr++;
log.debug("*** Set interrupt endpoint");
}
}