Skip to content
Snippets Groups Projects
Commit 776e2ed2 authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Fix reconnection

parent dcc9934b
No related branches found
No related tags found
No related merge requests found
......@@ -521,12 +521,9 @@ void USB2::write(const Tango::DevVarCharArray *argin)
"", init_error.c_str(), __PRETTY_FUNCTION__);
}
if (max(output_queue_length(), 0) != 0) {
close();
open();
reconnections += 1;
if (max(output_queue_length(), 0) != 0 || ! dev_handle)
goto error;
}
while (bytes_total < bytes_to_write) {
ssize_t bytes_written;
conn_state = libusb_bulk_transfer(dev_handle, ep_down,
......@@ -758,6 +755,9 @@ void USB2::_read(size_t bytes_to_read)
size_t bytes_total = data.size();
int bytes_readed;
if (! dev_handle)
goto error;
while (bytes_total < bytes_to_read) {
conn_state = libusb_bulk_transfer(dev_handle, ep_up, buffer,
maxPacketSize, &bytes_readed, timeout);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment