Discard the additional bytes inside the init function.

This commit is contained in:
Jef Driesen 2010-11-04 20:50:28 +01:00
parent 57ae6b2c13
commit f8e8bd3b54

View File

@ -213,6 +213,9 @@ oceanic_atom2_init (oceanic_atom2_device_t *device)
if (rc != DEVICE_STATUS_SUCCESS) if (rc != DEVICE_STATUS_SUCCESS)
return rc; return rc;
// Discard all additional bytes (if there are any)
serial_flush (device->port, SERIAL_QUEUE_INPUT);
return DEVICE_STATUS_SUCCESS; return DEVICE_STATUS_SUCCESS;
} }
@ -289,9 +292,6 @@ oceanic_atom2_device_open (device_t **out, const char* name)
return status; return status;
} }
// Make sure everything is in a sane state.
serial_flush (device->port, SERIAL_QUEUE_BOTH);
// Switch the device from surface mode into download mode. Before sending // Switch the device from surface mode into download mode. Before sending
// this command, the device needs to be in PC mode (automatically activated // this command, the device needs to be in PC mode (automatically activated
// by connecting the device), or already in download mode. // by connecting the device), or already in download mode.