mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-17 21:56:15 +02:00
tools/lib/: atnet now works (tried atrf-txrx send and receive, atrf-rssi)
- atrf-proxy/atrf-proxy.c (cmd_two): "SET" wrote the wrong value - lib/atnet.c (atnet_buf_read): cleaned up the logic and fixed some small bugs
This commit is contained in:
parent
803d40878e
commit
4246535456
@ -73,7 +73,7 @@ static int cmd_two(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
|
||||
return ret;
|
||||
if (val > 255)
|
||||
return netio_printf(netio, "-bad argument\n");
|
||||
atrf_reg_write(dsc, n, ret);
|
||||
atrf_reg_write(dsc, n, val);
|
||||
if (atrf_error(dsc))
|
||||
return netio_printf(netio, "-I/O error\n");
|
||||
return netio_printf(netio, "+\n");
|
||||
|
@ -321,15 +321,22 @@ static int atnet_buf_read(void *dsc, void *buf, int size)
|
||||
goto fail;
|
||||
|
||||
n = netio_read_until(netio, " ", tmp, sizeof(tmp)-1, NULL);
|
||||
if (n < 0)
|
||||
goto fail;
|
||||
tmp[n] = 0;
|
||||
if (*tmp == '-') {
|
||||
tmp[n] = 0;
|
||||
fprintf(stderr, "%s\n", tmp+1);
|
||||
fprintf(stderr, "%s ", tmp+1);
|
||||
n = netio_read_until(netio, "\n", tmp, sizeof(tmp)-1, NULL);
|
||||
if (n >= 0) {
|
||||
tmp[n] = 0;
|
||||
fprintf(stderr, "%s\n", tmp);
|
||||
}
|
||||
goto fail;
|
||||
}
|
||||
if (*tmp != '+' || n < 3) /* +0<spc> */
|
||||
if (*tmp != '+' || n < 2) /* +0<spc> */
|
||||
goto invalid;
|
||||
len = strtoul(tmp+1, &end, 0);
|
||||
if (*end != ' ')
|
||||
if (*end)
|
||||
goto invalid;
|
||||
if (len > size) {
|
||||
fprintf(stderr, "buffer overflow\n");
|
||||
|
Loading…
Reference in New Issue
Block a user