* [PATCH 00/12] More customization options
@ 2014-09-30 11:06 Szymon Janc
2014-09-30 11:06 ` [PATCH 01/12] android: Add support for more configuration options Szymon Janc
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Hi,
Following patches extend configuration with more options required by DIS and
DID profiles.
Characteristics in DIS that would allow device tracking (serial and system id)
now require pairing before reading.
Proposed Android properties and fallbacks are described in last patch.
Comments are welcome.
Szymon Janc
Szymon Janc (12):
android: Add support for more configuration options
android/gatt: Bring back System ID in DIS
android/gatt: Fix serial number in DIS
android/gatt: Require encryption for Serial and System ID in DIS
android/bluetooth: Use configured values for DID
lib/uuid: Add define for GATT PnP ID UUID
android/gatt: Add support for PnP ID in DIS
android/gatt: Use release version for software revision in DIS
android: Remove few not needed blank lines
android: Add support for FW and HW revision config options
android/pts: Update PTS settings and results for DIS
android/README: Update with new configuration options
android/README | 12 ++++
android/bluetooth.c | 25 +++------
android/gatt.c | 108 +++++++++++++++++++++++++++++++-----
android/hal-bluetooth.c | 25 +++++++++
android/hal-ipc-api.txt | 5 ++
android/hal-msg.h | 5 ++
android/main.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++--
android/pics-dis.txt | 4 +-
android/pixit-dis.txt | 2 +-
android/pts-dis.txt | 8 +--
android/utils.h | 8 +++
lib/uuid.h | 1 +
12 files changed, 303 insertions(+), 45 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/12] android: Add support for more configuration options
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 02/12] android/gatt: Bring back System ID in DIS Szymon Janc
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
This adds support for system ID, serial number and PnP ID options.
---
android/hal-bluetooth.c | 15 ++++++
android/hal-ipc-api.txt | 3 ++
android/hal-msg.h | 3 ++
android/main.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
android/utils.h | 6 +++
5 files changed, 146 insertions(+)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 07e86b0..f7db416 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -438,6 +438,21 @@ static int send_configuration(void)
cmd->num++;
}
+ if (get_config("serialno", prop, "ro.serialno") > 0) {
+ len += add_prop(prop, HAL_CONFIG_SERIAL_NUMBER, buf + len);
+ cmd->num++;
+ }
+
+ if (get_config("systemid", prop, NULL) > 0) {
+ len += add_prop(prop, HAL_CONFIG_SYSTEM_ID, buf + len);
+ cmd->num++;
+ }
+
+ if (get_config("pnpid", prop, NULL) > 0) {
+ len += add_prop(prop, HAL_CONFIG_PNP_ID, buf + len);
+ cmd->num++;
+ }
+
return hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_CONFIGURATION, len, cmd,
NULL, NULL, NULL);
}
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 81aab50..82067f2 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -158,6 +158,9 @@ Core Service (ID 0)
Valid configure option types: 0x00 = Vendor
0x01 = Model
0x02 = Name
+ 0x03 = Serial Number
+ 0x04 = System ID
+ 0x05 = PnP ID
In case of an error, the error response will be returned.
diff --git a/android/hal-msg.h b/android/hal-msg.h
index bb6b1e0..9ae8c24 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -73,6 +73,9 @@ struct hal_cmd_unregister_module {
#define HAL_CONFIG_VENDOR 0x00
#define HAL_CONFIG_MODEL 0x01
#define HAL_CONFIG_NAME 0x02
+#define HAL_CONFIG_SERIAL_NUMBER 0x03
+#define HAL_CONFIG_SYSTEM_ID 0x04
+#define HAL_CONFIG_PNP_ID 0x05
struct hal_config_prop {
uint8_t type;
diff --git a/android/main.c b/android/main.c
index 27f5c48..9ee9960 100644
--- a/android/main.c
+++ b/android/main.c
@@ -74,6 +74,12 @@
static char *config_vendor = NULL;
static char *config_model = NULL;
static char *config_name = NULL;
+static char *config_serial = NULL;
+static uint64_t config_system_id = 0;
+static uint16_t config_pnp_source = 0x0002; /* USB */
+static uint16_t config_pnp_vendor = 0x1d6b; /* Linux Foundation */
+static uint16_t config_pnp_product = 0x0247; /* BlueZ for Android */
+static uint16_t config_pnp_version = 0x0000;
static guint quit_timeout = 0;
@@ -109,6 +115,36 @@ const char *bt_config_get_model(void)
return DEFAULT_MODEL;
}
+const char *bt_config_get_serial(void)
+{
+ return config_serial;
+}
+
+uint64_t bt_config_get_system_id(void)
+{
+ return config_system_id;
+}
+
+uint16_t bt_config_get_pnp_source(void)
+{
+ return config_pnp_source;
+}
+
+uint16_t bt_config_get_pnp_vendor(void)
+{
+ return config_pnp_vendor;
+}
+
+uint16_t bt_config_get_pnp_product(void)
+{
+ return config_pnp_product;
+}
+
+uint16_t bt_config_get_pnp_version(void)
+{
+ return config_pnp_version;
+}
+
static void service_register(const void *buf, uint16_t len)
{
const struct hal_cmd_register_module *m = buf;
@@ -284,6 +320,61 @@ static char *get_prop(char *prop, uint16_t len, const uint8_t *val)
return prop;
}
+static void parse_pnp_id(uint16_t len, const uint8_t *val)
+{
+ int result;
+ uint16_t vendor, product, version , source;
+ char *pnp;
+
+ /* version is optional */
+ version = config_pnp_version;
+
+ pnp = get_prop(NULL, len, val);
+ if (!pnp)
+ return;
+
+ DBG("pnp_id %s", pnp);
+
+ result = sscanf(pnp, "bluetooth:%4hx:%4hx:%4hx",
+ &vendor, &product, &version);
+ if (result != EOF && result >= 2) {
+ source = 0x0001;
+ goto done;
+ }
+
+ result = sscanf(pnp, "usb:%4hx:%4hx:%4hx", &vendor, &product, &version);
+ if (result != EOF && result >= 2) {
+ source = 0x0002;
+ goto done;
+ }
+
+ free(pnp);
+ return;
+done:
+ free(pnp);
+
+ config_pnp_source = source;
+ config_pnp_vendor = vendor;
+ config_pnp_product = product;
+ config_pnp_version = version;
+}
+
+static void parse_system_id(uint16_t len, const uint8_t *val)
+{
+ uint64_t res;
+ char *id;
+
+ id = get_prop(NULL, len, val);
+ if (!id)
+ return;
+
+ res = strtoull(id, NULL, 16);
+ if (res == ULLONG_MAX && errno == ERANGE)
+ return;
+
+ config_system_id = res;
+}
+
static void configuration(const void *buf, uint16_t len)
{
const struct hal_cmd_configuration *cmd = buf;
@@ -324,6 +415,21 @@ static void configuration(const void *buf, uint16_t len)
DBG("model %s", config_model);
break;
+ case HAL_CONFIG_SERIAL_NUMBER:
+ config_serial = get_prop(config_serial, prop->len,
+ prop->val);
+
+ DBG("serial %s", config_serial);
+
+ break;
+ case HAL_CONFIG_SYSTEM_ID:
+ parse_system_id(prop->len, prop->val);
+
+ break;
+ case HAL_CONFIG_PNP_ID:
+ parse_pnp_id(prop->len, prop->val);
+
+ break;
default:
error("Invalid configuration option (%u), terminating",
prop->type);
@@ -561,12 +667,24 @@ static bool set_capabilities(void)
return true;
}
+static void set_version(void)
+{
+ uint8_t major, minor;
+
+ if (sscanf(VERSION, "%hhu.%hhu", &major, &minor) != 2)
+ return;
+
+ config_pnp_version = major << 8 | minor;
+}
+
int main(int argc, char *argv[])
{
GOptionContext *context;
GError *err = NULL;
guint signal;
+ set_version();
+
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
@@ -651,6 +769,7 @@ int main(int argc, char *argv[])
free(config_vendor);
free(config_model);
free(config_name);
+ free(config_serial);
return EXIT_SUCCESS;
}
diff --git a/android/utils.h b/android/utils.h
index c70f8cb..9bf2195 100644
--- a/android/utils.h
+++ b/android/utils.h
@@ -34,3 +34,9 @@ static inline void bdaddr2android(const bdaddr_t *src, void *buf)
const char *bt_config_get_vendor(void);
const char *bt_config_get_model(void);
const char *bt_config_get_name(void);
+const char *bt_config_get_serial(void);
+uint64_t bt_config_get_system_id(void);
+uint16_t bt_config_get_pnp_source(void);
+uint16_t bt_config_get_pnp_vendor(void);
+uint16_t bt_config_get_pnp_product(void);
+uint16_t bt_config_get_pnp_version(void);
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/12] android/gatt: Bring back System ID in DIS
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
2014-09-30 11:06 ` [PATCH 01/12] android: Add support for more configuration options Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 03/12] android/gatt: Fix serial number " Szymon Janc
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/gatt.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/android/gatt.c b/android/gatt.c
index 1d9971c..37bdeb6 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6414,6 +6414,38 @@ done:
entry->state = REQUEST_DONE;
}
+static void device_info_read_system_id_cb(uint16_t handle, uint16_t offset,
+ uint8_t att_opcode, bdaddr_t *bdaddr,
+ void *user_data)
+{
+ struct pending_request *entry;
+ struct gatt_device *dev;
+
+ dev = find_device_by_addr(bdaddr);
+ if (!dev) {
+ error("gatt: Could not find device ?!");
+ return;
+ }
+
+ entry = queue_find(dev->pending_requests, match_dev_request_by_handle,
+ UINT_TO_PTR(handle));
+ if (!entry)
+ return;
+
+ entry->value = malloc0(sizeof(uint64_t));
+ if (!entry->value) {
+ entry->error = ATT_ECODE_UNLIKELY;
+ goto done;
+ }
+
+ entry->length = sizeof(uint64_t);
+ put_le64(bt_config_get_system_id(), entry->value);
+ entry->offset = offset;
+
+done:
+ entry->state = REQUEST_DONE;
+}
+
static void register_device_info_service(void)
{
bt_uuid_t uuid;
@@ -6447,6 +6479,15 @@ static void register_device_info_service(void)
(void *) data);
}
+ if (bt_config_get_system_id()) {
+ bt_uuid16_create(&uuid, GATT_CHARAC_SYSTEM_ID);
+ gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
+ GATT_PERM_READ,
+ GATT_CHR_PROP_READ,
+ device_info_read_system_id_cb,
+ NULL, NULL);
+ }
+
/* TODO */
data = NULL;
if (data) {
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/12] android/gatt: Fix serial number in DIS
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
2014-09-30 11:06 ` [PATCH 01/12] android: Add support for more configuration options Szymon Janc
2014-09-30 11:06 ` [PATCH 02/12] android/gatt: Bring back System ID in DIS Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 04/12] android/gatt: Require encryption for Serial and System ID " Szymon Janc
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Fix use of name as serial number value. Since now proper config option
exists use real serial if provided.
---
android/gatt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/gatt.c b/android/gatt.c
index 37bdeb6..c482364 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6469,7 +6469,7 @@ static void register_device_info_service(void)
(void *) data);
}
- /* TODO */
+ data = bt_config_get_serial();
if (data) {
bt_uuid16_create(&uuid, GATT_CHARAC_SERIAL_NUMBER_STRING);
gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/12] android/gatt: Require encryption for Serial and System ID in DIS
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (2 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 03/12] android/gatt: Fix serial number " Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 05/12] android/bluetooth: Use configured values for DID Szymon Janc
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Those chararcteristics are unique for device and could allow tracking
with privacy enabled. Require devices to be paired before reading
those.
---
android/gatt.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/android/gatt.c b/android/gatt.c
index c482364..c00265a 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6451,6 +6451,7 @@ static void register_device_info_service(void)
bt_uuid_t uuid;
uint16_t srvc_handle, end_handle;
const char *data;
+ uint32_t enc_perm = GATT_PERM_READ | GATT_PERM_READ_ENCRYPTED;
DBG("");
@@ -6473,8 +6474,7 @@ static void register_device_info_service(void)
if (data) {
bt_uuid16_create(&uuid, GATT_CHARAC_SERIAL_NUMBER_STRING);
gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
- GATT_PERM_READ,
- GATT_CHR_PROP_READ,
+ enc_perm, GATT_CHR_PROP_READ,
device_info_read_cb, NULL,
(void *) data);
}
@@ -6482,8 +6482,7 @@ static void register_device_info_service(void)
if (bt_config_get_system_id()) {
bt_uuid16_create(&uuid, GATT_CHARAC_SYSTEM_ID);
gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
- GATT_PERM_READ,
- GATT_CHR_PROP_READ,
+ enc_perm, GATT_CHR_PROP_READ,
device_info_read_system_id_cb,
NULL, NULL);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/12] android/bluetooth: Use configured values for DID
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (3 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 04/12] android/gatt: Require encryption for Serial and System ID " Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 06/12] lib/uuid: Add define for GATT PnP ID UUID Szymon Janc
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/bluetooth.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/android/bluetooth.c b/android/bluetooth.c
index c7ccf9d..3016ea4 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -94,10 +94,6 @@
#define DEVICES_FILE ANDROID_STORAGEDIR"/devices"
#define CACHE_FILE ANDROID_STORAGEDIR"/cache"
-#define DEVICE_ID_SOURCE 0x0002 /* USB */
-#define DEVICE_ID_VENDOR 0x1d6b /* Linux Foundation */
-#define DEVICE_ID_PRODUCT 0x0247 /* BlueZ for Android */
-
#define ADAPTER_MAJOR_CLASS 0x02 /* Phone */
#define ADAPTER_MINOR_CLASS 0x03 /* Smartphone */
@@ -2827,26 +2823,21 @@ static void set_io_capability(void)
static void set_device_id(void)
{
struct mgmt_cp_set_device_id cp;
- uint8_t major, minor;
- uint16_t version;
-
- if (sscanf(VERSION, "%hhu.%hhu", &major, &minor) != 2)
- return;
-
- version = major << 8 | minor;
memset(&cp, 0, sizeof(cp));
- cp.source = htobs(DEVICE_ID_SOURCE);
- cp.vendor = htobs(DEVICE_ID_VENDOR);
- cp.product = htobs(DEVICE_ID_PRODUCT);
- cp.version = htobs(version);
+ cp.source = htobs(bt_config_get_pnp_source());
+ cp.vendor = htobs(bt_config_get_pnp_vendor());
+ cp.product = htobs(bt_config_get_pnp_product());
+ cp.version = htobs(bt_config_get_pnp_version());
if (mgmt_send(mgmt_if, MGMT_OP_SET_DEVICE_ID, adapter.index,
sizeof(cp), &cp, NULL, NULL, NULL) == 0)
error("Failed to set device id");
- register_device_id(DEVICE_ID_SOURCE, DEVICE_ID_VENDOR,
- DEVICE_ID_PRODUCT, version);
+ register_device_id(bt_config_get_pnp_source(),
+ bt_config_get_pnp_vendor(),
+ bt_config_get_pnp_product(),
+ bt_config_get_pnp_version());
bt_adapter_add_record(sdp_record_find(0x10000), 0x00);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/12] lib/uuid: Add define for GATT PnP ID UUID
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (4 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 05/12] android/bluetooth: Use configured values for DID Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 07/12] android/gatt: Add support for PnP ID in DIS Szymon Janc
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
lib/uuid.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/uuid.h b/lib/uuid.h
index 7901d34..8303772 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -127,6 +127,7 @@ extern "C" {
#define GATT_CHARAC_HARDWARE_REVISION_STRING 0x2A27
#define GATT_CHARAC_SOFTWARE_REVISION_STRING 0x2A28
#define GATT_CHARAC_MANUFACTURER_NAME_STRING 0x2A29
+#define GATT_CHARAC_PNP_ID 0x2A50
/* GATT Characteristic Descriptors */
#define GATT_CHARAC_EXT_PROPER_UUID 0x2900
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/12] android/gatt: Add support for PnP ID in DIS
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (5 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 06/12] lib/uuid: Add define for GATT PnP ID UUID Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 08/12] android/gatt: Use release version for software revision " Szymon Janc
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/gatt.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/android/gatt.c b/android/gatt.c
index c00265a..7346d98 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6446,6 +6446,43 @@ done:
entry->state = REQUEST_DONE;
}
+static void device_info_read_pnp_id_cb(uint16_t handle, uint16_t offset,
+ uint8_t att_opcode, bdaddr_t *bdaddr,
+ void *user_data)
+{
+ struct pending_request *entry;
+ struct gatt_device *dev;
+
+ dev = find_device_by_addr(bdaddr);
+ if (!dev) {
+ error("gatt: Could not find device ?!");
+ return;
+ }
+
+ entry = queue_find(dev->pending_requests, match_dev_request_by_handle,
+ UINT_TO_PTR(handle));
+ if (!entry)
+ return;
+
+ entry->value = malloc0(sizeof(uint8_t) + 3 * sizeof(uint16_t));
+ if (!entry->value) {
+ entry->error = ATT_ECODE_UNLIKELY;
+ goto done;
+ }
+
+ entry->length = sizeof(uint8_t) + 3 * sizeof(uint16_t);
+
+ entry->value[0] = bt_config_get_pnp_source();
+ put_le16(bt_config_get_pnp_vendor(), entry->value + 1);
+ put_le16(bt_config_get_pnp_product(), entry->value + 3);
+ put_le16(bt_config_get_pnp_version(), entry->value + 5);
+
+ entry->offset = offset;
+
+done:
+ entry->state = REQUEST_DONE;
+}
+
static void register_device_info_service(void)
{
bt_uuid_t uuid;
@@ -6530,6 +6567,15 @@ static void register_device_info_service(void)
(void *) data);
}
+ if (bt_config_get_pnp_source()) {
+ bt_uuid16_create(&uuid, GATT_CHARAC_PNP_ID);
+ gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
+ GATT_PERM_READ,
+ GATT_CHR_PROP_READ,
+ device_info_read_pnp_id_cb,
+ NULL, NULL);
+ }
+
gatt_db_service_set_active(gatt_db, srvc_handle, true);
/* SDP */
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/12] android/gatt: Use release version for software revision in DIS
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (6 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 07/12] android/gatt: Add support for PnP ID in DIS Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 09/12] android: Remove few not needed blank lines Szymon Janc
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/gatt.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/android/gatt.c b/android/gatt.c
index 7346d98..425f6a5 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6546,16 +6546,10 @@ static void register_device_info_service(void)
(void *) data);
}
- /* TODO */
- data = NULL;
- if (data) {
- bt_uuid16_create(&uuid, GATT_CHARAC_SOFTWARE_REVISION_STRING);
- gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
- GATT_PERM_READ,
- GATT_CHR_PROP_READ,
- device_info_read_cb, NULL,
- (void *) data);
- }
+ bt_uuid16_create(&uuid, GATT_CHARAC_SOFTWARE_REVISION_STRING);
+ gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, GATT_PERM_READ,
+ GATT_CHR_PROP_READ, device_info_read_cb,
+ NULL, VERSION);
data = bt_config_get_vendor();
if (data) {
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/12] android: Remove few not needed blank lines
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (7 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 08/12] android/gatt: Use release version for software revision " Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 10/12] android: Add support for FW and HW revision config options Szymon Janc
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/main.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/android/main.c b/android/main.c
index 9ee9960..014b763 100644
--- a/android/main.c
+++ b/android/main.c
@@ -397,38 +397,28 @@ static void configuration(const void *buf, uint16_t len)
case HAL_CONFIG_VENDOR:
config_vendor = get_prop(config_vendor, prop->len,
prop->val);
-
DBG("vendor %s", config_vendor);
-
break;
case HAL_CONFIG_NAME:
config_name = get_prop(config_name, prop->len,
prop->val);
-
DBG("name %s", config_name);
-
break;
case HAL_CONFIG_MODEL:
config_model = get_prop(config_model, prop->len,
prop->val);
-
DBG("model %s", config_model);
-
break;
case HAL_CONFIG_SERIAL_NUMBER:
config_serial = get_prop(config_serial, prop->len,
prop->val);
-
DBG("serial %s", config_serial);
-
break;
case HAL_CONFIG_SYSTEM_ID:
parse_system_id(prop->len, prop->val);
-
break;
case HAL_CONFIG_PNP_ID:
parse_pnp_id(prop->len, prop->val);
-
break;
default:
error("Invalid configuration option (%u), terminating",
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/12] android: Add support for FW and HW revision config options
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (8 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 09/12] android: Remove few not needed blank lines Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 11/12] android/pts: Update PTS settings and results for DIS Szymon Janc
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/gatt.c | 6 ++----
android/hal-bluetooth.c | 10 ++++++++++
android/hal-ipc-api.txt | 2 ++
android/hal-msg.h | 2 ++
android/main.c | 24 ++++++++++++++++++++++++
android/utils.h | 2 ++
6 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/android/gatt.c b/android/gatt.c
index 425f6a5..ad20a71 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -6524,8 +6524,7 @@ static void register_device_info_service(void)
NULL, NULL);
}
- /* TODO */
- data = NULL;
+ data = bt_config_get_fw_rev();
if (data) {
bt_uuid16_create(&uuid, GATT_CHARAC_FIRMWARE_REVISION_STRING);
gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
@@ -6535,8 +6534,7 @@ static void register_device_info_service(void)
(void *) data);
}
- /* TODO */
- data = NULL;
+ data = bt_config_get_hw_rev();
if (data) {
bt_uuid16_create(&uuid, GATT_CHARAC_HARDWARE_REVISION_STRING);
gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid,
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index f7db416..6754279 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -453,6 +453,16 @@ static int send_configuration(void)
cmd->num++;
}
+ if (get_config("fwrev", prop, "ro.build.version.release") > 0) {
+ len += add_prop(prop, HAL_CONFIG_FW_REV, buf + len);
+ cmd->num++;
+ }
+
+ if (get_config("hwrev", prop, "ro.board.platform") > 0) {
+ len += add_prop(prop, HAL_CONFIG_HW_REV, buf + len);
+ cmd->num++;
+ }
+
return hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_CONFIGURATION, len, cmd,
NULL, NULL, NULL);
}
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 82067f2..739fdbf 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -161,6 +161,8 @@ Core Service (ID 0)
0x03 = Serial Number
0x04 = System ID
0x05 = PnP ID
+ 0x06 = Firmware Rev
+ 0x07 = Hardware Rev
In case of an error, the error response will be returned.
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9ae8c24..71969b5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -76,6 +76,8 @@ struct hal_cmd_unregister_module {
#define HAL_CONFIG_SERIAL_NUMBER 0x03
#define HAL_CONFIG_SYSTEM_ID 0x04
#define HAL_CONFIG_PNP_ID 0x05
+#define HAL_CONFIG_FW_REV 0x06
+#define HAL_CONFIG_HW_REV 0x07
struct hal_config_prop {
uint8_t type;
diff --git a/android/main.c b/android/main.c
index 014b763..4f3a6bf 100644
--- a/android/main.c
+++ b/android/main.c
@@ -75,6 +75,8 @@ static char *config_vendor = NULL;
static char *config_model = NULL;
static char *config_name = NULL;
static char *config_serial = NULL;
+static char *config_fw_rev = NULL;
+static char *config_hw_rev = NULL;
static uint64_t config_system_id = 0;
static uint16_t config_pnp_source = 0x0002; /* USB */
static uint16_t config_pnp_vendor = 0x1d6b; /* Linux Foundation */
@@ -120,6 +122,16 @@ const char *bt_config_get_serial(void)
return config_serial;
}
+const char *bt_config_get_fw_rev(void)
+{
+ return config_fw_rev;
+}
+
+const char *bt_config_get_hw_rev(void)
+{
+ return config_hw_rev;
+}
+
uint64_t bt_config_get_system_id(void)
{
return config_system_id;
@@ -420,6 +432,16 @@ static void configuration(const void *buf, uint16_t len)
case HAL_CONFIG_PNP_ID:
parse_pnp_id(prop->len, prop->val);
break;
+ case HAL_CONFIG_FW_REV:
+ config_fw_rev = get_prop(config_fw_rev, prop->len,
+ prop->val);
+ DBG("fw_rev %s", config_fw_rev);
+ break;
+ case HAL_CONFIG_HW_REV:
+ config_hw_rev = get_prop(config_hw_rev, prop->len,
+ prop->val);
+ DBG("hw_rev %s", config_hw_rev);
+ break;
default:
error("Invalid configuration option (%u), terminating",
prop->type);
@@ -760,6 +782,8 @@ int main(int argc, char *argv[])
free(config_model);
free(config_name);
free(config_serial);
+ free(config_fw_rev);
+ free(config_hw_rev);
return EXIT_SUCCESS;
}
diff --git a/android/utils.h b/android/utils.h
index 9bf2195..7adc2da 100644
--- a/android/utils.h
+++ b/android/utils.h
@@ -35,6 +35,8 @@ const char *bt_config_get_vendor(void);
const char *bt_config_get_model(void);
const char *bt_config_get_name(void);
const char *bt_config_get_serial(void);
+const char *bt_config_get_fw_rev(void);
+const char *bt_config_get_hw_rev(void);
uint64_t bt_config_get_system_id(void);
uint16_t bt_config_get_pnp_source(void);
uint16_t bt_config_get_pnp_vendor(void);
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/12] android/pts: Update PTS settings and results for DIS
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (9 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 10/12] android: Add support for FW and HW revision config options Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-09-30 11:06 ` [PATCH 12/12] android/README: Update with new configuration options Szymon Janc
2014-10-02 13:50 ` [PATCH 00/12] More customization options Szymon Janc
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/pics-dis.txt | 4 ++--
android/pixit-dis.txt | 2 +-
android/pts-dis.txt | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/android/pics-dis.txt b/android/pics-dis.txt
index 1fd24d8..0a1ab3f 100644
--- a/android/pics-dis.txt
+++ b/android/pics-dis.txt
@@ -29,11 +29,11 @@ TSPC_DIS_2_4 True Serial Number String Characteristic (O)
TSPC_DIS_2_5 True Hardware Revision String Characteristic (O)
TSPC_DIS_2_6 True Firmware Revision String Characteristic (O)
TSPC_DIS_2_7 True Software Revision String Characteristic (O)
-TSPC_DIS_2_8 False (*) System ID Characteristic (O)
+TSPC_DIS_2_8 True System ID Characteristic (O)
TSPC_DIS_2_9 False (*) IEEE 11073-20601 Regulatory Certification
Data List Characteristic (O)
TSPC_DIS_2_10 True SDP Interoperability (C.1)
-TSPC_DIS_2_11 False (*) PnP ID (O)
+TSPC_DIS_2_11 True PnP ID (O)
-------------------------------------------------------------------------------
C.1: Mandatory if 1/1 (BR/EDR) is supported, otherwise excluded.
-------------------------------------------------------------------------------
diff --git a/android/pixit-dis.txt b/android/pixit-dis.txt
index 0847d76..c29ec36 100644
--- a/android/pixit-dis.txt
+++ b/android/pixit-dis.txt
@@ -19,7 +19,7 @@ TSPX_delete_link_key FALSE
TSPX_pin_code 0000
TSPX_use_dynamic_pin FALSE
TSPX_delete_ltk FALSE
-TSPX_security_enabled FALSE
+TSPX_security_enabled TRUE
TSPX_iut_setup_att_over_br_edr FALSE
TSPX_tester_appearance 0000
-------------------------------------------------------------------------------
diff --git a/android/pts-dis.txt b/android/pts-dis.txt
index 8f2bae6..8489430 100644
--- a/android/pts-dis.txt
+++ b/android/pts-dis.txt
@@ -21,17 +21,17 @@ TC_DEC_BV_03_C PASS
TC_DEC_BV_04_C PASS
TC_DEC_BV_05_C PASS
TC_DEC_BV_06_C PASS
-TC_DEC_BV_07_C N/A
+TC_DEC_BV_07_C PASS
TC_DEC_BV_08_C N/A
-TC_DEC_BV_09_C N/A
+TC_DEC_BV_09_C PASS
TC_CR_BV_01_C PASS
TC_CR_BV_02_C PASS
TC_CR_BV_03_C PASS
TC_CR_BV_04_C PASS
TC_CR_BV_05_C PASS
TC_CR_BV_06_C PASS
-TC_CR_BV_07_C N/A
+TC_CR_BV_07_C PASS
TC_CR_BV_08_C N/A
-TC_CR_BV_09_C N/A
+TC_CR_BV_09_C PASS
TC_SDP_BV_01_C PASS
-------------------------------------------------------------------------------
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 12/12] android/README: Update with new configuration options
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (10 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 11/12] android/pts: Update PTS settings and results for DIS Szymon Janc
@ 2014-09-30 11:06 ` Szymon Janc
2014-10-02 13:50 ` [PATCH 00/12] More customization options Szymon Janc
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-09-30 11:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/README | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/android/README b/android/README
index 706d424..4bfe10b 100644
--- a/android/README
+++ b/android/README
@@ -216,6 +216,18 @@ model <any> Set model name used as default adapter name.
If not set fallback to "ro.product.model".
name <any> Set model number in DIS. If not set fallback to
"ro.product.name".
+serialno <any> Set serial number in DIS. If not set fallback to
+ "ro.serialno".
+systemid <uint64> Set system ID in DIS. Hex string encoded uint64.
+pnpid <any> PnP information used in DIS and DID profiles.
+ Required format: "Source:VID:PID:Version".
+ Source must be either "bluetooth" or "usb".
+ VID, PID and Version are uint16. Version is
+ optional.
+fwrev <any> Firmware revision in DIS. If not set fallback to
+ "ro.build.version.release".
+hwrew <any> Hardware revision in DIS. If not set fallback to
+ "ro.board.platform".
Building and running on Linux
--
1.9.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 00/12] More customization options
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
` (11 preceding siblings ...)
2014-09-30 11:06 ` [PATCH 12/12] android/README: Update with new configuration options Szymon Janc
@ 2014-10-02 13:50 ` Szymon Janc
12 siblings, 0 replies; 14+ messages in thread
From: Szymon Janc @ 2014-10-02 13:50 UTC (permalink / raw)
To: linux-bluetooth
On Tuesday 30 of September 2014 13:06:15 Szymon Janc wrote:
> Hi,
>
> Following patches extend configuration with more options required by DIS and
> DID profiles.
>
> Characteristics in DIS that would allow device tracking (serial and system id)
> now require pairing before reading.
>
> Proposed Android properties and fallbacks are described in last patch.
>
> Comments are welcome.
> Szymon Janc
>
> Szymon Janc (12):
> android: Add support for more configuration options
> android/gatt: Bring back System ID in DIS
> android/gatt: Fix serial number in DIS
> android/gatt: Require encryption for Serial and System ID in DIS
> android/bluetooth: Use configured values for DID
> lib/uuid: Add define for GATT PnP ID UUID
> android/gatt: Add support for PnP ID in DIS
> android/gatt: Use release version for software revision in DIS
> android: Remove few not needed blank lines
> android: Add support for FW and HW revision config options
> android/pts: Update PTS settings and results for DIS
> android/README: Update with new configuration options
>
> android/README | 12 ++++
> android/bluetooth.c | 25 +++------
> android/gatt.c | 108 +++++++++++++++++++++++++++++++-----
> android/hal-bluetooth.c | 25 +++++++++
> android/hal-ipc-api.txt | 5 ++
> android/hal-msg.h | 5 ++
> android/main.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++--
> android/pics-dis.txt | 4 +-
> android/pixit-dis.txt | 2 +-
> android/pts-dis.txt | 8 +--
> android/utils.h | 8 +++
> lib/uuid.h | 1 +
> 12 files changed, 303 insertions(+), 45 deletions(-)
>
>
Applied.
--
Best regards,
Szymon Janc
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-10-02 13:50 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-30 11:06 [PATCH 00/12] More customization options Szymon Janc
2014-09-30 11:06 ` [PATCH 01/12] android: Add support for more configuration options Szymon Janc
2014-09-30 11:06 ` [PATCH 02/12] android/gatt: Bring back System ID in DIS Szymon Janc
2014-09-30 11:06 ` [PATCH 03/12] android/gatt: Fix serial number " Szymon Janc
2014-09-30 11:06 ` [PATCH 04/12] android/gatt: Require encryption for Serial and System ID " Szymon Janc
2014-09-30 11:06 ` [PATCH 05/12] android/bluetooth: Use configured values for DID Szymon Janc
2014-09-30 11:06 ` [PATCH 06/12] lib/uuid: Add define for GATT PnP ID UUID Szymon Janc
2014-09-30 11:06 ` [PATCH 07/12] android/gatt: Add support for PnP ID in DIS Szymon Janc
2014-09-30 11:06 ` [PATCH 08/12] android/gatt: Use release version for software revision " Szymon Janc
2014-09-30 11:06 ` [PATCH 09/12] android: Remove few not needed blank lines Szymon Janc
2014-09-30 11:06 ` [PATCH 10/12] android: Add support for FW and HW revision config options Szymon Janc
2014-09-30 11:06 ` [PATCH 11/12] android/pts: Update PTS settings and results for DIS Szymon Janc
2014-09-30 11:06 ` [PATCH 12/12] android/README: Update with new configuration options Szymon Janc
2014-10-02 13:50 ` [PATCH 00/12] More customization options Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox