Code example for UsbInterface

Methods: getEndpoint

0
        // class should be USB_CLASS_CDC_DATA 
 
        if (!mConnection.claimInterface(mDataInterface, true)) {
            throw new IOException("Could not claim data interface.");
        } 
        mReadEndpoint = mDataInterface.getEndpoint(1);
        Log.d(TAG, "Read endpoint direction: " + mReadEndpoint.getDirection());
        mWriteEndpoint = mDataInterface.getEndpoint(0);
        Log.d(TAG, "Write endpoint direction: " + mWriteEndpoint.getDirection());
 
        Log.d(TAG, "Setting line coding");
        setBaudRate(115200); 
 
    } 
 
    private static final int USB_RECIP_INTERFACE = 0x01;
    private static final int USB_RT_ACM = UsbConstants.USB_TYPE_CLASS | USB_RECIP_INTERFACE;
 
    private static final int SET_LINE_CODING = 0x20;  // USB CDC 1.1 section 6.2
 
    private int sendAcmControlMessage(int request, int value, byte[] buf) {