protected override int ReadInternal(byte[] dest, int timeoutMillis)
        {
            if (false)//(mEnableAsyncReads)
            {
                UsbRequest request = new UsbRequest();
                try
                {
                    request.Initialize(Connection, mReadEndpoint);
                    ByteBuffer buf = ByteBuffer.Wrap(dest);
                    if (!request.Queue(buf, dest.Length))
                    {
                        throw new IOException("Error queueing request.");
                    }

                    UsbRequest response = Connection.RequestWait();
                    if (response == null)
                    {
                        throw new IOException("Null response");
                    }

                    int nread = buf.Position();
                    if (nread > 0)
                    {
                        //Log.Debug(Tag, HexDump.DumpHexString(dest, 0, Math.Min(32, dest.Length)));
                        return nread;
                    }
                    else
                    {
                        return 0;
                    }
                }
                finally
                {
                    request.Close();
                }
            }

            int numBytesRead;
            lock (mInternalReadBufferLock)
            {
                int readAmt = Math.Min(dest.Length, mInternalReadBuffer.Length);
                numBytesRead = Connection.BulkTransfer(mReadEndpoint, mInternalReadBuffer, readAmt,
                        timeoutMillis);
                if (numBytesRead < 0)
                {
                    // This sucks: we get -1 on timeout, not 0 as preferred.
                    // We *should* use UsbRequest, except it has a bug/api oversight
                    // where there is no way to determine the number of bytes read
                    // in response :\ -- http://b.android.com/28023
                    if (timeoutMillis == int.MaxValue)
                    {
                        // Hack: Special case "~infinite timeout" as an error.
                        return -1;
                    }
                    return 0;
                }
                Array.Copy(mInternalReadBuffer, 0, dest, 0, numBytesRead);
            }
            return numBytesRead;
        }
        protected override int ReadInternal(byte[] dest, int timeoutMillis)
        {
            UsbEndpoint endpoint = UsbDevice.GetInterface(0).GetEndpoint(0);

            if (ENABLE_ASYNC_READS)
            {
                int readAmt;
                lock (mInternalReadBufferLock)
                {
                    // mReadBuffer is only used for maximum read size.
                    readAmt = Math.Min(dest.Length, mInternalReadBuffer.Length);
                }

                UsbRequest request = new UsbRequest();
                request.Initialize(Connection, endpoint);

                ByteBuffer buf = ByteBuffer.Wrap(dest);
                if (!request.Queue(buf, readAmt))
                {
                    throw new IOException("Error queueing request.");
                }

                UsbRequest response = Connection.RequestWait();
                if (response == null)
                {
                    throw new IOException("Null response");
                }

                int payloadBytesRead = buf.Position() - MODEM_STATUS_HEADER_LENGTH;
                if (payloadBytesRead > 0)
                {
                    //Log.Debug(TAG, HexDump.DumpHexString(dest, 0, Math.Min(32, dest.Length)));
                    return payloadBytesRead;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                int totalBytesRead;

                lock (mInternalReadBufferLock)
                {
                    int readAmt = Math.Min(dest.Length, mInternalReadBuffer.Length);
                    totalBytesRead = Connection.BulkTransfer(endpoint, mInternalReadBuffer,
                            readAmt, timeoutMillis);

                    if (totalBytesRead < MODEM_STATUS_HEADER_LENGTH)
                    {
                        throw new IOException("Expected at least " + MODEM_STATUS_HEADER_LENGTH + " bytes");
                    }

                    return FilterStatusBytes(mInternalReadBuffer, dest, totalBytesRead, endpoint.MaxPacketSize);
                }
            }
        }