1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
$NetBSD: patch-ab,v 1.4 2012/02/15 09:30:23 plunky Exp $
--- lib/bluetooth.h.orig 2011-12-22 00:18:58.000000000 +0000
+++ lib/bluetooth.h
@@ -30,6 +30,7 @@
extern "C" {
#endif
+#if 0
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -107,6 +108,20 @@ enum {
#else
#error "Unknown byte order"
#endif
+#else
+#include <bluetooth.h>
+#include <string.h>
+
+#define SOL_HCI BTPROTO_HCI
+
+#define htobs(d) htole16(d)
+#define htobl(d) htole32(d)
+#define btohs(d) le16toh(d)
+#define btohl(d) le32toh(d)
+#define bswap_64(v) bswap64(v)
+#define bswap_32(v) bswap32(v)
+#define bswap_16(v) bswap16(v)
+#endif
/* Bluetooth unaligned access */
#define bt_get_unaligned(ptr) \
@@ -189,6 +204,7 @@ static inline uint16_t bt_get_be16(void
#error "Unknown byte order"
#endif
+#if 0
/* BD Address */
typedef struct {
uint8_t b[6];
@@ -197,6 +213,7 @@ typedef struct {
#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
#define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
+#endif
/* Copy, swap, convert BD Address */
static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
@@ -209,9 +226,12 @@ static inline void bacpy(bdaddr_t *dst,
}
void baswap(bdaddr_t *dst, const bdaddr_t *src);
+#if 0
bdaddr_t *strtoba(const char *str);
char *batostr(const bdaddr_t *ba);
+#endif
int ba2str(const bdaddr_t *ba, char *str);
+#if 0
int str2ba(const char *str, bdaddr_t *ba);
int ba2oui(const bdaddr_t *ba, char *oui);
int bachk(const char *str);
@@ -220,11 +240,14 @@ int baprintf(const char *format, ...);
int bafprintf(FILE *stream, const char *format, ...);
int basprintf(char *str, const char *format, ...);
int basnprintf(char *str, size_t size, const char *format, ...);
+#endif
void *bt_malloc(size_t size);
void bt_free(void *ptr);
+#if 0
int bt_error(uint16_t code);
+#endif
char *bt_compidtostr(int id);
typedef struct {
|