From a48d8b4639f36e6fc2d7e87cac92e178674caaa1 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Fri, 8 Mar 2002 21:10:06 +0000 Subject: Initial revision --- src/bluetooth.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 src/bluetooth.c (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c new file mode 100644 index 00000000..6dfccf44 --- /dev/null +++ b/src/bluetooth.c @@ -0,0 +1,164 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2000-2001 Qualcomm Incorporated + + Written 2000,2001 by Maxim Krasnyansky + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +/* + * $Id$ + */ + +#include +#include +#include +#include +#include + +#include +#include + +void baswap(bdaddr_t *dst, bdaddr_t *src) +{ + register unsigned char * d = (unsigned char *)dst; + register unsigned char * s = (unsigned char *)src; + register int i; + for(i=0; i<6; i++) + d[i] = s[5-i]; +} + +char * batostr(bdaddr_t *ba) +{ + static char str[2][18]; + static int i = 1; + + i ^= 1; + sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", + ba->b[0], ba->b[1], ba->b[2], + ba->b[3], ba->b[4], ba->b[5]); + return str[i]; +} + +bdaddr_t * strtoba(char *str) +{ + static unsigned char ba[2][sizeof(bdaddr_t)]; + static int i = 1; + register char *ptr = str; + register int x; + + i ^= 1; + for(x=0; x<6; x++){ + ba[i][x] = (uint8_t) strtol(ptr, NULL, 16); + if( x!=5 && !(ptr=strchr(ptr,':')) ) + ptr = ":00:00:00:00:00"; + ptr++; + } + return (bdaddr_t *) ba[i]; +} + +int ba2str(bdaddr_t *ba, char *str) +{ + return sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", + ba->b[0], ba->b[1], ba->b[2], + ba->b[3], ba->b[4], ba->b[5]); +} + +int str2ba(char *str, bdaddr_t *ba) +{ + unsigned char *b = (void *) ba; + char *ptr = str; + register int x; + + for (x=0; x < 6; x++) { + b[x] = (uint8_t) strtol(ptr, NULL, 16); + if (x!=5 && !(ptr=strchr(ptr, ':'))) + ptr = ":00:00:00:00:00"; + ptr++; + } + return 0; +} + +/* Bluetooth error codes to Unix errno mapping */ +int bterr(uint16_t code) +{ + switch(code) { + case 0: + return 0; + case 0x01: + return EBADRQC; + case 0x02: + return ENOTCONN; + case 0x03: + return EIO; + case 0x04: + return EHOSTDOWN; + case 0x05: + return EACCES; + case 0x06: + return EINVAL; + case 0x07: + return ENOMEM; + case 0x08: + return ETIMEDOUT; + case 0x09: + return EMLINK; + case 0x0a: + return EMLINK; + case 0x0b: + return EALREADY; + case 0x0c: + return EBUSY; + case 0x0d: + case 0x0e: + case 0x0f: + return ECONNREFUSED; + case 0x10: + return ETIMEDOUT; + case 0x11: + case 0x27: + case 0x29: + case 0x20: + return EOPNOTSUPP; + case 0x12: + return EINVAL; + case 0x13: + case 0x14: + case 0x15: + return ECONNRESET; + case 0x16: + return ECONNABORTED; + case 0x17: + return ELOOP; + case 0x18: + return EACCES; + case 0x1a: + return EPROTONOSUPPORT; + case 0x1b: + return ECONNREFUSED; + case 0x19: + case 0x1e: + case 0x23: + case 0x24: + case 0x25: + return EPROTO; + default: + return ENOSYS; + } +} -- cgit From a51747b602f9cd03c7431788f80431c1710f5827 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Thu, 21 Mar 2002 23:20:32 +0000 Subject: Additional strtoXX and XXtostr functions. --- src/bluetooth.c | 216 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 153 insertions(+), 63 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 6dfccf44..b202f280 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -96,69 +96,159 @@ int str2ba(char *str, bdaddr_t *ba) } /* Bluetooth error codes to Unix errno mapping */ -int bterr(uint16_t code) +int bt_error(uint16_t code) { - switch(code) { - case 0: - return 0; - case 0x01: - return EBADRQC; - case 0x02: - return ENOTCONN; - case 0x03: - return EIO; - case 0x04: - return EHOSTDOWN; - case 0x05: - return EACCES; - case 0x06: - return EINVAL; - case 0x07: - return ENOMEM; - case 0x08: - return ETIMEDOUT; - case 0x09: - return EMLINK; - case 0x0a: - return EMLINK; - case 0x0b: - return EALREADY; - case 0x0c: - return EBUSY; - case 0x0d: - case 0x0e: - case 0x0f: - return ECONNREFUSED; - case 0x10: - return ETIMEDOUT; - case 0x11: - case 0x27: - case 0x29: - case 0x20: - return EOPNOTSUPP; - case 0x12: - return EINVAL; - case 0x13: - case 0x14: - case 0x15: - return ECONNRESET; - case 0x16: - return ECONNABORTED; - case 0x17: - return ELOOP; - case 0x18: - return EACCES; - case 0x1a: - return EPROTONOSUPPORT; - case 0x1b: - return ECONNREFUSED; - case 0x19: - case 0x1e: - case 0x23: - case 0x24: - case 0x25: - return EPROTO; - default: - return ENOSYS; + switch (code) { + case 0: + return 0; + case 0x01: + return EBADRQC; + case 0x02: + return ENOTCONN; + case 0x03: + return EIO; + case 0x04: + return EHOSTDOWN; + case 0x05: + return EACCES; + case 0x06: + return EINVAL; + case 0x07: + return ENOMEM; + case 0x08: + return ETIMEDOUT; + case 0x09: + return EMLINK; + case 0x0a: + return EMLINK; + case 0x0b: + return EALREADY; + case 0x0c: + return EBUSY; + case 0x0d: + case 0x0e: + case 0x0f: + return ECONNREFUSED; + case 0x10: + return ETIMEDOUT; + case 0x11: + case 0x27: + case 0x29: + case 0x20: + return EOPNOTSUPP; + case 0x12: + return EINVAL; + case 0x13: + case 0x14: + case 0x15: + return ECONNRESET; + case 0x16: + return ECONNABORTED; + case 0x17: + return ELOOP; + case 0x18: + return EACCES; + case 0x1a: + return EPROTONOSUPPORT; + case 0x1b: + return ECONNREFUSED; + case 0x19: + case 0x1e: + case 0x23: + case 0x24: + case 0x25: + return EPROTO; + default: + return ENOSYS; + } +} + +char *bt_compidtostr(int compid) +{ + switch (compid) { + case 0: + return "Ericsson Mobile Comunications"; + case 1: + return "Nokia Mobile Phones"; + case 2: + return "Intel Corp."; + case 3: + return "IBM Corp."; + case 4: + return "Toshiba Corp."; + case 5: + return "3Com"; + case 6: + return "Microsoft"; + case 7: + return "Lucent"; + case 8: + return "Motorola"; + case 9: + return "Infineon Technologies AG"; + case 10: + return "Cambridge Silicon Radio"; + case 11: + return "Silicon Wave"; + case 12: + return "Digianswer A/S"; + case 13: + return "Texas Instruments Inc."; + case 14: + return "Parthus Technologies Inc."; + case 15: + return "Broadcom Corporation"; + case 16: + return "Mitel Semiconductor"; + case 17: + return "Widcomm, Inc."; + case 18: + return "Telencomm Inc."; + case 19: + return "Atmel Corporation"; + case 20: + return "Mitsubishi Electric Corporation"; + case 21: + return "RTX Telecom A/S"; + case 22: + return "KC Technology Inc."; + case 23: + return "Newlogic"; + case 24: + return "Transilica, Inc."; + case 25: + return "Rohde & Schwartz GmbH & Co. KG"; + case 26: + return "TTPCom Limited"; + case 27: + return "Signia Technologies, Inc."; + case 28: + return "Conexant Systems Inc."; + case 29: + return "Qualcomm"; + case 30: + return "Inventel"; + case 31: + return "AVM Berlin"; + case 32: + return "BandSpeed, Inc."; + case 33: + return "Mansella Ltd"; + case 34: + return "NEC Corporation"; + case 35: + return "WavePlus Technology Co., Ltd."; + case 36: + return "Alcatel"; + case 37: + return "Philips Semiconductors"; + case 38: + return "C Technologies"; + case 39: + return "Open Interface"; + case 65535: + return "internal use"; + default: + return "not assigned"; } } -- cgit From 87f8b3bc7c1967cef913de6b23bbdebb8f98d19e Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Mon, 25 Mar 2002 19:12:16 +0000 Subject: Fix static allocations. --- src/bluetooth.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index b202f280..add25594 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -44,33 +44,34 @@ void baswap(bdaddr_t *dst, bdaddr_t *src) d[i] = s[5-i]; } -char * batostr(bdaddr_t *ba) +char *batostr(bdaddr_t *ba) { - static char str[2][18]; - static int i = 1; + char *str = malloc(18); + if (!str) + return NULL; - i ^= 1; - sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", + sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", ba->b[0], ba->b[1], ba->b[2], ba->b[3], ba->b[4], ba->b[5]); - return str[i]; + return str; } -bdaddr_t * strtoba(char *str) +bdaddr_t *strtoba(char *str) { - static unsigned char ba[2][sizeof(bdaddr_t)]; - static int i = 1; - register char *ptr = str; - register int x; - - i ^= 1; - for(x=0; x<6; x++){ - ba[i][x] = (uint8_t) strtol(ptr, NULL, 16); - if( x!=5 && !(ptr=strchr(ptr,':')) ) + char *ptr = str; + int i; + + uint8_t *ba = malloc(sizeof(bdaddr_t)); + if (!ba) + return NULL; + + for(i=0; i<6; i++){ + ba[i] = (uint8_t) strtol(ptr, NULL, 16); + if( i!=5 && !(ptr=strchr(ptr,':')) ) ptr = ":00:00:00:00:00"; ptr++; } - return (bdaddr_t *) ba[i]; + return (bdaddr_t *) ba; } int ba2str(bdaddr_t *ba, char *str) @@ -82,13 +83,13 @@ int ba2str(bdaddr_t *ba, char *str) int str2ba(char *str, bdaddr_t *ba) { - unsigned char *b = (void *) ba; + uint8_t *b = (void *) ba; char *ptr = str; - register int x; + int i; - for (x=0; x < 6; x++) { - b[x] = (uint8_t) strtol(ptr, NULL, 16); - if (x!=5 && !(ptr=strchr(ptr, ':'))) + for (i=0; i < 6; i++) { + b[i] = (uint8_t) strtol(ptr, NULL, 16); + if (i!=5 && !(ptr=strchr(ptr, ':'))) ptr = ":00:00:00:00:00"; ptr++; } -- cgit From 21efc9d87640fa0d9b78a311677e316590515171 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Thu, 28 Mar 2002 23:11:53 +0000 Subject: Swap address in str2ba and ba2str. --- src/bluetooth.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index add25594..97a1cf57 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -76,14 +76,16 @@ bdaddr_t *strtoba(char *str) int ba2str(bdaddr_t *ba, char *str) { + uint8_t b[6]; + + baswap((bdaddr_t *)b, ba); return sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", - ba->b[0], ba->b[1], ba->b[2], - ba->b[3], ba->b[4], ba->b[5]); + b[0], b[1], b[2], b[3], b[4], b[5]); } int str2ba(char *str, bdaddr_t *ba) { - uint8_t *b = (void *) ba; + uint8_t b[6]; char *ptr = str; int i; @@ -93,6 +95,7 @@ int str2ba(char *str, bdaddr_t *ba) ptr = ":00:00:00:00:00"; ptr++; } + baswap(ba, (bdaddr_t *)b); return 0; } -- cgit From d61a1930cd52b112516c0442a9b75d8461a6031a Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Mon, 13 May 2002 19:00:25 +0000 Subject: more company ids --- src/bluetooth.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 97a1cf57..622464f8 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -250,6 +250,12 @@ char *bt_compidtostr(int compid) return "C Technologies"; case 39: return "Open Interface"; + case 40: + return "R F Micro Devices"; + case 41: + return "Hitachi Ltd"; + case 42: + return "Symbol Technologies, Inc."; case 65535: return "internal use"; default: -- cgit From 00b68045e890dccbf09bed06727f0453daa27b90 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Tue, 4 Jun 2002 00:13:33 +0000 Subject: Additional comp ids --- src/bluetooth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 622464f8..6c09c4d9 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -256,6 +256,10 @@ char *bt_compidtostr(int compid) return "Hitachi Ltd"; case 42: return "Symbol Technologies, Inc."; + case 43: + return "Tenovis"; + case 44: + return "Macronix International Co. Ltd."; case 65535: return "internal use"; default: -- cgit From afdbc9e8fe53fdf5c4a5c78e379d604e92a61480 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Tue, 25 Jun 2002 04:03:54 +0000 Subject: new comp ids --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 6c09c4d9..d769e2b9 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -260,6 +260,8 @@ char *bt_compidtostr(int compid) return "Tenovis"; case 44: return "Macronix International Co. Ltd."; + case 45: + return "GCT Semiconductor"; case 65535: return "internal use"; default: -- cgit From 8ee9bf3777ff4f57ec1e170174e2fcb6e1f870f7 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Tue, 2 Jul 2002 18:34:22 +0000 Subject: more compids --- src/bluetooth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index d769e2b9..7097ebf0 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -262,6 +262,10 @@ char *bt_compidtostr(int compid) return "Macronix International Co. Ltd."; case 45: return "GCT Semiconductor"; + case 46: + return "Norwood Systems"; + case 47: + return "MewTel Technology Inc."; case 65535: return "internal use"; default: -- cgit From 9b62711dfb2f6fa13d6ddc02a713ba5960926c66 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 17 Oct 2002 14:49:27 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 7097ebf0..7bd06ff0 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -266,6 +266,12 @@ char *bt_compidtostr(int compid) return "Norwood Systems"; case 47: return "MewTel Technology Inc."; + case 48: + return "ST Microelectronics"; + case 49: + return "Synopsys"; + case 50: + return "Red-M (Communications) Ltd"; case 65535: return "internal use"; default: -- cgit From 7e64d607acb1f9701381d09ccdeca0793f127592 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 28 Nov 2002 21:26:59 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 7bd06ff0..b60b0191 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -272,6 +272,8 @@ char *bt_compidtostr(int compid) return "Synopsys"; case 50: return "Red-M (Communications) Ltd"; + case 51: + return "Commil Ltd"; case 65535: return "internal use"; default: -- cgit From 805b906186b0a5ea0ce77824b4a7c659b6b7b598 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Mon, 3 Feb 2003 17:39:11 +0000 Subject: use error codes --- src/bluetooth.c | 69 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index b60b0191..4548b121 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -105,62 +105,61 @@ int bt_error(uint16_t code) switch (code) { case 0: return 0; - case 0x01: + case HCI_UNKNOWN_COMMAND: return EBADRQC; - case 0x02: + case HCI_NO_CONNECTION: return ENOTCONN; - case 0x03: + case HCI_HARDWARE_FAILURE: return EIO; - case 0x04: + case HCI_PAGE_TIMEOUT: return EHOSTDOWN; - case 0x05: + case HCI_AUTHENTICATION_FAILURE: return EACCES; - case 0x06: + case HCI_KEY_MISSING: return EINVAL; - case 0x07: + case HCI_MEMORY_FULL: return ENOMEM; - case 0x08: + case HCI_CONNECTION_TIMEOUT: return ETIMEDOUT; - case 0x09: + case HCI_MAX_NUMBER_OF_CONNECTIONS: + case HCI_MAX_NUMBER_OF_SCO_CONNECTIONS: return EMLINK; - case 0x0a: - return EMLINK; - case 0x0b: + case HCI_ACL_CONNECTION_EXISTS: return EALREADY; - case 0x0c: + case HCI_COMMAND_DISALLOWED: return EBUSY; - case 0x0d: - case 0x0e: - case 0x0f: + case HCI_REJECTED_LIMITED_RESOURCES: + case HCI_REJECTED_SECURITY: + case HCI_REJECTED_PERSONAL: return ECONNREFUSED; - case 0x10: + case HCI_HOST_TIMEOUT: return ETIMEDOUT; - case 0x11: - case 0x27: - case 0x29: - case 0x20: + case HCI_UNSUPPORTED_FEATURE: + case HCI_QOS_NOT_SUPPORTED: + case HCI_PAIRING_NOT_SUPPORTED: + case HCI_UNSUPPORTED_LMP_PARAMETER_VALUE: return EOPNOTSUPP; - case 0x12: + case HCI_INVALID_PARAMETERS: return EINVAL; - case 0x13: - case 0x14: - case 0x15: + case HCI_OE_USER_ENDED_CONNECTION: + case HCI_OE_LOW_RESOURCES: + case HCI_OE_POWER_OFF: return ECONNRESET; - case 0x16: + case HCI_CONNECTION_TERMINATED: return ECONNABORTED; - case 0x17: + case HCI_REPEATED_ATTEMPTS: return ELOOP; - case 0x18: + case HCI_PAIRING_NOT_ALLOWED: return EACCES; - case 0x1a: + case HCI_UNSUPPORTED_REMOTE_FEATURE: return EPROTONOSUPPORT; - case 0x1b: + case HCI_SCO_OFFSET_REJECTED: return ECONNREFUSED; - case 0x19: - case 0x1e: - case 0x23: - case 0x24: - case 0x25: + case HCI_UNKNOWN_LMP_PDU: + case HCI_INVALID_LMP_PARAMETERS: + case HCI_LMP_ERROR_TRANSACTION_COLLISION: + case HCI_LMP_PDU_NOT_ALLOWED: + case HCI_ENCRYPTION_MODE_NOT_ACCEPTED: return EPROTO; default: return ENOSYS; -- cgit From 109bfa547ab9e24672472371e2183dcec24d0058 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Tue, 11 Feb 2003 10:22:23 +0000 Subject: add const to fn sigs; fns to auth and enc links --- src/bluetooth.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 4548b121..bc0eb238 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -35,16 +35,16 @@ #include #include -void baswap(bdaddr_t *dst, bdaddr_t *src) +void baswap(bdaddr_t *dst, const bdaddr_t *src) { - register unsigned char * d = (unsigned char *)dst; - register unsigned char * s = (unsigned char *)src; + register unsigned char *d = (unsigned char *)dst; + register const unsigned char *s = (const unsigned char *)src; register int i; for(i=0; i<6; i++) d[i] = s[5-i]; } -char *batostr(bdaddr_t *ba) +char *batostr(const bdaddr_t *ba) { char *str = malloc(18); if (!str) @@ -56,9 +56,9 @@ char *batostr(bdaddr_t *ba) return str; } -bdaddr_t *strtoba(char *str) +bdaddr_t *strtoba(const char *str) { - char *ptr = str; + const char *ptr = str; int i; uint8_t *ba = malloc(sizeof(bdaddr_t)); @@ -74,7 +74,7 @@ bdaddr_t *strtoba(char *str) return (bdaddr_t *) ba; } -int ba2str(bdaddr_t *ba, char *str) +int ba2str(const bdaddr_t *ba, char *str) { uint8_t b[6]; @@ -83,10 +83,10 @@ int ba2str(bdaddr_t *ba, char *str) b[0], b[1], b[2], b[3], b[4], b[5]); } -int str2ba(char *str, bdaddr_t *ba) +int str2ba(const char *str, bdaddr_t *ba) { uint8_t b[6]; - char *ptr = str; + const char *ptr = str; int i; for (i=0; i < 6; i++) { -- cgit From c12c507c9a494cd70e82b01c9856d92ebf36f165 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 26 May 2003 13:10:49 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index bc0eb238..baaf9f7c 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -273,6 +273,8 @@ char *bt_compidtostr(int compid) return "Red-M (Communications) Ltd"; case 51: return "Commil Ltd"; + case 52: + return "Computer Access Technology Corporation (CATC)"; case 65535: return "internal use"; default: -- cgit From 8095772fc06beb7d21bb02c0cc0a2157734e5919 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 3 Jun 2003 14:04:01 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index baaf9f7c..f2c13a24 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -275,6 +275,8 @@ char *bt_compidtostr(int compid) return "Commil Ltd"; case 52: return "Computer Access Technology Corporation (CATC)"; + case 53: + return "Eclipse (HQ Espana) S.L."; case 65535: return "internal use"; default: -- cgit From 9b910ddd11031c344408cc11b50116f0d5631231 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 18 Jul 2003 01:51:09 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index f2c13a24..97688efc 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -277,6 +277,8 @@ char *bt_compidtostr(int compid) return "Computer Access Technology Corporation (CATC)"; case 53: return "Eclipse (HQ Espana) S.L."; + case 54: + return "Renesas Technology Corp."; case 65535: return "internal use"; default: -- cgit From 349d081b82323130f0648eeac5329fa53610d3f1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 25 Jul 2003 12:57:59 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 97688efc..af56573b 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -279,6 +279,8 @@ char *bt_compidtostr(int compid) return "Eclipse (HQ Espana) S.L."; case 54: return "Renesas Technology Corp."; + case 55: + return "Mobilian Corporation"; case 65535: return "internal use"; default: -- cgit From 1ebb5e939840d4be143d086eaa68a1c281084561 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 13 Aug 2003 15:48:33 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index af56573b..fedeb384 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -281,6 +281,10 @@ char *bt_compidtostr(int compid) return "Renesas Technology Corp."; case 55: return "Mobilian Corporation"; + case 56: + return "Terax"; + case 57: + return "Integrated System Solution Corp."; case 65535: return "internal use"; default: -- cgit From 3d29835ef69b00fa3ed92702727ea2f737f37af2 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 7 Sep 2003 17:55:45 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index fedeb384..9c4536fc 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -285,6 +285,8 @@ char *bt_compidtostr(int compid) return "Terax"; case 57: return "Integrated System Solution Corp."; + case 58: + return "Matsushita Electric Industrial Co., Ltd."; case 65535: return "internal use"; default: -- cgit From a1b95e6f01957e2e5c3a9950a6da307e9ada285b Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 24 Dec 2003 11:58:54 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 9c4536fc..a2aae586 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -287,6 +287,8 @@ char *bt_compidtostr(int compid) return "Integrated System Solution Corp."; case 58: return "Matsushita Electric Industrial Co., Ltd."; + case 59: + return "Gennum Corporation"; case 65535: return "internal use"; default: -- cgit From 382615bc4b30d8204bdad79643f98cf19656b2a3 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 31 Jan 2004 00:55:32 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index a2aae586..1607c04f 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -289,6 +289,8 @@ char *bt_compidtostr(int compid) return "Matsushita Electric Industrial Co., Ltd."; case 59: return "Gennum Corporation"; + case 60: + return "Research In Motion"; case 65535: return "internal use"; default: -- cgit From 51e671b116fe121053444c4817e38ad07e9586f8 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 31 Mar 2004 19:50:46 +0000 Subject: Use $(top_builddir) as include root directory --- src/bluetooth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 1607c04f..a57809d7 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -32,8 +32,8 @@ #include #include -#include -#include +#include +#include void baswap(bdaddr_t *dst, const bdaddr_t *src) { -- cgit From 764abe23a0d4ede999f1f34ee0e310c0eeaaff79 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Apr 2004 05:11:38 +0000 Subject: Update copyright information --- src/bluetooth.c | 76 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index a57809d7..61a632a5 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -1,31 +1,37 @@ -/* - BlueZ - Bluetooth protocol stack for Linux - Copyright (C) 2000-2001 Qualcomm Incorporated - - Written 2000,2001 by Maxim Krasnyansky - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation; - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS - SOFTWARE IS DISCLAIMED. -*/ - /* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2000-2001 Qualcomm Incorporated + * Copyright (C) 2002-2003 Maxim Krasnyansky + * Copyright (C) 2002-2004 Marcel Holtmann + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + * SOFTWARE IS DISCLAIMED. + * + * * $Id$ */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -37,10 +43,10 @@ void baswap(bdaddr_t *dst, const bdaddr_t *src) { - register unsigned char *d = (unsigned char *)dst; - register const unsigned char *s = (const unsigned char *)src; + register unsigned char *d = (unsigned char *) dst; + register const unsigned char *s = (const unsigned char *) src; register int i; - for(i=0; i<6; i++) + for (i = 0; i < 6; i++) d[i] = s[5-i]; } @@ -51,7 +57,7 @@ char *batostr(const bdaddr_t *ba) return NULL; sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", - ba->b[0], ba->b[1], ba->b[2], + ba->b[0], ba->b[1], ba->b[2], ba->b[3], ba->b[4], ba->b[5]); return str; } @@ -65,9 +71,9 @@ bdaddr_t *strtoba(const char *str) if (!ba) return NULL; - for(i=0; i<6; i++){ + for(i = 0; i < 6; i++) { ba[i] = (uint8_t) strtol(ptr, NULL, 16); - if( i!=5 && !(ptr=strchr(ptr,':')) ) + if (i != 5 && !(ptr = strchr(ptr,':'))) ptr = ":00:00:00:00:00"; ptr++; } @@ -78,9 +84,9 @@ int ba2str(const bdaddr_t *ba, char *str) { uint8_t b[6]; - baswap((bdaddr_t *)b, ba); + baswap((bdaddr_t *) b, ba); return sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", - b[0], b[1], b[2], b[3], b[4], b[5]); + b[0], b[1], b[2], b[3], b[4], b[5]); } int str2ba(const char *str, bdaddr_t *ba) @@ -89,13 +95,13 @@ int str2ba(const char *str, bdaddr_t *ba) const char *ptr = str; int i; - for (i=0; i < 6; i++) { + for (i = 0; i < 6; i++) { b[i] = (uint8_t) strtol(ptr, NULL, 16); - if (i!=5 && !(ptr=strchr(ptr, ':'))) + if (i != 5 && !(ptr = strchr(ptr, ':'))) ptr = ":00:00:00:00:00"; ptr++; } - baswap(ba, (bdaddr_t *)b); + baswap(ba, (bdaddr_t *) b); return 0; } -- cgit From 2d0aca374edda17c9dfb547679b8f03feacf616e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 8 May 2004 18:17:29 +0000 Subject: Update company identifiers --- src/bluetooth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 61a632a5..1cd247d6 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -176,7 +176,7 @@ char *bt_compidtostr(int compid) { switch (compid) { case 0: - return "Ericsson Mobile Comunications"; + return "Ericsson Technology Licensing"; case 1: return "Nokia Mobile Phones"; case 2: @@ -212,7 +212,7 @@ char *bt_compidtostr(int compid) case 17: return "Widcomm, Inc."; case 18: - return "Telencomm Inc."; + return "Zeevo, Inc."; case 19: return "Atmel Corporation"; case 20: -- cgit From a01d0b2417283b208e951db3a950cc0374b44b61 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 26 Oct 2004 13:36:41 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 1cd247d6..22957c7f 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -297,6 +297,8 @@ char *bt_compidtostr(int compid) return "Gennum Corporation"; case 60: return "Research In Motion"; + case 61: + return "IPextreme, Inc."; case 65535: return "internal use"; default: -- cgit From 34fb9e62566cddafd8d4fea40e368434859ae25a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 8 Nov 2004 21:51:52 +0000 Subject: Change HCI_KEY_MISSING to HCI_PIN_OR_KEY_MISSING --- src/bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 22957c7f..00639d2d 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -121,7 +121,7 @@ int bt_error(uint16_t code) return EHOSTDOWN; case HCI_AUTHENTICATION_FAILURE: return EACCES; - case HCI_KEY_MISSING: + case HCI_PIN_OR_KEY_MISSING: return EINVAL; case HCI_MEMORY_FULL: return ENOMEM; -- cgit From c3b2524a78dc4d27025f6cd3c8f4c56f5de012ee Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 9 Nov 2004 00:05:01 +0000 Subject: Add the missing HCI error codes --- src/bluetooth.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 00639d2d..20a1aee6 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -133,19 +133,25 @@ int bt_error(uint16_t code) case HCI_ACL_CONNECTION_EXISTS: return EALREADY; case HCI_COMMAND_DISALLOWED: + case HCI_TRANSACTION_COLLISION: + case HCI_ROLE_SWITCH_PENDING: return EBUSY; case HCI_REJECTED_LIMITED_RESOURCES: - case HCI_REJECTED_SECURITY: case HCI_REJECTED_PERSONAL: + case HCI_QOS_REJECTED: return ECONNREFUSED; case HCI_HOST_TIMEOUT: return ETIMEDOUT; case HCI_UNSUPPORTED_FEATURE: case HCI_QOS_NOT_SUPPORTED: case HCI_PAIRING_NOT_SUPPORTED: + case HCI_CLASSIFICATION_NOT_SUPPORTED: case HCI_UNSUPPORTED_LMP_PARAMETER_VALUE: + case HCI_PARAMETER_OUT_OF_RANGE: + case HCI_QOS_UNACCEPTABLE_PARAMETER: return EOPNOTSUPP; case HCI_INVALID_PARAMETERS: + case HCI_SLOT_VIOLATION: return EINVAL; case HCI_OE_USER_ENDED_CONNECTION: case HCI_OE_LOW_RESOURCES: @@ -155,7 +161,9 @@ int bt_error(uint16_t code) return ECONNABORTED; case HCI_REPEATED_ATTEMPTS: return ELOOP; + case HCI_REJECTED_SECURITY: case HCI_PAIRING_NOT_ALLOWED: + case HCI_INSUFFICIENT_SECURITY: return EACCES; case HCI_UNSUPPORTED_REMOTE_FEATURE: return EPROTONOSUPPORT; -- cgit From 816b0a911d833aeb2b8af041b55c7b7c66e43588 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 27 Jan 2005 23:14:46 +0000 Subject: Update the copyright year --- src/bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 20a1aee6..110d65cd 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2004 Marcel Holtmann + * Copyright (C) 2002-2005 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 9280b803576dc54bfc7f51c8e5154d1f29692991 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 27 Mar 2005 14:37:59 +0000 Subject: Add ba*printf() functions --- src/bluetooth.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 110d65cd..484b263b 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -33,9 +33,10 @@ #endif #include +#include +#include #include #include -#include #include #include @@ -105,6 +106,54 @@ int str2ba(const char *str, bdaddr_t *ba) return 0; } +int baprintf(const char *format, ...) +{ + va_list ap; + int len; + + va_start(ap, format); + len = vprintf(format, ap); + va_end(ap); + + return len; +} + +int bafprintf(FILE *stream, const char *format, ...) +{ + va_list ap; + int len; + + va_start(ap, format); + len = vfprintf(stream, format, ap); + va_end(ap); + + return len; +} + +int basprintf(char *str, const char *format, ...) +{ + va_list ap; + int len; + + va_start(ap, format); + len = vsnprintf(str, (~0U) >> 1, format, ap); + va_end(ap); + + return len; +} + +int basnprintf(char *str, size_t size, const char *format, ...) +{ + va_list ap; + int len; + + va_start(ap, format); + len = vsnprintf(str, size, format, ap); + va_end(ap); + + return len; +} + /* Bluetooth error codes to Unix errno mapping */ int bt_error(uint16_t code) { -- cgit From 4c2d1cbe438713b5d6c350ee0983e1d312c69823 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 27 Mar 2005 14:43:44 +0000 Subject: Add ba2oui() function --- src/bluetooth.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 484b263b..0f4c49e6 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -106,6 +106,14 @@ int str2ba(const char *str, bdaddr_t *ba) return 0; } +int ba2oui(const bdaddr_t *ba, char *str) +{ + uint8_t b[6]; + + baswap((bdaddr_t *) b, ba); + return sprintf(str, "%2.2X-%2.2X-%2.2X", b[0], b[1], b[2]); +} + int baprintf(const char *format, ...) { va_list ap; -- cgit From e8c8131bc6c67b3592a5b5ec1882f2d8abf00608 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 19 May 2005 12:20:54 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 0f4c49e6..c54d63e3 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -364,6 +364,8 @@ char *bt_compidtostr(int compid) return "Research In Motion"; case 61: return "IPextreme, Inc."; + case 62: + return "Systems and Chips, Inc"; case 65535: return "internal use"; default: -- cgit From a73893381f0b7be98b8eb99d31ff834c7658d27c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 5 Aug 2005 07:11:32 +0000 Subject: Introduce bt_malloc() and bt_free() functions --- src/bluetooth.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index c54d63e3..1c01e2d9 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -162,6 +163,16 @@ int basnprintf(char *str, size_t size, const char *format, ...) return len; } +void *bt_malloc(size_t size) +{ + return malloc(size); +} + +void bt_free(void *ptr) +{ + free(ptr); +} + /* Bluetooth error codes to Unix errno mapping */ int bt_error(uint16_t code) { -- cgit From 652785638e4bf41e1a60827005d1253a0af7b3e8 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 26 Aug 2005 22:26:49 +0000 Subject: Use bt_malloc() for address translation functions --- src/bluetooth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 1c01e2d9..9ba19c50 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -54,7 +54,7 @@ void baswap(bdaddr_t *dst, const bdaddr_t *src) char *batostr(const bdaddr_t *ba) { - char *str = malloc(18); + char *str = bt_malloc(18); if (!str) return NULL; @@ -69,7 +69,7 @@ bdaddr_t *strtoba(const char *str) const char *ptr = str; int i; - uint8_t *ba = malloc(sizeof(bdaddr_t)); + uint8_t *ba = bt_malloc(sizeof(bdaddr_t)); if (!ba) return NULL; -- cgit From 7e5d794489e6dacb2e37553495af61c98cb78fbc Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 4 Sep 2005 22:01:16 +0000 Subject: Add two new company identifiers --- src/bluetooth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 9ba19c50..36f186c5 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -377,6 +377,10 @@ char *bt_compidtostr(int compid) return "IPextreme, Inc."; case 62: return "Systems and Chips, Inc"; + case 63: + return "Bluetooth SIG, Inc"; + case 64: + return "Seiko Epson Corporation"; case 65535: return "internal use"; default: -- cgit From c0d524486a50e8366c12c5ebea1a4441e9db46aa Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Oct 2005 19:25:42 +0000 Subject: Big cleanup of CVS relics --- src/bluetooth.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 36f186c5..5b468285 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -8,24 +8,19 @@ * * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS - * SOFTWARE IS DISCLAIMED. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * - * $Id$ */ #ifdef HAVE_CONFIG_H -- cgit From 197a2aee34d9a1643cd474f8f167552ca6395d01 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 3 Jan 2006 12:56:09 +0000 Subject: Update copyright information --- src/bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 5b468285..1482a56e 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2005 Marcel Holtmann + * Copyright (C) 2002-2006 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From fd920beb236c034c779de5ccf4a5d050897d40bc Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 16 Apr 2006 19:32:38 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 1482a56e..75888730 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -376,6 +376,8 @@ char *bt_compidtostr(int compid) return "Bluetooth SIG, Inc"; case 64: return "Seiko Epson Corporation"; + case 65: + return "Integrated Silicon Solution Taiwain, Inc."; case 65535: return "internal use"; default: -- cgit From 1b64c76ef66c10500f575240bd214c7b38b68a1f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 30 May 2006 10:51:54 +0000 Subject: Add two new company identifiers --- src/bluetooth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 75888730..9df142a0 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -378,6 +378,10 @@ char *bt_compidtostr(int compid) return "Seiko Epson Corporation"; case 65: return "Integrated Silicon Solution Taiwain, Inc."; + case 66: + return "CONWISE Technology Corporation Ltd"; + case 67: + return "PARROT SA"; case 65535: return "internal use"; default: -- cgit From e4c8ef4fa293cb27510c898e84ce25f948122286 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 3 Sep 2006 09:26:32 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 9df142a0..645a4d63 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -382,6 +382,8 @@ char *bt_compidtostr(int compid) return "CONWISE Technology Corporation Ltd"; case 67: return "PARROT SA"; + case 68: + return "Socket Communications"; case 65535: return "internal use"; default: -- cgit From 25effaf3a661c4de960ebae7125ba56a990ad628 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 13 Jan 2007 17:50:06 +0000 Subject: Update copyright information --- src/bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 645a4d63..33e033ad 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2006 Marcel Holtmann + * Copyright (C) 2002-2007 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 07c0013ff14eb0b16570d33fc50a9130d008609c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 11 Jun 2007 18:48:59 +0000 Subject: Add new company identifiers --- src/bluetooth.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 33e033ad..e2ba87ca 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -384,6 +384,16 @@ char *bt_compidtostr(int compid) return "PARROT SA"; case 68: return "Socket Communications"; + case 69: + return "Atheros Communications, Inc."; + case 70: + return "MediaTek, Inc."; + case 71: + return "Bluegiga"; /* (tentative) */ + case 72: + return "Marvell Technology Group Ltd."; + case 73: + return "3DSP Corporation"; case 65535: return "internal use"; default: -- cgit From 54d90a07ab77d86aeac4eed963071a07247eff18 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 20 Jun 2007 15:34:46 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index e2ba87ca..f0f800a5 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -394,6 +394,8 @@ char *bt_compidtostr(int compid) return "Marvell Technology Group Ltd."; case 73: return "3DSP Corporation"; + case 74: + return "Accel Semiconductor Ltd."; case 65535: return "internal use"; default: -- cgit From 3536636a5b1664499ee0ededd305b9bdc9ddeaa4 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 21 Jun 2007 21:18:00 +0000 Subject: Add common bachk() function --- src/bluetooth.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index f0f800a5..676e468e 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -110,6 +111,40 @@ int ba2oui(const bdaddr_t *ba, char *str) return sprintf(str, "%2.2X-%2.2X-%2.2X", b[0], b[1], b[2]); } +int bachk(const char *str) +{ + char tmp[18], *ptr = tmp; + + if (!str) + return -1; + + if (strlen(str) != 17) + return -1; + + memcpy(tmp, str, 18); + + while (*ptr) { + *ptr = toupper(*ptr); + if (*ptr < '0'|| (*ptr > '9' && *ptr < 'A') || *ptr > 'F') + return -1; + ptr++; + + *ptr = toupper(*ptr); + if (*ptr < '0'|| (*ptr > '9' && *ptr < 'A') || *ptr > 'F') + return -1; + ptr++; + + *ptr = toupper(*ptr); + if (*ptr == 0) + break; + if (*ptr != ':') + return -1; + ptr++; + } + + return 0; +} + int baprintf(const char *format, ...) { va_list ap; -- cgit From 175d6403eb52b7f6c2f081624159405d28521749 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 27 Aug 2007 11:29:08 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 676e468e..5cbff47f 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -431,6 +431,8 @@ char *bt_compidtostr(int compid) return "3DSP Corporation"; case 74: return "Accel Semiconductor Ltd."; + case 75: + return "Continental Automotive Systems"; case 65535: return "internal use"; default: -- cgit From 7208028266fc19d380ac77c97c46b6f2fdc80e1d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 2 Feb 2008 03:11:09 +0000 Subject: Update copyright information --- src/bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 5cbff47f..afbd4928 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -4,7 +4,7 @@ * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2007 Marcel Holtmann + * Copyright (C) 2002-2008 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify -- cgit From 20b6d88f9505c38b03a998db38be742eedf0e0df Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 23 Feb 2008 00:22:19 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index afbd4928..c8ad0b11 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -433,6 +433,8 @@ char *bt_compidtostr(int compid) return "Accel Semiconductor Ltd."; case 75: return "Continental Automotive Systems"; + case 76: + return "Apple, Inc."; case 65535: return "internal use"; default: -- cgit From f4f6e80b7ba37ed1f4e6505995a24f9185e6fb19 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 3 Apr 2008 01:11:50 +0000 Subject: Add another company identifier --- src/bluetooth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index c8ad0b11..d183d97e 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -435,6 +435,8 @@ char *bt_compidtostr(int compid) return "Continental Automotive Systems"; case 76: return "Apple, Inc."; + case 77: + return "Staccato Communications, Inc."; case 65535: return "internal use"; default: -- cgit From bb45b882917f26aaa26b2b903b70d622b39cce84 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 11 Jun 2008 13:12:21 +0000 Subject: It is better to include string.h instead of malloc.h --- src/bluetooth.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index d183d97e..463e0e05 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include -- cgit From 522cd764e3d3666b773f016609026bf8287979f6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 1 Jul 2008 03:00:53 +0000 Subject: Add two additional company identifiers --- src/bluetooth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth.c') diff --git a/src/bluetooth.c b/src/bluetooth.c index 463e0e05..f7a46bcf 100644 --- a/src/bluetooth.c +++ b/src/bluetooth.c @@ -436,6 +436,10 @@ char *bt_compidtostr(int compid) return "Apple, Inc."; case 77: return "Staccato Communications, Inc."; + case 78: + return "Avago Technologies"; + case 79: + return "APT Ltd."; case 65535: return "internal use"; default: -- cgit