]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - net/bluetooth/lib.c
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
25 /* Bluetooth kernel library. */
27 #include <linux/config.h>
28 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/stddef.h>
32 #include <linux/string.h>
33 #include <asm/errno.h>
35 #include <net/bluetooth/bluetooth.h>
37 void bt_dump(char *pref
, __u8
*buf
, int count
)
43 printk(KERN_INFO
"%s: dump, len %d\n", pref
, count
);
47 for (i
= 0; i
< count
; i
++) {
48 ptr
+= sprintf(ptr
, " %2.2X", buf
[i
]);
50 if (i
&& !((i
+ 1) % 20)) {
51 printk(KERN_INFO
"%s:%s\n", pref
, line
);
58 printk(KERN_INFO
"%s:%s\n", pref
, line
);
60 EXPORT_SYMBOL(bt_dump
);
62 void baswap(bdaddr_t
*dst
, bdaddr_t
*src
)
64 unsigned char *d
= (unsigned char *) dst
;
65 unsigned char *s
= (unsigned char *) src
;
68 for (i
= 0; i
< 6; i
++)
71 EXPORT_SYMBOL(baswap
);
73 char *batostr(bdaddr_t
*ba
)
75 static char str
[2][18];
79 sprintf(str
[i
], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
80 ba
->b
[0], ba
->b
[1], ba
->b
[2],
81 ba
->b
[3], ba
->b
[4], ba
->b
[5]);
85 EXPORT_SYMBOL(batostr
);
87 /* Bluetooth error codes to Unix errno mapping */
88 int bt_err(__u16 code
)
162 return EPROTONOSUPPORT
;
178 EXPORT_SYMBOL(bt_err
);