summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2015-06-08 17:17:10 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2015-06-08 20:46:56 +0900
commit82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3 (patch)
tree94cd4766383381127b03f8de9b66b4b3ecb19a4d /lib
parentc270b3c99f32d1ce10b8552822b9353ab9a0484a (diff)
downloadbluez-82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3.tar.gz
bluez-82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3.tar.bz2
bluez-82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3.zip
Upgrade Bluez 5.28 and synchronize Tizen 2.4's bluez
Change-Id: Ifaf2154ba0ab19b180946e0d92f1817a1d9ed839 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/bluetooth.c98
-rw-r--r--lib/bluetooth.h20
-rw-r--r--lib/hci.c4
-rw-r--r--lib/hci.h4
-rw-r--r--lib/mgmt.h52
-rw-r--r--lib/uuid.c22
-rw-r--r--lib/uuid.h9
7 files changed, 197 insertions, 12 deletions
diff --git a/lib/bluetooth.c b/lib/bluetooth.c
index 57e27444..4fe5941a 100644
--- a/lib/bluetooth.c
+++ b/lib/bluetooth.c
@@ -1141,6 +1141,104 @@ const char *bt_compidtostr(int compid)
return "LM Technologies Ltd";
case 439:
return "General Electric Company";
+ case 440:
+ return "i+D3 S.L.";
+ case 441:
+ return "HANA Micron";
+ case 442:
+ return "Stages Cycling LLC";
+ case 443:
+ return "Cochlear Bone Anchored Solutions AB";
+ case 444:
+ return "SenionLab AB";
+ case 445:
+ return "Syszone Co., Ltd";
+ case 446:
+ return "Pulsate Mobile Ltd.";
+ case 447:
+ return "Hong Kong HunterSun Electronic Limited";
+ case 448:
+ return "pironex GmbH";
+ case 449:
+ return "BRADATECH Corp.";
+ case 450:
+ return "Transenergooil AG";
+ case 451:
+ return "Bunch";
+ case 452:
+ return "DME Microelectronics";
+ case 453:
+ return "Bitcraze AB";
+ case 454:
+ return "HASWARE Inc.";
+ case 455:
+ return "Abiogenix Inc.";
+ case 456:
+ return "Poly-Control ApS";
+ case 457:
+ return "Avi-on";
+ case 458:
+ return "Laerdal Medical AS";
+ case 459:
+ return "Fetch My Pet";
+ case 460:
+ return "Sam Labs Ltd.";
+ case 461:
+ return "Chengdu Synwing Technology Ltd";
+ case 462:
+ return "HOUWA SYSTEM DESIGN, k.k.";
+ case 463:
+ return "BSH";
+ case 464:
+ return "Primus Inter Pares Ltd";
+ case 465:
+ return "August";
+ case 466:
+ return "Gill Electronics";
+ case 467:
+ return "Sky Wave Design";
+ case 468:
+ return "Newlab S.r.l.";
+ case 469:
+ return "ELAD srl";
+ case 470:
+ return "G-wearables inc.";
+ case 471:
+ return "Squadrone Systems Inc.";
+ case 472:
+ return "Code Corporation";
+ case 473:
+ return "Savant Systems LLC";
+ case 474:
+ return "Logitech International SA";
+ case 475:
+ return "Innblue Consulting";
+ case 476:
+ return "iParking Ltd.";
+ case 477:
+ return "Koninklijke Philips Electronics N.V.";
+ case 478:
+ return "Minelab Electronics Pty Limited";
+ case 479:
+ return "Bison Group Ltd.";
+ case 480:
+ return "Widex A/S";
+ case 481:
+ return "Jolla Ltd";
+ case 482:
+ return "Lectronix, Inc.";
+ case 483:
+ return "Caterpillar Inc";
+ case 484:
+ return "Freedom Innovations";
+ case 485:
+ return "Dynamic Devices Ltd";
+ case 486:
+ return "Technology Solutions (UK) Ltd";
+ case 487:
+ return "IPS Group Inc.";
+ case 488:
+ return "STIR";
case 65535:
return "internal use";
default:
diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index f214d81e..6ca64b68 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -343,6 +343,16 @@ typedef struct {
uint8_t data[16];
} uint128_t;
+static inline void bswap_128(const void *src, void *dst)
+{
+ const uint8_t *s = src;
+ uint8_t *d = dst;
+ int i;
+
+ for (i = 0; i < 16; i++)
+ d[15 - i] = s[i];
+}
+
#if __BYTE_ORDER == __BIG_ENDIAN
#define ntoh64(x) (x)
@@ -354,10 +364,7 @@ static inline void ntoh128(const uint128_t *src, uint128_t *dst)
static inline void btoh128(const uint128_t *src, uint128_t *dst)
{
- int i;
-
- for (i = 0; i < 16; i++)
- dst->data[15 - i] = src->data[i];
+ bswap_128(src, dst);
}
#else
@@ -375,10 +382,7 @@ static inline uint64_t ntoh64(uint64_t n)
static inline void ntoh128(const uint128_t *src, uint128_t *dst)
{
- int i;
-
- for (i = 0; i < 16; i++)
- dst->data[15 - i] = src->data[i];
+ bswap_128(src, dst);
}
static inline void btoh128(const uint128_t *src, uint128_t *dst)
diff --git a/lib/hci.c b/lib/hci.c
index c25be9e5..bc453f7a 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -156,6 +156,10 @@ char *hci_bustostr(int bus)
return "PCI";
case HCI_SDIO:
return "SDIO";
+#ifdef __TIZEN_PATCH__
+ case HCI_SMD:
+ return "QC_SMD";
+#endif
default:
return "UNKNOWN";
}
diff --git a/lib/hci.h b/lib/hci.h
index d877d97c..8f524ff8 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -56,6 +56,10 @@ extern "C" {
#define HCI_PCI 5
#define HCI_SDIO 6
+#ifdef __TIZEN_PATCH__
+#define HCI_SMD 7
+#endif
+
/* HCI controller types */
#define HCI_BREDR 0x00
#define HCI_AMP 0x01
diff --git a/lib/mgmt.h b/lib/mgmt.h
index 473d76de..6a8f603b 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -98,6 +98,7 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_DEBUG_KEYS 0x00001000
#define MGMT_SETTING_PRIVACY 0x00002000
#define MGMT_SETTING_CONFIGURATION 0x00004000
+#define MGMT_SETTING_STATIC_ADDRESS 0x00008000
#define MGMT_OP_READ_INFO 0x0004
struct mgmt_rp_read_info {
@@ -602,7 +603,7 @@ struct mgmt_ev_new_irk {
struct mgmt_csrk_info {
struct mgmt_addr_info addr;
- uint8_t master;
+ uint8_t type;
uint8_t val[16];
} __packed;
@@ -779,7 +780,7 @@ struct mgmt_cp_set_advertising_params {
#define MGMT_OP_SET_ADVERTISING_DATA (TIZEN_OP_CODE_BASE + 0x02)
struct mgmt_cp_set_advertising_data {
- uint8_t data[MGMT_MAX_ADVERTISING_LENGTH - 3]; /* Except flag */
+ uint8_t data[MGMT_MAX_ADVERTISING_LENGTH];
} __packed;
#define MGMT_OP_SET_SCAN_RSP_DATA (TIZEN_OP_CODE_BASE + 0x03)
@@ -887,7 +888,28 @@ struct mgmt_cp_set_voice_setting {
uint16_t voice_setting;
} __packed;
+#define MGMT_OP_GET_ADV_TX_POWER (TIZEN_OP_CODE_BASE + 0x11)
+struct mgmt_rp_get_adv_tx_power {
+ int8_t adv_tx_power;
+} __packed;
+
+#define MGMT_OP_ENABLE_6LOWPAN (TIZEN_OP_CODE_BASE + 0x12)
+struct mgmt_cp_enable_6lowpan {
+ uint8_t enable_6lowpan;
+} __packed;
+
+#define MGMT_OP_CONNECT_6LOWPAN (TIZEN_OP_CODE_BASE + 0x13)
+struct mgmt_cp_connect_6lowpan {
+ struct mgmt_addr_info addr;
+} __packed;
+
+#define MGMT_OP_DISCONNECT_6LOWPAN (TIZEN_OP_CODE_BASE + 0x14)
+struct mgmt_cp_disconnect_6lowpan {
+ struct mgmt_addr_info addr;
+} __packed;
+
/* Currently there is no support in kernel for below MGMT cmd opcodes. */
+#if 0 // Not defined in kernel
#define MGMT_OP_READ_RSSI (TIZEN_OP_CODE_BASE + 0x11)
struct mgmt_cp_read_rssi {
bdaddr_t bdaddr;
@@ -939,6 +961,8 @@ struct mgmt_rp_read_auth_payload_timeout {
uint8_t status;
uint16_t auth_payload_timeout;
} __packed;
+#endif
+
/* BEGIN TIZEN_Bluetooth :: name update changes */
#define MGMT_EV_DEVICE_NAME_UPDATE (TIZEN_EV_BASE + 0x01)
@@ -1002,10 +1026,26 @@ struct mgmt_ev_le_device_found {
uint8_t eir[0];
} __packed;
+#define MGMT_EV_MULTI_ADV_STATE_CHANGED (TIZEN_EV_BASE + 0x0b)
+struct mgmt_ev_vendor_specific_multi_adv_state_changed {
+ uint8_t adv_instance;
+ uint8_t state_change_reason;
+ int16_t connection_handle;
+} __packed;
+
+#define MGMT_EV_6LOWPAN_CONN_STATE_CHANGED (TIZEN_EV_BASE + 0x0c)
+struct mgmt_ev_6lowpan_conn_state_changed {
+ struct mgmt_addr_info addr;
+ uint8_t connected;
+} __packed;
+
+/* Currently there is no support in kernel for below MGMT events. */
+#if 0 // Not defined in kernel
#define MGMT_EV_NEW_LOCAL_IRK (TIZEN_EV_BASE + 0x0b)
struct mgmt_ev_new_local_irk {
uint8_t irk[16];
} __packed;
+#endif
static const char *mgmt_tizen_op[] = {
"<0x0000>",
@@ -1024,7 +1064,10 @@ static const char *mgmt_tizen_op[] = {
"LE Connection Update",
"Set Manufacturer Data",
"LE Set Scan Parameters",
- "Set Voice Setting"
+ "Set Voice Setting",
+ "Get Adv Tx Power",
+ "Connect BT 6LOWPAN",
+ "Disconnect BT 6LOWPAN"
};
static const char *mgmt_tizen_ev[] = {
@@ -1039,7 +1082,8 @@ static const char *mgmt_tizen_ev[] = {
"LE Connection Updated",
"LE Connection Update Failed",
"LE Device Found",
- "New Local IRK Generated",
+ "Multi Adv State Change",
+ "BT 6LOWPAN state Change"
};
#endif /* End of __TIZEN_PATCH__ */
diff --git a/lib/uuid.c b/lib/uuid.c
index e3f31df9..4f34b17f 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <errno.h>
+#include "lib/bluetooth.h"
#include "uuid.h"
static uint128_t bluetooth_base_uuid = {
@@ -290,3 +291,24 @@ int bt_uuid_strcmp(const void *a, const void *b)
{
return strcasecmp(a, b);
}
+
+int bt_uuid_to_le(const bt_uuid_t *src, void *dst)
+{
+ bt_uuid_t uuid;
+
+ switch (src->type) {
+ case BT_UUID16:
+ bt_put_le16(src->value.u16, dst);
+ return 0;
+ case BT_UUID32:
+ bt_uuid_to_uuid128(src, &uuid);
+ /* Fallthrough */
+ case BT_UUID128:
+ /* Convert from 128-bit BE to LE */
+ bswap_128(&src->value.u128, dst);
+ return 0;
+ case BT_UUID_UNSPEC:
+ default:
+ return -EINVAL;
+ }
+}
diff --git a/lib/uuid.h b/lib/uuid.h
index 83037722..05968f10 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -30,7 +30,9 @@ extern "C" {
#endif
#include <stdint.h>
+#ifdef __TIZEN_PATCH__
#include <bluetooth/bluetooth.h>
+#endif
#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805f9b34fb"
@@ -140,6 +142,11 @@ extern "C" {
#define GATT_EXTERNAL_REPORT_REFERENCE 0x2907
#define GATT_REPORT_REFERENCE 0x2908
+#ifdef __TIZEN_PATCH__
+/* GATT Service UUIDs : Defined by SIG */
+#define GATT_IPSP_UUID 0x1820
+#endif
+
typedef struct {
enum {
BT_UUID_UNSPEC = 0,
@@ -168,6 +175,8 @@ void bt_uuid_to_uuid128(const bt_uuid_t *src, bt_uuid_t *dst);
int bt_uuid_to_string(const bt_uuid_t *uuid, char *str, size_t n);
int bt_string_to_uuid(bt_uuid_t *uuid, const char *string);
+int bt_uuid_to_le(const bt_uuid_t *uuid, void *dst);
+
static inline int bt_uuid_len(const bt_uuid_t *uuid)
{
return uuid->type / 8;