public UsbInterfaceAssert hasEndpointCount(int count) { isNotNull(); int actualCount = actual.getEndpointCount(); Assertions.assertThat(actualCount) // .overridingErrorMessage("Expected endpoint count <%s> but was <%s>.", count, actualCount) // .isEqualTo(count); return this; }
public UsbInterfaceAssert hasEndpointCount(int count) { isNotNull(); int actualCount = actual.getEndpointCount(); Assertions.assertThat(actualCount) // .overridingErrorMessage("Expected endpoint count <%s> but was <%s>.", count, actualCount) // .isEqualTo(count); return this; }
private boolean openCP2130() { if(connection.claimInterface(mInterface, true)) { Log.i(CLASS_ID, "Interface succesfully claimed"); }else { Log.i(CLASS_ID, "Interface could not be claimed"); return false; } // Assign endpoints int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++) { UsbEndpoint endpoint = mInterface.getEndpoint(i); if(endpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK && endpoint.getDirection() == UsbConstants.USB_DIR_IN) { inEndpoint = endpoint; }else { outEndpoint = endpoint; } } return true; }
private UsbMidiInterface asMidiInterface(UsbInterface iface) { // We really ought to check interface class and subclass, but we don't since a lot of MIDI // devices don't fully comply with the standard. // if (iface.getInterfaceClass() != 1 || iface.getInterfaceSubclass() != 3) return null; List<UsbMidiInput> inputs = new ArrayList<UsbMidiInput>(); List<UsbMidiOutput> outputs = new ArrayList<UsbMidiOutput>(); int epCount = iface.getEndpointCount(); for (int j = 0; j < epCount; ++j) { UsbEndpoint ep = iface.getEndpoint(j); // If the endpoint looks like a MIDI endpoint, assume that it is one. My reading of the USB // MIDI specification is that the max // packet size ought to be 0x40, but I've seen at least one interface (Focusrite Scarlett 2i4) // that reports a max packet size // of 0x200. So, we'll just check the minimum requirement for the rest of this class to work, // i.e., the max packet size must be // a positive multiple of 4. if ((ep.getType() & UsbConstants.USB_ENDPOINT_XFERTYPE_MASK) == UsbConstants.USB_ENDPOINT_XFER_BULK && (ep.getMaxPacketSize() & 0x03) == 0 && ep.getMaxPacketSize() > 0) { if ((ep.getDirection() & UsbConstants.USB_ENDPOINT_DIR_MASK) == UsbConstants.USB_DIR_IN) { inputs.add(new UsbMidiInput(iface, ep)); } else { outputs.add(new UsbMidiOutput(iface, ep)); } } } return (inputs.isEmpty() && outputs.isEmpty()) ? null : new UsbMidiInterface(iface, inputs, outputs); }
for(int i = 0; i < device.getInterfaceCount(); i++) { iface = device.getInterface(i); if(iface.getEndpointCount() == ENDPOINT_COUNT) { break; for(int i = 0; i < iface.getEndpointCount(); i++) { UsbEndpoint endpoint = iface.getEndpoint(i); if(endpoint.getType() ==
/** * Enumerate the endpoints and interfaces on the connected device. * * @param device Device to query. * @return String description of the device configuration. */ public static String readDevice(UsbDevice device) { StringBuilder sb = new StringBuilder(); sb.append("Device Name: " + device.getDeviceName() + "\n"); sb.append(String.format( "Device Class: %s -> Subclass: 0x%02x -> Protocol: 0x%02x\n", nameForClass(device.getDeviceClass()), device.getDeviceSubclass(), device.getDeviceProtocol())); for (int i = 0; i < device.getInterfaceCount(); i++) { UsbInterface intf = device.getInterface(i); sb.append(String.format(Locale.US, "-- Interface %d Class: %s -> Subclass: 0x%02x -> Protocol: 0x%02x\n", intf.getId(), nameForClass(intf.getInterfaceClass()), intf.getInterfaceSubclass(), intf.getInterfaceProtocol())); sb.append(String.format(Locale.US, " -- Endpoint Count: %d\n", intf.getEndpointCount())); } return sb.toString(); }
private boolean openCH34X() { if(connection.claimInterface(mInterface, true)) { Log.i(CLASS_ID, "Interface succesfully claimed"); }else { Log.i(CLASS_ID, "Interface could not be claimed"); return false; } // Assign endpoints int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++) { UsbEndpoint endpoint = mInterface.getEndpoint(i); if(endpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK && endpoint.getDirection() == UsbConstants.USB_DIR_IN) { inEndpoint = endpoint; }else if(endpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK && endpoint.getDirection() == UsbConstants.USB_DIR_OUT) { outEndpoint = endpoint; } } return init() == 0; }
int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++)
int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++)
for (int i = 0; i < dataIface.getEndpointCount(); i++) { UsbEndpoint ep = dataIface.getEndpoint(i); if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
for (int i = 0; i < dataIface.getEndpointCount(); i++) { UsbEndpoint ep = dataIface.getEndpoint(i); if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
for (int i = 0; i < dataIface.getEndpointCount(); i++) { UsbEndpoint ep = dataIface.getEndpoint(i); if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++)
int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++)
int numberEndpoints = mInterface.getEndpointCount(); for(int i=0;i<=numberEndpoints-1;i++)
Log.i(TAG," Inteface class: " + mUsbInterface.getInterfaceClass()); Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol()); Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount()); for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
for (int i = 0; i < dataIface.getEndpointCount(); i++) { UsbEndpoint ep = dataIface.getEndpoint(i); if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
Log.info("Interface " + i + " endpoint count:" + usb_intf[i].getEndpointCount());
for (int i = 0; i < dataIface.getEndpointCount(); i++) { UsbEndpoint ep = dataIface.getEndpoint(i); if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
throw new InterfaceInUseException("Could not get control of USB interface, it may be in use by other applications."); for (int i = 0; i < usbInterface.getEndpointCount(); i++) { if (usbInterface.getEndpoint(i).getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) { if (usbInterface.getEndpoint(i).getDirection() == UsbConstants.USB_DIR_IN)