ADB::poll() and delay(500)
GoogleCodeExporter opened this issue · 1 comments
GoogleCodeExporter commented
There is a delay(500) in the ADB::poll() method in Adb.cpp.
Since poll() is typically executed inside the main loop, I suggest to remove
the delay or replace it with a return statement.
I haven't tested it yet so I'd appreciate your comments.
void ADB::poll()
{
Connection * connection;
adb_message message;
// Poll the USB layer.
USB::poll();
// If no USB device, there's no work for us to be done, so just return.
if (adbDevice==NULL) return;
// If not connected, send a connection string to the device.
if (!connected)
{
ADB::writeStringMessage(adbDevice, A_CNXN, 0x01000000, 4096, (char*)"host::microbridge");
delay(500); // Give the device some time to respond.
}
// If we are connected, check if there are connections that need to be opened
if (connected)
ADB::openClosedConnections();
// Check for an incoming ADB message.
if (!ADB::pollMessage(&message, true))
return;
// Handle a response from the ADB device to our CONNECT message.
if (message.command == A_CNXN)
ADB::handleConnect(&message);
// Handle messages for specific connections
for (connection = firstConnection; connection != NULL; connection = connection->next)
{
if (connection->status!=ADB_UNUSED && connection->localID==message.arg1)
{
switch(message.command)
{
case A_OKAY:
ADB::handleOkay(connection, &message);
break;
case A_CLSE:
ADB::handleClose(connection);
break;
case A_WRTE:
ADB::handleWrite(connection, &message);
break;
default:
break;
}
}
}
}
Original issue reported on code.google.com by josema...@alcerreca.com
on 20 Sep 2011 at 2:50
GoogleCodeExporter commented
The delay is necessary to give the phone some time to respond, as stated in the
comments. Note that the delay is only executed when there is no ADB connection,
so it does not in any way affect the operation of MicroBridge as soon as the
connection has been established.
Original comment by inopia.s...@gmail.com
on 19 Jan 2012 at 9:43
- Changed state: Invalid