1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 18:47:11 +02:00

tools/: API change - atrf_open now requires a string argument (can be NULL)

atrf_open(NULL) maintains the old behaviour. To select a driver, use
atrf_open("name") or atrf_open("name:driver-specific-arguments")
The driver name is "ben" or "usb".

- include/atrf.h (atrf_open), lib/atrf.c (do_atrf_open, atrf_open):
  atrf_open now requires the string argument for driver selection
- atrf-id/atrf-id.c (main), atrf-reset/atrf-reset.c (main),
  atrf-rssi/atrf-rssi.c (main), atrf-trim/atrf-trim.c (main),
  atrf-txrx/atrf-txrx.c (main), atrf-xtal/atrf-xtal.c (main):
  changed atrf_open() to atrf_open(NULL)
This commit is contained in:
Werner Almesberger 2011-04-09 21:13:11 -03:00
parent 4e64e7ad90
commit 5296fc8cf5
8 changed files with 12 additions and 18 deletions

View File

@ -168,7 +168,7 @@ int main(int argc, const char **argv)
if (argc != 1) if (argc != 1)
usage(*argv); usage(*argv);
dsc = atrf_open(); dsc = atrf_open(NULL);
if (!dsc) if (!dsc)
return 1; return 1;

View File

@ -1,8 +1,8 @@
/* /*
* atrf-reset/atrf-reset.c - Reset the transceiver or the whole board * atrf-reset/atrf-reset.c - Reset the transceiver or the whole board
* *
* Written 2010 by Werner Almesberger * Written 2010-2011 by Werner Almesberger
* Copyright 2010 Werner Almesberger * Copyright 2010-2011 Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -48,7 +48,7 @@ int main(int argc, const char **argv)
usage(*argv); usage(*argv);
} }
dsc = atrf_open(); dsc = atrf_open(NULL);
if (!dsc) if (!dsc)
return 1; return 1;

View File

@ -115,7 +115,7 @@ int main(int argc, char **argv)
signal(SIGINT, die); signal(SIGINT, die);
dsc = atrf_open(); dsc = atrf_open(NULL);
if (!dsc) if (!dsc)
return 1; return 1;

View File

@ -1,8 +1,8 @@
/* /*
* atrf-trim/atrf-trim.c - AT86RF230 oscillator trim utility * atrf-trim/atrf-trim.c - AT86RF230 oscillator trim utility
* *
* Written 2010 by Werner Almesberger * Written 2010-2011 by Werner Almesberger
* Copyright 2010 Werner Almesberger * Copyright 2010-2011 Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@ int main(int argc, const char **argv)
usage(*argv); usage(*argv);
} }
dsc = atrf_open(); dsc = atrf_open(NULL);
if (!dsc) if (!dsc)
return 1; return 1;

View File

@ -90,7 +90,7 @@ static struct atrf_dsc *init_txrx(int trim, unsigned mhz)
{ {
struct atrf_dsc *dsc; struct atrf_dsc *dsc;
dsc = atrf_open(); dsc = atrf_open(NULL);
if (!dsc) if (!dsc)
exit(1); exit(1);

View File

@ -145,7 +145,7 @@ int main(int argc, char *const *argv)
exit(1); exit(1);
} }
dsc = atrf_open(); dsc = atrf_open(NULL);
if (!dsc) if (!dsc)
return 1; return 1;

View File

@ -28,7 +28,7 @@ struct atrf_dsc;
void *atrf_usb_handle(struct atrf_dsc *dsc); /* hack for atrf-id */ void *atrf_usb_handle(struct atrf_dsc *dsc); /* hack for atrf-id */
struct atrf_dsc *atrf_open(void); struct atrf_dsc *atrf_open(const char *arg);
void atrf_close(struct atrf_dsc *dsc); void atrf_close(struct atrf_dsc *dsc);
int atrf_error(struct atrf_dsc *dsc); int atrf_error(struct atrf_dsc *dsc);

View File

@ -133,7 +133,7 @@ static const struct atrf_driver *select_driver(const char *arg,
} }
static struct atrf_dsc *do_atrf_open(const char *arg) struct atrf_dsc *atrf_open(const char *arg)
{ {
struct atrf_dsc *dsc; struct atrf_dsc *dsc;
const struct atrf_driver *driver; const struct atrf_driver *driver;
@ -158,12 +158,6 @@ static struct atrf_dsc *do_atrf_open(const char *arg)
} }
struct atrf_dsc *atrf_open(void)
{
return do_atrf_open(NULL);
}
void atrf_close(struct atrf_dsc *dsc) void atrf_close(struct atrf_dsc *dsc)
{ {
if (dsc->driver->close) if (dsc->driver->close)