summaryrefslogtreecommitdiffstats
path: root/servers/fpga_server_lin/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-26 21:52:21 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-26 21:52:21 -0500
commit9c9085621bf01f9b39e15eb856ff521ecb01fccf (patch)
tree0d912f472a89ffccbcc3bb79ceed6a2b3a350118 /servers/fpga_server_lin/src
parentb2f2dba837c0d28bf73ec36933af901f484633f5 (diff)
downloadulab-9c9085621bf01f9b39e15eb856ff521ecb01fccf.tar.gz
ulab-9c9085621bf01f9b39e15eb856ff521ecb01fccf.zip
Fix krb client/server sockets
Diffstat (limited to 'servers/fpga_server_lin/src')
-rw-r--r--servers/fpga_server_lin/src/fpga_conn.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp
index 1b0927c..1335a5a 100644
--- a/servers/fpga_server_lin/src/fpga_conn.cpp
+++ b/servers/fpga_server_lin/src/fpga_conn.cpp
@@ -110,9 +110,15 @@ int FPGASocket::setupSerial() {
tcgetattr(m_fd_tty, &oldtio); // Save current port settings
long serialBaud;
- if (desiredBaudRate == "9600") {
+ if (desiredBaudRate == "1200") {
+ serialBaud = B1200;
+ }
+ else if (desiredBaudRate == "9600") {
serialBaud = B9600;
}
+ else if (desiredBaudRate == "19200") {
+ serialBaud = B19200;
+ }
else if (desiredBaudRate == "115200") {
serialBaud = B115200;
}
@@ -139,22 +145,26 @@ int FPGASocket::setupSerial() {
}
int FPGASocket::enterCommandLoop() {
+ int cc;
+ char buffer[10000];
+
m_criticalSection++;
try {
while (state() == TQSocket::Connected) {
- // RAJA FIXME
-// cc = read(fd_tty, readbuf, 100000);
-// if (cc > 0) {
-// write_data_to_client(fd, readbuf, cc);
-// fsync(fd_tty);
-// printf("[DEBUG] Got %d bytes from the serial port\n\r", cc); fflush(stdout);
-// }
-// cc = read(fd, writebuf, 100000);
-// if (cc > 0) {
-// write(fd_tty, writebuf, cc);
-// fsync(fd);
-// printf("[DEBUG] Got %d bytes from the network interface\n\r", cc); fflush(stdout);
-// }
+ cc = read(m_fd_tty, buffer, 10000);
+ if (cc > 0) {
+ writeBlock(buffer, cc);
+ printf("[DEBUG] Got %d bytes from the serial port\n\r", cc); fflush(stdout);
+ }
+ if (canReadLine()) {
+ cc = readBlock(buffer, 10000);
+ if (cc > 0) {
+ if (write(m_fd_tty, buffer, cc) < 0) {
+ // ERROR
+ }
+ printf("[DEBUG] Got %d bytes from the network interface\n\r", cc); fflush(stdout);
+ }
+ }
}
m_criticalSection--;