From 8d671956e20484ec040985820c0f5fb3a1e5a671 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 22 Apr 2017 07:23:44 -0600 Subject: [PATCH] wireless/ieee802154: libaudio and libmac need to return the correct error codes. --- .../ieee802154/libradio/ieee802154_energydetect.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_getcca.c | 7 +++++-- wireless/ieee802154/libradio/ieee802154_getchan.c | 12 ++++++++---- wireless/ieee802154/libradio/ieee802154_getdevmode.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_geteaddr.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_getpanid.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_getpromisc.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_getsaddr.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_gettxpwr.c | 7 ++++--- wireless/ieee802154/libradio/ieee802154_setcca.c | 4 +++- wireless/ieee802154/libradio/ieee802154_setchan.c | 9 +++++++-- wireless/ieee802154/libradio/ieee802154_setdevmode.c | 4 +++- wireless/ieee802154/libradio/ieee802154_seteaddr.c | 4 +++- wireless/ieee802154/libradio/ieee802154_setpanid.c | 4 +++- wireless/ieee802154/libradio/ieee802154_setpromisc.c | 4 +++- wireless/ieee802154/libradio/ieee802154_setsaddr.c | 4 ++-- wireless/ieee802154/libradio/ieee802154_settxpwr.c | 4 ++-- .../ieee802154/libradio/sixlowpan_energydetect.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_getcca.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_getchan.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_getdevmode.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_geteaddr.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_getpanid.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_getpromisc.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_getsaddr.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_gettxpwr.c | 7 ++++--- wireless/ieee802154/libradio/sixlowpan_setcca.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_setchan.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_setdevmode.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_seteaddr.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_setpanid.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_setpromisc.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_setsaddr.c | 4 ++-- wireless/ieee802154/libradio/sixlowpan_settxpwr.c | 4 ++-- 34 files changed, 119 insertions(+), 81 deletions(-) diff --git a/wireless/ieee802154/libradio/ieee802154_energydetect.c b/wireless/ieee802154/libradio/ieee802154_energydetect.c index 7af672431..9a8f0b5d9 100644 --- a/wireless/ieee802154/libradio/ieee802154_energydetect.c +++ b/wireless/ieee802154/libradio/ieee802154_energydetect.c @@ -61,10 +61,11 @@ int ieee802154_energydetect(int fd, FAR bool *energy) ret = ioctl(fd, PHY802154IOC_ENERGYDETECT, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_ENERGYDETECT failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_ENERGYDETECT failed: %d\n", ret); + return ret; } *energy = arg.energy; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_getcca.c b/wireless/ieee802154/libradio/ieee802154_getcca.c index 260470f5e..ca9f1e77b 100644 --- a/wireless/ieee802154/libradio/ieee802154_getcca.c +++ b/wireless/ieee802154/libradio/ieee802154_getcca.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -62,9 +63,11 @@ int ieee802154_getcca(int fd, FAR struct ieee802154_cca_s *cca) ret = ioctl(fd, PHY802154IOC_GET_CCA, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_GET_CCA failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_CCA failed\n", ret); + return ret; } memcpy(cca, &arg.cca, sizeof(struct ieee802154_cca_s)); - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_getchan.c b/wireless/ieee802154/libradio/ieee802154_getchan.c index 94641b8b9..2d367dc4b 100644 --- a/wireless/ieee802154/libradio/ieee802154_getchan.c +++ b/wireless/ieee802154/libradio/ieee802154_getchan.c @@ -39,12 +39,15 @@ ****************************************************************************/ #include + +#include #include #include -#include -#include +#include +#include #include + #include "wireless/ieee802154.h" /**************************************************************************** @@ -59,10 +62,11 @@ int ieee802154_getchan(int fd, FAR uint8_t *chan) ret = ioctl(fd, PHY802154IOC_GET_CHAN, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_GET_CHAN failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_CHAN failed: %d\n", ret); return ret; } *chan = arg.channel; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_getdevmode.c b/wireless/ieee802154/libradio/ieee802154_getdevmode.c index b82feec5e..d02f89959 100644 --- a/wireless/ieee802154/libradio/ieee802154_getdevmode.c +++ b/wireless/ieee802154/libradio/ieee802154_getdevmode.c @@ -61,10 +61,11 @@ int ieee802154_getdevmode(int fd, FAR uint8_t *devmode) ret = ioctl(fd, PHY802154IOC_GET_DEVMODE, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_DEVMODE failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_DEVMODE failed: %d\n", ret); + return ret; } *devmode = arg.devmode; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_geteaddr.c b/wireless/ieee802154/libradio/ieee802154_geteaddr.c index 589b80e29..7cf824b3d 100644 --- a/wireless/ieee802154/libradio/ieee802154_geteaddr.c +++ b/wireless/ieee802154/libradio/ieee802154_geteaddr.c @@ -62,10 +62,11 @@ int ieee802154_geteaddr(int fd, FAR uint8_t *eaddr) ret = ioctl(fd, PHY802154IOC_GET_EADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_EADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_EADDR failed: %d\n", ret); + return ret; } memcpy(eaddr, arg.eaddr, EADDR_SIZE); - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_getpanid.c b/wireless/ieee802154/libradio/ieee802154_getpanid.c index 7a5991d75..c9efdb5c8 100644 --- a/wireless/ieee802154/libradio/ieee802154_getpanid.c +++ b/wireless/ieee802154/libradio/ieee802154_getpanid.c @@ -61,10 +61,11 @@ int ieee802154_getpanid(int fd, FAR uint16_t *panid) ret = ioctl(fd, PHY802154IOC_GET_PANID, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_PANID failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_PANID failed: %d\n", ret); + return ret; } *panid = arg.panid; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_getpromisc.c b/wireless/ieee802154/libradio/ieee802154_getpromisc.c index 3a0b8c614..dbdc2a382 100644 --- a/wireless/ieee802154/libradio/ieee802154_getpromisc.c +++ b/wireless/ieee802154/libradio/ieee802154_getpromisc.c @@ -61,10 +61,11 @@ int ieee802154_getpromisc(int fd, FAR bool *promisc) ret = ioctl(fd, PHY802154IOC_GET_PROMISC, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_PROMISC failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_PROMISC failed: %d\n", ret); + return ret; } *promisc = arg.promisc; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_getsaddr.c b/wireless/ieee802154/libradio/ieee802154_getsaddr.c index 90d58c7bf..d82b59d4e 100644 --- a/wireless/ieee802154/libradio/ieee802154_getsaddr.c +++ b/wireless/ieee802154/libradio/ieee802154_getsaddr.c @@ -61,10 +61,11 @@ int ieee802154_getsaddr(int fd, FAR uint16_t *saddr) ret = ioctl(fd, PHY802154IOC_GET_SADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_SADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_SADDR failed: %d\n", ret); + return ret; } *saddr = arg.saddr; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_gettxpwr.c b/wireless/ieee802154/libradio/ieee802154_gettxpwr.c index 12ff275fd..5717e4ef3 100644 --- a/wireless/ieee802154/libradio/ieee802154_gettxpwr.c +++ b/wireless/ieee802154/libradio/ieee802154_gettxpwr.c @@ -61,10 +61,11 @@ int ieee802154_gettxpwr(int fd, FAR int32_t *txpwr) ret = ioctl(fd, PHY802154IOC_GET_TXPWR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_TXPWR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_TXPWR failed: %d\n", ret); + return ret; } *txpwr = arg.txpwr; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/ieee802154_setcca.c b/wireless/ieee802154/libradio/ieee802154_setcca.c index a916473c0..2b9da93f5 100644 --- a/wireless/ieee802154/libradio/ieee802154_setcca.c +++ b/wireless/ieee802154/libradio/ieee802154_setcca.c @@ -44,6 +44,7 @@ #include #include #include +#include #include @@ -64,7 +65,8 @@ int ieee802154_setcca(int fd, FAR struct ieee802154_cca_s *cca) ret = ioctl(fd, PHY802154IOC_SET_CCA, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_SET_CCA failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_CCA failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_setchan.c b/wireless/ieee802154/libradio/ieee802154_setchan.c index ea47c2e14..c5b47017f 100644 --- a/wireless/ieee802154/libradio/ieee802154_setchan.c +++ b/wireless/ieee802154/libradio/ieee802154_setchan.c @@ -39,11 +39,15 @@ ****************************************************************************/ #include + +#include #include #include -#include +#include + #include #include + #include "wireless/ieee802154.h" /**************************************************************************** @@ -60,7 +64,8 @@ int ieee802154_setchan(int fd, uint8_t chan) ret = ioctl(fd, PHY802154IOC_SET_CHAN, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_SET_CHAN failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_CHAN failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_setdevmode.c b/wireless/ieee802154/libradio/ieee802154_setdevmode.c index 3f9f4d076..59d3851dd 100644 --- a/wireless/ieee802154/libradio/ieee802154_setdevmode.c +++ b/wireless/ieee802154/libradio/ieee802154_setdevmode.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,8 @@ int ieee802154_setdevmode(int fd, uint8_t devmode) ret = ioctl(fd, PHY802154IOC_SET_DEVMODE, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_SET_DEVMODE failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_DEVMODE failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_seteaddr.c b/wireless/ieee802154/libradio/ieee802154_seteaddr.c index 297ebccfa..a5dbcdc48 100644 --- a/wireless/ieee802154/libradio/ieee802154_seteaddr.c +++ b/wireless/ieee802154/libradio/ieee802154_seteaddr.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -64,7 +65,8 @@ int ieee802154_seteaddr(int fd, FAR const uint8_t *eaddr) ret = ioctl(fd, PHY802154IOC_SET_EADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_SET_EADDR failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_EADDR failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_setpanid.c b/wireless/ieee802154/libradio/ieee802154_setpanid.c index 064f4f67d..7f5b92204 100644 --- a/wireless/ieee802154/libradio/ieee802154_setpanid.c +++ b/wireless/ieee802154/libradio/ieee802154_setpanid.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,8 @@ int ieee802154_setpanid(int fd, uint16_t panid) ret = ioctl(fd, PHY802154IOC_SET_PANID, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_SET_PANID failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_PANID failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_setpromisc.c b/wireless/ieee802154/libradio/ieee802154_setpromisc.c index 7eb196b65..f972dcaf8 100644 --- a/wireless/ieee802154/libradio/ieee802154_setpromisc.c +++ b/wireless/ieee802154/libradio/ieee802154_setpromisc.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -64,7 +65,8 @@ int ieee802154_setpromisc(int fd, bool promisc) ret = ioctl(fd, PHY802154IOC_SET_PROMISC, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - printf("PHY802154IOC_SET_PROMISC failed\n"); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_PROMISC failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_setsaddr.c b/wireless/ieee802154/libradio/ieee802154_setsaddr.c index 53f555f58..03d015058 100644 --- a/wireless/ieee802154/libradio/ieee802154_setsaddr.c +++ b/wireless/ieee802154/libradio/ieee802154_setsaddr.c @@ -64,8 +64,8 @@ int ieee802154_setsaddr(int fd, uint16_t saddr) ret = ioctl(fd, PHY802154IOC_SET_SADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_SADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_SADDR failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/ieee802154_settxpwr.c b/wireless/ieee802154/libradio/ieee802154_settxpwr.c index 0143a8d8c..2a285ecce 100644 --- a/wireless/ieee802154/libradio/ieee802154_settxpwr.c +++ b/wireless/ieee802154/libradio/ieee802154_settxpwr.c @@ -63,8 +63,8 @@ int ieee802154_settxpwr(int fd, int32_t txpwr) ret = ioctl(fd, PHY802154IOC_SET_TXPWR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_TXPWR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_TXPWR failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_energydetect.c b/wireless/ieee802154/libradio/sixlowpan_energydetect.c index 83fdf3742..9527a00d4 100644 --- a/wireless/ieee802154/libradio/sixlowpan_energydetect.c +++ b/wireless/ieee802154/libradio/sixlowpan_energydetect.c @@ -64,10 +64,11 @@ int sixlowpan_energydetect(int sock, FAR const char *ifname, FAR bool *energy) ret = ioctl(sock, PHY802154IOC_ENERGYDETECT, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_ENERGYDETECT failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_ENERGYDETECT failed: %d\n", ret); + return ret; } *energy = arg.u.energy; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_getcca.c b/wireless/ieee802154/libradio/sixlowpan_getcca.c index 62a282502..83a38871e 100644 --- a/wireless/ieee802154/libradio/sixlowpan_getcca.c +++ b/wireless/ieee802154/libradio/sixlowpan_getcca.c @@ -65,10 +65,11 @@ int sixlowpan_getcca(int sock, FAR const char *ifname, ret = ioctl(sock, PHY802154IOC_GET_CCA, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_CCA failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_CCA failed: %d\n", ret); + return ret; } memcpy(cca, &arg.u.cca, sizeof(struct ieee802154_cca_s)); - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_getchan.c b/wireless/ieee802154/libradio/sixlowpan_getchan.c index 24b53c293..6f0a5f5e6 100644 --- a/wireless/ieee802154/libradio/sixlowpan_getchan.c +++ b/wireless/ieee802154/libradio/sixlowpan_getchan.c @@ -64,10 +64,11 @@ int sixlowpan_getchan(int sock, FAR const char *ifname, FAR uint8_t *chan) ret = ioctl(sock, PHY802154IOC_GET_CHAN, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_CHAN failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_CHAN failed: %d\n", ret); + return ret; } *chan = arg.u.channel; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_getdevmode.c b/wireless/ieee802154/libradio/sixlowpan_getdevmode.c index 4e5c9d50c..71256beff 100644 --- a/wireless/ieee802154/libradio/sixlowpan_getdevmode.c +++ b/wireless/ieee802154/libradio/sixlowpan_getdevmode.c @@ -63,10 +63,11 @@ int sixlowpan_getdevmode(int sock, FAR const char *ifname, ret = ioctl(sock, PHY802154IOC_GET_DEVMODE, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_DEVMODE failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_DEVMODE failed: %d\n", ret); + return ret; } *devmode = arg.u.devmode; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_geteaddr.c b/wireless/ieee802154/libradio/sixlowpan_geteaddr.c index 2fa9d3069..9e89aab17 100644 --- a/wireless/ieee802154/libradio/sixlowpan_geteaddr.c +++ b/wireless/ieee802154/libradio/sixlowpan_geteaddr.c @@ -64,10 +64,11 @@ int sixlowpan_geteaddr(int sock, FAR const char *ifname, FAR uint8_t *eaddr) ret = ioctl(sock, PHY802154IOC_GET_EADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_EADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_EADDR failed: %d\n", ret); + return ret; } memcpy(eaddr, arg.u.eaddr, EADDR_SIZE); - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_getpanid.c b/wireless/ieee802154/libradio/sixlowpan_getpanid.c index 79b455744..88c0342e4 100644 --- a/wireless/ieee802154/libradio/sixlowpan_getpanid.c +++ b/wireless/ieee802154/libradio/sixlowpan_getpanid.c @@ -64,10 +64,11 @@ int sixlowpan_getpanid(int sock, FAR const char *ifname, FAR uint16_t *panid) ret = ioctl(sock, PHY802154IOC_GET_PANID, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_PANID failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_PANID failed: %d\n", ret); + return ret; } *panid = arg.u.panid; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_getpromisc.c b/wireless/ieee802154/libradio/sixlowpan_getpromisc.c index ef3596f2c..c12d215e4 100644 --- a/wireless/ieee802154/libradio/sixlowpan_getpromisc.c +++ b/wireless/ieee802154/libradio/sixlowpan_getpromisc.c @@ -64,10 +64,11 @@ int sixlowpan_getpromisc(int sock, FAR const char *ifname, FAR bool *promisc) ret = ioctl(sock, PHY802154IOC_GET_PROMISC, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_PROMISC failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_PROMISC failed: %d\n", ret); + return ret; } *promisc = arg.u.promisc; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_getsaddr.c b/wireless/ieee802154/libradio/sixlowpan_getsaddr.c index 8c5e30ab2..c089ddd5f 100644 --- a/wireless/ieee802154/libradio/sixlowpan_getsaddr.c +++ b/wireless/ieee802154/libradio/sixlowpan_getsaddr.c @@ -64,10 +64,11 @@ int sixlowpan_getsaddr(int sock, FAR const char *ifname, FAR uint16_t *saddr) ret = ioctl(sock, PHY802154IOC_GET_SADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_SADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_SADDR failed: %d\n", ret); + return ret; } *saddr = arg.u.saddr; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_gettxpwr.c b/wireless/ieee802154/libradio/sixlowpan_gettxpwr.c index 5c450c0e3..5627b66f4 100644 --- a/wireless/ieee802154/libradio/sixlowpan_gettxpwr.c +++ b/wireless/ieee802154/libradio/sixlowpan_gettxpwr.c @@ -64,10 +64,11 @@ int sixlowpan_gettxpwr(int sock, FAR const char *ifname, FAR int32_t *txpwr) ret = ioctl(sock, PHY802154IOC_GET_TXPWR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_GET_TXPWR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_GET_TXPWR failed: %d\n", ret); + return ret; } *txpwr = arg.u.txpwr; - return ret; + return OK; } diff --git a/wireless/ieee802154/libradio/sixlowpan_setcca.c b/wireless/ieee802154/libradio/sixlowpan_setcca.c index c257ddb77..3a881f730 100644 --- a/wireless/ieee802154/libradio/sixlowpan_setcca.c +++ b/wireless/ieee802154/libradio/sixlowpan_setcca.c @@ -65,8 +65,8 @@ int sixlowpan_setcca(int sock, FAR const char *ifname, FAR struct ieee802154_cca ret = ioctl(sock, PHY802154IOC_SET_CCA, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_CCA failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_CCA failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_setchan.c b/wireless/ieee802154/libradio/sixlowpan_setchan.c index 0def2f6be..afddb862d 100644 --- a/wireless/ieee802154/libradio/sixlowpan_setchan.c +++ b/wireless/ieee802154/libradio/sixlowpan_setchan.c @@ -65,8 +65,8 @@ int sixlowpan_setchan(int sock, FAR const char *ifname, uint8_t chan) ret = ioctl(sock, PHY802154IOC_SET_CHAN, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_CHAN failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_CHAN failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_setdevmode.c b/wireless/ieee802154/libradio/sixlowpan_setdevmode.c index 7c784571d..a96639f6a 100644 --- a/wireless/ieee802154/libradio/sixlowpan_setdevmode.c +++ b/wireless/ieee802154/libradio/sixlowpan_setdevmode.c @@ -65,8 +65,8 @@ int sixlowpan_setdevmode(int sock, FAR const char *ifname, uint8_t devmode) ret = ioctl(sock, PHY802154IOC_SET_DEVMODE, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_DEVMODE failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_DEVMODE failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_seteaddr.c b/wireless/ieee802154/libradio/sixlowpan_seteaddr.c index 32cf3d7a4..3a2dbd4dc 100644 --- a/wireless/ieee802154/libradio/sixlowpan_seteaddr.c +++ b/wireless/ieee802154/libradio/sixlowpan_seteaddr.c @@ -65,8 +65,8 @@ int sixlowpan_seteaddr(int sock, FAR const char *ifname, FAR const uint8_t *eadd ret = ioctl(sock, PHY802154IOC_SET_EADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_EADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_EADDR failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_setpanid.c b/wireless/ieee802154/libradio/sixlowpan_setpanid.c index abf3f54ac..195730bee 100644 --- a/wireless/ieee802154/libradio/sixlowpan_setpanid.c +++ b/wireless/ieee802154/libradio/sixlowpan_setpanid.c @@ -65,8 +65,8 @@ int sixlowpan_setpanid(int sock, FAR const char *ifname, uint16_t panid) ret = ioctl(sock, PHY802154IOC_SET_PANID, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_PANID failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_PANID failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_setpromisc.c b/wireless/ieee802154/libradio/sixlowpan_setpromisc.c index b2bcc9b7d..45e23dcea 100644 --- a/wireless/ieee802154/libradio/sixlowpan_setpromisc.c +++ b/wireless/ieee802154/libradio/sixlowpan_setpromisc.c @@ -66,8 +66,8 @@ int sixlowpan_setpromisc(int sock, FAR const char *ifname, bool promisc) ret = ioctl(sock, PHY802154IOC_SET_PROMISC, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_PROMISC failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_PROMISC failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_setsaddr.c b/wireless/ieee802154/libradio/sixlowpan_setsaddr.c index 7f628de5a..173e18d80 100644 --- a/wireless/ieee802154/libradio/sixlowpan_setsaddr.c +++ b/wireless/ieee802154/libradio/sixlowpan_setsaddr.c @@ -65,8 +65,8 @@ int sixlowpan_setsaddr(int sock, FAR const char *ifname, uint16_t saddr) ret = ioctl(sock, PHY802154IOC_SET_SADDR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_SADDR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_SADDR failed: %d\n", ret); } return ret; diff --git a/wireless/ieee802154/libradio/sixlowpan_settxpwr.c b/wireless/ieee802154/libradio/sixlowpan_settxpwr.c index 189235713..8a82d7c8e 100644 --- a/wireless/ieee802154/libradio/sixlowpan_settxpwr.c +++ b/wireless/ieee802154/libradio/sixlowpan_settxpwr.c @@ -65,8 +65,8 @@ int sixlowpan_settxpwr(int sock, FAR const char *ifname, int32_t txpwr) ret = ioctl(sock, PHY802154IOC_SET_TXPWR, (unsigned long)((uintptr_t)&arg)); if (ret < 0) { - int errcode = errno; - printf("PHY802154IOC_SET_TXPWR failed: %d\n", errcode); + ret = -errno; + fprintf(stderr, "PHY802154IOC_SET_TXPWR failed: %d\n", ret); } return ret;