Code example for UsbDevice

Methods: getInterface, getInterfaceCount

0
	        super.onDestroy(); 
	    } 
 
	    private void setDevice(UsbDevice device) {
	        Log.d(TAG, "setDevice " + device);
	        if (device.getInterfaceCount() != 1) {
	            Log.e(TAG, "could not find interface");
	            return; 
	        } 
	        UsbInterface intf = device.getInterface(0);
	        // device should have one endpoint 
	        if (intf.getEndpointCount() != 1) {
	            Log.e(TAG, "could not find endpoint");
	            return; 
	        } 
	        // endpoint should be of type interrupt 
	        UsbEndpoint ep = intf.getEndpoint(0);
	        if (ep.getType() != UsbConstants.USB_ENDPOINT_XFER_INT) {
	            Log.e(TAG, "endpoint is not interrupt type");
	            return; 
	        }