diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
| commit | 98e0ffaefb0f241cda3a72395d3be04192ae0d47 (patch) | |
| tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.sbin/bluetooth | |
| parent | b17ff922d4072ae132ece458f5b5d74a236880ac (diff) | |
| parent | e81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff) | |
Notes
Diffstat (limited to 'usr.sbin/bluetooth')
79 files changed, 575 insertions, 54 deletions
diff --git a/usr.sbin/bluetooth/Makefile b/usr.sbin/bluetooth/Makefile index 594b4402a9c7..1737107b1c0d 100644 --- a/usr.sbin/bluetooth/Makefile +++ b/usr.sbin/bluetooth/Makefile @@ -1,12 +1,10 @@ # $Id: Makefile,v 1.5 2003/09/08 02:28:35 max Exp $ # $FreeBSD$ +.include <src.opts.mk> + SUBDIR= \ - ath3kfw \ - bcmfw \ bt3cfw \ - bthidcontrol \ - bthidd \ btpand \ hccontrol \ hcsecd \ @@ -17,5 +15,12 @@ SUBDIR= \ sdpcontrol \ sdpd +.if ${MK_USB} != "no" +SUBDIR+= ath3kfw +SUBDIR+= bcmfw +SUBDIR+= bthidcontrol +SUBDIR+= bthidd +.endif + .include <bsd.subdir.mk> diff --git a/usr.sbin/bluetooth/ath3kfw/Makefile b/usr.sbin/bluetooth/ath3kfw/Makefile index 373655b210dd..26ce06e71a88 100644 --- a/usr.sbin/bluetooth/ath3kfw/Makefile +++ b/usr.sbin/bluetooth/ath3kfw/Makefile @@ -2,7 +2,6 @@ PROG= ath3kfw MAN= ath3kfw.8 -DPADD+= ${LIBUSB} -LDADD+= -lusb +LIBADD+= usb .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/bt3cfw/Makefile b/usr.sbin/bluetooth/bt3cfw/Makefile index 90bf7517253e..f9da6cac05ab 100644 --- a/usr.sbin/bluetooth/bt3cfw/Makefile +++ b/usr.sbin/bluetooth/bt3cfw/Makefile @@ -5,7 +5,6 @@ PROG= bt3cfw MAN= bt3cfw.8 WARNS?= 2 -DPADD= ${LIBNETGRAPH} -LDADD= -lnetgraph +LIBADD+= netgraph .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/bthidcontrol/Makefile b/usr.sbin/bluetooth/bthidcontrol/Makefile index 6c9eafb735c1..09128d6c0059 100644 --- a/usr.sbin/bluetooth/bthidcontrol/Makefile +++ b/usr.sbin/bluetooth/bthidcontrol/Makefile @@ -9,7 +9,6 @@ SRCS= bthidcontrol.c hid.c lexer.l parser.y sdp.c WARNS?= 1 CFLAGS+= -DBTHIDCONTROL=1 -I${.CURDIR}/../bthidd -DPADD= ${LIBBLUETOOTH} ${LIBSDP} ${LIBUSBHID} -LDADD= -lbluetooth -lsdp -lusbhid +LIBADD+= bluetooth sdp usbhid .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/bthidcontrol/Makefile.depend b/usr.sbin/bluetooth/bthidcontrol/Makefile.depend index 7ce677b0f3e2..0bcf768e602d 100644 --- a/usr.sbin/bluetooth/bthidcontrol/Makefile.depend +++ b/usr.sbin/bluetooth/bthidcontrol/Makefile.depend @@ -13,6 +13,7 @@ DIRDEPS = \ lib/libcompiler_rt \ lib/libsdp \ lib/libusbhid \ + usr.bin/yacc.host \ .include <dirdeps.mk> diff --git a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c index 900bda5d559b..0f795dd5b159 100644 --- a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c +++ b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c @@ -31,6 +31,7 @@ #include <sys/queue.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <errno.h> diff --git a/usr.sbin/bluetooth/bthidcontrol/hid.c b/usr.sbin/bluetooth/bthidcontrol/hid.c index 9fb6220da5a8..e43ef6a1101e 100644 --- a/usr.sbin/bluetooth/bthidcontrol/hid.c +++ b/usr.sbin/bluetooth/bthidcontrol/hid.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> diff --git a/usr.sbin/bluetooth/bthidcontrol/sdp.c b/usr.sbin/bluetooth/bthidcontrol/sdp.c index a0b4534e4cad..3beabc14be77 100644 --- a/usr.sbin/bluetooth/bthidcontrol/sdp.c +++ b/usr.sbin/bluetooth/bthidcontrol/sdp.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> diff --git a/usr.sbin/bluetooth/bthidd/Makefile b/usr.sbin/bluetooth/bthidd/Makefile index fe6ef33ff179..f36d216c2e59 100644 --- a/usr.sbin/bluetooth/bthidd/Makefile +++ b/usr.sbin/bluetooth/bthidd/Makefile @@ -8,10 +8,8 @@ SRCS= bthidd.c client.c hid.c kbd.c lexer.l parser.y server.c \ session.c CFLAGS+= -I${.CURDIR} -DEBUG_FLAGS= -g -DPADD= ${LIBBLUETOOTH} ${LIBUSBHID} -LDADD= -lbluetooth -lusbhid +LIBADD+= bluetooth usbhid NO_WMISSING_VARIABLE_DECLARATIONS= diff --git a/usr.sbin/bluetooth/bthidd/Makefile.depend b/usr.sbin/bluetooth/bthidd/Makefile.depend index c4c93a260e45..dedd94424c6d 100644 --- a/usr.sbin/bluetooth/bthidd/Makefile.depend +++ b/usr.sbin/bluetooth/bthidd/Makefile.depend @@ -12,6 +12,7 @@ DIRDEPS = \ lib/libc \ lib/libcompiler_rt \ lib/libusbhid \ + usr.bin/yacc.host \ .include <dirdeps.mk> diff --git a/usr.sbin/bluetooth/bthidd/bthidd.c b/usr.sbin/bluetooth/bthidd/bthidd.c index b93fd3dd6df4..7e988fced0ba 100644 --- a/usr.sbin/bluetooth/bthidd/bthidd.c +++ b/usr.sbin/bluetooth/bthidd/bthidd.c @@ -34,6 +34,7 @@ #include <sys/time.h> #include <sys/queue.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <errno.h> diff --git a/usr.sbin/bluetooth/bthidd/client.c b/usr.sbin/bluetooth/bthidd/client.c index 59f0d19a1ce8..5f01133d20c2 100644 --- a/usr.sbin/bluetooth/bthidd/client.c +++ b/usr.sbin/bluetooth/bthidd/client.c @@ -33,6 +33,7 @@ #include <sys/queue.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <fcntl.h> @@ -236,7 +237,9 @@ client_socket(bdaddr_p bdaddr, uint16_t psm) l2addr.l2cap_family = AF_BLUETOOTH; memset(&l2addr.l2cap_bdaddr, 0, sizeof(l2addr.l2cap_bdaddr)); l2addr.l2cap_psm = 0; - + l2addr.l2cap_bdaddr_type = BDADDR_BREDR; + l2addr.l2cap_cid = 0; + if (bind(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) { close(s); return (-1); diff --git a/usr.sbin/bluetooth/bthidd/hid.c b/usr.sbin/bluetooth/bthidd/hid.c index c68865b0a3db..69a6fdcc4d28 100644 --- a/usr.sbin/bluetooth/bthidd/hid.c +++ b/usr.sbin/bluetooth/bthidd/hid.c @@ -35,6 +35,7 @@ #include <sys/mouse.h> #include <sys/queue.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -48,12 +49,6 @@ #include "bthidd.h" #include "kbd.h" -#undef min -#define min(x, y) (((x) < (y))? (x) : (y)) - -#undef ASIZE -#define ASIZE(a) (sizeof(a)/sizeof(a[0])) - /* * Process data from control channel */ @@ -165,9 +160,21 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_t len) continue; page = HID_PAGE(h.usage); - usage = HID_USAGE(h.usage); val = hid_get_data(data, &h); + /* + * When the input field is an array and the usage is specified + * with a range instead of an ID, we have to derive the actual + * usage by using the item value as an index in the usage range + * list. + */ + if ((h.flags & HIO_VARIABLE)) { + usage = HID_USAGE(h.usage); + } else { + const uint32_t usage_offset = val - h.logical_minimum; + usage = HID_USAGE(h.usage_minimum + usage_offset); + } + switch (page) { case HUP_GENERIC_DESKTOP: switch (usage) { diff --git a/usr.sbin/bluetooth/bthidd/kbd.c b/usr.sbin/bluetooth/bthidd/kbd.c index b5bdfe16e70f..e570b80863f7 100644 --- a/usr.sbin/bluetooth/bthidd/kbd.c +++ b/usr.sbin/bluetooth/bthidd/kbd.c @@ -37,6 +37,7 @@ #include <sys/queue.h> #include <sys/wait.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> @@ -225,8 +226,8 @@ static int32_t const x[] = /* Keyboard Int'l 7 8D */ -1, /* Unassigned */ /* Keyboard Int'l 8 8E */ -1, /* Unassigned */ /* Keyboard Int'l 9 8F */ -1, /* Unassigned */ -/* Keyboard Lang 1 90 */ NOBREAK|0xF2, /* None */ -/* Keyboard Lang 2 91 */ NOBREAK|0xF1, /* None */ +/* Keyboard Lang 1 90 */ 0x71, /* eisu */ +/* Keyboard Lang 2 91 */ 0x72, /* kana */ /* Keyboard Lang 3 92 */ 0x78, /* F8 */ /* Keyboard Lang 4 93 */ 0x77, /* F7 */ /* Keyboard Lang 5 94 */ 0x76, /* F6 */ diff --git a/usr.sbin/bluetooth/bthidd/lexer.l b/usr.sbin/bluetooth/bthidd/lexer.l index b9f62a1e7ca2..6d913eede778 100644 --- a/usr.sbin/bluetooth/bthidd/lexer.l +++ b/usr.sbin/bluetooth/bthidd/lexer.l @@ -31,7 +31,7 @@ * $Id: lexer.l,v 1.3 2006/09/07 21:06:53 max Exp $ * $FreeBSD$ */ - +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <stdlib.h> #include "parser.h" diff --git a/usr.sbin/bluetooth/bthidd/parser.y b/usr.sbin/bluetooth/bthidd/parser.y index 50468f4e03a8..dbb27632680c 100644 --- a/usr.sbin/bluetooth/bthidd/parser.y +++ b/usr.sbin/bluetooth/bthidd/parser.y @@ -33,6 +33,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> diff --git a/usr.sbin/bluetooth/bthidd/server.c b/usr.sbin/bluetooth/bthidd/server.c index d76bd62664eb..26aeb4a961a1 100644 --- a/usr.sbin/bluetooth/bthidd/server.c +++ b/usr.sbin/bluetooth/bthidd/server.c @@ -33,6 +33,7 @@ #include <sys/queue.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <dev/vkbd/vkbd_var.h> #include <errno.h> @@ -90,7 +91,9 @@ server_init(bthid_server_p srv) l2addr.l2cap_family = AF_BLUETOOTH; memcpy(&l2addr.l2cap_bdaddr, &srv->bdaddr, sizeof(l2addr.l2cap_bdaddr)); l2addr.l2cap_psm = htole16(0x11); - + l2addr.l2cap_bdaddr_type = BDADDR_BREDR; + l2addr.l2cap_cid = 0; + if (bind(srv->ctrl, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) { syslog(LOG_ERR, "Could not bind control L2CAP socket. " \ "%s (%d)", strerror(errno), errno); diff --git a/usr.sbin/bluetooth/bthidd/session.c b/usr.sbin/bluetooth/bthidd/session.c index b9f331bf7e7f..260cb8654d72 100644 --- a/usr.sbin/bluetooth/bthidd/session.c +++ b/usr.sbin/bluetooth/bthidd/session.c @@ -33,6 +33,7 @@ #include <sys/queue.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <fcntl.h> diff --git a/usr.sbin/bluetooth/btpand/Makefile b/usr.sbin/bluetooth/btpand/Makefile index 5e4bb0b71674..0689d17c6c31 100644 --- a/usr.sbin/bluetooth/btpand/Makefile +++ b/usr.sbin/bluetooth/btpand/Makefile @@ -7,7 +7,6 @@ SRCS= btpand.c bnep.c channel.c client.c event.c packet.c server.c sdp.c tap.c WARNS?= 3 -DPADD+= ${LIBBLUETOOTH} ${LIBSDP} ${LIBUTIL} -LDADD+= -lbluetooth -lsdp -lutil +LIBADD= bluetooth sdp util .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/btpand/bnep.c b/usr.sbin/bluetooth/btpand/bnep.c index 200a72301183..4065b1ba8e0c 100644 --- a/usr.sbin/bluetooth/btpand/bnep.c +++ b/usr.sbin/bluetooth/btpand/bnep.c @@ -31,6 +31,7 @@ __RCSID("$NetBSD: bnep.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); #include <sys/uio.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <stdarg.h> diff --git a/usr.sbin/bluetooth/btpand/btpand.8 b/usr.sbin/bluetooth/btpand/btpand.8 index b89bf95348e3..4f6ede6ac2d2 100644 --- a/usr.sbin/bluetooth/btpand/btpand.8 +++ b/usr.sbin/bluetooth/btpand/btpand.8 @@ -206,10 +206,10 @@ Will create a Group Network and register the GN service with the local SDP server. .Sh SEE ALSO .Xr bluetooth 3 , -.Xr tap 4 , .Xr bridge 4 , -.Xr hccontrol 8 , +.Xr tap 4 , .Xr dhclient 8 , +.Xr hccontrol 8 , .Xr ifconfig 8 , .Xr sdpd 8 .Pp diff --git a/usr.sbin/bluetooth/btpand/btpand.c b/usr.sbin/bluetooth/btpand/btpand.c index 938744448bea..243fcf5292b9 100644 --- a/usr.sbin/bluetooth/btpand/btpand.c +++ b/usr.sbin/bluetooth/btpand/btpand.c @@ -33,6 +33,7 @@ __RCSID("$NetBSD: btpand.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); #include <sys/wait.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <fcntl.h> diff --git a/usr.sbin/bluetooth/btpand/channel.c b/usr.sbin/bluetooth/btpand/channel.c index b4eb4ab49c8f..32f248718e3a 100644 --- a/usr.sbin/bluetooth/btpand/channel.c +++ b/usr.sbin/bluetooth/btpand/channel.c @@ -35,7 +35,7 @@ __RCSID("$NetBSD: channel.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); #include <libutil.h> #include <unistd.h> - +#define L2CAP_SOCKET_CHECKED #include "btpand.h" static struct chlist channel_list; diff --git a/usr.sbin/bluetooth/btpand/client.c b/usr.sbin/bluetooth/btpand/client.c index 2cc908996584..f88dc6ee5098 100644 --- a/usr.sbin/bluetooth/btpand/client.c +++ b/usr.sbin/bluetooth/btpand/client.c @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __RCSID("$NetBSD: client.c,v 1.2 2008/12/06 20:01:14 plunky Exp $"); +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <sdp.h> @@ -65,6 +66,9 @@ client_init(void) memset(&sa, 0, sizeof(sa)); sa.l2cap_family = AF_BLUETOOTH; sa.l2cap_len = sizeof(sa); + sa.l2cap_bdaddr_type = BDADDR_BREDR; + sa.l2cap_cid = 0; + bdaddr_copy(&sa.l2cap_bdaddr, &local_bdaddr); if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { log_err("Could not bind client socket: %m"); diff --git a/usr.sbin/bluetooth/btpand/event.c b/usr.sbin/bluetooth/btpand/event.c index 159f90c862d4..ac51f57d1480 100644 --- a/usr.sbin/bluetooth/btpand/event.c +++ b/usr.sbin/bluetooth/btpand/event.c @@ -45,6 +45,7 @@ #include <syslog.h> #include "event.h" +#define L2CAP_SOCKET_CHECKED #include "btpand.h" #define __event_link(ev) \ diff --git a/usr.sbin/bluetooth/btpand/packet.c b/usr.sbin/bluetooth/btpand/packet.c index e42e5c5b3045..21a563c754e3 100644 --- a/usr.sbin/bluetooth/btpand/packet.c +++ b/usr.sbin/bluetooth/btpand/packet.c @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __RCSID("$NetBSD: packet.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); +#define L2CAP_SOCKET_CHECKED #include "btpand.h" packet_t * diff --git a/usr.sbin/bluetooth/btpand/sdp.c b/usr.sbin/bluetooth/btpand/sdp.c index e5aec1c6bbba..3cad3f8fbefa 100644 --- a/usr.sbin/bluetooth/btpand/sdp.c +++ b/usr.sbin/bluetooth/btpand/sdp.c @@ -32,6 +32,7 @@ __RCSID("$NetBSD: sdp.c,v 1.2 2008/12/06 20:01:14 plunky Exp $"); #include <string.h> +#define L2CAP_SOCKET_CHECKED #include "sdp.h" /* diff --git a/usr.sbin/bluetooth/btpand/server.c b/usr.sbin/bluetooth/btpand/server.c index b24d416ff196..b72b0322b0f3 100644 --- a/usr.sbin/bluetooth/btpand/server.c +++ b/usr.sbin/bluetooth/btpand/server.c @@ -32,6 +32,7 @@ __RCSID("$NetBSD: server.c,v 1.2 2009/01/24 17:29:28 plunky Exp $"); #include <sys/ioctl.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <inttypes.h> #include <errno.h> @@ -103,6 +104,9 @@ server_open(void) sa.l2cap_family = AF_BLUETOOTH; sa.l2cap_len = sizeof(sa); sa.l2cap_psm = htole16(l2cap_psm); + sa.l2cap_bdaddr_type = BDADDR_BREDR; + sa.l2cap_cid = 0; + bdaddr_copy(&sa.l2cap_bdaddr, &local_bdaddr); if (bind(server_fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { log_err("Could not bind server socket: %m"); diff --git a/usr.sbin/bluetooth/btpand/tap.c b/usr.sbin/bluetooth/btpand/tap.c index c96563338ea2..644bf02366fa 100644 --- a/usr.sbin/bluetooth/btpand/tap.c +++ b/usr.sbin/bluetooth/btpand/tap.c @@ -43,6 +43,7 @@ __RCSID("$NetBSD: tap.c,v 1.1 2008/08/17 13:20:57 plunky Exp $"); #include <stdio.h> #include <unistd.h> +#define L2CAP_SOCKET_CHECKED #include "btpand.h" static bool tap_send(channel_t *, packet_t *); diff --git a/usr.sbin/bluetooth/hccontrol/Makefile b/usr.sbin/bluetooth/hccontrol/Makefile index 592247e11ad9..a81fda4e350b 100644 --- a/usr.sbin/bluetooth/hccontrol/Makefile +++ b/usr.sbin/bluetooth/hccontrol/Makefile @@ -3,12 +3,11 @@ PROG= hccontrol MAN= hccontrol.8 -SRCS= send_recv.c link_policy.c link_control.c \ +SRCS= send_recv.c link_policy.c link_control.c le.c\ host_controller_baseband.c info.c status.c node.c hccontrol.c \ util.c WARNS?= 2 -DPADD= ${LIBBLUETOOTH} -LDADD= -lbluetooth +LIBADD= bluetooth .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.8 b/usr.sbin/bluetooth/hccontrol/hccontrol.8 index af0a67f1cd86..d8c5263cccfc 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.8 +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.8 @@ -25,12 +25,12 @@ .\" $Id: hccontrol.8,v 1.6 2003/08/06 21:26:38 max Exp $ .\" $FreeBSD$ .\" -.Dd June 14, 2002 +.Dd February 7, 2015 .Dt HCCONTROL 8 .Os .Sh NAME .Nm hccontrol -.Nd HCI configuration utility +.Nd Bluetooth HCI configuration utility .Sh SYNOPSIS .Nm .Op Fl hN diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.c b/usr.sbin/bluetooth/hccontrol/hccontrol.c index 089869b3cf03..b72854f9c09e 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.c +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.c @@ -29,6 +29,7 @@ * $FreeBSD$ */ +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sys/ioctl.h> #include <sys/sysctl.h> @@ -143,6 +144,7 @@ socket_open(char const *node) bit_set(filter.event_mask, NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL - 1); bit_set(filter.event_mask, NG_HCI_EVENT_CON_PKT_TYPE_CHANGED - 1); bit_set(filter.event_mask, NG_HCI_EVENT_ROLE_CHANGE - 1); + bit_set(filter.event_mask, NG_HCI_EVENT_LE -1); if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, (void * const) &filter, sizeof(filter)) < 0) @@ -181,6 +183,7 @@ do_hci_command(char const *node, int argc, char **argv) print_hci_command(host_controller_baseband_commands); print_hci_command(info_commands); print_hci_command(status_commands); + print_hci_command(le_commands); print_hci_command(node_commands); fprintf(stdout, "\nFor more information use " \ "'help command'\n"); @@ -212,6 +215,11 @@ do_hci_command(char const *node, int argc, char **argv) if (c != NULL) goto execute; + c = find_hci_command(cmd, le_commands); + if (c != NULL) + goto execute; + + c = find_hci_command(cmd, node_commands); if (c == NULL) { fprintf(stdout, "Unknown command: \"%s\"\n", cmd); diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.h b/usr.sbin/bluetooth/hccontrol/hccontrol.h index cd56ebfb7bc7..c96aab078d62 100644 --- a/usr.sbin/bluetooth/hccontrol/hccontrol.h +++ b/usr.sbin/bluetooth/hccontrol/hccontrol.h @@ -53,6 +53,7 @@ extern struct hci_command host_controller_baseband_commands[]; extern struct hci_command info_commands[]; extern struct hci_command status_commands[]; extern struct hci_command node_commands[]; +extern struct hci_command le_commands[]; int hci_request (int, int, char const *, int, char *, int *); int hci_simple_request (int, int, char *, int *); diff --git a/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c b/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c index aae5dd1457ed..532ca1c15ce1 100644 --- a/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c +++ b/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c @@ -29,6 +29,7 @@ * $FreeBSD$ */ +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <stdio.h> @@ -1487,6 +1488,78 @@ hci_write_page_scan_mode(int s, int argc, char **argv) return (OK); } /* hci_write_page_scan_mode */ +static int +hci_read_le_host_supported_command(int s, int argc, char **argv) +{ + ng_hci_read_le_host_supported_rp rp; + int n; + n = sizeof(rp); + if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, + NG_HCI_OCF_READ_LE_HOST_SUPPORTED), + (char *) &rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + fprintf(stdout, "LE Host support: %#02x\n", rp.le_supported_host); + fprintf(stdout, "Simulateneouse LE Host : %#02x\n", rp.simultaneous_le_host); + + return (OK); + +} +static int +hci_write_le_host_supported_command(int s, int argc, char **argv) +{ + ng_hci_write_le_host_supported_cp cp; + ng_hci_write_le_host_supported_rp rp; + + int n; + + cp.le_supported_host = 0; + cp.simultaneous_le_host = 0; + switch (argc) { + case 2: + if (sscanf(argv[1], "%d", &n) != 1 || (n != 0 && n != 1)){ + printf("ARGC2: %d\n", n); + return (USAGE); + } + cp.simultaneous_le_host = (n &1); + + case 1: + if (sscanf(argv[0], "%d", &n) != 1 || (n != 0 && n != 1)){ + printf("ARGC1: %d\n", n); + return (USAGE); + } + + cp.le_supported_host = (n &1); + break; + + default: + return (USAGE); + } + + + /* send command */ + n = sizeof(rp); + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, + NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED), + (char const *) &cp, sizeof(cp), + (char *) &rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + return (OK); +} + struct hci_command host_controller_baseband_commands[] = { { "reset", @@ -1872,6 +1945,17 @@ struct hci_command host_controller_baseband_commands[] = { "\t0x03 - Optional Page Scan Mode III", &hci_write_page_scan_mode }, +{ +"read_le_host_supported_command", \ +"Read if this host is in le supported mode and stimulatenouse le supported mode", +&hci_read_le_host_supported_command, +}, +{ +"write_le_host_supported_command", \ +"write_le_host_supported_command le_host[0|1] stimultajeous_le[0|1]", +&hci_write_le_host_supported_command, +}, + { NULL, } }; diff --git a/usr.sbin/bluetooth/hccontrol/info.c b/usr.sbin/bluetooth/hccontrol/info.c index d7bad36bb8de..ee9d1a164328 100644 --- a/usr.sbin/bluetooth/hccontrol/info.c +++ b/usr.sbin/bluetooth/hccontrol/info.c @@ -29,6 +29,7 @@ * $FreeBSD$ */ +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <stdio.h> diff --git a/usr.sbin/bluetooth/hccontrol/le.c b/usr.sbin/bluetooth/hccontrol/le.c new file mode 100644 index 000000000000..afb151e71ad2 --- /dev/null +++ b/usr.sbin/bluetooth/hccontrol/le.c @@ -0,0 +1,356 @@ +/* + * le.c + * + * Copyright (c) 2015 Takanori Watanabe <takawata@freebsd.org> + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id: hccontrol.c,v 1.5 2003/09/05 00:38:24 max Exp $ + * $FreeBSD$ + */ + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/sysctl.h> +#include <sys/bitstring.h> +#include <sys/select.h> +#include <assert.h> +#include <err.h> +#include <errno.h> +#include <netgraph/ng_message.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <stdint.h> +#define L2CAP_SOCKET_CHECKED +#include <bluetooth.h> +#include "hccontrol.h" + +static int le_set_scan_param(int s, int argc, char *argv[]); +static int le_set_scan_enable(int s, int argc, char *argv[]); +static int parse_param(int argc, char *argv[], char *buf, int *len); +static int le_set_scan_response(int s, int argc, char *argv[]); +static int le_read_supported_status(int s, int argc, char *argv[]); +static int le_read_local_supported_features(int s, int argc ,char *argv[]); +static int set_le_event_mask(int s, uint64_t mask); +static int set_event_mask(int s, uint64_t mask); +static int le_enable(int s, int argc, char *argv[]); + +static int +le_set_scan_param(int s, int argc, char *argv[]) +{ + int type; + int interval; + int window; + int adrtype; + int policy; + int e, n; + + ng_hci_le_set_scan_parameters_cp cp; + ng_hci_le_set_scan_parameters_rp rp; + + if (argc != 5) + return USAGE; + + if (strcmp(argv[0], "active") == 0) + type = 1; + else if (strcmp(argv[0], "passive") == 0) + type = 0; + else + return USAGE; + + interval = (int)(atof(argv[1])/0.625); + interval = (interval < 4)? 4: interval; + window = (int)(atof(argv[2])/0.625); + window = (window < 4) ? 4 : interval; + + if (strcmp(argv[3], "public") == 0) + adrtype = 0; + else if (strcmp(argv[0], "random") == 0) + adrtype = 1; + else + return USAGE; + + if (strcmp(argv[4], "all") == 0) + policy = 0; + else if (strcmp(argv[4], "whitelist") == 0) + policy = 1; + else + return USAGE; + + cp.le_scan_type = type; + cp.le_scan_interval = interval; + cp.own_address_type = adrtype; + cp.le_scan_window = window; + cp.scanning_filter_policy = policy; + n = sizeof(rp); + e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_SET_SCAN_PARAMETERS), + (void *)&cp, sizeof(cp), (void *)&rp, &n); + + return 0; +} + +static int +le_set_scan_enable(int s, int argc, char *argv[]) +{ + ng_hci_le_set_scan_enable_cp cp; + ng_hci_le_set_scan_enable_rp rp; + int e, n, enable = 0; + + if (argc != 1) + return USAGE; + + if (strcmp(argv[0], "enable") == 0) + enable = 1; + else if (strcmp(argv[0], "disable") != 0) + return USAGE; + + n = sizeof(rp); + cp.le_scan_enable = enable; + cp.filter_duplicates = 0; + e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_SET_SCAN_ENABLE), + (void *)&cp, sizeof(cp), (void *)&rp, &n); + + if (e != 0 || rp.status != 0) + return ERROR; + + return OK; +} + +static int +parse_param(int argc, char *argv[], char *buf, int *len) +{ + char *buflast = buf + (*len); + char *curbuf = buf; + char *token,*lenpos; + int ch; + int datalen; + uint16_t value; + optreset = 1; + optind = 0; + while ((ch = getopt(argc, argv , "n:f:u:")) != -1) { + switch(ch){ + case 'n': + datalen = strlen(optarg); + if ((curbuf + datalen + 2) >= buflast) + goto done; + curbuf[0] = datalen + 1; + curbuf[1] = 8; + curbuf += 2; + memcpy(curbuf, optarg, datalen); + curbuf += datalen; + break; + case 'f': + if (curbuf+3 > buflast) + goto done; + curbuf[0] = 2; + curbuf[1] = 1; + curbuf[2] = atoi(optarg); + curbuf += 3; + break; + case 'u': + lenpos = buf; + if ((buf+2) >= buflast) + goto done; + curbuf[1] = 2; + *lenpos = 1; + curbuf += 2; + while ((token = strsep(&optarg, ",")) != NULL) { + value = strtol(token, NULL, 16); + if ((curbuf+2) >= buflast) + break; + curbuf[0] = value &0xff; + curbuf[1] = (value>>8)&0xff; + curbuf += 2; + } + + } + } +done: + *len = curbuf - buf; + + return OK; +} + +static int +le_set_scan_response(int s, int argc, char *argv[]) +{ + ng_hci_le_set_scan_response_data_cp cp; + ng_hci_le_set_scan_response_data_rp rp; + int n; + int e; + int len; + char buf[NG_HCI_ADVERTISING_DATA_SIZE]; + + len = sizeof(buf); + parse_param(argc, argv, buf, &len); + memset(cp.scan_response_data, 0, sizeof(cp.scan_response_data)); + cp.scan_response_data_length = len; + memcpy(cp.scan_response_data, buf, len); + n = sizeof(rp); + e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA), + (void *)&cp, sizeof(cp), (void *)&rp, &n); + + printf("SET SCAN RESPONSE %d %d %d\n", e, rp.status, n); + + return OK; +} + +static int +le_read_local_supported_features(int s, int argc ,char *argv[]) +{ + ng_hci_le_read_local_supported_features_rp rp; + int e; + int n = sizeof(rp); + + e = hci_simple_request(s, + NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES), + (void *)&rp, &n); + + printf("LOCAL SUPPORTED: %d %d %jx\n", e, rp.status, + (uintmax_t) rp.le_features); + + return 0; +} + +static int +le_read_supported_status(int s, int argc, char *argv[]) +{ + ng_hci_le_read_supported_status_rp rp; + int e; + int n = sizeof(rp); + + e = hci_simple_request(s, NG_HCI_OPCODE( + NG_HCI_OGF_LE, + NG_HCI_OCF_LE_READ_SUPPORTED_STATUS), + (void *)&rp, &n); + + printf("LE_STATUS: %d %d %jx\n", e, rp.status, (uintmax_t)rp.le_status); + + return 0; +} + +static int +set_le_event_mask(int s, uint64_t mask) +{ + ng_hci_le_set_event_mask_cp semc; + ng_hci_le_set_event_mask_rp rp; + int i, n ,e; + + n = sizeof(rp); + + for (i=0; i < NG_HCI_LE_EVENT_MASK_SIZE; i++) { + semc.event_mask[i] = mask&0xff; + mask >>= 8; + } + e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_SET_EVENT_MASK), + (void *)&semc, sizeof(semc), (void *)&rp, &n); + + return 0; +} + +static int +set_event_mask(int s, uint64_t mask) +{ + ng_hci_set_event_mask_cp semc; + ng_hci_set_event_mask_rp rp; + int i, n, e; + + n = sizeof(rp); + + for (i=0; i < NG_HCI_EVENT_MASK_SIZE; i++) { + semc.event_mask[i] = mask&0xff; + mask >>= 8; + } + e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, + NG_HCI_OCF_SET_EVENT_MASK), + (void *)&semc, sizeof(semc), (void *)&rp, &n); + + return 0; +} + +static +int le_enable(int s, int argc, char *argv[]) +{ + if (argc != 1) + return USAGE; + + if (strcasecmp(argv[0], "enable") == 0) { + set_event_mask(s, NG_HCI_EVENT_MASK_DEFAULT | + NG_HCI_EVENT_MASK_LE); + set_le_event_mask(s, NG_HCI_LE_EVENT_MASK_ALL); + } else if (strcasecmp(argv[0], "disble") == 0) + set_event_mask(s, NG_HCI_EVENT_MASK_DEFAULT); + else + return USAGE; + + return OK; +} + +struct hci_command le_commands[] = { +{ + "le_enable", + "le_enable [enable|disable] \n" + "Enable LE event ", + &le_enable, +}, + { + "le_read_local_supported_features", + "le_read_local_supported_features\n" + "read local supported features mask", + &le_read_local_supported_features, + }, + { + "le_read_supported_status", + "le_read_supported_status\n" + "read supported status" + , + &le_read_supported_status, + }, + { + "le_set_scan_response", + "le_set_scan_response -n $name -f $flag -u $uuid16,$uuid16 \n" + "set LE scan response data" + , + &le_set_scan_response, + }, + { + "le_set_scan_enable", + "le_set_scan_enable [enable|disable] \n" + "enable or disable LE device scan", + &le_set_scan_enable + }, + { + "le_set_scan_param", + "le_set_scan_param [active|passive] interval(ms) window(ms) [public|random] [all|whitelist] \n" + "set LE device scan parameter", + &le_set_scan_param + }, +}; diff --git a/usr.sbin/bluetooth/hccontrol/link_control.c b/usr.sbin/bluetooth/hccontrol/link_control.c index 536520a71298..a55426c088a8 100644 --- a/usr.sbin/bluetooth/hccontrol/link_control.c +++ b/usr.sbin/bluetooth/hccontrol/link_control.c @@ -29,6 +29,7 @@ * $FreeBSD$ */ +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <stdio.h> diff --git a/usr.sbin/bluetooth/hccontrol/link_policy.c b/usr.sbin/bluetooth/hccontrol/link_policy.c index 67b32d5a0d61..8142b2365f10 100644 --- a/usr.sbin/bluetooth/hccontrol/link_policy.c +++ b/usr.sbin/bluetooth/hccontrol/link_policy.c @@ -29,6 +29,7 @@ * $FreeBSD$ */ +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <stdio.h> diff --git a/usr.sbin/bluetooth/hccontrol/node.c b/usr.sbin/bluetooth/hccontrol/node.c index ede2153b6ced..fb6fd199376b 100644 --- a/usr.sbin/bluetooth/hccontrol/node.c +++ b/usr.sbin/bluetooth/hccontrol/node.c @@ -30,6 +30,7 @@ */ #include <sys/ioctl.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <netgraph/ng_message.h> diff --git a/usr.sbin/bluetooth/hccontrol/util.c b/usr.sbin/bluetooth/hccontrol/util.c index 4bb5000c087a..1b0517070bc5 100644 --- a/usr.sbin/bluetooth/hccontrol/util.c +++ b/usr.sbin/bluetooth/hccontrol/util.c @@ -30,6 +30,7 @@ */ #include <sys/param.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <stdio.h> #include <string.h> @@ -151,7 +152,12 @@ hci_ver2str(int ver) /* 0x00 */ "Bluetooth HCI Specification 1.0B", /* 0x01 */ "Bluetooth HCI Specification 1.1", /* 0x02 */ "Bluetooth HCI Specification 1.2", - /* 0x03 */ "Bluetooth HCI Specification 2.0" + /* 0x03 */ "Bluetooth HCI Specification 2.0", + /* 0x04 */ "Bluetooth HCI Specification 2.1", + /* 0x05 */ "Bluetooth HCI Specification 3.0", + /* 0x06 */ "Bluetooth HCI Specification 4.0", + /* 0x07 */ "Bluetooth HCI Specification 4.1", + /* 0x08 */ "Bluetooth HCI Specification 4.2" }; return (ver >= SIZE(t)? "?" : t[ver]); @@ -164,7 +170,12 @@ hci_lmpver2str(int ver) /* 0x00 */ "Bluetooth LMP 1.0", /* 0x01 */ "Bluetooth LMP 1.1", /* 0x02 */ "Bluetooth LMP 1.2", - /* 0x03 */ "Bluetooth LMP 2.0" + /* 0x03 */ "Bluetooth LMP 2.0", + /* 0x04 */ "Bluetooth LMP 2.1", + /* 0x04 */ "Bluetooth LMP 3.0", + /* 0x04 */ "Bluetooth LMP 4.0", + /* 0x04 */ "Bluetooth LMP 4.1", + /* 0x04 */ "Bluetooth LMP 4.2" }; return (ver >= SIZE(t)? "?" : t[ver]); diff --git a/usr.sbin/bluetooth/hcsecd/Makefile b/usr.sbin/bluetooth/hcsecd/Makefile index e544ed4e6180..684243d8fd7b 100644 --- a/usr.sbin/bluetooth/hcsecd/Makefile +++ b/usr.sbin/bluetooth/hcsecd/Makefile @@ -7,7 +7,6 @@ SRCS= hcsecd.c lexer.l parser.y WARNS?= 2 CFLAGS+= -I${.CURDIR} -DPADD= ${LIBBLUETOOTH} -LDADD= -lbluetooth +LIBADD= bluetooth .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/hcsecd/Makefile.depend b/usr.sbin/bluetooth/hcsecd/Makefile.depend index cba7fb148b49..cd6c344bdfdb 100644 --- a/usr.sbin/bluetooth/hcsecd/Makefile.depend +++ b/usr.sbin/bluetooth/hcsecd/Makefile.depend @@ -11,6 +11,7 @@ DIRDEPS = \ lib/libbluetooth \ lib/libc \ lib/libcompiler_rt \ + usr.bin/yacc.host \ .include <dirdeps.mk> diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.c b/usr.sbin/bluetooth/hcsecd/hcsecd.c index 72f9c8cb8fdf..15b5ca45138e 100644 --- a/usr.sbin/bluetooth/hcsecd/hcsecd.c +++ b/usr.sbin/bluetooth/hcsecd/hcsecd.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <errno.h> diff --git a/usr.sbin/bluetooth/hcsecd/parser.y b/usr.sbin/bluetooth/hcsecd/parser.y index ec91c484cae2..cfaeb022b89e 100644 --- a/usr.sbin/bluetooth/hcsecd/parser.y +++ b/usr.sbin/bluetooth/hcsecd/parser.y @@ -32,6 +32,7 @@ #include <sys/fcntl.h> #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <limits.h> diff --git a/usr.sbin/bluetooth/hcseriald/Makefile b/usr.sbin/bluetooth/hcseriald/Makefile index ed0bf3243820..e02e1ae48b8a 100644 --- a/usr.sbin/bluetooth/hcseriald/Makefile +++ b/usr.sbin/bluetooth/hcseriald/Makefile @@ -5,7 +5,6 @@ PROG= hcseriald MAN= hcseriald.8 WARNS?= 2 -DPADD= ${LIBNETGRAPH} -LDADD= -lnetgraph +LIBADD= netgraph .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/l2control/Makefile b/usr.sbin/bluetooth/l2control/Makefile index 847ff4ba97d6..8f17e02f0045 100644 --- a/usr.sbin/bluetooth/l2control/Makefile +++ b/usr.sbin/bluetooth/l2control/Makefile @@ -6,7 +6,6 @@ MAN= l2control.8 SRCS= l2cap.c l2control.c WARNS?= 2 -DPADD= ${LIBBLUETOOTH} -LDADD= -lbluetooth +LIBADD= bluetooth .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/l2control/l2cap.c b/usr.sbin/bluetooth/l2control/l2cap.c index c23106c3db3f..44009ef2ef40 100644 --- a/usr.sbin/bluetooth/l2control/l2cap.c +++ b/usr.sbin/bluetooth/l2control/l2cap.c @@ -30,6 +30,7 @@ */ #include <sys/ioctl.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <stdio.h> diff --git a/usr.sbin/bluetooth/l2control/l2control.c b/usr.sbin/bluetooth/l2control/l2control.c index fdbf2f5b841d..87ec2371a360 100644 --- a/usr.sbin/bluetooth/l2control/l2control.c +++ b/usr.sbin/bluetooth/l2control/l2control.c @@ -30,6 +30,7 @@ */ #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <errno.h> diff --git a/usr.sbin/bluetooth/l2ping/Makefile b/usr.sbin/bluetooth/l2ping/Makefile index bc130e33aac9..572366ae4dd3 100644 --- a/usr.sbin/bluetooth/l2ping/Makefile +++ b/usr.sbin/bluetooth/l2ping/Makefile @@ -5,7 +5,6 @@ PROG= l2ping MAN= l2ping.8 WARNS?= 2 -DPADD= ${LIBBLUETOOTH} -LDADD= -lbluetooth +LIBADD= bluetooth .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/l2ping/l2ping.c b/usr.sbin/bluetooth/l2ping/l2ping.c index 4baa3540d14b..92e7a0aa777b 100644 --- a/usr.sbin/bluetooth/l2ping/l2ping.c +++ b/usr.sbin/bluetooth/l2ping/l2ping.c @@ -34,6 +34,7 @@ #include <arpa/inet.h> #include <netinet/in.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <errno.h> diff --git a/usr.sbin/bluetooth/rfcomm_pppd/Makefile b/usr.sbin/bluetooth/rfcomm_pppd/Makefile index adac64eca14a..f31e1e518480 100644 --- a/usr.sbin/bluetooth/rfcomm_pppd/Makefile +++ b/usr.sbin/bluetooth/rfcomm_pppd/Makefile @@ -8,7 +8,6 @@ MAN= rfcomm_pppd.8 SRCS= rfcomm_pppd.c rfcomm_sdp.c WARNS?= 2 -DPADD= ${LIBBLUETOOTH} ${LIBSDP} -LDADD= -lbluetooth -lsdp +LIBADD= bluetooth sdp .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c index 956dc4d83839..e970fb030be1 100644 --- a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c +++ b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c @@ -30,7 +30,7 @@ * $Id: rfcomm_pppd.c,v 1.5 2003/09/07 18:32:11 max Exp $ * $FreeBSD$ */ - +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <ctype.h> #include <err.h> diff --git a/usr.sbin/bluetooth/sdpcontrol/Makefile b/usr.sbin/bluetooth/sdpcontrol/Makefile index c0ec8d423f74..e3ebcd8d7254 100644 --- a/usr.sbin/bluetooth/sdpcontrol/Makefile +++ b/usr.sbin/bluetooth/sdpcontrol/Makefile @@ -6,7 +6,6 @@ MAN= sdpcontrol.8 SRCS= sdpcontrol.c search.c WARNS?= 2 -DPADD= ${LIBBLUETOOTH} ${LIBSDP} -LDADD= -lbluetooth -lsdp +LIBADD= bluetooth sdp .include <bsd.prog.mk> diff --git a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 index 89db90b85955..82aafad5d6d3 100644 --- a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 +++ b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 @@ -25,12 +25,12 @@ .\" $Id: sdpcontrol.8,v 1.1 2003/09/08 02:27:27 max Exp $ .\" $FreeBSD$ .\" -.Dd September 7, 2003 +.Dd February 7, 2015 .Dt SDPCONTROL 8 .Os .Sh NAME .Nm sdpcontrol -.Nd SDP query utility +.Nd Bluetooth Service Discovery Protocol query utility .Sh SYNOPSIS .Nm .Fl h diff --git a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c index fca2015c9c02..65ee3d0f9234 100644 --- a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c +++ b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c @@ -30,6 +30,7 @@ */ #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <err.h> #include <errno.h> diff --git a/usr.sbin/bluetooth/sdpcontrol/search.c b/usr.sbin/bluetooth/sdpcontrol/search.c index e7d824436aa4..acc8c167ed6e 100644 --- a/usr.sbin/bluetooth/sdpcontrol/search.c +++ b/usr.sbin/bluetooth/sdpcontrol/search.c @@ -30,6 +30,7 @@ */ #include <netinet/in.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <ctype.h> #include <sdp.h> diff --git a/usr.sbin/bluetooth/sdpd/bgd.c b/usr.sbin/bluetooth/sdpd/bgd.c index 70dda891072f..2c4e4d9698b5 100644 --- a/usr.sbin/bluetooth/sdpd/bgd.c +++ b/usr.sbin/bluetooth/sdpd/bgd.c @@ -28,7 +28,7 @@ * $Id: bgd.c,v 1.4 2004/01/13 01:54:39 max Exp $ * $FreeBSD$ */ - +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/dun.c b/usr.sbin/bluetooth/sdpd/dun.c index e7aeb78d679e..1496285a68c2 100644 --- a/usr.sbin/bluetooth/sdpd/dun.c +++ b/usr.sbin/bluetooth/sdpd/dun.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/ftrn.c b/usr.sbin/bluetooth/sdpd/ftrn.c index bcebfc79807f..bc1095eada3d 100644 --- a/usr.sbin/bluetooth/sdpd/ftrn.c +++ b/usr.sbin/bluetooth/sdpd/ftrn.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/gn.c b/usr.sbin/bluetooth/sdpd/gn.c index d35c0eea5fda..c2bea4811350 100644 --- a/usr.sbin/bluetooth/sdpd/gn.c +++ b/usr.sbin/bluetooth/sdpd/gn.c @@ -32,6 +32,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/irmc.c b/usr.sbin/bluetooth/sdpd/irmc.c index d28a1205be67..2b8f31746966 100644 --- a/usr.sbin/bluetooth/sdpd/irmc.c +++ b/usr.sbin/bluetooth/sdpd/irmc.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/irmc_command.c b/usr.sbin/bluetooth/sdpd/irmc_command.c index 10dafe0b1ed2..a55e1337985d 100644 --- a/usr.sbin/bluetooth/sdpd/irmc_command.c +++ b/usr.sbin/bluetooth/sdpd/irmc_command.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/lan.c b/usr.sbin/bluetooth/sdpd/lan.c index 2425a89db5a2..3ed2b1243c4f 100644 --- a/usr.sbin/bluetooth/sdpd/lan.c +++ b/usr.sbin/bluetooth/sdpd/lan.c @@ -31,6 +31,7 @@ #include <arpa/inet.h> #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <stdio.h> diff --git a/usr.sbin/bluetooth/sdpd/main.c b/usr.sbin/bluetooth/sdpd/main.c index 1df3bf0d5887..a287b9b70fd4 100644 --- a/usr.sbin/bluetooth/sdpd/main.c +++ b/usr.sbin/bluetooth/sdpd/main.c @@ -30,6 +30,7 @@ */ #include <sys/select.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <grp.h> diff --git a/usr.sbin/bluetooth/sdpd/nap.c b/usr.sbin/bluetooth/sdpd/nap.c index 5a857d8e91ad..c034ee68909b 100644 --- a/usr.sbin/bluetooth/sdpd/nap.c +++ b/usr.sbin/bluetooth/sdpd/nap.c @@ -32,6 +32,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/opush.c b/usr.sbin/bluetooth/sdpd/opush.c index 36359daa98ef..bcdfda2733be 100644 --- a/usr.sbin/bluetooth/sdpd/opush.c +++ b/usr.sbin/bluetooth/sdpd/opush.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/panu.c b/usr.sbin/bluetooth/sdpd/panu.c index e00f6503c924..5b2773e44e4a 100644 --- a/usr.sbin/bluetooth/sdpd/panu.c +++ b/usr.sbin/bluetooth/sdpd/panu.c @@ -32,6 +32,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/profile.c b/usr.sbin/bluetooth/sdpd/profile.c index f3dfaa7652a3..5c25d037378e 100644 --- a/usr.sbin/bluetooth/sdpd/profile.c +++ b/usr.sbin/bluetooth/sdpd/profile.c @@ -32,6 +32,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/provider.c b/usr.sbin/bluetooth/sdpd/provider.c index b0f5347018f8..0243305b0d9f 100644 --- a/usr.sbin/bluetooth/sdpd/provider.c +++ b/usr.sbin/bluetooth/sdpd/provider.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <string.h> #include <stdlib.h> diff --git a/usr.sbin/bluetooth/sdpd/sar.c b/usr.sbin/bluetooth/sdpd/sar.c index 4fc25d92b118..705f7161eaad 100644 --- a/usr.sbin/bluetooth/sdpd/sar.c +++ b/usr.sbin/bluetooth/sdpd/sar.c @@ -34,6 +34,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <sdp.h> diff --git a/usr.sbin/bluetooth/sdpd/scr.c b/usr.sbin/bluetooth/sdpd/scr.c index d0c9ec5f29d6..1df72d1df5da 100644 --- a/usr.sbin/bluetooth/sdpd/scr.c +++ b/usr.sbin/bluetooth/sdpd/scr.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <sdp.h> diff --git a/usr.sbin/bluetooth/sdpd/sd.c b/usr.sbin/bluetooth/sdpd/sd.c index 1743ea7dc406..c5397ce084da 100644 --- a/usr.sbin/bluetooth/sdpd/sd.c +++ b/usr.sbin/bluetooth/sdpd/sd.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/server.c b/usr.sbin/bluetooth/sdpd/server.c index 4ef153b1661f..abd181574f00 100644 --- a/usr.sbin/bluetooth/sdpd/server.c +++ b/usr.sbin/bluetooth/sdpd/server.c @@ -38,6 +38,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <pwd.h> diff --git a/usr.sbin/bluetooth/sdpd/sp.c b/usr.sbin/bluetooth/sdpd/sp.c index 31a9585a25e1..48edc77fe7fb 100644 --- a/usr.sbin/bluetooth/sdpd/sp.c +++ b/usr.sbin/bluetooth/sdpd/sp.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/srr.c b/usr.sbin/bluetooth/sdpd/srr.c index fd636d56d446..60f48ca439b9 100644 --- a/usr.sbin/bluetooth/sdpd/srr.c +++ b/usr.sbin/bluetooth/sdpd/srr.c @@ -34,6 +34,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <sdp.h> diff --git a/usr.sbin/bluetooth/sdpd/ssar.c b/usr.sbin/bluetooth/sdpd/ssar.c index eac92351c824..5e52e80e4c7b 100644 --- a/usr.sbin/bluetooth/sdpd/ssar.c +++ b/usr.sbin/bluetooth/sdpd/ssar.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <string.h> diff --git a/usr.sbin/bluetooth/sdpd/ssr.c b/usr.sbin/bluetooth/sdpd/ssr.c index ac27548575cc..785c8cac3755 100644 --- a/usr.sbin/bluetooth/sdpd/ssr.c +++ b/usr.sbin/bluetooth/sdpd/ssr.c @@ -34,6 +34,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <assert.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <sdp.h> diff --git a/usr.sbin/bluetooth/sdpd/sur.c b/usr.sbin/bluetooth/sdpd/sur.c index 143eaf3dbec9..581b593f3001 100644 --- a/usr.sbin/bluetooth/sdpd/sur.c +++ b/usr.sbin/bluetooth/sdpd/sur.c @@ -30,6 +30,7 @@ */ #include <sys/queue.h> +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <errno.h> #include <sdp.h> diff --git a/usr.sbin/bluetooth/sdpd/uuid.c b/usr.sbin/bluetooth/sdpd/uuid.c index 1989bc5e797d..dff8d2c66b93 100644 --- a/usr.sbin/bluetooth/sdpd/uuid.c +++ b/usr.sbin/bluetooth/sdpd/uuid.c @@ -28,7 +28,7 @@ * $Id: uuid.c,v 1.1 2004/12/09 18:20:26 max Exp $ * $FreeBSD$ */ - +#define L2CAP_SOCKET_CHECKED #include <bluetooth.h> #include <sdp.h> #include <uuid.h> |
