summaryrefslogtreecommitdiffstats
path: root/servers/fpga_server_lin/src/fpga_conn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/fpga_server_lin/src/fpga_conn.cpp')
-rw-r--r--servers/fpga_server_lin/src/fpga_conn.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp
index 6f4cecf..3acd499 100644
--- a/servers/fpga_server_lin/src/fpga_conn.cpp
+++ b/servers/fpga_server_lin/src/fpga_conn.cpp
@@ -161,13 +161,16 @@ int FPGASocket::setupSerial() {
void FPGASocket::commandLoop() {
int cc;
char buffer[10000];
+ bool transferred_data;
m_criticalSection++;
try {
+ transferred_data = false;
if (state() == TQSocket::Connected) {
cc = read(m_fd_tty, buffer, 10000);
if (cc > 0) {
writeBlock(buffer, cc);
+ transferred_data = true;
printf("[DEBUG] Got %d bytes from the serial port\n\r", cc); fflush(stdout);
}
if (canReadData()) {
@@ -176,12 +179,18 @@ void FPGASocket::commandLoop() {
if (write(m_fd_tty, buffer, cc) < 0) {
// ERROR
}
+ transferred_data = true;
printf("[DEBUG] Got %d bytes from the network interface\n\r", cc); fflush(stdout);
}
}
}
m_criticalSection--;
- if (m_loopTimer) m_loopTimer->start(0, TRUE);
+ if (transferred_data) {
+ if (m_loopTimer) m_loopTimer->start(0, TRUE);
+ }
+ else {
+ if (m_loopTimer) m_loopTimer->start(100, TRUE);
+ }
return;
}
catch (...) {