update to hcidump from BlueZ-5.66 changes to the parser, with newer profiles catered fordiff -r1.12 -r1.13 pkgsrc/sysutils/netbt-hcidump/Makefile
(plunky)
@@ -1,18 +1,17 @@ | @@ -1,18 +1,17 @@ | |||
1 | # $NetBSD: Makefile,v 1.12 2022/12/31 21:49:13 plunky Exp $ | 1 | # $NetBSD: Makefile,v 1.13 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | DISTNAME= bluez-5.27 | 3 | DISTNAME= bluez-5.66 | |
4 | PKGNAME= netbt-hcidump-${BLUEZ_VERSION} | 4 | PKGNAME= netbt-hcidump-${BLUEZ_VERSION} | |
5 | PKGREVISION= 1 | |||
6 | CATEGORIES= sysutils | 5 | CATEGORIES= sysutils | |
7 | MASTER_SITES= http://www.kernel.org/pub/linux/bluetooth/ | 6 | MASTER_SITES= http://www.kernel.org/pub/linux/bluetooth/ | |
8 | EXTRACT_SUFX= .tar.xz | 7 | EXTRACT_SUFX= .tar.xz | |
9 | 8 | |||
10 | MAINTAINER= plunky@NetBSD.org | 9 | MAINTAINER= plunky@NetBSD.org | |
11 | HOMEPAGE= http://www.bluez.org/ | 10 | HOMEPAGE= http://www.bluez.org/ | |
12 | COMMENT= Bluetooth packet analyzer (netbt version) | 11 | COMMENT= Bluetooth packet analyzer (netbt version) | |
13 | LICENSE= gnu-gpl-v2 | 12 | LICENSE= gnu-gpl-v2 | |
14 | 13 | |||
15 | BLUEZ_VERSION= ${DISTNAME:S/bluez-//} | 14 | BLUEZ_VERSION= ${DISTNAME:S/bluez-//} | |
16 | 15 | |||
17 | EXTRACT_USING= bsdtar | 16 | EXTRACT_USING= bsdtar | |
18 | 17 |
@@ -1,23 +1,23 @@ | @@ -1,23 +1,23 @@ | |||
1 | $NetBSD: distinfo,v 1.18 2021/10/26 11:19:54 nia Exp $ | 1 | $NetBSD: distinfo,v 1.19 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | BLAKE2s (bluez-5.27.tar.xz) = ab8a97adae31921171c6239cd93a4c4ee7ec49548eb6f59d39080128a9a34622 | 3 | BLAKE2s (bluez-5.66.tar.xz) = 680796ff604f7d485cbe7cce6f13ad64d7bf6a30771a6fec4accef33b5cf7512 | |
4 | SHA512 (bluez-5.27.tar.xz) = 5e5e3ec17b4552027559083effb076e9c7d45528765fb27ca1aa1f3d8bb6a4a79c9fda91392f7b5b6da7aabf2b2b6e5bb16b0546323901501a93c53f79a66324 | 4 | SHA512 (bluez-5.66.tar.xz) = ed0994932687eacf27207867366671b323671f5d5199daf36ea5eff8f254f2bc99ef989ef7df9883b35c06f2af60452be8bad0a06109428a4717cf2b247b4865 | |
5 | Size (bluez-5.27.tar.xz) = 1542348 bytes | 5 | Size (bluez-5.66.tar.xz) = 2257288 bytes | |
6 | SHA1 (patch-Makefile) = 24c3f132b0c454c7f06915ca368b67e463c4e4f0 | 6 | SHA1 (patch-Makefile) = 24c3f132b0c454c7f06915ca368b67e463c4e4f0 | |
7 | SHA1 (patch-lib_Makefile) = d881586878b8ee58f642f993bfad6a614148fb7b | 7 | SHA1 (patch-lib_Makefile) = d881586878b8ee58f642f993bfad6a614148fb7b | |
8 | SHA1 (patch-lib_bluetooth.c) = 997da8b1f00bf0093ca45cdd5c416d6155c591ea | 8 | SHA1 (patch-lib_bluetooth.c) = 997da8b1f00bf0093ca45cdd5c416d6155c591ea | |
9 | SHA1 (patch-lib_bluetooth.h) = cd200dfefdabe7a517928c62848faceb41fb302a | 9 | SHA1 (patch-lib_bluetooth.h) = 23a982bfb85e74dc876c42bdd8c0041461963c20 | |
10 | SHA1 (patch-lib_hci.c) = 825b01082e2be2336c429e27ec78348fe4c39985 | 10 | SHA1 (patch-lib_hci.c) = 825b01082e2be2336c429e27ec78348fe4c39985 | |
11 | SHA1 (patch-lib_hci.h) = e032192fba2b96cf44888a7ae383685e11ae16b7 | 11 | SHA1 (patch-lib_hci.h) = 258596cbbbaf1c1827bdd59fa1bbdd7582244277 | |
12 | SHA1 (patch-lib_hci__lib.h) = aa2768c85c1a775cbc65d4274e1a9cb47f16a7da | 12 | SHA1 (patch-lib_hci__lib.h) = aa2768c85c1a775cbc65d4274e1a9cb47f16a7da | |
13 | SHA1 (patch-lib_l2cap.h) = 744d600f5b25eaf8f7fca6646d5dbdd73f709753 | 13 | SHA1 (patch-lib_l2cap.h) = 744d600f5b25eaf8f7fca6646d5dbdd73f709753 | |
14 | SHA1 (patch-src_shared_util.h) = 349f8869b54746d5799af5beadd390dffd5f260b | 14 | SHA1 (patch-src_shared_util.h) = 3509ed85b0758add9f7704f070f41a3f6aa93ab9 | |
15 | SHA1 (patch-tools_Makefile) = 4c63cb92ce4fc8446fcb6b16a60f17d68b25078f | 15 | SHA1 (patch-tools_Makefile) = 4c63cb92ce4fc8446fcb6b16a60f17d68b25078f | |
16 | SHA1 (patch-tools_hcidump.1) = 3981ca329e9837ea9719fea59277357a435cc265 | 16 | SHA1 (patch-tools_hcidump.1) = 7bd27aa48435d8b1ea8f292b27c63eb36c78f820 | |
17 | SHA1 (patch-tools_hcidump.c) = ca6871ca562bc218ce445edf8b364f528d260d4e | 17 | SHA1 (patch-tools_hcidump.c) = 2dddf54f9c648a34597f036b281baabadb8689eb | |
18 | SHA1 (patch-tools_parser_Makefile) = 4d4410493393d521c89ba429b39b0a3bbbba135b | 18 | SHA1 (patch-tools_parser_Makefile) = 4d4410493393d521c89ba429b39b0a3bbbba135b | |
19 | SHA1 (patch-tools_parser_bnep.c) = efbbe5f4cd47dcb0bf72c16bd67d9d93ba7cd43a | 19 | SHA1 (patch-tools_parser_bnep.c) = efbbe5f4cd47dcb0bf72c16bd67d9d93ba7cd43a | |
20 | SHA1 (patch-tools_parser_lmp.c) = f410be55cf07f6d7f7d3b1466b7fbe708b1a6de5 | 20 | SHA1 (patch-tools_parser_lmp.c) = f410be55cf07f6d7f7d3b1466b7fbe708b1a6de5 | |
21 | SHA1 (patch-tools_parser_parser.h) = 19ff1cdd8d7af71d9ae86497d3e1f49ae9db9a2a | 21 | SHA1 (patch-tools_parser_parser.h) = e8e1c7b9c9ee958e7b0dd8b7e971557375ac33b9 | |
22 | SHA1 (patch-tools_parser_rfcomm.h) = 917dd10203c62de7679909fc014a69ccd2a5185d | 22 | SHA1 (patch-tools_parser_rfcomm.h) = 917dd10203c62de7679909fc014a69ccd2a5185d | |
23 | SHA1 (patch-tools_parser_tcpip.c) = e06881372e8edf23f22c1a0a61c9bc346381a0e3 | 23 | SHA1 (patch-tools_parser_tcpip.c) = e06881372e8edf23f22c1a0a61c9bc346381a0e3 |
@@ -1,72 +1,72 @@ | @@ -1,72 +1,72 @@ | |||
1 | $NetBSD: patch-lib_bluetooth.h,v 1.1 2014/12/30 08:39:13 plunky Exp $ | 1 | $NetBSD: patch-lib_bluetooth.h,v 1.2 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | Not much of the original library is needed. | 3 | Not much of the original library is needed. | |
4 | 4 | |||
5 | --- lib/bluetooth.h.orig 2014-12-12 13:38:33.000000000 +0000 | 5 | --- lib/bluetooth.h.orig 2020-03-15 06:38:34.000000000 +0000 | |
6 | +++ lib/bluetooth.h | 6 | +++ lib/bluetooth.h | |
7 | @@ -30,6 +30,7 @@ | 7 | @@ -30,6 +30,7 @@ | |
8 | extern "C" { | 8 | extern "C" { | |
9 | #endif | 9 | #endif | |
10 | 10 | |||
11 | +#if 0 | 11 | +#if 0 | |
12 | #include <stdio.h> | 12 | #include <stdio.h> | |
13 | #include <stdint.h> | 13 | #include <stdint.h> | |
14 | #include <string.h> | 14 | #include <string.h> | |
15 | @@ -153,6 +154,20 @@ enum { | 15 | @@ -172,6 +173,20 @@ enum { | |
16 | #else | 16 | #else | |
17 | #error "Unknown byte order" | 17 | #error "Unknown byte order" | |
18 | #endif | 18 | #endif | |
19 | +#else | 19 | +#else | |
20 | +#include <bluetooth.h> | 20 | +#include <bluetooth.h> | |
21 | +#include <string.h> | 21 | +#include <string.h> | |
22 | + | 22 | + | |
23 | +#define SOL_HCI BTPROTO_HCI | 23 | +#define SOL_HCI BTPROTO_HCI | |
24 | + | 24 | + | |
25 | +#define htobs(d) htole16(d) | 25 | +#define htobs(d) htole16(d) | |
26 | +#define htobl(d) htole32(d) | 26 | +#define htobl(d) htole32(d) | |
27 | +#define btohs(d) le16toh(d) | 27 | +#define btohs(d) le16toh(d) | |
28 | +#define btohl(d) le32toh(d) | 28 | +#define btohl(d) le32toh(d) | |
29 | +#define bswap_64(v) bswap64(v) | 29 | +#define bswap_64(v) bswap64(v) | |
30 | +#define bswap_32(v) bswap32(v) | 30 | +#define bswap_32(v) bswap32(v) | |
31 | +#define bswap_16(v) bswap16(v) | 31 | +#define bswap_16(v) bswap16(v) | |
32 | +#endif | 32 | +#endif | |
33 | 33 | |||
34 | /* Bluetooth unaligned access */ | 34 | /* Bluetooth unaligned access */ | |
35 | #define bt_get_unaligned(ptr) \ | 35 | #define bt_get_unaligned(ptr) \ | |
36 | @@ -296,6 +311,7 @@ static inline void bt_put_be16(uint16_t | 36 | @@ -315,6 +330,7 @@ static inline void bt_put_be16(uint16_t | |
37 | #error "Unknown byte order" | 37 | #error "Unknown byte order" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | +#if 0 | 40 | +#if 0 | |
41 | /* BD Address */ | 41 | /* BD Address */ | |
42 | typedef struct { | 42 | typedef struct { | |
43 | uint8_t b[6]; | 43 | uint8_t b[6]; | |
44 | @@ -309,6 +325,7 @@ typedef struct { | 44 | @@ -328,6 +344,7 @@ typedef struct { | |
45 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) | 45 | #define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) | |
46 | #define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) | 46 | #define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}) | |
47 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) | 47 | #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) | |
48 | +#endif | 48 | +#endif | |
49 | 49 | |||
50 | /* Copy, swap, convert BD Address */ | 50 | /* Copy, swap, convert BD Address */ | |
51 | static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) | 51 | static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) | |
52 | @@ -321,9 +338,12 @@ static inline void bacpy(bdaddr_t *dst, | 52 | @@ -340,9 +357,12 @@ static inline void bacpy(bdaddr_t *dst, | |
53 | } | 53 | } | |
54 | 54 | |||
55 | void baswap(bdaddr_t *dst, const bdaddr_t *src); | 55 | void baswap(bdaddr_t *dst, const bdaddr_t *src); | |
56 | +#if 0 | 56 | +#if 0 | |
57 | bdaddr_t *strtoba(const char *str); | 57 | bdaddr_t *strtoba(const char *str); | |
58 | char *batostr(const bdaddr_t *ba); | 58 | char *batostr(const bdaddr_t *ba); | |
59 | +#endif | 59 | +#endif | |
60 | int ba2str(const bdaddr_t *ba, char *str); | 60 | int ba2str(const bdaddr_t *ba, char *str); | |
61 | +#if 0 | 61 | +#if 0 | |
62 | int ba2strlc(const bdaddr_t *ba, char *str); | |||
62 | int str2ba(const char *str, bdaddr_t *ba); | 63 | int str2ba(const char *str, bdaddr_t *ba); | |
63 | int ba2oui(const bdaddr_t *ba, char *oui); | 64 | int ba2oui(const bdaddr_t *ba, char *oui); | |
64 | int bachk(const char *str); | 65 | @@ -357,6 +377,7 @@ void *bt_malloc(size_t size); | |
65 | @@ -337,6 +357,7 @@ void *bt_malloc(size_t size); | |||
66 | void bt_free(void *ptr); | 66 | void bt_free(void *ptr); | |
67 | 67 | |||
68 | int bt_error(uint16_t code); | 68 | int bt_error(uint16_t code); | |
69 | +#endif | 69 | +#endif | |
70 | const char *bt_compidtostr(int id); | 70 | const char *bt_compidtostr(int id); | |
71 | 71 | |||
72 | typedef struct { | 72 | typedef struct { |
@@ -1,57 +1,58 @@ | @@ -1,57 +1,58 @@ | |||
1 | $NetBSD: patch-lib_hci.h,v 1.1 2014/12/30 08:39:13 plunky Exp $ | 1 | $NetBSD: patch-lib_hci.h,v 1.2 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | Not much of the original library is needed. | 3 | Not much of the original library is needed. | |
4 | 4 | |||
5 | --- lib/hci.h.orig 2014-12-26 17:54:42.000000000 +0000 | 5 | --- lib/hci.h.orig 2021-10-13 18:38:34.000000000 +0000 | |
6 | +++ lib/hci.h | 6 | +++ lib/hci.h | |
7 | @@ -39,6 +39,7 @@ extern "C" { | 7 | @@ -27,6 +27,7 @@ extern "C" { | |
8 | #define HCI_MAX_EVENT_SIZE 260 | 8 | #define HCI_MAX_EVENT_SIZE 260 | |
9 | #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) | 9 | #define HCI_MAX_FRAME_SIZE (HCI_MAX_AMP_SIZE + 4) | |
10 | 10 | |||
11 | +#if 0 | 11 | +#if 0 | |
12 | /* HCI dev events */ | 12 | /* HCI dev events */ | |
13 | #define HCI_DEV_REG 1 | 13 | #define HCI_DEV_REG 1 | |
14 | #define HCI_DEV_UNREG 2 | 14 | #define HCI_DEV_UNREG 2 | |
15 | @@ -55,11 +56,13 @@ extern "C" { | 15 | @@ -47,12 +48,14 @@ extern "C" { | |
16 | #define HCI_RS232 4 | 16 | #define HCI_I2C 8 | |
17 | #define HCI_PCI 5 | 17 | #define HCI_SMD 9 | |
18 | #define HCI_SDIO 6 | 18 | #define HCI_VIRTIO 10 | |
19 | +#endif | 19 | +#endif | |
20 | 20 | |||
21 | /* HCI controller types */ | 21 | /* HCI controller types */ | |
22 | #define HCI_BREDR 0x00 | 22 | #define HCI_PRIMARY 0x00 | |
23 | #define HCI_AMP 0x01 | 23 | #define HCI_AMP 0x01 | |
24 | #define HCI_BREDR HCI_PRIMARY | |||
24 | 25 | |||
25 | +#if 0 | 26 | +#if 0 | |
26 | /* HCI device flags */ | 27 | /* HCI device flags */ | |
27 | enum { | 28 | enum { | |
28 | HCI_UP, | 29 | HCI_UP, | |
29 | @@ -107,6 +110,7 @@ enum { | 30 | @@ -100,6 +103,7 @@ enum { | |
30 | #define HCIUNBLOCKADDR _IOW('H', 231, int) | 31 | #define HCIUNBLOCKADDR _IOW('H', 231, int) | |
31 | 32 | |||
32 | #define HCIINQUIRY _IOR('H', 240, int) | 33 | #define HCIINQUIRY _IOR('H', 240, int) | |
33 | +#endif | 34 | +#endif | |
34 | 35 | |||
35 | #ifndef __NO_HCI_DEFS | 36 | #ifndef __NO_HCI_DEFS | |
36 | 37 | |||
37 | @@ -2328,6 +2332,7 @@ typedef struct { | 38 | @@ -2322,6 +2326,7 @@ typedef struct { | |
38 | 39 | |||
39 | #endif /* _NO_HCI_DEFS */ | 40 | #endif /* _NO_HCI_DEFS */ | |
40 | 41 | |||
41 | +#if 0 | 42 | +#if 0 | |
42 | /* HCI Socket options */ | 43 | /* HCI Socket options */ | |
43 | #define HCI_DATA_DIR 1 | 44 | #define HCI_DATA_DIR 1 | |
44 | #define HCI_FILTER 2 | 45 | #define HCI_FILTER 2 | |
45 | @@ -2441,6 +2446,12 @@ struct hci_inquiry_req { | 46 | @@ -2436,6 +2441,12 @@ struct hci_inquiry_req { | |
46 | uint8_t num_rsp; | 47 | uint8_t num_rsp; | |
47 | }; | 48 | }; | |
48 | #define IREQ_CACHE_FLUSH 0x0001 | 49 | #define IREQ_CACHE_FLUSH 0x0001 | |
49 | +#else | 50 | +#else | |
50 | +#define HCI_CMSG_DIR SCM_HCI_DIRECTION | 51 | +#define HCI_CMSG_DIR SCM_HCI_DIRECTION | |
51 | +#define HCI_CMSG_TSTAMP SCM_TIMESTAMP | 52 | +#define HCI_CMSG_TSTAMP SCM_TIMESTAMP | |
52 | +#define HCI_DEV_NONE NULL | 53 | +#define HCI_DEV_NONE NULL | |
53 | +#define HCI_DATA_DIR SO_HCI_DIRECTION | 54 | +#define HCI_DATA_DIR SO_HCI_DIRECTION | |
54 | +#endif | 55 | +#endif | |
55 | 56 | |||
56 | #ifdef __cplusplus | 57 | #ifdef __cplusplus | |
57 | } | 58 | } |
@@ -1,35 +1,31 @@ | @@ -1,35 +1,31 @@ | |||
1 | $NetBSD: patch-tools_hcidump.1,v 1.1 2014/12/30 08:39:13 plunky Exp $ | 1 | $NetBSD: patch-tools_hcidump.1,v 1.2 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | adjust the manual page | 3 | adjust the manual page | |
4 | 4 | |||
5 | --- tools/hcidump.1.orig 2012-12-24 17:46:55.000000000 +0000 | 5 | --- tools/hcidump.1.orig 2021-10-13 18:49:06.000000000 +0000 | |
6 | +++ tools/hcidump.1 | 6 | +++ tools/hcidump.1 | |
7 | @@ -12,8 +12,8 @@ hcidump \- Parse HCI data | 7 | @@ -37,18 +37,18 @@ level margin: \\n[rst2man-indent\\n[rst2 | |
8 | hcidump | 8 | \fBhcidump\fP [OPTIONS ...] [FILTERS] | |
9 | reads raw HCI data coming from and going to a Bluetooth device (which can be | 9 | .SH DESCRIPTION | |
10 | specified with the option | 10 | .sp | |
11 | -.BR -i , | 11 | -\fBhcidump(1)\fP reads raw HCI data coming from and going to a Bluetooth device | |
12 | -default is the first available one) and prints to screen commands, events and | 12 | -(which can be specified with the option \fB\-i\fP, default is the first available | |
13 | +.BR -i ) | 13 | -one) and prints to screen commands, events and data in a human\-readable form. | |
14 | +and prints to screen commands, events and | 14 | +\fBhcidump(1)\fP reads raw HCI data coming from and going to Bluetooth devices | |
15 | data in a human-readable form. Optionally, the dump can be written to a file | 15 | +(which can be specified with the option \fB\-i\fP) | |
16 | rather than parsed, and the dump file can be parsed in a subsequent moment. | 16 | +and prints to screen commands, events and data in a human\-readable form. | |
17 | Optionally, the dump can be written to a file rather than parsed, and the dump | |||
18 | file can be parsed in a subsequent moment. | |||
17 | .SH OPTIONS | 19 | .SH OPTIONS | |
18 | @@ -21,14 +21,14 @@ rather than parsed, and the dump file ca | 20 | .INDENT 0.0 | |
19 | .BI -h | |||
20 | Prints usage info and exits | |||
21 | .TP | 21 | .TP | |
22 | -.BI -i " <hciX>" | 22 | -.BI \-i \ <hciX> | |
23 | +.BI -i " <device>" | 23 | -Data is read from \fIhciX\fP, which must be the name of an installed Bluetooth | |
24 | Data is read from | 24 | +.BI \-i \ <device> | |
25 | -.IR hciX , | 25 | +Data is read from \fIdevice\fP, which must be the name of an installed Bluetooth | |
26 | +.IR device, | 26 | device. If not specified, and if \fB\-r\fP option is not set, data is read from | |
27 | which must be the name of an installed Bluetooth device. If not specified, | 27 | -the first available Bluetooth device. | |
28 | and if | 28 | +all available Bluetooth devices. | |
29 | .B | |||
30 | -r | |||
31 | -option is not set, data is read from the first available Bluetooth device. | |||
32 | +option is not set, data is read from all available Bluetooth devices. | |||
33 | .TP | 29 | .TP | |
34 | .BI -l " <len>" "\fR,\fP \-\^\-snap-len=" "<len>" | 30 | .BI \-l \ <len>\fR,\fB \ \-\-snap\-len\fB= <len> | |
35 | Sets max length of processed packets to | 31 | Sets max length of processed packets to \fIlen\fP\&. |
@@ -1,72 +1,72 @@ | @@ -1,72 +1,72 @@ | |||
1 | $NetBSD: patch-tools_hcidump.c,v 1.1 2014/12/30 08:39:13 plunky Exp $ | 1 | $NetBSD: patch-tools_hcidump.c,v 1.2 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | changes here, are that netbt stack | 3 | changes here, are that netbt stack | |
4 | - uses a string for the device address | 4 | - uses a string for the device address | |
5 | - uses sockaddr_bt throughout | 5 | - uses sockaddr_bt throughout | |
6 | - provides event and packet filters separately | 6 | - provides event and packet filters separately | |
7 | 7 | |||
8 | Also, the BSDs provide a socket level TIMESTAMP option | 8 | Also, the BSDs provide a socket level TIMESTAMP option | |
9 | 9 | |||
10 | --- tools/hcidump.c.orig 2014-10-05 19:31:20.000000000 +0000 | 10 | --- tools/hcidump.c.orig 2015-09-04 01:19:36.000000000 +0000 | |
11 | +++ tools/hcidump.c | 11 | +++ tools/hcidump.c | |
12 | @@ -135,7 +135,7 @@ static inline int write_n(int fd, char * | 12 | @@ -135,7 +135,7 @@ static inline int write_n(int fd, char * | |
13 | return t; | 13 | return t; | |
14 | } | 14 | } | |
15 | 15 | |||
16 | -static int process_frames(int dev, int sock, int fd, unsigned long flags) | 16 | -static int process_frames(int dev, int sock, int fd, unsigned long flags) | |
17 | +static int process_frames(char *dev, int sock, int fd, unsigned long flags) | 17 | +static int process_frames(char *dev, int sock, int fd, unsigned long flags) | |
18 | { | 18 | { | |
19 | struct cmsghdr *cmsg; | 19 | struct cmsghdr *cmsg; | |
20 | struct msghdr msg; | 20 | struct msghdr msg; | |
21 | @@ -177,7 +177,7 @@ static int process_frames(int dev, int s | 21 | @@ -171,7 +171,7 @@ static int process_frames(int dev, int s | |
22 | if (dev == HCI_DEV_NONE) | 22 | if (dev == HCI_DEV_NONE) | |
23 | printf("system: "); | 23 | printf("system: "); | |
24 | else | 24 | else | |
25 | - printf("device: hci%d ", dev); | 25 | - printf("device: hci%d ", dev); | |
26 | + printf("device: %s ", dev); | 26 | + printf("device: %s ", dev); | |
27 | 27 | |||
28 | printf("snap_len: %d filter: 0x%lx\n", snap_len, parser.filter); | 28 | printf("snap_len: %d filter: 0x%lx\n", snap_len, parser.filter); | |
29 | 29 | |||
30 | @@ -522,9 +522,9 @@ static int open_file(char *file, int mod | 30 | @@ -516,9 +516,9 @@ static int open_file(char *file, int mod | |
31 | return fd; | 31 | return fd; | |
32 | } | 32 | } | |
33 | 33 | |||
34 | -static int open_socket(int dev, unsigned long flags) | 34 | -static int open_socket(int dev, unsigned long flags) | |
35 | +static int open_socket(char *dev, unsigned long flags) | 35 | +static int open_socket(char *dev, unsigned long flags) | |
36 | { | 36 | { | |
37 | - struct sockaddr_hci addr; | 37 | - struct sockaddr_hci addr; | |
38 | + struct sockaddr_bt addr; | 38 | + struct sockaddr_bt addr; | |
39 | struct hci_filter flt; | 39 | struct hci_filter flt; | |
40 | int sk, opt; | 40 | int sk, opt; | |
41 | 41 | |||
42 | @@ -542,12 +542,13 @@ static int open_socket(int dev, unsigned | 42 | @@ -536,12 +536,13 @@ static int open_socket(int dev, unsigned | |
43 | } | 43 | } | |
44 | 44 | |||
45 | opt = 1; | 45 | opt = 1; | |
46 | - if (setsockopt(sk, SOL_HCI, HCI_TIME_STAMP, &opt, sizeof(opt)) < 0) { | 46 | - if (setsockopt(sk, SOL_HCI, HCI_TIME_STAMP, &opt, sizeof(opt)) < 0) { | |
47 | + if (setsockopt(sk, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) { | 47 | + if (setsockopt(sk, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) { | |
48 | perror("Can't enable time stamp"); | 48 | perror("Can't enable time stamp"); | |
49 | return -1; | 49 | goto fail; | |
50 | } | 50 | } | |
51 | 51 | |||
52 | /* Setup filter */ | 52 | /* Setup filter */ | |
53 | +#if 0 | 53 | +#if 0 | |
54 | hci_filter_clear(&flt); | 54 | hci_filter_clear(&flt); | |
55 | hci_filter_all_ptypes(&flt); | 55 | hci_filter_all_ptypes(&flt); | |
56 | hci_filter_all_events(&flt); | 56 | hci_filter_all_events(&flt); | |
57 | @@ -555,13 +556,34 @@ static int open_socket(int dev, unsigned | 57 | @@ -549,13 +550,34 @@ static int open_socket(int dev, unsigned | |
58 | perror("Can't set filter"); | 58 | perror("Can't set filter"); | |
59 | return -1; | 59 | goto fail; | |
60 | } | 60 | } | |
61 | +#else | 61 | +#else | |
62 | + memset(&flt, 0xff, sizeof(flt)); | 62 | + memset(&flt, 0xff, sizeof(flt)); | |
63 | + if (setsockopt(sk, BTPROTO_HCI, SO_HCI_EVT_FILTER, &flt, sizeof(flt)) < 0) { | 63 | + if (setsockopt(sk, BTPROTO_HCI, SO_HCI_EVT_FILTER, &flt, sizeof(flt)) < 0) { | |
64 | + perror("Can't set event filter"); | 64 | + perror("Can't set event filter"); | |
65 | + return -1; | 65 | + return -1; | |
66 | + } | 66 | + } | |
67 | + | 67 | + | |
68 | + if (setsockopt(sk, BTPROTO_HCI, SO_HCI_PKT_FILTER, &flt, sizeof(flt)) < 0) { | 68 | + if (setsockopt(sk, BTPROTO_HCI, SO_HCI_PKT_FILTER, &flt, sizeof(flt)) < 0) { | |
69 | + perror("Can't set packet filter"); | 69 | + perror("Can't set packet filter"); | |
70 | + return -1; | 70 | + return -1; | |
71 | + } | 71 | + } | |
72 | +#endif | 72 | +#endif | |
@@ -78,33 +78,33 @@ Also, the BSDs provide a socket level TI | @@ -78,33 +78,33 @@ Also, the BSDs provide a socket level TI | |||
78 | addr.hci_dev = dev; | 78 | addr.hci_dev = dev; | |
79 | +#else | 79 | +#else | |
80 | + addr.bt_len = sizeof(addr); | 80 | + addr.bt_len = sizeof(addr); | |
81 | + addr.bt_family = AF_BLUETOOTH; | 81 | + addr.bt_family = AF_BLUETOOTH; | |
82 | + if (dev != HCI_DEV_NONE && !bt_devaddr(dev, &addr.bt_bdaddr)) { | 82 | + if (dev != HCI_DEV_NONE && !bt_devaddr(dev, &addr.bt_bdaddr)) { | |
83 | + perror("device"); | 83 | + perror("device"); | |
84 | + return -1; | 84 | + return -1; | |
85 | + } | 85 | + } | |
86 | +#endif | 86 | +#endif | |
87 | if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { | 87 | if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { | |
88 | - printf("Can't attach to device hci%d. %s(%d)\n", | 88 | - printf("Can't attach to device hci%d. %s(%d)\n", | |
89 | + printf("Can't attach to device %s. %s(%d)\n", | 89 | + printf("Can't attach to device %s. %s(%d)\n", | |
90 | dev, strerror(errno), errno); | 90 | dev, strerror(errno), errno); | |
91 | return -1; | 91 | goto fail; | |
92 | } | 92 | } | |
93 | @@ -672,7 +694,7 @@ int main(int argc, char *argv[]) | 93 | @@ -670,7 +692,7 @@ int main(int argc, char *argv[]) | |
94 | { | 94 | { | |
95 | unsigned long flags = 0; | 95 | unsigned long flags = 0; | |
96 | unsigned long filter = 0; | 96 | unsigned long filter = 0; | |
97 | - int device = 0; | 97 | - int device = 0; | |
98 | + char *device = HCI_DEV_NONE; | 98 | + char *device = HCI_DEV_NONE; | |
99 | int defpsm = 0; | 99 | int defpsm = 0; | |
100 | int defcompid = DEFAULT_COMPID; | 100 | int defcompid = DEFAULT_COMPID; | |
101 | int opt, pppdump_fd = -1, audio_fd = -1; | 101 | int opt, pppdump_fd = -1, audio_fd = -1; | |
102 | @@ -684,7 +706,7 @@ int main(int argc, char *argv[]) | 102 | @@ -682,7 +704,7 @@ int main(int argc, char *argv[]) | |
103 | switch(opt) { | 103 | switch(opt) { | |
104 | case 'i': | 104 | case 'i': | |
105 | if (strcasecmp(optarg, "none") && strcasecmp(optarg, "system")) | 105 | if (strcasecmp(optarg, "none") && strcasecmp(optarg, "system")) | |
106 | - device = atoi(optarg + 3); | 106 | - device = atoi(optarg + 3); | |
107 | + device = optarg; | 107 | + device = optarg; | |
108 | else | 108 | else | |
109 | device = HCI_DEV_NONE; | 109 | device = HCI_DEV_NONE; | |
110 | break; | 110 | break; |
@@ -1,27 +1,27 @@ | @@ -1,27 +1,27 @@ | |||
1 | $NetBSD: patch-tools_parser_parser.h,v 1.2 2015/03/19 19:16:31 joerg Exp $ | 1 | $NetBSD: patch-tools_parser_parser.h,v 1.3 2023/06/04 09:06:16 plunky Exp $ | |
2 | 2 | |||
3 | the device ID is a string on netbt stack | 3 | the device ID is a string on netbt stack | |
4 | 4 | |||
5 | --- tools/parser/parser.h.orig 2014-03-25 20:53:42.000000000 +0000 | 5 | --- tools/parser/parser.h.orig 2021-10-13 18:38:35.000000000 +0000 | |
6 | +++ tools/parser/parser.h | 6 | +++ tools/parser/parser.h | |
7 | @@ -37,7 +37,7 @@ struct frame { | 7 | @@ -24,7 +24,7 @@ struct frame { | |
8 | uint32_t data_len; | 8 | uint32_t data_len; | |
9 | void *ptr; | 9 | void *ptr; | |
10 | uint32_t len; | 10 | uint32_t len; | |
11 | - uint16_t dev_id; | 11 | - uint16_t dev_id; | |
12 | + char *dev_id; | 12 | + char *dev_id; | |
13 | uint8_t in; | 13 | uint8_t in; | |
14 | uint8_t master; | 14 | uint8_t central; | |
15 | uint16_t handle; | 15 | uint16_t handle; | |
16 | @@ -135,9 +135,9 @@ static inline void p_indent(int level, s | 16 | @@ -122,9 +122,9 @@ static inline void p_indent(int level, s | |
17 | localtime_r(&t, &tm); | 17 | localtime_r(&t, &tm); | |
18 | printf("%04d-%02d-%02d %02d:%02d:%02d.%06lu ", | 18 | printf("%04d-%02d-%02d %02d:%02d:%02d.%06lu ", | |
19 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, | 19 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, | |
20 | - tm.tm_hour, tm.tm_min, tm.tm_sec, f->ts.tv_usec); | 20 | - tm.tm_hour, tm.tm_min, tm.tm_sec, f->ts.tv_usec); | |
21 | + tm.tm_hour, tm.tm_min, tm.tm_sec, (unsigned long)f->ts.tv_usec); | 21 | + tm.tm_hour, tm.tm_min, tm.tm_sec, (unsigned long)f->ts.tv_usec); | |
22 | } else | 22 | } else | |
23 | - printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); | 23 | - printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); | |
24 | + printf("%8ju.%06lu ", (uintmax_t)f->ts.tv_sec, (unsigned long)f->ts.tv_usec); | 24 | + printf("%8ju.%06lu ", (uintmax_t)f->ts.tv_sec, (unsigned long)f->ts.tv_usec); | |
25 | } | 25 | } | |
26 | printf("%c ", (f->in ? '>' : '<')); | 26 | printf("%c ", (f->in ? '>' : '<')); | |
27 | parser.state = 1; | 27 | parser.state = 1; |