aboutsummaryrefslogtreecommitdiff
path: root/rpc_client_serial.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-06-30 21:52:59 -0400
committerPaul Selkirk <paul@psgd.org>2016-06-30 21:52:59 -0400
commit3ba7ca4155c7be439108b174a3b49a508923d378 (patch)
treec066815bbb29ad52fd309c6b5103cbd1bb9716c3 /rpc_client_serial.c
parent709a71c0030225ba08cddf5227a1c67c2dbb4176 (diff)
RPC wire format now includes client handle in all requests, and opcode and
client handle in all responses. This simplies the daemon a little, and means that the directly-connected serial client uses the same wire format as the daemon. The expense is some redundant code in rpc_client and rpc_server to process (and throw away) this extra stuff.
Diffstat (limited to 'rpc_client_serial.c')
-rw-r--r--rpc_client_serial.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/rpc_client_serial.c b/rpc_client_serial.c
index ec53e05..b27c255 100644
--- a/rpc_client_serial.c
+++ b/rpc_client_serial.c
@@ -44,8 +44,11 @@
#include "hal_internal.h"
#include "slip_internal.h"
-#define DEVICE "/dev/ttyUSB0"
-#define SPEED B115200
+/* XXX These REALLY ought to be passed from the client app command line,
+ * rather than compiled into the library.
+ */
+#define DEVICE "/dev/ttyUSB1"
+#define SPEED B921600
hal_error_t hal_rpc_client_transport_init(void)
{
@@ -64,5 +67,8 @@ hal_error_t hal_rpc_send(const uint8_t * const buf, const size_t len)
hal_error_t hal_rpc_recv(uint8_t * const buf, size_t * const len)
{
- return hal_slip_recv(buf, *len);
+ size_t maxlen = *len;
+ *len = 0;
+ hal_error_t err = hal_slip_recv(buf, len, maxlen);
+ return err;
}