mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-18 00:30:36 +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;
|
return ret;
|
||||||
if (val > 255)
|
if (val > 255)
|
||||||
return netio_printf(netio, "-bad argument\n");
|
return netio_printf(netio, "-bad argument\n");
|
||||||
atrf_reg_write(dsc, n, ret);
|
atrf_reg_write(dsc, n, val);
|
||||||
if (atrf_error(dsc))
|
if (atrf_error(dsc))
|
||||||
return netio_printf(netio, "-I/O error\n");
|
return netio_printf(netio, "-I/O error\n");
|
||||||
return netio_printf(netio, "+\n");
|
return netio_printf(netio, "+\n");
|
||||||
|
@ -321,15 +321,22 @@ static int atnet_buf_read(void *dsc, void *buf, int size)
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
n = netio_read_until(netio, " ", tmp, sizeof(tmp)-1, NULL);
|
n = netio_read_until(netio, " ", tmp, sizeof(tmp)-1, NULL);
|
||||||
|
if (n < 0)
|
||||||
|
goto fail;
|
||||||
|
tmp[n] = 0;
|
||||||
if (*tmp == '-') {
|
if (*tmp == '-') {
|
||||||
tmp[n] = 0;
|
fprintf(stderr, "%s ", tmp+1);
|
||||||
fprintf(stderr, "%s\n", 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;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (*tmp != '+' || n < 3) /* +0<spc> */
|
if (*tmp != '+' || n < 2) /* +0<spc> */
|
||||||
goto invalid;
|
goto invalid;
|
||||||
len = strtoul(tmp+1, &end, 0);
|
len = strtoul(tmp+1, &end, 0);
|
||||||
if (*end != ' ')
|
if (*end)
|
||||||
goto invalid;
|
goto invalid;
|
||||||
if (len > size) {
|
if (len > size) {
|
||||||
fprintf(stderr, "buffer overflow\n");
|
fprintf(stderr, "buffer overflow\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user