diff options
Diffstat (limited to 'sysutils/hcidump/patches/patch-ab')
-rw-r--r-- | sysutils/hcidump/patches/patch-ab | 166 |
1 files changed, 0 insertions, 166 deletions
diff --git a/sysutils/hcidump/patches/patch-ab b/sysutils/hcidump/patches/patch-ab deleted file mode 100644 index f10792dbb8d..00000000000 --- a/sysutils/hcidump/patches/patch-ab +++ /dev/null @@ -1,166 +0,0 @@ -$NetBSD: patch-ab,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $ - -fix NetBSD compiler warnings, and convert to NetBSD -bluetooth compatibility - ---- hcidump/hcidump.c.orig 2004-03-03 19:52:10.000000000 +0100 -+++ hcidump/hcidump.c -@@ -34,12 +34,13 @@ - #include <getopt.h> - #include <stdio.h> - #include <stdlib.h> -+#include <sys/ioctl.h> - #include <string.h> - #include <unistd.h> - --#include <netgraph/bluetooth/include/ng_hci.h> --#include <netgraph/bluetooth/include/ng_l2cap.h> --#include <netgraph/bluetooth/include/ng_btsocket.h> -+#include <netbt/bluetooth.h> -+#include <netbt/hci.h> -+#include <netbt/l2cap.h> - - #include "parser.h" - #include "hcidump.h" -@@ -104,7 +105,7 @@ static void process_frames(char *dev, in - exit(1); - } - dh = (void *) buf; -- frm.data = buf + DUMP_HDR_SIZE; -+ frm.data = (uint8_t *)(buf + DUMP_HDR_SIZE); - - if (!(ctrl = malloc(100))) { - perror("Can't allocate control buffer"); -@@ -139,8 +140,8 @@ static void process_frames(char *dev, in - frm.in = 0; - cmsg = CMSG_FIRSTHDR(&msg); - while (cmsg) { -- if (cmsg->cmsg_level == SOL_HCI_RAW && -- cmsg->cmsg_type == SCM_HCI_RAW_DIRECTION) -+ if (cmsg->cmsg_level == BTPROTO_HCI && -+ cmsg->cmsg_type == SCM_HCI_DIRECTION) - memcpy(&frm.in,CMSG_DATA(cmsg),sizeof(frm.in)); - - if (cmsg->cmsg_level == SOL_SOCKET && -@@ -192,7 +193,7 @@ static void read_dump(int file) - - frm.data_len = le16toh(dh.len); - -- if ((err = read_n(file, frm.data, frm.data_len)) < 0) -+ if ((err = read_n(file, (char *)frm.data, frm.data_len)) < 0) - goto failed; - if (!err) return; - -@@ -210,16 +211,16 @@ failed: - exit(1); - } - --static int open_file(char *file, int mode) -+static int open_file(char *file, int m) - { -- int f, flags; -+ int f, fl; - -- if (mode == WRITE) -- flags = O_WRONLY | O_CREAT | O_APPEND; -+ if (m == WRITE) -+ fl = O_WRONLY | O_CREAT | O_APPEND; - else -- flags = O_RDONLY; -+ fl = O_RDONLY; - -- if ((f = open(file, flags, 0600)) < 0) { -+ if ((f = open(file, fl, 0600)) < 0) { - perror("Can't open output file"); - exit(1); - } -@@ -228,12 +229,12 @@ static int open_file(char *file, int mod - - static int open_socket(char *dev) - { -- struct sockaddr_hci addr; -- struct ng_btsocket_hci_raw_filter flt; -+ struct sockaddr_bt addr; -+ struct hci_filter flt; - int s, opt; - - /* Create HCI socket */ -- if ((s=socket(AF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI)) < 0) { -+ if ((s=socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0) { - perror("Can't create HCI socket"); - exit(1); - } -@@ -245,37 +246,60 @@ static int open_socket(char *dev) - } - - opt = 1; -- if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_DIRECTION, &opt, sizeof(opt)) < 0) { -- perror("Can't enable data direction info"); -+ if (setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) { -+ perror("Can't enable time stamp"); - exit(1); - } - - opt = 1; -- if (setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) { -- perror("Can't enable time stamp"); -+ if (setsockopt(s, BTPROTO_HCI, SO_HCI_DIRECTION, &opt, sizeof(opt)) < 0) { -+ perror("Can't enable data direction info"); -+ exit(1); -+ } -+ -+ /* Setup filters */ -+ memset(&flt, 0xff, sizeof(flt)); -+ if (setsockopt(s, BTPROTO_HCI, SO_HCI_EVT_FILTER, (void const *) &flt, sizeof(flt)) < 0) { -+ perror("Can't set HCI Event filter"); - exit(1); - } - -- /* Setup filter */ - memset(&flt, 0xff, sizeof(flt)); -- if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, (void const *) &flt, sizeof(flt)) < 0) { -- perror("Can't set HCI filter"); -+ if (setsockopt(s, BTPROTO_HCI, SO_HCI_PKT_FILTER, (void const *) &flt, sizeof(flt)) < 0) { -+ perror("Can't set HCI Packet filter"); - exit(1); - } - - /* Bind socket to the HCI device */ - memset(&addr, 0, sizeof(addr)); -- addr.hci_len = sizeof(addr); -- addr.hci_family = AF_BLUETOOTH; -+ addr.bt_len = sizeof(addr); -+ addr.bt_family = AF_BLUETOOTH; - if (dev != NULL) { -- strncpy(addr.hci_node, dev, sizeof(addr.hci_node)); -+ struct btreq btr; - -- if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { -- printf("Can't attach to device %s. %s(%d)\n", -- dev, strerror(errno), errno); -+ memset(&btr, 0, sizeof(btr)); -+ strlcpy(btr.btr_name, dev, HCI_DEVNAME_SIZE); -+ -+ if (ioctl(s, SIOCGBTINFO, &btr) < 0) { -+ printf("Can't get device info for '%s': %s(%d)\n", -+ dev, strerror(errno), errno); - exit(1); - } -+ -+ if ((btr.btr_flags & (BTF_UP|BTF_RUNNING)) != (BTF_UP|BTF_RUNNING)) { -+ printf("Can't get BDADDR for '%s' (not running).\n", dev); -+ exit(1); -+ } -+ -+ bdaddr_copy(&addr.bt_bdaddr, &btr.btr_bdaddr); - } -+ -+ if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { -+ printf("Can't bind to device %s. %s(%d)\n", -+ dev, strerror(errno), errno); -+ exit(1); -+ } -+ - return s; - } - |