From 0094b411dac84a82a291a5735d3d23f96c94e8e9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 3 Apr 2018 10:01:55 -0600 Subject: [PATCH] apps/netutils/netlib: Various fixes needed to get a clean netlib build with Bluetooth only. --- include/netutils/netlib.h | 4 ++++ netutils/netlib/netlib_getessid.c | 5 ++++- netutils/netlib/netlib_getifstatus.c | 5 ++++- netutils/netlib/netlib_getmacaddr.c | 5 ++++- netutils/netlib/netlib_setessid.c | 3 +++ netutils/netlib/netlib_setifstatus.c | 5 ++++- netutils/netlib/netlib_setmacaddr.c | 6 +++++- nshlib/nsh_netinit.c | 3 +++ 8 files changed, 31 insertions(+), 5 deletions(-) diff --git a/include/netutils/netlib.h b/include/netutils/netlib.h index 2bfa24fae..e2240a036 100644 --- a/include/netutils/netlib.h +++ b/include/netutils/netlib.h @@ -98,6 +98,8 @@ # define NETLIB_SOCK_FAMILY AF_IEEE802154 #elif defined(CONFIG_WIRELESS_PKTRADIO) # define NETLIB_SOCK_FAMILY AF_PKTRADIO +#elif defined(CONFIG_NET_BLUETOOTH) +# define NETLIB_SOCK_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define NETLIB_SOCK_FAMILY AF_INET #else @@ -146,6 +148,8 @@ # define NETLIB_SOCK_TYPE SOCK_RAW #elif NETLIB_SOCK_FAMILY == AF_IEEE802154 # define NETLIB_SOCK_TYPE SOCK_DGRAM +#elif NETLIB_SOCK_FAMILY == AF_BLUETOOTH +# define NETLIB_SOCK_TYPE SOCK_RAW #endif /**************************************************************************** diff --git a/netutils/netlib/netlib_getessid.c b/netutils/netlib/netlib_getessid.c index db6e6be1b..c5af7b045 100644 --- a/netutils/netlib/netlib_getessid.c +++ b/netutils/netlib/netlib_getessid.c @@ -1,7 +1,7 @@ /**************************************************************************** * netutils/netlib/netlib_getessid.c * - * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2017-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -73,6 +73,9 @@ #elif defined(CONFIG_NET_IEEE802154) # define PF_FAMILY PF_IEEE802154 # define AF_FAMILY AF_IEEE802154 +#elif defined(CONFIG_NET_BLUETOOTH) +# define PF_FAMILY PF_BLUETOOTH +# define AF_FAMILY AF_BLUETOOTH #endif /**************************************************************************** diff --git a/netutils/netlib/netlib_getifstatus.c b/netutils/netlib/netlib_getifstatus.c index e11946ba0..3fcb3b7dc 100644 --- a/netutils/netlib/netlib_getifstatus.c +++ b/netutils/netlib/netlib_getifstatus.c @@ -1,7 +1,8 @@ /**************************************************************************** * netutils/netlib/netlib_getifstatus.c * - * Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2014, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -71,6 +72,8 @@ # define AF_FAMILY AF_PACKET #elif defined(CONFIG_NET_IEEE802154) # define AF_FAMILY AF_IEEE802154 +#elif defined(CONFIG_NET_BLUETOOTH) +# define AF_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define AF_FAMILY AF_INET #endif diff --git a/netutils/netlib/netlib_getmacaddr.c b/netutils/netlib/netlib_getmacaddr.c index ee1a24518..0d99296dc 100644 --- a/netutils/netlib/netlib_getmacaddr.c +++ b/netutils/netlib/netlib_getmacaddr.c @@ -1,7 +1,8 @@ /**************************************************************************** * netutils/netlib/netlib_getmacaddr.c * - * Copyright (C) 2007-2009, 2011, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2017-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -68,6 +69,8 @@ # define AF_FAMILY AF_PACKET #elif defined(CONFIG_NET_IEEE802154) # define AF_FAMILY AF_IEEE802154 +#elif defined(CONFIG_NET_BLUETOOTH) +# define AF_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define AF_FAMILY AF_INET #endif diff --git a/netutils/netlib/netlib_setessid.c b/netutils/netlib/netlib_setessid.c index ac94ec245..aa664b9d4 100644 --- a/netutils/netlib/netlib_setessid.c +++ b/netutils/netlib/netlib_setessid.c @@ -73,6 +73,9 @@ #elif defined(CONFIG_NET_IEEE802154) # define PF_FAMILY PF_IEEE802154 # define AF_FAMILY AF_IEEE802154 +#elif defined(CONFIG_NET_BLUETOOTH) +# define PF_FAMILY PF_BLUETOOTH +# define AF_FAMILY AF_BLUETOOTH #endif /**************************************************************************** diff --git a/netutils/netlib/netlib_setifstatus.c b/netutils/netlib/netlib_setifstatus.c index a8262dafc..2a8ad4073 100644 --- a/netutils/netlib/netlib_setifstatus.c +++ b/netutils/netlib/netlib_setifstatus.c @@ -1,7 +1,8 @@ /**************************************************************************** * netutils/netlib/netlib_setifstatus.c * - * Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2014, 2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -70,6 +71,8 @@ # define AF_FAMILY AF_PACKET #elif defined(CONFIG_NET_IEEE802154) # define AF_FAMILY AF_IEEE802154 +#elif defined(CONFIG_NET_BLUETOOTH) +# define AF_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define AF_FAMILY AF_INET #endif diff --git a/netutils/netlib/netlib_setmacaddr.c b/netutils/netlib/netlib_setmacaddr.c index 3ef41c504..51cab6385 100644 --- a/netutils/netlib/netlib_setmacaddr.c +++ b/netutils/netlib/netlib_setmacaddr.c @@ -1,7 +1,8 @@ /**************************************************************************** * netutils/netlib/netlib_setmacaddr.c * - * Copyright (C) 2007-2009, 2011-2012, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2017-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -73,6 +74,9 @@ #elif defined(CONFIG_NET_IEEE802154) # define PF_FAMILY PF_IEEE802154 # define AF_FAMILY AF_IEEE802154 +#elif defined(CONFIG_NET_BLUETOOTH) +# define PF_FAMILY PF_BLUETOOTH +# define AF_FAMILY AF_BLUETOOTH #elif defined(CONFIG_NET_USRSOCK) # define PF_FAMILY PF_INET # define AF_FAMILY AF_INET diff --git a/nshlib/nsh_netinit.c b/nshlib/nsh_netinit.c index 4ef9d0d56..6b7ace556 100644 --- a/nshlib/nsh_netinit.c +++ b/nshlib/nsh_netinit.c @@ -189,6 +189,9 @@ #elif defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154) # define NET_DEVNAME "wpan0" # define NSH_HAVE_NETDEV +#elif defined(CONFIG_NET_BLUETOOTH) +# define NET_DEVNAME "bnep0" +# define NSH_HAVE_NETDEV #elif defined(CONFIG_NET_SLIP) # define NET_DEVNAME "sl0" # ifndef CONFIG_NSH_NOMAC