diff --git a/wireless/ieee802154/i8sak/Makefile b/wireless/ieee802154/i8sak/Makefile index 530740af5..cef46ecfe 100644 --- a/wireless/ieee802154/i8sak/Makefile +++ b/wireless/ieee802154/i8sak/Makefile @@ -47,8 +47,9 @@ STACKSIZE = 4096 # IEEE 802.15.4 SAK (Swiss Army Knife) ASRCS = -CSRCS = i8sak_acceptassoc.c i8sak_assoc.c i8sak_blaster.c i8sak_poll.c -CSRCS += i8sak_sniffer.c i8sak_startpan.c i8sak_tx.c wpanlistener.c +CSRCS = i8sak_acceptassoc.c i8sak_assoc.c i8sak_scan.c i8sak_blaster.c i8sak_poll.c +CSRCS += i8sak_sniffer.c i8sak_startpan.c i8sak_tx.c i8sak_chan.c +CSRCS += wpanlistener.c MAINSRC = i8sak_main.c AOBJS = $(ASRCS:.S=$(OBJEXT)) diff --git a/wireless/ieee802154/i8sak/i8sak.h b/wireless/ieee802154/i8sak/i8sak.h index c9508ce14..0d6d1395a 100644 --- a/wireless/ieee802154/i8sak/i8sak.h +++ b/wireless/ieee802154/i8sak/i8sak.h @@ -146,7 +146,7 @@ struct i8sak_s /* Settings */ - uint8_t chnum; + uint8_t chan; uint8_t chpage; struct ieee802154_addr_s addr; struct ieee802154_addr_s ep; @@ -154,6 +154,9 @@ struct i8sak_s uint8_t payload[IEEE802154_MAX_MAC_PAYLOAD_SIZE]; uint16_t payload_len; int blasterperiod; + + struct ieee802154_pandesc_s pandescs[CONFIG_MAC802154_NPANDESC]; + uint8_t npandesc; }; /**************************************************************************** @@ -175,10 +178,12 @@ bool i8sak_str2bool(FAR const char *str); void i8sak_startpan_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); void i8sak_acceptassoc_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); void i8sak_assoc_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); +void i8sak_scan_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); void i8sak_tx_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); void i8sak_poll_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); void i8sak_sniffer_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); void i8sak_blaster_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); +void i8sak_chan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]); /**************************************************************************** * Inline Functions diff --git a/wireless/ieee802154/i8sak/i8sak_assoc.c b/wireless/ieee802154/i8sak/i8sak_assoc.c index da34816ab..d8ef39b41 100644 --- a/wireless/ieee802154/i8sak/i8sak_assoc.c +++ b/wireless/ieee802154/i8sak/i8sak_assoc.c @@ -79,10 +79,12 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) { struct ieee802154_assoc_req_s assocreq; struct wpanlistener_eventfilter_s filter; + FAR struct ieee802154_pandesc_s *pandesc; int fd; int option; int optcnt; int ret; + uint8_t resindex; /* If the addresses has never been automatically or manually set before, set * it assuming that we are the default device address and the endpoint is the @@ -96,7 +98,7 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) } optcnt = 0; - while ((option = getopt(argc, argv, ":hs:e:")) != ERROR) + while ((option = getopt(argc, argv, ":hr:s:e:")) != ERROR) { optcnt++; switch (option) @@ -105,12 +107,31 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) fprintf(stderr, "Requests association with endpoint\n" "Usage: %s [-h]\n" " -h = this help menu\n" + " -r = use scan result index\n" , argv[0]); /* Must manually reset optind if we are going to exit early */ optind = -1; return; + case 'r': + resindex = i8sak_str2luint8(optarg); + + if (resindex >= i8sak->npandesc) + { + fprintf(stderr, "ERROR: missing argument\n"); + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + i8sak_cmd_error(i8sak); /* This exits for us */ + } + + pandesc = &i8sak->pandescs[resindex]; + + i8sak->chan = pandesc->chan; + i8sak->chpage = pandesc->chpage; + memcpy(&i8sak->ep, &pandesc->coordaddr, sizeof(struct ieee802154_addr_s)); + break; case 's': /* Parse extended address and put it into the i8sak instance */ @@ -158,15 +179,6 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) i8sak_cmd_error(i8sak); } - if (argc < 2) - { - /* TODO: Perform a scan operation here, to determine addressing information - * of coordinator. - */ - - fprintf(stderr, "i8sak: scan not implemented. Using default values\n"); - } - /* Register new callback for receiving the association notifications */ memset(&filter, 0, sizeof(struct wpanlistener_eventfilter_s)); @@ -177,7 +189,7 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) printf("i8sak: issuing ASSOC. request\n"); - assocreq.chnum = i8sak->chnum; + assocreq.chan = i8sak->chan; assocreq.chpage = i8sak->chpage; memcpy(&assocreq.coordaddr, &i8sak->ep, sizeof(struct ieee802154_addr_s)); diff --git a/wireless/ieee802154/i8sak/i8sak_chan.c b/wireless/ieee802154/i8sak/i8sak_chan.c new file mode 100644 index 000000000..0c27999ef --- /dev/null +++ b/wireless/ieee802154/i8sak/i8sak_chan.c @@ -0,0 +1,139 @@ +/**************************************************************************** + * apps/wireless/ieee802154/i8sak/i8sak_chan.c + * IEEE 802.15.4 Swiss Army Knife + * + * Copyright (C) 2017 Verge Inc. All rights reserved. + * Author: Anthony Merlino + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + + /**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "i8sak.h" + +#include +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name : i8sak_chan_cmd + * + * Description : + * Try and extract data from the coordinator + ****************************************************************************/ + +void i8sak_chan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) +{ + int option; + int fd; + int argind; + bool getchan = false; + uint8_t channel; + + argind = 1; + while ((option = getopt(argc, argv, ":hg")) != ERROR) + { + switch (option) + { + argind++; + case 'h': + fprintf(stderr, "Polls coordinator for data\n" + "Usage: %s [-h]\n" + " -h = this help menu\n" + , argv[0]); + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + return; + case 'g': + getchan = true; + break; + + case ':': + fprintf(stderr, "ERROR: missing argument\n"); + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + i8sak_cmd_error(i8sak); /* This exits for us */ + case '?': + fprintf(stderr, "ERROR: unknown argument\n"); + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + i8sak_cmd_error(i8sak); /* This exits for us */ + } + } + + if (!getchan) + { + if (argc < argind + 1) + { + fprintf(stderr, "ERROR: missing channel\n"); + i8sak_cmd_error(i8sak); /* This exits for us */ + } + + channel = i8sak_str2luint8(argv[argind]); + } + + fd = open(i8sak->devname, O_RDWR); + if (fd < 0) + { + printf("cannot open %s, errno=%d\n", i8sak->devname, errno); + i8sak_cmd_error(i8sak); + } + + if (getchan) + { + ieee802154_getchan(fd, &channel); + printf("i8sak: Channel: %d\n", (int)channel); + } + else + { + printf("i8sak: Setting Channel: %d\n", (int)channel); + ieee802154_setchan(fd, channel); + } + + close(fd); +} diff --git a/wireless/ieee802154/i8sak/i8sak_main.c b/wireless/ieee802154/i8sak/i8sak_main.c index 96586778f..0e15fe48e 100644 --- a/wireless/ieee802154/i8sak/i8sak_main.c +++ b/wireless/ieee802154/i8sak/i8sak_main.c @@ -104,10 +104,12 @@ static const struct i8sak_command_s g_i8sak_commands[] = {"startpan", (CODE void *)i8sak_startpan_cmd}, {"acceptassoc", (CODE void *)i8sak_acceptassoc_cmd}, {"assoc", (CODE void *)i8sak_assoc_cmd}, + {"scan", (CODE void *)i8sak_scan_cmd}, {"tx", (CODE void *)i8sak_tx_cmd}, {"poll", (CODE void *)i8sak_poll_cmd}, {"sniffer", (CODE void *)i8sak_sniffer_cmd}, {"blaster", (CODE void *)i8sak_blaster_cmd}, + {"chan", (CODE void *)i8sak_chan_cmd}, }; #define NCOMMANDS (sizeof(g_i8sak_commands) / sizeof(struct i8sak_command_s)) @@ -559,7 +561,7 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname) i8sak->daemon_started = false; i8sak->daemon_shutdown = false; - i8sak->chnum = CONFIG_IEEE802154_I8SAK_CHNUM; + i8sak->chan = CONFIG_IEEE802154_I8SAK_CHNUM; i8sak->chpage = CONFIG_IEEE802154_I8SAK_CHPAGE; if (strlen(devname) > I8SAK_MAX_DEVNAME) @@ -730,11 +732,13 @@ static int i8sak_showusage(FAR const char *progname, int exitcode) fprintf(stderr, "Usage: %s\n" " startpan [-h]\n" " acceptassoc [-h|e ]\n" - " assoc [-h] [] \n" + " scan [-h|p|a|e] minch-maxch\n" + " assoc [-h] []\n" " tx [-h|d] \n" " poll [-h]\n" " blaster [-h|q|f |p ]\n" " sniffer [-h|q]\n" + " chan [-h|g] []" , progname); exit(exitcode); } diff --git a/wireless/ieee802154/i8sak/i8sak_poll.c b/wireless/ieee802154/i8sak/i8sak_poll.c index 7db6eaf48..e62a7f7a9 100644 --- a/wireless/ieee802154/i8sak/i8sak_poll.c +++ b/wireless/ieee802154/i8sak/i8sak_poll.c @@ -83,7 +83,6 @@ void i8sak_poll_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) int fd; int ret; - ret = OK; while ((option = getopt(argc, argv, ":h")) != ERROR) { switch (option) @@ -112,11 +111,6 @@ void i8sak_poll_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) } } - if (ret != OK) - { - i8sak_cmd_error(i8sak); - } - fd = open(i8sak->devname, O_RDWR); if (fd < 0) { diff --git a/wireless/ieee802154/i8sak/i8sak_scan.c b/wireless/ieee802154/i8sak/i8sak_scan.c new file mode 100644 index 000000000..3e22b2599 --- /dev/null +++ b/wireless/ieee802154/i8sak/i8sak_scan.c @@ -0,0 +1,253 @@ +/**************************************************************************** + * apps/wireless/ieee802154/i8sak/i8sak_scan.c + * IEEE 802.15.4 Swiss Army Knife + * + * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2017 Verge Inc. All rights reserved. + * + * Author: Anthony Merlino + * Author: Gregory Nuttx + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "i8sak.h" + +#include +#include +#include "wireless/ieee802154.h" + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static void scan_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *arg); + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name : i8sak_scan_cmd + * + * Description : + * Request association with the Coordinator + ****************************************************************************/ + +void i8sak_scan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) +{ + struct ieee802154_scan_req_s scan; + struct wpanlistener_eventfilter_s filter; + int fd; + int option; + int argind; + int i; + int minchannel; + int maxchannel; + + scan.type = IEEE802154_SCANTYPE_PASSIVE; + + argind = 1; + while ((option = getopt(argc, argv, ":hpae")) != ERROR) + { + argind++; + switch (option) + { + case 'h': + fprintf(stderr, "Requests association with endpoint\n" + "Usage: %s [-h|p|a|e] minCh-maxCh\n" + " -h = this help menu\n" + " -p = passive scan (default)\n" + " -a = active scan\n" + " -e = energy scan\n" + , argv[0]); + + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + return; + + case 'p': + scan.type = IEEE802154_SCANTYPE_PASSIVE; + break; + + case 'a': + scan.type = IEEE802154_SCANTYPE_ACTIVE; + break; + + case 'e': + scan.type = IEEE802154_SCANTYPE_ED; + break; + + case ':': + fprintf(stderr, "ERROR: missing argument\n"); + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + i8sak_cmd_error(i8sak); /* This exits for us */ + + case '?': + fprintf(stderr, "ERROR: unknown argument\n"); + /* Must manually reset optind if we are going to exit early */ + + optind = -1; + i8sak_cmd_error(i8sak); /* This exits for us */ + } + } + + /* There should always be one argument after the list option argument */ + + if (argc != argind + 1) + { + fprintf(stderr, "ERROR: invalid channel list\n"); + i8sak_cmd_error(i8sak); + } + + scan.duration = 5; + scan.chpage = i8sak->chpage; + + /* Parse channel list */ + + sscanf(argv[argind], "%d-%d", &minchannel, &maxchannel); + + scan.numchan = maxchannel - minchannel + 1; + + if (scan.numchan > 15) + { + fprintf(stderr, "ERROR: too many channels\n"); + i8sak_cmd_error(i8sak); + } + + for (i = 0; i < scan.numchan; i++) + { + scan.channels[i] = minchannel + i; + } + + fd = open(i8sak->devname, O_RDWR); + if (fd < 0) + { + printf("i8sak: cannot open %s, errno=%d\n", i8sak->devname, errno); + i8sak_cmd_error(i8sak); + } + + /* Register new callback for receiving the scan confirmation notification */ + + memset(&filter, 0, sizeof(struct wpanlistener_eventfilter_s)); + filter.confevents.scan = true; + + wpanlistener_add_eventreceiver(&i8sak->wpanlistener, scan_eventcb, &filter, + (FAR void *)i8sak, true); + + printf("i8sak: starting scan\n"); + + ieee802154_scan_req(fd, &scan); + + close(fd); +} + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static void scan_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *arg) +{ + FAR struct i8sak_s *i8sak = (FAR struct i8sak_s *)arg; + FAR struct ieee802154_scan_conf_s *scan = ¬if->u.scanconf; + int i; + + printf("\n\ni8sak: Scan complete: %s\n", + IEEE802154_STATUS_STRING[scan->status]); + + printf("Scan type: "); + + switch (scan->type) + { + case IEEE802154_SCANTYPE_ACTIVE: + printf("Active\n"); + break; + case IEEE802154_SCANTYPE_PASSIVE: + printf("Passive\n"); + break; + case IEEE802154_SCANTYPE_ED: + printf("Energy\n"); + break; + default: + printf("Unknown\n"); + break; + } + + /* Copy the results from the notification */ + + i8sak->npandesc = scan->numdesc; + memcpy(i8sak->pandescs, scan->pandescs, + sizeof(struct ieee802154_pandesc_s) * i8sak->npandesc); + + printf("Scan results: \n"); + + for (i = 0; i < scan->numdesc; i++) + { + printf("Result %d\n", i); + printf(" Channel: %u\n", scan->pandescs[i].chan); + printf(" PAN ID: %02X:%02X\n", + scan->pandescs[i].coordaddr.panid[0], + scan->pandescs[i].coordaddr.panid[1]); + + if (scan->pandescs[i].coordaddr.mode == IEEE802154_ADDRMODE_SHORT) + { + printf(" Coordinator saddr: %02X:%02X\n", + scan->pandescs[i].coordaddr.saddr[0], + scan->pandescs[i].coordaddr.saddr[1]); + } + else + { + printf(" Coordinator eaddr: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", + scan->pandescs[i].coordaddr.eaddr[0], + scan->pandescs[i].coordaddr.eaddr[1], + scan->pandescs[i].coordaddr.eaddr[2], + scan->pandescs[i].coordaddr.eaddr[3], + scan->pandescs[i].coordaddr.eaddr[4], + scan->pandescs[i].coordaddr.eaddr[5], + scan->pandescs[i].coordaddr.eaddr[6], + scan->pandescs[i].coordaddr.eaddr[7]); + } + } +} diff --git a/wireless/ieee802154/i8sak/i8sak_startpan.c b/wireless/ieee802154/i8sak/i8sak_startpan.c index 5a09a58d7..1f45a534b 100644 --- a/wireless/ieee802154/i8sak/i8sak_startpan.c +++ b/wireless/ieee802154/i8sak/i8sak_startpan.c @@ -189,7 +189,7 @@ void i8sak_startpan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) printf("i8sak: starting PAN\n"); IEEE802154_PANIDCOPY(startreq.panid, i8sak->addr.panid); - startreq.chnum = i8sak->chnum; + startreq.chan = i8sak->chan; startreq.chpage = i8sak->chpage; if (beaconenabled) diff --git a/wireless/ieee802154/i8sak/i8sak_tx.c b/wireless/ieee802154/i8sak/i8sak_tx.c index 56fc83454..00a67aabe 100644 --- a/wireless/ieee802154/i8sak/i8sak_tx.c +++ b/wireless/ieee802154/i8sak/i8sak_tx.c @@ -126,15 +126,11 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]) case '?': fprintf(stderr, "ERROR: unknown argument\n"); ret = ERROR; - break; + optind = -1; + i8sak_cmd_error(i8sak); } } - if (ret != OK) - { - i8sak_cmd_error(i8sak); - } - if (argc == argind + 1) { i8sak->payload_len = i8sak_str2payload(argv[1], &i8sak->payload[0]); diff --git a/wireless/ieee802154/libmac/ieee802154_getchan.c b/wireless/ieee802154/libmac/ieee802154_getchan.c index c988e373b..132e03bb9 100644 --- a/wireless/ieee802154/libmac/ieee802154_getchan.c +++ b/wireless/ieee802154/libmac/ieee802154_getchan.c @@ -58,10 +58,10 @@ int ieee802154_getchan(int fd, FAR uint8_t *chan) struct ieee802154_get_req_s req; int ret; - req.attr = IEEE802154_ATTR_PHY_CURRENT_CHANNEL; + req.attr = IEEE802154_ATTR_PHY_CHAN; ret = ieee802154_get_req(fd, &req); - *chan = req.attrval.phy.channel; + *chan = req.attrval.phy.chan; return ret; } diff --git a/wireless/ieee802154/libmac/ieee802154_geteaddr.c b/wireless/ieee802154/libmac/ieee802154_geteaddr.c index 773c7ffe8..0e7b26c41 100644 --- a/wireless/ieee802154/libmac/ieee802154_geteaddr.c +++ b/wireless/ieee802154/libmac/ieee802154_geteaddr.c @@ -58,7 +58,7 @@ int ieee802154_geteaddr(int fd, FAR uint8_t *eaddr) struct ieee802154_get_req_s req; int ret; - req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR; + req.attr = IEEE802154_ATTR_MAC_EADDR; ret = ieee802154_get_req(fd, &req); IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr); diff --git a/wireless/ieee802154/libmac/ieee802154_getsaddr.c b/wireless/ieee802154/libmac/ieee802154_getsaddr.c index cd20cc126..850e82ead 100644 --- a/wireless/ieee802154/libmac/ieee802154_getsaddr.c +++ b/wireless/ieee802154/libmac/ieee802154_getsaddr.c @@ -58,7 +58,7 @@ int ieee802154_getsaddr(int fd, FAR uint8_t *saddr) struct ieee802154_get_req_s req; int ret; - req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS; + req.attr = IEEE802154_ATTR_MAC_SADDR; ret = ieee802154_get_req(fd, &req); IEEE802154_SADDRCOPY(saddr, req.attrval.mac.saddr); diff --git a/wireless/ieee802154/libmac/ieee802154_setchan.c b/wireless/ieee802154/libmac/ieee802154_setchan.c index bac4bc6f7..4f3488dc2 100644 --- a/wireless/ieee802154/libmac/ieee802154_setchan.c +++ b/wireless/ieee802154/libmac/ieee802154_setchan.c @@ -57,8 +57,8 @@ int ieee802154_setchan(int fd, uint8_t chan) { struct ieee802154_set_req_s req; - req.attr = IEEE802154_ATTR_PHY_CURRENT_CHANNEL; - req.attrval.phy.channel = chan; + req.attr = IEEE802154_ATTR_PHY_CHAN; + req.attrval.phy.chan = chan; return ieee802154_set_req(fd, &req); } diff --git a/wireless/ieee802154/libmac/ieee802154_seteaddr.c b/wireless/ieee802154/libmac/ieee802154_seteaddr.c index 19494eafd..d7f22d97a 100644 --- a/wireless/ieee802154/libmac/ieee802154_seteaddr.c +++ b/wireless/ieee802154/libmac/ieee802154_seteaddr.c @@ -58,7 +58,7 @@ int ieee802154_seteaddr(int fd, FAR const uint8_t *eaddr) { struct ieee802154_set_req_s req; - req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR; + req.attr = IEEE802154_ATTR_MAC_EADDR; IEEE802154_EADDRCOPY(req.attrval.mac.eaddr, eaddr); return ieee802154_set_req(fd, &req); diff --git a/wireless/ieee802154/libmac/ieee802154_setsaddr.c b/wireless/ieee802154/libmac/ieee802154_setsaddr.c index 20f2fa544..31675cce8 100644 --- a/wireless/ieee802154/libmac/ieee802154_setsaddr.c +++ b/wireless/ieee802154/libmac/ieee802154_setsaddr.c @@ -58,7 +58,7 @@ int ieee802154_setsaddr(int fd, FAR const uint8_t *saddr) { struct ieee802154_set_req_s req; - req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS; + req.attr = IEEE802154_ATTR_MAC_SADDR; IEEE802154_SADDRCOPY(req.attrval.mac.saddr, saddr); return ieee802154_set_req(fd, &req); diff --git a/wireless/ieee802154/libmac/sixlowpan_getchan.c b/wireless/ieee802154/libmac/sixlowpan_getchan.c index f445d421e..fddc17f77 100644 --- a/wireless/ieee802154/libmac/sixlowpan_getchan.c +++ b/wireless/ieee802154/libmac/sixlowpan_getchan.c @@ -58,10 +58,10 @@ int sixlowpan_getchan(int sock, FAR const char *ifname, FAR uint8_t *chan) struct ieee802154_get_req_s req; int ret; - req.attr = IEEE802154_ATTR_PHY_CURRENT_CHANNEL; + req.attr = IEEE802154_ATTR_PHY_CHAN; ret = sixlowpan_get_req(sock, ifname, &req); - *chan = req.attrval.phy.channel; + *chan = req.attrval.phy.chan; return ret; } diff --git a/wireless/ieee802154/libmac/sixlowpan_geteaddr.c b/wireless/ieee802154/libmac/sixlowpan_geteaddr.c index 0344d43c6..18a23d2df 100644 --- a/wireless/ieee802154/libmac/sixlowpan_geteaddr.c +++ b/wireless/ieee802154/libmac/sixlowpan_geteaddr.c @@ -58,7 +58,7 @@ int sixlowpan_geteaddr(int sock, FAR const char *ifname, FAR uint8_t *eaddr) struct ieee802154_get_req_s req; int ret; - req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR; + req.attr = IEEE802154_ATTR_MAC_EADDR; ret = sixlowpan_get_req(sock, ifname, &req); IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr); diff --git a/wireless/ieee802154/libmac/sixlowpan_getsaddr.c b/wireless/ieee802154/libmac/sixlowpan_getsaddr.c index ef221190c..e721ca3bb 100644 --- a/wireless/ieee802154/libmac/sixlowpan_getsaddr.c +++ b/wireless/ieee802154/libmac/sixlowpan_getsaddr.c @@ -58,7 +58,7 @@ int sixlowpan_getsaddr(int sock, FAR const char *ifname, FAR uint8_t *saddr) struct ieee802154_get_req_s req; int ret; - req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS; + req.attr = IEEE802154_ATTR_MAC_SADDR; ret = sixlowpan_get_req(sock, ifname, &req); IEEE802154_SADDRCOPY(saddr, req.attrval.mac.saddr); diff --git a/wireless/ieee802154/libmac/sixlowpan_setchan.c b/wireless/ieee802154/libmac/sixlowpan_setchan.c index c4e746b8c..04d44f382 100644 --- a/wireless/ieee802154/libmac/sixlowpan_setchan.c +++ b/wireless/ieee802154/libmac/sixlowpan_setchan.c @@ -57,8 +57,8 @@ int sixlowpan_setchan(int sock, FAR const char *ifname, uint8_t chan) { struct ieee802154_set_req_s req; - req.attr = IEEE802154_ATTR_PHY_CURRENT_CHANNEL; - req.attrval.phy.channel = chan; + req.attr = IEEE802154_ATTR_PHY_CHAN; + req.attrval.phy.chan = chan; return sixlowpan_set_req(sock, ifname, &req); } diff --git a/wireless/ieee802154/libmac/sixlowpan_seteaddr.c b/wireless/ieee802154/libmac/sixlowpan_seteaddr.c index 9f3dcb46d..3aa114f95 100644 --- a/wireless/ieee802154/libmac/sixlowpan_seteaddr.c +++ b/wireless/ieee802154/libmac/sixlowpan_seteaddr.c @@ -57,7 +57,7 @@ int sixlowpan_seteaddr(int sock, FAR const char *ifname, FAR const uint8_t *eadd { struct ieee802154_set_req_s req; - req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR; + req.attr = IEEE802154_ATTR_MAC_EADDR; IEEE802154_EADDRCOPY(req.attrval.mac.eaddr, eaddr); return sixlowpan_set_req(sock, ifname, &req); diff --git a/wireless/ieee802154/libmac/sixlowpan_setsaddr.c b/wireless/ieee802154/libmac/sixlowpan_setsaddr.c index 49c46f28b..02260d73c 100644 --- a/wireless/ieee802154/libmac/sixlowpan_setsaddr.c +++ b/wireless/ieee802154/libmac/sixlowpan_setsaddr.c @@ -57,7 +57,7 @@ int sixlowpan_setsaddr(int sock, FAR const char *ifname, FAR const uint8_t *sadd { struct ieee802154_set_req_s req; - req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS; + req.attr = IEEE802154_ATTR_MAC_SADDR; IEEE802154_SADDRCOPY(req.attrval.mac.saddr, saddr); return sixlowpan_set_req(sock, ifname, &req);