* [PATCH_v2 4/4] android/hidhost: Free all connected devices in profile cleanup call
From: Ravi kumar Veeramally @ 2013-11-19 14:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1384872988-19914-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This can be easily verified with haltest tool.
---
android/hidhost.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/android/hidhost.c b/android/hidhost.c
index 049dd6d..502b10b 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -1226,6 +1226,14 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
return true;
}
+static void free_hid_devices(gpointer data, gpointer user_data)
+{
+ struct hid_device *dev = data;
+
+ bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED);
+ hid_device_free(dev);
+}
+
void bt_hid_unregister(void)
{
DBG("");
@@ -1233,6 +1241,8 @@ void bt_hid_unregister(void)
if (notification_sk < 0)
return;
+ g_slist_foreach(devices, free_hid_devices, NULL);
+ devices = NULL;
notification_sk = -1;
if (ctrl_io) {
--
1.8.3.2
^ permalink raw reply related
* [PATCH_v2 3/4] android/hidhost: Handle error case properly in interrupt_connect_cb
From: Ravi kumar Veeramally @ 2013-11-19 14:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1384872988-19914-1-git-send-email-ravikumar.veeramally@linux.intel.com>
In case of conn_err in interrupt_connect_cb, device is freed but
connection status is not notified. Declared a local variable and
handled error case properly in case of conn_err and uhid failures.
Now connection status notified before freeing device.
---
android/hidhost.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/android/hidhost.c b/android/hidhost.c
index df21f81..049dd6d 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -522,7 +522,6 @@ static int uhid_create(struct hid_device *dev)
dev->uhid_fd = open(UHID_DEVICE_FILE, O_RDWR | O_CLOEXEC);
if (dev->uhid_fd < 0) {
error("Failed to open uHID device: %s", strerror(errno));
- bt_hid_notify_state(dev, HAL_HIDHOST_STATE_NO_HID);
return -errno;
}
@@ -541,7 +540,6 @@ static int uhid_create(struct hid_device *dev)
error("Failed to create uHID device: %s", strerror(errno));
close(dev->uhid_fd);
dev->uhid_fd = -1;
- bt_hid_notify_state(dev, HAL_HIDHOST_STATE_NO_HID);
return -errno;
}
@@ -559,16 +557,20 @@ static void interrupt_connect_cb(GIOChannel *chan, GError *conn_err,
gpointer user_data)
{
struct hid_device *dev = user_data;
+ uint8_t state;
DBG("");
if (conn_err) {
error("%s", conn_err->message);
+ state = HAL_HIDHOST_STATE_FAILED;
goto failed;
}
- if (uhid_create(dev) < 0)
+ if (uhid_create(dev) < 0) {
+ state = HAL_HIDHOST_STATE_NO_HID;
goto failed;
+ }
dev->intr_watch = g_io_add_watch(dev->intr_io,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
@@ -579,6 +581,7 @@ static void interrupt_connect_cb(GIOChannel *chan, GError *conn_err,
return;
failed:
+ bt_hid_notify_state(dev, state);
hid_device_free(dev);
}
--
1.8.3.2
^ permalink raw reply related
* [PATCH_v2 2/4] android: Handle multiple init(register) and cleanup(unregister) calls properly
From: Ravi kumar Veeramally @ 2013-11-19 14:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1384872988-19914-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This can be tested with haltest.
---
android/a2dp.c | 6 ++++++
android/bluetooth.c | 6 ++++++
android/hidhost.c | 6 ++++++
android/pan.c | 6 ++++++
4 files changed, 24 insertions(+)
diff --git a/android/a2dp.c b/android/a2dp.c
index 74d0082..a9e7c65 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -332,6 +332,9 @@ bool bt_a2dp_register(int sk, const bdaddr_t *addr)
DBG("");
+ if (notification_sk >= 0)
+ return false;
+
bacpy(&adapter_addr, addr);
server = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -365,6 +368,9 @@ void bt_a2dp_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
bt_adapter_remove_record(record_id);
diff --git a/android/bluetooth.c b/android/bluetooth.c
index 7dc2ec3..11b9d76 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2275,6 +2275,9 @@ bool bt_bluetooth_register(int sk)
{
DBG("");
+ if (notification_sk >= 0)
+ return false;
+
notification_sk = sk;
return true;
@@ -2284,5 +2287,8 @@ void bt_bluetooth_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
}
diff --git a/android/hidhost.c b/android/hidhost.c
index 842b8ad..df21f81 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -1190,6 +1190,9 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
DBG("");
+ if (notification_sk >= 0)
+ return false;
+
bacpy(&adapter_addr, addr);
ctrl_io = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -1224,6 +1227,9 @@ void bt_hid_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
if (ctrl_io) {
diff --git a/android/pan.c b/android/pan.c
index fba86b8..ada458a 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -95,6 +95,9 @@ bool bt_pan_register(int sk, const bdaddr_t *addr)
{
DBG("");
+ if (notification_sk >= 0)
+ return false;
+
notification_sk = sk;
return true;
@@ -104,5 +107,8 @@ void bt_pan_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
}
--
1.8.3.2
^ permalink raw reply related
* [PATCH_v2 1/4] android/hal-pan: Return error in case of unsupported PAN roles
From: Ravi kumar Veeramally @ 2013-11-19 14:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
---
android/hal-pan.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/android/hal-pan.c b/android/hal-pan.c
index 2bc560e..a2e6060 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -77,6 +77,9 @@ static bt_status_t pan_enable(int local_role)
if (!interface_ready())
return BT_STATUS_NOT_READY;
+ if (!(local_role == BTPAN_ROLE_PANU || local_role == BTPAN_ROLE_PANNAP))
+ return BT_STATUS_UNSUPPORTED;
+
cmd.local_role = local_role;
return hal_ipc_cmd(HAL_SERVICE_ID_PAN, HAL_OP_PAN_ENABLE,
@@ -112,6 +115,20 @@ static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,
if (!interface_ready())
return BT_STATUS_NOT_READY;
+ switch (local_role) {
+ case BTPAN_ROLE_PANNAP:
+ if (remote_role != BTPAN_ROLE_PANU)
+ return BT_STATUS_UNSUPPORTED;
+ break;
+ case BTPAN_ROLE_PANU:
+ if (remote_role != BTPAN_ROLE_PANNAP &&
+ remote_role != BTPAN_ROLE_PANU)
+ return BT_STATUS_UNSUPPORTED;
+ break;
+ default:
+ return BT_STATUS_UNSUPPORTED;
+ }
+
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
cmd.local_role = local_role;
cmd.remote_role = remote_role;
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH v3 0/6] android: IPC improvements
From: Luiz Augusto von Dentz @ 2013-11-19 14:44 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Tue, Nov 19, 2013 at 4:02 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> v3:
> - fixed compilation on android 4.2
>
> Szymon Janc (6):
> android/hal: Add initial code for IPC message handlers
> android/hal-bluetooth: Register IPC message handlers
> android/hal-hidhost: Use generic IPC message handling for events
> android/hal-pan: Use generic IPC message handling for events
> android/hal-a2dp: Use generic IPC message handling for events
> android/hal: Check if command socket was shutdown by peer
>
> android/hal-a2dp.c | 41 +++++-----
> android/hal-bluetooth.c | 208 ++++++++++++++++++++++++++++++------------------
> android/hal-hidhost.c | 76 ++++++++++--------
> android/hal-ipc.c | 123 +++++++++++++++++++---------
> android/hal-ipc.h | 10 +++
> android/hal-pan.c | 40 +++++-----
> android/hal.h | 4 -
> 7 files changed, 310 insertions(+), 192 deletions(-)
>
> --
> 1.8.4.3
Pushed, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCHv3 2/2] android: Add PTS PICS for HID
From: Jakub Tyszkowski @ 2013-11-19 14:36 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384871775-8348-1-git-send-email-jakub.tyszkowski@tieto.com>
PTS PICS for HID, targeting Android 4.4.
---
android/pics-hid.txt | 285 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 285 insertions(+)
create mode 100644 android/pics-hid.txt
diff --git a/android/pics-hid.txt b/android/pics-hid.txt
new file mode 100644
index 0000000..b0b7d52
--- /dev/null
+++ b/android/pics-hid.txt
@@ -0,0 +1,285 @@
+HID PICS for the PTS tool.
+
+* - different than PTS defaults
+# - not yet implemented/supported
+
+M - mandatory
+O - optional
+
+ Roles
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_1_1 True (*) Role: Host, Report protocol (O.1)
+TSPC_HID_1_2 False Role: HID Role (O.1)
+TSPC_HID_1_3 False Role: Host, Boot protocol (O.1)
+-------------------------------------------------------------------------------
+O.1: It is Mandatory to support One of these roles.
+-------------------------------------------------------------------------------
+
+
+ Application Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_2_1 True Host: Establish HID connection (M.1)
+TSPC_HID_2_2 True Host: Accept HID connection (M.1)
+TSPC_HID_2_3 True Host: Terminate HID connection (M.1)
+TSPC_HID_2_4 True Host: Accept termination of HID connection (M.1)
+TSPC_HID_2_5 True Host: Support for virtual cables (M.1)
+TSPC_HID_2_6 True Host: HID initiated connection (M.1)
+TSPC_HID_2_7 True Host: Host initiated connection (M.1)
+TSPC_HID_2_8 True Host: Host data transfer to HID (C.1)
+TSPC_HID_2_9 True Host: HID data transfer to Host (C.1)
+TSPC_HID_2_10 False Host: Boot mode data transfer to Host (C.2)
+TSPC_HID_2_11 False Host : Boot mode data transfer to HID (C.2)
+TSPC_HID_2_12 False Host : Support for Application to send
+ GET_Report (O)
+TSPC_HID_2_13 False Host : Support for Application to send
+ SET_REPORT (O)
+TSPC_HID_2_14 False Host : Support for sending HCI_CONTROL with
+ VIRTUAL_CABLE_UNPLUG (C.3)
+TSPC_HID_2_15 False Host : Support for receiving HCI_CONTROL with
+ VIRTUAL_CABLE_UNPLUG (C.2)
+-------------------------------------------------------------------------------
+M.1: Mandatory to support IF (TSPC_HID_1_1) supported.
+C.1: Optional for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Mandatory
+ for Host Role (TSPC_HID_1_1).
+C.2: Mandatory for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Optional.
+C.3: Optional IF (TSPC_HID_2_5) supported, otherwise excluded.
+-------------------------------------------------------------------------------
+
+
+ Device to Host Transfers
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_3_1 False Host : Data reports larger than host MTU on
+ Control channel (O)
+TSPC_HID_3_2 True (*) Host : Data reports larger than host MTU on
+ Interrupt channel (C.1)
+TSPC_HID_3_3 True (*) Host : Data reports to host (C.1)
+TSPC_HID_3_4 False Host : Boot mode reports to host (C.2)
+-------------------------------------------------------------------------------
+C.1: Excluded for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Mandatory if
+ (TSPC_HID_2_12), otherwise Optional.
+C.2: Mandatory for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Optional.
+-------------------------------------------------------------------------------
+
+
+ Host to Device Transfers
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_4_1 False Host : Data reports larger than device MTU on
+ Control channel (C.1)
+TSPC_HID_4_2 False Host : Data reports larger than device MTU on
+ Interrupt channel (C.1)
+TSPC_HID_4_3 True (*) Host : Data reports to device (C.2)
+TSPC_HID_4_4 False Host : Boot mode reports to device (O)
+-------------------------------------------------------------------------------
+C.1: Excluded for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Optional
+C.2: Excluded for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Mandatory for
+ Host Role (TSPC_HID_1_1).
+-------------------------------------------------------------------------------
+
+
+ HID Control Commands
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_5_1 False Host : Set_Protocol command (C.1)
+TSPC_HID_5_2 False Host : Get_Protocol command (C.1)
+TSPC_HID_5_3 False Host : Set_Idle command (O)
+TSPC_HID_5_4 False Host : Get_Idle command (O)
+TSPC_HID_5_5 False (*) Host : Set_Report command (M.1)
+TSPC_HID_5_6 False (*) Host : Get_Report command (M.2)
+-------------------------------------------------------------------------------
+M.1: Mandatory IF (TSPC_HID_1_1) supported AND (TSPC_HID_2_13) supported.
+C.1: Mandatory for Boot Mode Only Hosts (TSPC_HID_1_3); otherwise Optional.
+ If either Set_Protocol or Get_Protocol supported, both are Mandatory.
+M.2: Mandatory IF (TSPC_HID_1_1) Supported AND (TSPC_HID_2_12) Supported
+-------------------------------------------------------------------------------
+
+
+ Host Link Manager Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_6_1 False Host : Initiate Authentication before
+ connection completed (C.1)
+TSPC_HID_6_2 False Host : Initiate Authentication after connection
+ completed (C.1)
+TSPC_HID_6_3 False Host : Initiate pairing before connection
+ completed (C.2)
+TSPC_HID_6_4 False Host : Initiate pairing after connection
+ completed (C.2)
+TSPC_HID_6_5 False Host : Encryption (O)
+TSPC_HID_6_6 False Host : Initiate encryption (C.3)
+TSPC_HID_6_7 False Host : Accept encryption requests (C.3)
+TSPC_HID_6_8 True Host : Role switch (Master/Slave) (M.1)
+TSPC_HID_6_9 True Host : Request Master Slave switch (M.1)
+TSPC_HID_6_10 True Host : Accept Master Slave switch requests (M.1)
+TSPC_HID_6_11 False Host : Hold mode (O)
+TSPC_HID_6_12 True Host : Sniff mode (M.1)
+TSPC_HID_6_13 False Host : Park mode (O)
+-------------------------------------------------------------------------------
+C.1: If Host Authentication supported, both (TSPC_HID_6_1) AND (TSPC_HID_6_2)
+ must be supported.
+C.2: If Pairing supported both (TSPC_HID_6_3) AND (TSPC_HID_6_4) must
+ be supported.
+M.1: Mandatory IF (TSPC_HID_1_1) supported.
+C.3: Mandatory IF (TSPC_HID_6_5) encryption supported.
+-------------------------------------------------------------------------------
+
+
+ Host Link Control Requirements
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_7_1 True Host : Supports inquiry, 79 channel (M.1)
+TSPC_HID_7_2 False (*) Host : Supports inquiry scan, 79 channel (X)
+-------------------------------------------------------------------------------
+M.1: Mandatory to support IF (TSPC_HID_1_1) supported.
+X: Feature should not be used by a Host, but can be supported in LM.
+-------------------------------------------------------------------------------
+
+
+ HID Device Roles
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_8_1 False Hid : Pointing HID (O.1)
+TSPC_HID_8_2 False Hid : Keyboard HID (O.1)
+TSPC_HID_8_3 False Hid : Identification HID (O.1)
+TSPC_HID_8_4 False Hid : Other HID (O.1)
+-------------------------------------------------------------------------------
+O.1: It is Mandatory to support One of these roles IF (TSPC_HID_1_2)
+ is selected
+-------------------------------------------------------------------------------
+
+
+ HID Application Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_9_1 False Hid : Establish HID connection (O)
+TSPC_HID_9_2 False (*) Hid : Accept HID connection (M.1)
+TSPC_HID_9_3 False Hid : Terminate HID connection (O)
+TSPC_HID_9_4 False (*) Hid : Accept Termination of HID connection (M.1)
+TSPC_HID_9_5 False Hid : Support for virtual cables (O)
+TSPC_HID_9_6 False Hid : HID initiated reconnection (C.1)
+TSPC_HID_9_7 False Hid : Host initiated reconnection (C.1)
+TSPC_HID_9_8 False Hid : Host data transfer to HID (C.2)
+TSPC_HID_9_9 False Hid : HID data transfer to Host (C.2)
+TSPC_HID_9_10 False Hid : HID Boot mode data transfer to Host (C.3)
+TSPC_HID_9_11 False Hid : Host Boot mode data transfer to HID (C.4)
+TSPC_HID_9_12 False Hid : Output reports declared (C.4)
+TSPC_HID_9_13 False Hid : Input reports declared (C.3)
+TSPC_HID_9_14 False Hid : Feature reports declared (O)
+TSPC_HID_9_15 False Hid : Support for sending HCI_CONTROL with
+ VIRTUAL_CABLE_UNPLUG (C.5)
+TSPC_HID_9_16 False Hid : Support for receiving HCI_CONTROL with
+ VIRTUAL_CABLE_UNPLUG (C.5)
+-------------------------------------------------------------------------------
+M.1: Mandatory IF (TSPC_HID_1_2) supported.
+C.1: One of these is Mandatory IF (TSPC_HID_9_5) is supported
+ (SDP attribute 0x204=True)
+C.2: One of these is Mandatory.
+C.3: Mandatory IF (TSPC_HID_8_1) OR (TSPC_HID_8_2) is selected
+C.4: Mandatory IF (TSPC_HID_8_2) is supported (for status indicators)
+C.5: Optional IF (TSPC_HID_9_2) supported, otherwise excluded.
+-------------------------------------------------------------------------------
+
+
+ Device to Host Transfers
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_10_1 False Hid : Data reports larger than host MTU on
+ Control channel (O)
+TSPC_HID_10_2 False Hid : Data reports larger than host MTU on
+ Interrupt channel (O)
+TSPC_HID_10_3 False Hid : Data reports to host (O)
+TSPC_HID_10_4 False Hid : Boot mode reports to host (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory IF (TSPC_HID_8_1) OR (TSPC_HID_8_2) is supported.
+ Optional for other HIDs.
+-------------------------------------------------------------------------------
+
+
+ Host to Device Transfers
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_11_1 False Hid : Data reports larger than device MTU on
+ Control channel (O)
+TSPC_HID_11_2 False Hid : Data reports larger than device MTU on
+ Interrupt channel (O)
+TSPC_HID_11_3 False Hid : Data reports to device (O)
+TSPC_HID_11_4 False Hid : Boot mode reports to device (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory IF (TSPC_HID_8_2) is supported. Optional for other HIDs.
+-------------------------------------------------------------------------------
+
+
+ HID Control Commands
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_12_1 False Hid : Set_Protocol command (C.1)
+TSPC_HID_12_2 False Hid : Get_Protocol command (C.1)
+TSPC_HID_12_3 False Hid : Set_Idle command (C.2)
+TSPC_HID_12_4 False Hid : Get_Idle command (C.2)
+TSPC_HID_12_5 False Hid : Set_Report command (C.3)
+TSPC_HID_12_6 False Hid : Get_Report command (C.4)
+-------------------------------------------------------------------------------
+C.1: Mandatory IF (TSPC_HID_8_1) OR (TSPC_HID_8_2) is supported.
+ Optional for other HIDs. If either Set_Protocol or Get_Protocol
+ supported, both are Mandatory.
+C.2: Mandatory IF (TSPC_HID_8_2) Keyboard is selected. Optional for other HIDs.
+C.3: Mandatory IF (TSPC_HID_9_12) or (TSPC_HID_9_14) supported.
+C.4: Mandatory IF (TSPC_HID_9_13) or (TSPC_HID_9_14) supported
+-------------------------------------------------------------------------------
+
+
+ HID Link Manager Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_13_1 False Hid : Host initiated Authentication before
+ connection completed (C.1)
+TSPC_HID_13_2 False Hid : Host initiated Authentication after
+ connection completed (C.1)
+TSPC_HID_13_3 False Hid : Initiate pairing before connection
+ completed (X)
+TSPC_HID_13_4 False Hid : Initiate pairing after connection
+ completed (X)
+TSPC_HID_13_5 False Hid : Encryption (C.1)
+TSPC_HID_13_6 False Hid : Initiate encryption (O)
+TSPC_HID_13_7 False Hid : Accept encryption requests (C.2)
+TSPC_HID_13_8 False Hid : Role switch (Master/Slave) (C.3)
+TSPC_HID_13_9 False Hid : Request Master Slave switch (O)
+TSPC_HID_13_10 False Hid : Accept Master Slave switch requests (C.3)
+TSPC_HID_13_11 False Hid : Hold mode (O)
+TSPC_HID_13_12 False Hid : Sniff mode (O)
+TSPC_HID_13_13 False Hid : Park mode (O)
+-------------------------------------------------------------------------------
+C.1: Mandatory IF (TSPC_HID_8_2) OR (TSPC_HID_8_3) is selected. Optional
+ for other HIDs.
+C.2: Mandatory IF (TSPC_HID_13_5) supported.
+C.3: Mandatory IF (TSPC_HID_9_6) is supported.
+X: Feature should not be used by a HID device, but can be supported in LM.
+-------------------------------------------------------------------------------
+
+
+ HID Link Control Requirements
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_HID_14_1 False Hid : Supports inquiry, 79 channel (O)
+TSPC_HID_14_2 False (*) Hid : Supports inquiry scan, 79 channel (M.1)
+TSPC_ALL False Enables all test cases when set to true.
+-------------------------------------------------------------------------------
+M.1: Mandatory IF (TSPC_HID_1_2) is supported.
+-------------------------------------------------------------------------------
--
1.8.4.1
^ permalink raw reply related
* [PATCHv3 1/2] android: Add PTS PICS for GAP
From: Jakub Tyszkowski @ 2013-11-19 14:36 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384871775-8348-1-git-send-email-jakub.tyszkowski@tieto.com>
PTS PICS for GAP, targeting Android 4.4.
---
android/pics-gap.txt | 708 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 708 insertions(+)
create mode 100644 android/pics-gap.txt
diff --git a/android/pics-gap.txt b/android/pics-gap.txt
new file mode 100644
index 0000000..2343975
--- /dev/null
+++ b/android/pics-gap.txt
@@ -0,0 +1,708 @@
+GAP PICS for the PTS tool.
+
+* - different than PTS defaults
+# - not yet implemented/supported
+
+M - mandatory
+O - optional
+
+ Device Configuration
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_0_1 False BR/EDR (C.1)
+TSPC_GAP_0_2 False LE (C.2)
+TSPC_GAP_0_3 True (*) BR/EDR/LE (C.3)
+-------------------------------------------------------------------------------
+C.1: Mandatory if ('End Product' or 'Host Subsystem') and ('BR Host' or
+ 'BR/HS Host') are Supported ('End Product' or 'Host Subsystem' with 'BR'
+ or 'BR/HS Host' CC), otherwise excluded. Optional for
+ 'Component (Tested)' or 'Component (Non-Tested)'.
+C.2: Mandatory if ('End Product' or 'Host Subsystem') and ('LE Host') are Supported
+ (End Product or Host Subsystem with LE Host CC), otherwise excluded.
+ Optional for 'Component (Tested)' or 'Component (Non-Tested)'.
+C.3: Mandatory if ('End Product' or 'Host Subsystem') and ('BR/LE Host' or
+ 'BR/HS/LE Host') are Supported (End Product or Host Subsystem with
+ BR/LE or BR/HS/LE Host CC), otherwise excluded.
+ Optional for 'Component (Tested)' or 'Component (Non-tested)'.
+Note - Only one transport shall be supported.
+-------------------------------------------------------------------------------
+
+
+ Version Configuration
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_0A_1 False Core Specification Addendum 3 (CSA3),
+ GAP Connection Parameters Changes,
+ Authentication and Lost Bond Changes,
+ Private Addressing Changes,
+ Dual Mode Addressing Changes,
+ Adopted 24 July 2012 (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory if 'CSA3 Adopted 24 July 2012' is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Modes
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_1_1 True (*) Non-discoverable mode (C.1)
+TSPC_GAP_1_2 False Limited-discoverable Mode (O)
+TSPC_GAP_1_3 True (*) General-discoverable mode (O)
+TSPC_GAP_1_4 True (*) Non-connectable mode (O)
+TSPC_GAP_1_5 True Connectable mode (M)
+TSPC_GAP_1_6 False Non-bondable mode (O)
+TSPC_GAP_1_7 True (*) Bondable mode (C.2)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_0_2 is supported, otherwise Optional.
+C.2: Mandatory if TSPC_GAP_3_5 is supported, otherwise Optional.
+-------------------------------------------------------------------------------
+
+
+ Security Aspects
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_2_1 True (*) Authentication procedure (C.1)
+TSPC_GAP_2_2 True (*) Support of LMP-Authentication (M)
+TSPC_GAP_2_3 True (*) Initiate LMP-Authentication (C.5)
+TSPC_GAP_2_4 False Security mode 1 (C.2)
+TSPC_GAP_2_5 True (*) Security mode 2 (O)
+TSPC_GAP_2_6 False Security mode 3 (C.7)
+TSPC_GAP_2_7 True (*) Security mode 4 (C.4)
+TSPC_GAP_2_8 True (*) Support of Authenticated link key (C.6)
+TSPC_GAP_2_9 True (*) Support of Unauthenticated link key (C.6)
+TSPC_GAP_2_10 False No security (C.6)
+-------------------------------------------------------------------------------
+C.1: Mandatory If (TSPC_GAP_2_5 or TSPC_GAP_2_6) is supported, otherwise
+ Optional.
+Note 1: The Authentication Procedure in item GAP, TSPC_GAP_2_1 is the one
+ described in Fig. 5.1 on page 198 in the GAP Profile Specification and
+ not the LMP-Authenticaion.
+C.2: Excluded if TSPC_GAP_2_7 is supported, otherwise Optional.
+C.5: Mandatory If (TSPC_GAP_2_5 or TSPC_GAP_2_6 or TSPC_GAP_2_7) is supported,
+ otherwise Optional.
+C.4: Mandatory if (Core Spec 2.1 or later) is supported, otherwise Excluded.
+Note 2. If a Core 2.0 and earlier design claims to support secure communcation
+ it should support either Security mode 2 or 3.
+Note 3. A Core 2.1 or later device shall always support secure communication
+ in Security Mode 4, and shall use that mode to connect with another
+ Core 2.1 or later device. It shall use Security Mode 2 only for
+ backward compatibility purposes with Core 2.0 and earlier devices.
+ Security Mode 1 is excluded for Core 2.1 or later devices based on
+ condition C.2.
+C.6: If TSPC_GAP_2_7 is supported then at least one of (TSPC_GAP_2_8 or
+ TSPC_GAP_2_9 or TSPC_GAP_2_10) is Mandatory, otherwise Excluded.
+C.7: Excluded if TSPC_GAP_2_7 is supported, otherwise Optional.
+-------------------------------------------------------------------------------
+
+
+ Idle Mode Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_3_1 True (*) Initiation of general inquiry (C.1)
+TSPC_GAP_3_2 False Initiation of limited inquiry (C.1)
+TSPC_GAP_3_3 True (*) Initiation of name discover (O)
+TSPC_GAP_3_4 True (*) Initiation of device discovery (O)
+TSPC_GAP_3_5 True (*) Initiation of general bonding (O)
+TSPC_GAP_3_6 True (*) Initiation of dedicated bonding (O)
+-------------------------------------------------------------------------------
+C.1: Mandatory to support at least one of TSPC_GAP_3_1 or TSPC_GAP_3_2 if
+ TSPC_GAP_3_5 is supported, otherwise Optional.
+-------------------------------------------------------------------------------
+
+
+ Establishment Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_4_1 True Support link establishment as initiator (M)
+TSPC_GAP_4_2 True Support link establishment as acceptor (M)
+TSPC_GAP_4_3 True (*) Support channel establishment as initiator (O)
+TSPC_GAP_4_4 True Support channel establishment as acceptor (M)
+TSPC_GAP_4_5 True (*) Support connection establishment as initiator
+ (O)
+TSPC_GAP_4_6 True (*) Support connection establishment as acceptor
+ (O)
+-------------------------------------------------------------------------------
+
+
+ LE Roles
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_5_1 False (*) Broadcaster (C.1)
+TSPC_GAP_5_2 False Observer (C.1)
+TSPC_GAP_5_3 False (*) Peripheral (C.1)
+TSPC_GAP_5_4 True (*#) Central (C.1)
+-------------------------------------------------------------------------------
+C.1: It is mandatory to support at least one of the defined roles.
+Note: 'LE Roles' is applicable for LE-only configurations, but it appears that
+ PTS is checking this precondition also in some BR/EDR/LE tests.
+-------------------------------------------------------------------------------
+
+
+ Broadcaster Physical Layer
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_6_1 False (*) Broadcaster: Transmitter (M)
+TSPC_GAP_6_2 False Broadcaster: Receiver (O)
+-------------------------------------------------------------------------------
+
+
+ Broadcaster Link Layer States
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_7_1 False (*) Broadcaster: Standby (M)
+TSPC_GAP_7_2 False (*) Broadcaster: Advertising (M)
+-------------------------------------------------------------------------------
+
+
+ Broadcaster Link Layer Advertising Event Types
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_8_1 False (*) Broadcaster: Non-Connectable Undirected Event
+ (M)
+TSPC_GAP_8_2 False Broadcaster: Scannable Undirected Event (O)
+-------------------------------------------------------------------------------
+
+
+ Broadcaster Link Layer Advertising Data Types
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_8A_1 False AD Type-Service UUID (O)
+TSPC_GAP_8A_2 False AD Type-Local Name (O)
+TSPC_GAP_8A_3 False (*) AD Type-Flags (M)
+TSPC_GAP_8A_4 False AD Type-Manufacturer Specific Data (O)
+TSPC_GAP_8A_5 False AD Type-TX Power Level (O)
+TSPC_GAP_8A_6 False AD Type-Security Manager Out of Band (OOB) (C.1)
+TSPC_GAP_8A_7 False AD Type-Security manager TK Value (O)
+TSPC_GAP_8A_8 False AD Type-Slave Connection Interval Range (O)
+TSPC_GAP_8A_9 False AD Type-Service Solicitation (O)
+TSPC_GAP_8A_10 False AD Type-Service Data (O)
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_SM_2_4 (OOB supported) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Broadcaster Connection Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_9_1 False (*) Broadcaster: Non-Connectable Mode
+-------------------------------------------------------------------------------
+
+
+ Broadcaster Broadcasting and Observing Features
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_10_1 False (*) Broadcaster: Broadcast Mode
+TSPC_GAP_11_1 False Broadcaster: Privacy Feature
+TSPC_GAP_11_2 False Broadcaster: Resolvable Private Address
+ Generation Procedure
+-------------------------------------------------------------------------------
+
+
+ Observer Physical Layer
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_12_1 True (#) Observer: Receiver
+TSPC_GAP_12_2 False Observer: Transmitter
+-------------------------------------------------------------------------------
+
+
+ Observer Link Layer States
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_13_1 True (#) Observer: Standby
+TSPC_GAP_13_2 True (#) Observer: Scanning
+-------------------------------------------------------------------------------
+
+
+ Observer Link Layer Scanning Types
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_14_1 True (#) Observer: Passive Scanning
+TSPC_GAP_14_2 False Observer: Active Scanning
+-------------------------------------------------------------------------------
+
+
+ Observer Connection Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_15_1 True (#) Observer: Non-Connectable Mode
+-------------------------------------------------------------------------------
+
+
+ Observer Broadcasting and Observing Features
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_16_1 True (#) Observer: Observation Procedure
+-------------------------------------------------------------------------------
+
+
+ Observer Privacy Feature
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_17_1 False Observer: Privacy Feature (O)
+TSPC_GAP_17_2 False Observer: Non-Resolvable Private Address
+ Generation Procedure (C.1)
+TSPC_GAP_17_3 False Observer: Resolvable Private Address Resolution
+ Procedure (C.2)
+TSPC_GAP_17_4 False Observer: Resolvable Private Address Generation
+ Procedure (C.3)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_17_1 and TSPC_GAP_14_2 (Active Scanning) are
+ supported and TSPC_GAP_17_4 (Resolvable Private Address Generation
+ Procedure) is Not Supported; Optional if CSA3 or later and
+ TSPC_GAP_17_4 are supported, otherwise Excluded.
+C.2: Optional if TSPC_GAP_17_1 is supported, otherwise Excluded.
+C.3: Mandatory if CSA3 or later and TSPC_GAP_17_1 and TSPC_GAP_14_2
+ (Active Scanning) are supported and TSPC_GAP_17_2 (Non-Resolvable
+ Private Address Generation Procedure) is not supported; Optional if
+ CSA3 or later and TSPC_GAP_17_2 (Non-Resolvable Private Address
+ Generation Procedure) are supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Peripheral Physical Layer
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_18_1 False Peripheral: Transmitter
+TSPC_GAP_18_2 False Peripheral: Receiver
+-------------------------------------------------------------------------------
+
+
+ Peripheral Link Layer States
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_19_1 False Peripheral: Standby
+TSPC_GAP_19_2 False Peripheral: Advertising
+TSPC_GAP_19_3 False Peripheral: Connection, Slave Role
+-------------------------------------------------------------------------------
+
+
+ Peripheral Link Layer Advertising Event Types
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_20_1 False Peripheral: Connectable Undirected Event
+TSPC_GAP_20_2 False Peripheral: Connectable Directed Event
+TSPC_GAP_20_3 False Peripheral: Non-Connectable Undirected Event
+TSPC_GAP_20_4 False Peripheral: Scannable Undirected Event
+-------------------------------------------------------------------------------
+
+
+ Peripheral Link Layer Advertising Data Types
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_20A_1 False AD Type-Service UUID (C.1)
+TSPC_GAP_20A_2 False AD Type-Local Name (C.1)
+TSPC_GAP_20A_3 False AD Type-Flags (C.2)
+TSPC_GAP_20A_4 False AD Type-Manufacturer Specific Data (C.1)
+TSPC_GAP_20A_5 False AD Type-TX Power Level (C.1)
+TSPC_GAP_20A_6 False AD Type-Security Manager Out of Band (OOB) (C.3)
+TSPC_GAP_20A_7 False AD Type-Security manager TK Value (C.1)
+TSPC_GAP_20A_8 False AD Type-Slave Connection Interval Range (C.1)
+TSPC_GAP_20A_9 False AD Type-Service Solicitation (C.1)
+TSPC_GAP_20A_10 False AD Type-Service Data (C.1)
+-------------------------------------------------------------------------------
+C.1: Optional if (TSPC_GAP_20_1 or TSPC_GAP_20_3 or TSPC_GAP_20_4) is
+ supported, otherwise Excluded.
+C.2: Mandatory if TSPC_GAP_22_2 (Limited Discoverable Mode) or TSPC_GAP_22_3
+ (General Discoverable Mode) is supported, otherwise Optional.
+C.3: Optional if (TSPC_GAP_20_1 (Connectable Undirected Event) or TSPC_GAP_20_3
+ (Non-Connectable Undirected Event) or TSPC_GAP_20_4
+ (Scannable Undirected Event)) and TSPC_SM_2_4 (OOB supported) are
+ supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Peripheral Link Layer Control Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_21_1 False (*) Peripheral: Connection Update Procedure (M)
+TSPC_GAP_21_2 False (*) Peripheral: Channel Map Update Procedure (M)
+TSPC_GAP_21_3 False Peripheral: Encryption Procedure (O)
+TSPC_GAP_21_4 False (*) Peripheral: Feature Exchange Procedure (M)
+TSPC_GAP_21_5 False (*) Peripheral: Version Exchange Procedure (M)
+TSPC_GAP_21_6 False (*) Peripheral: Termination Procedure (M)
+-------------------------------------------------------------------------------
+
+
+ Peripheral Discovery Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_22_1 False Peripheral: Non-Discoverable Mode (C.2)
+TSPC_GAP_22_2 False Peripheral: Limited Discoverable Mode (C.1)
+TSPC_GAP_22_3 False Peripheral: General Discoverable Mode (C.1)
+TSPC_GAP_22_4 False Peripheral: Name Discovery Procedure (C.3)
+-------------------------------------------------------------------------------
+C.1: Optional if (TSPC_GAP_5_3 OR TSPC_GAP_42_2), otherwise Excluded.
+C.2: Mandatory if (TSPC_GAP_5_3 or TSPC_GAP_42_1) is supported,
+ otherwise Excluded.
+C.3: Optional if TSPC_GAP_5_3 is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Peripheral Connection Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_23_1 False Peripheral: Non-Connectable Mode (C.1)
+TSPC_GAP_23_2 False Peripheral: Directed Connectable Mode (O)
+TSPC_GAP_23_3 False Peripheral: Undirected Connectable Mode (M)
+TSPC_GAP_23_4 False Peripheral: Connection Parameter Update
+ Procedure (O)
+TSPC_GAP_23_5 False Peripheral: Terminate Connection Procedure (M)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_5_3 (LE Only – Peripheral role) OR TSPC_GAP_42_3
+ (BR/EDR/LE – Non-Connectable Mode) OR TSPC_GAP_42_4
+ (BR/EDR/LE – Connectable Mode) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Peripheral Bonding Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_24_1 False Peripheral: Non-Bondable Mode (M)
+TSPC_GAP_24_2 False Peripheral: Bondable Mode (C.1)
+TSPC_GAP_24_3 False Peripheral: Bonding Procedure (C.2)
+TSPC_GAP_24_4 False Peripheral: Multiple Bonds (C.3)
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_GAP_5_3 (LE Only – Peripheral role) OR (TSPC_GAP_38_3
+ (BR/EDR/LE – Peripheral role) AND NOT TSPC_GAP_42_6 (BR.EDR/LE -
+ Bondable Mode)) is supported, Mandatory if TSPC_GAP_42_6
+ (BR/EDR/LE – Bondable Mode) is supported, otherwise Excluded.
+C.2: Optional if TSPC_GAP_24_2 (Bondable Mode) is supported, otherwise Excluded
+-------------------------------------------------------------------------------
+
+
+ Peripheral Security Aspects Features
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_25_1 False Peripheral: Security Mode (O)
+TSPC_GAP_25_2 False Peripheral: Security Mode 2 (O)
+TSPC_GAP_25_3 False Peripheral: Authentication Procedure (C.2)
+TSPC_GAP_25_4 False Peripheral: Authorization Procedure (O)
+TSPC_GAP_25_5 False Peripheral: Connection Data Signing Procedure
+ (O)
+TSPC_GAP_25_6 False Peripheral: Authenticate Signed Data Procedure
+ (O)
+TSPC_GAP_25_7 False Peripheral: Authenticated Pairing
+ (LE security mode 1 level 3) (C.1)
+TSPC_GAP_25_8 False Peripheral: Unauthenticated Pairing
+ (LE security mode 1 level 2) (C.1)
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_GAP_25_1 is supported, otherwise Excluded.
+C.2: Mandatory if TSPC_GAP_0A_1 and TSPC_GAP_27_4 are supported,
+ otherwise Optional.
+-------------------------------------------------------------------------------
+
+
+ Peripheral Privacy Feature
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_26_1 False Peripheral: Privacy Feature (O)
+TSPC_GAP_26_2 False Peripheral: Non-Resolvable Private Address
+ Generation Procedure (C.1)
+TSPC_GAP_26_3 False Peripheral: Resolvable Private Address
+ Generation Procedure (C.2)
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_GAP_26_1 is supported, otherwise Excluded.
+C.2: Mandatory if TSPC_GAP_26_1 is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Peripheral GAP Characteristics
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_27_1 False (*) Peripheral: Device Name (M)
+TSPC_GAP_27_2 False (*) Peripheral: Appearance (M)
+TSPC_GAP_27_3 False Peripheral: Peripheral Privacy Flag (C.1)
+TSPC_GAP_27_4 False Peripheral: Reconnection Address (C.2)
+TSPC_GAP_27_5 False Peripheral: Peripheral Preferred Connection
+ Parameters (O)
+TSPC_GAP_27_6 False Peripheral: Writeable Device Name (O)
+TSPC_GAP_27_7 False Peripheral: Writeable Appearance (O)
+TSPC_GAP_27_8 False Peripheral: Writeable Peripheral Privacy Flag
+ (O)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_26_1 is supported, otherwise Excluded.
+C.2: Optional if TSPC_GAP_26_1 and TSPC_GAP_27_3 are supported,
+ otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central Physical Layer
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_28_1 True (*#) Central: Transmitter (M)
+TSPC_GAP_28_2 True (*#) Central: Receiver (M)
+-------------------------------------------------------------------------------
+
+
+ Central Link Layer States
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_29_1 True (*#) Central: Standby (M)
+TSPC_GAP_29_2 True (*#) Central: Scanning (M)
+TSPC_GAP_29_3 True (*#) Central: Initiating (M)
+TSPC_GAP_29_4 True (*#) Central: Connection, Master Role (M)
+-------------------------------------------------------------------------------
+
+
+ Central Link Layer Scanning Types
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_30_1 True (*#) Central: Passive Scanning (O)
+TSPC_GAP_30_2 True (*#) Central: Active Scanning (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory if (TSPC_GAP_5_4 or TSPC_GAP_38_4) is supported.
+ Optional if TSPC_GAP_30_1 and (TSPC_GAP_5_4 OR TSPC_GAP_38_4)
+ is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central Link Layer Control Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_31_1 True (*#) Central: Connection Update Procedure (M)
+TSPC_GAP_31_2 True (*#) Central: Channel Map Update Procedure (M)
+TSPC_GAP_31_3 True (*#) Central: Encryption Procedure (O)
+TSPC_GAP_31_4 True (*#) Central: Feature Exchange Procedure (M)
+TSPC_GAP_31_5 True (*#) Central: Version Exchange Procedure (M)
+TSPC_GAP_31_6 True (*#) Central: Termination Procedure (M)
+-------------------------------------------------------------------------------
+
+
+ Central Discovery Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_32_1 False Central: Limited Discovery Procedure (C.2)
+TSPC_GAP_32_2 True (*#) Central: General Discovery Procedure (C.1)
+TSPC_GAP_32_3 True (*#) Central: Name Discovery Procedure (C.3)
+-------------------------------------------------------------------------------
+C.1: Mandatory if (TSPC_GAP_5_4 or TSPC_GAP_40_1) is supported, else Excluded.
+C.2: Optional if (TSPC_GAP_5_4 or TSPC_GAP_40_2) is supported,
+ otherwise Excluded.
+C.3: Optional if (TSPC_GAP_5_4 or TSPC_GAP_40_4) is supported,
+ otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central Connection Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_33_1 True (*#) Central: Auto Connection Establishment
+ Procedure (C.3)
+TSPC_GAP_33_2 True (*#) Central: General Connection Establishment
+ Procedure (C.1)
+TSPC_GAP_33_3 True (*#) Central: Selective Connection Establishment
+ Procedure (C.3)
+TSPC_GAP_33_4 True (*#) Central: Direct Connectin Establishment
+ Procedure (C.2)
+TSPC_GAP_33_5 True (*#) Central: Connection Parameter Update Procedure
+ (C.2)
+TSPC_GAP_33_6 True (*#) Central: Terminate Connection Procedure
+ (C.2)
+-------------------------------------------------------------------------------
+C.1: Mandatory if (TSPC_GAP_5_4 or TSPC_GAP_40_5) and TSPC_GAP_36_1 is
+ supported, otherwise Optional.
+C.2: Mandatory if (TSPC_GAP_5_4 or TSPC_GAP_40_5) is supported,
+ otherwise Excluded.
+C.3: Optional if (TSPC_GAP_5_4 or TSPC_GAP_40_5) is supported,
+ otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central Bonding Modes and Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_34_1 False Central: Non-Bondable Mode (C.1)
+TSPC_GAP_34_2 True (*#) Central: Bondable Mode (C.2)
+TSPC_GAP_34_3 True (*#) Central: Bonding Procedure (O)
+-------------------------------------------------------------------------------
+C.1: Mandatory if (TSPC_GAP_5_4 or 39/5) is supported, otherwise Excluded.
+C.2: Optional if (TSPC_GAP_5_4 or 39/6) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central Security Features
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_35_1 True (*#) Central: Security Mode 1 (O)
+TSPC_GAP_35_2 True (*#) Central: Security Mode 2 (O)
+TSPC_GAP_35_3 True (*#) Central: Authentication Procedure (O)
+TSPC_GAP_35_4 True (*#) Central: Authorization Procedure (O)
+TSPC_GAP_35_5 True (*#) Central: Connection Data Signing Procedure (O)
+TSPC_GAP_35_6 True (*#) Central: Authenticate Signed Data Procedure (O)
+TSPC_GAP_35_7 False Central: Authenticated Pairing
+ (LE security mode 1 level 3) (C.1)
+TSPC_GAP_35_8 False Central: Unauthenticated Pairing
+ (LE security mode 1 level 2) (C.1)
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_GAP_35_1 is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central Privacy Feature
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_36_1 False Central: Privacy Feature (C.3)
+TSPC_GAP_36_2 False Central: Non-Resolvable Private Address
+ Generation Procedure (C.1)
+TSPC_GAP_36_3 False Central: Resolvable Private Address Resolution
+ Procedure (C.2)
+TSPC_GAP_36_4 False Central: Write to Privacy Characteristic
+ (Enable/Disable Privacy) (O)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_36_1 and TSPC_GAP_30_2 are supported,
+ otherwise Excluded.
+C.2: Mandatory if TSPC_GAP_36_1 is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central GAP Characteristics
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_37_1 True (*#) Central: Device Name (M)
+TSPC_GAP_37_2 True (*#) Central: Appearance (M)
+-------------------------------------------------------------------------------
+
+
+ BR/EDR/LE Roles
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_38_1 False BR/EDR/LE: Broadcaster (C.1)
+TSPC_GAP_38_2 True (*#) BR/EDR/LE: Observer (C.1)
+TSPC_GAP_38_3 False BR/EDR/LE: Peripheral (C.1)
+TSPC_GAP_38_4 True (*#) BR/EDR/LE: Central (C.1)
+-------------------------------------------------------------------------------
+C.1: It is mandatory to support at least one of the defined roles.
+This table is applicable for BR/EDR/LE configurations. For LE-only
+configurations, see 'LE Roles' table for role declarations.
+-------------------------------------------------------------------------------
+
+
+ Central BR/EDR/LE Modes
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_39_1 True (*#) Central BR/EDR/LE: Non-Discoverable Mode (C.1)
+TSPC_GAP_39_2 True (*#) Central BR/EDR/LE: Discoverable Mode (C.2)
+TSPC_GAP_39_3 True (*#) Central BR/EDR/LE: Non-Connectable Mode (C.3)
+TSPC_GAP_39_4 True (#) Central BR/EDR/LE: Connectable Mode (M)
+TSPC_GAP_39_5 False Central BR/EDR/LE: Non-Bondable Mode (C.4)
+TSPC_GAP_39_6 True (*#) Central BR/EDR/LE: Bondable Mode (C.5)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_1_1 is supported over BR/EDR, otherwise Excluded.
+C.2: Mandatory if (TSPC_GAP_1_2 or TSPC_GAP_1_3) is supported over BR/EDR,
+ otherwise Excluded.
+C.3: Mandatory if TSPC_GAP_1_4 is supported over BR/EDR, otherwise Excluded.
+C.4: Mandatory if TSPC_GAP_1_6 is supported over BR/EDR, otherwise Excluded.
+C.5: Mandatory if TSPC_GAP_1_7 is supported over BR/EDR, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central BR/EDR/LE Idle Mode Procedures
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_40_1 True (*#) Central BR/EDR/LE: General Discovery (C.1)
+TSPC_GAP_40_2 False Central BR/EDR/LE: Limited Discovery (C.2)
+TSPC_GAP_40_3 True (*#) Central BR/EDR/LE: Device Type Discovery (C.3)
+TSPC_GAP_40_4 True (*#) Central BR/EDR/LE: Name Discovery (C.4)
+TSPC_GAP_40_5 True (*#) Central BR/EDR/LE: Link Establishment (C.5)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_3_1 is supported over BR/EDR, otherwise Excluded.
+C.2: Mandatory if TSPC_GAP_3_2 is supported over BR/EDR, otherwise Excluded.
+C.3: Mandatory if (TSPC_GAP_3_1 or TSPC_GAP_3_2) is supported over BR/EDR,
+ otherwise Excluded.
+C.4: Mandatory if TSPC_GAP_3_3 is supported over BR/EDR, otherwise Excluded.
+C.5: Mandatory if (TSPC_GAP_4_1 or TSPC_GAP_4_2) is supported over BR/EDR,
+ otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Central BR/EDR/LE Security Aspects
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_41_1 True (#) Central BR/EDR/LE: Security Aspects (M)
+-------------------------------------------------------------------------------
+
+
+ Peripheral BR/EDR/LE Modes
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_42_1 False Peripheral BR/EDR/LE: Non-Discoverable Mode
+ (C.1)
+TSPC_GAP_42_2 False Peripheral BR/EDR/LE: Discoverable Mode
+ (C.2)
+TSPC_GAP_42_3 False Peripheral BR/EDR/LE: Non-Connectable Mode
+ (C.3)
+TSPC_GAP_42_4 False (*) Peripheral BR/EDR/LE: Connectable Mode (M)
+TSPC_GAP_42_5 False Peripheral BR/EDR/LE: Non-Bondable Mode (C.4)
+TSPC_GAP_42_6 False Peripheral BR/EDR/LE: Bondable Mode (C.5)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_GAP_1_1 is supported over BR/EDR, otherwise Excluded.
+C.2: Mandatory if (TSPC_GAP_1_2 or TSPC_GAP_1_3) is supported over BR/EDR,
+ otherwise Excluded.
+C.3: Mandatory if TSPC_GAP_1_4 is supported over BR/EDR, otherwise Excluded.
+C.4: Mandatory if TSPC_GAP_1_6 is supported over BR/EDR, otherwise Excluded.
+C.5: Mandatory if TSPC_GAP_1_7 is supported over BR/EDR, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+ Peripheral BR/EDR/LE Security Aspects
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_GAP_43_1 False (*) Peripheral BR/EDR/LE: Security Aspects (M)
+-------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+Parameter Name Selected Description
+-------------------------------------------------------------------------------
+TSPC_SM_1_1 False Master Role (Initiator)
+TSPC_SM_1_2 False Slave Role (Responder)
+TSPC_SM_2_4 False OOB supported (O)
+TSPC_ALL False Turns on all
+-------------------------------------------------------------------------------
--
1.8.4.1
^ permalink raw reply related
* [PATCHv3 0/2] PICS for GAP and HID
From: Jakub Tyszkowski @ 2013-11-19 14:36 UTC (permalink / raw)
To: linux-bluetooth
Please note that some PICS marked as mandatory for LE were not
selected because of Android 4.4 not supporting some LE Roles.
v3: layout changed, added: mandatory/optional/conditional
markings and descriptions, # - not implemented mark
v2: layout changed, each parameter description added
v1: initial documents with PICS targeting Android 4.4
Jakub Tyszkowski (2):
android: Add PTS PICS for GAP
android: Add PTS PICS for HID
android/pics-gap.txt | 708 +++++++++++++++++++++++++++++++++++++++++++++++++++
android/pics-hid.txt | 285 +++++++++++++++++++++
2 files changed, 993 insertions(+)
create mode 100644 android/pics-gap.txt
create mode 100644 android/pics-hid.txt
--
1.8.4.1
^ permalink raw reply
* [PATCH v3 6/6] android/hal: Check if command socket was shutdown by peer
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
This will allow to print proper error before exiting.
---
android/hal-ipc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 5d622e1..b19704a 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -356,6 +356,12 @@ int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,
exit(EXIT_FAILURE);
}
+ /* socket was shutdown */
+ if (ret == 0) {
+ error("Command socket closed, aborting");
+ exit(EXIT_FAILURE);
+ }
+
memset(&msg, 0, sizeof(msg));
memset(&cmd, 0, sizeof(cmd));
--
1.8.4.3
^ permalink raw reply related
* [PATCH v3 5/6] android/hal-a2dp: Use generic IPC message handling for events
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
Register handlers on service init and unregister on cleanup.
---
android/hal-a2dp.c | 41 +++++++++++++++++++++--------------------
android/hal.h | 1 -
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/android/hal-a2dp.c b/android/hal-a2dp.c
index e9fadb7..7d91151 100644
--- a/android/hal-a2dp.c
+++ b/android/hal-a2dp.c
@@ -31,7 +31,7 @@ static bool interface_ready(void)
return cbs != NULL;
}
-static void handle_conn_state(void *buf)
+static void handle_conn_state(void *buf, uint16_t len)
{
struct hal_ev_a2dp_conn_state *ev = buf;
@@ -40,7 +40,7 @@ static void handle_conn_state(void *buf)
(bt_bdaddr_t *) (ev->bdaddr));
}
-static void handle_audio_state(void *buf)
+static void handle_audio_state(void *buf, uint16_t len)
{
struct hal_ev_a2dp_audio_state *ev = buf;
@@ -48,24 +48,20 @@ static void handle_audio_state(void *buf)
cbs->audio_state_cb(ev->state, (bt_bdaddr_t *)(ev->bdaddr));
}
-/* will be called from notification thread context */
-void bt_notify_a2dp(uint8_t opcode, void *buf, uint16_t len)
-{
- if (!interface_ready())
- return;
-
- switch (opcode) {
- case HAL_EV_A2DP_CONN_STATE:
- handle_conn_state(buf);
- break;
- case HAL_EV_A2DP_AUDIO_STATE:
- handle_audio_state(buf);
- break;
- default:
- DBG("Unhandled callback opcode=0x%x", opcode);
- break;
- }
-}
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+ { /* HAL_EV_A2DP_CONN_STATE */
+ .handler = handle_conn_state,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_pan_conn_state),
+ },
+ { /* HAL_EV_A2DP_AUDIO_STATE */
+ .handler = handle_audio_state,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_pan_ctrl_state),
+ },
+};
static bt_status_t a2dp_connect(bt_bdaddr_t *bd_addr)
{
@@ -105,6 +101,9 @@ static bt_status_t init(btav_callbacks_t *callbacks)
cbs = callbacks;
+ hal_ipc_register(HAL_SERVICE_ID_A2DP, ev_handlers,
+ sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
cmd.service_id = HAL_SERVICE_ID_A2DP;
return hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
@@ -126,6 +125,8 @@ static void cleanup()
hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
sizeof(cmd), &cmd, 0, NULL, NULL);
+
+ hal_ipc_unregister(HAL_SERVICE_ID_A2DP);
}
static btav_interface_t iface = {
diff --git a/android/hal.h b/android/hal.h
index 6bd4c5a..b475411 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -28,4 +28,3 @@ btav_interface_t *bt_get_a2dp_interface(void);
void bt_thread_associate(void);
void bt_thread_disassociate(void);
-void bt_notify_a2dp(uint8_t opcode, void *buf, uint16_t len);
--
1.8.4.3
^ permalink raw reply related
* [PATCH v3 4/6] android/hal-pan: Use generic IPC message handling for events
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
Register handlers on service init and unregister on cleanup.
---
android/hal-pan.c | 40 +++++++++++++++++++++-------------------
android/hal.h | 1 -
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/android/hal-pan.c b/android/hal-pan.c
index 2bc560e..0ca9e12 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -31,7 +31,7 @@ static bool interface_ready(void)
return cbs != NULL;
}
-static void handle_conn_state(void *buf)
+static void handle_conn_state(void *buf, uint16_t len)
{
struct hal_ev_pan_conn_state *ev = buf;
@@ -41,7 +41,7 @@ static void handle_conn_state(void *buf)
ev->local_role, ev->remote_role);
}
-static void handle_ctrl_state(void *buf)
+static void handle_ctrl_state(void *buf, uint16_t len)
{
struct hal_ev_pan_ctrl_state *ev = buf;
@@ -50,23 +50,20 @@ static void handle_ctrl_state(void *buf)
ev->local_role, (char *)ev->name);
}
-void bt_notify_pan(uint8_t opcode, void *buf, uint16_t len)
-{
- if (!interface_ready())
- return;
-
- switch (opcode) {
- case HAL_EV_PAN_CONN_STATE:
- handle_conn_state(buf);
- break;
- case HAL_EV_PAN_CTRL_STATE:
- handle_ctrl_state(buf);
- break;
- default:
- DBG("Unhandled callback opcode=0x%x", opcode);
- break;
- }
-}
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+ { /* HAL_EV_PAN_CTRL_STATE */
+ .handler = handle_conn_state,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_pan_conn_state),
+ },
+ { /* HAL_EV_PAN_CONN_STATE */
+ .handler = handle_ctrl_state,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_pan_ctrl_state),
+ },
+};
static bt_status_t pan_enable(int local_role)
{
@@ -143,6 +140,9 @@ static bt_status_t pan_init(const btpan_callbacks_t *callbacks)
cbs = callbacks;
+ hal_ipc_register(HAL_SERVICE_ID_PAN, ev_handlers,
+ sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
cmd.service_id = HAL_SERVICE_ID_PAN;
return hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
@@ -164,6 +164,8 @@ static void pan_cleanup()
hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
sizeof(cmd), &cmd, 0, NULL, NULL);
+
+ hal_ipc_unregister(HAL_SERVICE_ID_PAN);
}
static btpan_interface_t pan_if = {
diff --git a/android/hal.h b/android/hal.h
index 58426a9..6bd4c5a 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -29,4 +29,3 @@ btav_interface_t *bt_get_a2dp_interface(void);
void bt_thread_associate(void);
void bt_thread_disassociate(void);
void bt_notify_a2dp(uint8_t opcode, void *buf, uint16_t len);
-void bt_notify_pan(uint8_t opcode, void *buf, uint16_t len);
--
1.8.4.3
^ permalink raw reply related
* [PATCH v3 3/6] android/hal-hidhost: Use generic IPC message handling for events
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
Register handlers on service init and unregister on cleanup.
---
android/hal-hidhost.c | 76 +++++++++++++++++++++++++++++----------------------
android/hal.h | 1 -
2 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 2ce17a3..0573006 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -32,7 +32,7 @@ static bool interface_ready(void)
return cbacks != NULL;
}
-static void handle_conn_state(void *buf)
+static void handle_conn_state(void *buf, uint16_t len)
{
struct hal_ev_hidhost_conn_state *ev = buf;
@@ -41,7 +41,7 @@ static void handle_conn_state(void *buf)
ev->state);
}
-static void handle_info(void *buf)
+static void handle_info(void *buf, uint16_t len)
{
struct hal_ev_hidhost_info *ev = buf;
bthh_hid_info_t info;
@@ -60,7 +60,7 @@ static void handle_info(void *buf)
cbacks->hid_info_cb((bt_bdaddr_t *) ev->bdaddr, info);
}
-static void handle_proto_mode(void *buf)
+static void handle_proto_mode(void *buf, uint16_t len)
{
struct hal_ev_hidhost_proto_mode *ev = buf;
@@ -69,16 +69,21 @@ static void handle_proto_mode(void *buf)
ev->status, ev->mode);
}
-static void handle_get_report(void *buf)
+static void handle_get_report(void *buf, uint16_t len)
{
struct hal_ev_hidhost_get_report *ev = buf;
+ if (len != sizeof(*ev) + ev->len) {
+ error("invalid get report event, aborting");
+ exit(EXIT_FAILURE);
+ }
+
if (cbacks->get_report_cb)
cbacks->get_report_cb((bt_bdaddr_t *) ev->bdaddr, ev->status,
ev->data, ev->len);
}
-static void handle_virtual_unplug(void *buf)
+static void handle_virtual_unplug(void *buf, uint16_t len)
{
struct hal_ev_hidhost_virtual_unplug *ev = buf;
@@ -87,33 +92,35 @@ static void handle_virtual_unplug(void *buf)
ev->status);
}
-/* will be called from notification thread context */
-void bt_notify_hidhost(uint8_t opcode, void *buf, uint16_t len)
-{
- if (!interface_ready())
- return;
-
- switch (opcode) {
- case HAL_EV_HIDHOST_CONN_STATE:
- handle_conn_state(buf);
- break;
- case HAL_EV_HIDHOST_INFO:
- handle_info(buf);
- break;
- case HAL_EV_HIDHOST_PROTO_MODE:
- handle_proto_mode(buf);
- break;
- case HAL_EV_HIDHOST_GET_REPORT:
- handle_get_report(buf);
- break;
- case HAL_EV_HIDHOST_VIRTUAL_UNPLUG:
- handle_virtual_unplug(buf);
- break;
- default:
- DBG("Unhandled callback opcode=0x%x", opcode);
- break;
- }
-}
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+ { /* HAL_EV_HIDHOST_CONN_STATE */
+ .handler = handle_conn_state,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_hidhost_conn_state)
+ },
+ { /* HAL_EV_HIDHOST_INFO */
+ .handler = handle_info,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_hidhost_info),
+ },
+ { /* HAL_EV_HIDHOST_PROTO_MODE */
+ .handler = handle_proto_mode,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_hidhost_proto_mode),
+ },
+ { /* HAL_EV_HIDHOST_GET_REPORT */
+ .handler = handle_get_report,
+ .var_len = true,
+ .data_len = sizeof(struct hal_ev_hidhost_get_report),
+ },
+ { /* HAL_EV_HIDHOST_VIRTUAL_UNPLUG */
+ .handler = handle_virtual_unplug,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_hidhost_virtual_unplug),
+ },
+};
static bt_status_t hidhost_connect(bt_bdaddr_t *bd_addr)
{
@@ -362,6 +369,9 @@ static bt_status_t init(bthh_callbacks_t *callbacks)
/* store reference to user callbacks */
cbacks = callbacks;
+ hal_ipc_register(HAL_SERVICE_ID_HIDHOST, ev_handlers,
+ sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
cmd.service_id = HAL_SERVICE_ID_HIDHOST;
return hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
@@ -383,6 +393,8 @@ static void cleanup(void)
hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
sizeof(cmd), &cmd, 0, NULL, NULL);
+
+ hal_ipc_unregister(HAL_SERVICE_ID_HIDHOST);
}
static bthh_interface_t hidhost_if = {
diff --git a/android/hal.h b/android/hal.h
index 67dad5d..58426a9 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -28,6 +28,5 @@ btav_interface_t *bt_get_a2dp_interface(void);
void bt_thread_associate(void);
void bt_thread_disassociate(void);
-void bt_notify_hidhost(uint8_t opcode, void *buf, uint16_t len);
void bt_notify_a2dp(uint8_t opcode, void *buf, uint16_t len);
void bt_notify_pan(uint8_t opcode, void *buf, uint16_t len);
--
1.8.4.3
^ permalink raw reply related
* [PATCH v3 2/6] android/hal-bluetooth: Register IPC message handlers
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
Register handlers on service init. Since this requires all handlers to
be registered (unknown opcode is considered IPC error) missing handlers
stubs are provided.
---
android/hal-bluetooth.c | 208 ++++++++++++++++++++++++++++++------------------
android/hal.h | 1 -
2 files changed, 129 insertions(+), 80 deletions(-)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 078d537..69c304a 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -35,7 +35,7 @@ static const bt_callbacks_t *bt_hal_cbacks = NULL;
*pe = *((uint8_t *) (hal_prop->val)); \
} while (0)
-static void handle_adapter_state_changed(void *buf)
+static void handle_adapter_state_changed(void *buf, uint16_t len)
{
struct hal_ev_adapter_state_changed *ev = buf;
@@ -45,38 +45,35 @@ static void handle_adapter_state_changed(void *buf)
bt_hal_cbacks->adapter_state_changed_cb(ev->state);
}
-static void adapter_props_to_hal(bt_property_t *send_props,
- struct hal_property *hal_prop,
- uint8_t num_props, void *buff_end)
+static void adapter_props_to_hal(bt_property_t *send_props, void *buf,
+ uint8_t num_props)
{
- void *p = hal_prop;
+ struct hal_property *prop = buf;
uint8_t i;
for (i = 0; i < num_props; i++) {
- if (p + sizeof(*hal_prop) + hal_prop->len > buff_end) {
- error("invalid adapter properties event, aborting");
- exit(EXIT_FAILURE);
- }
-
- send_props[i].type = hal_prop->type;
+ send_props[i].type = prop->type;
- switch (hal_prop->type) {
+ switch (prop->type) {
case HAL_PROP_ADAPTER_TYPE:
- create_enum_prop(send_props[i], hal_prop,
+ create_enum_prop(send_props[i], prop,
bt_device_type_t);
break;
case HAL_PROP_ADAPTER_SCAN_MODE:
- create_enum_prop(send_props[i], hal_prop,
+ create_enum_prop(send_props[i], prop,
bt_scan_mode_t);
break;
case HAL_PROP_ADAPTER_SERVICE_REC:
default:
- send_props[i].len = hal_prop->len;
- send_props[i].val = hal_prop->val;
+ send_props[i].len = prop->len;
+ send_props[i].val = prop->val;
break;
}
DBG("prop[%d]: %s", i, btproperty2str(&send_props[i]));
+
+ buf += sizeof(*prop) + prop->len;
+ prop = buf;
}
}
@@ -96,36 +93,30 @@ static void adapter_hal_props_cleanup(bt_property_t *props, uint8_t num)
}
}
-static void device_props_to_hal(bt_property_t *send_props,
- struct hal_property *hal_prop,
- uint8_t num_props, void *buff_end)
+static void device_props_to_hal(bt_property_t *send_props, void *buf,
+ uint8_t num_props)
{
- void *p = hal_prop;
+ struct hal_property *prop = buf;
uint8_t i;
for (i = 0; i < num_props; i++) {
- if (p + sizeof(*hal_prop) + hal_prop->len > buff_end) {
- error("invalid adapter properties event, aborting");
- exit(EXIT_FAILURE);
- }
+ send_props[i].type = prop->type;
- send_props[i].type = hal_prop->type;
-
- switch (hal_prop->type) {
+ switch (prop->type) {
case HAL_PROP_DEVICE_TYPE:
- create_enum_prop(send_props[i], hal_prop,
+ create_enum_prop(send_props[i], prop,
bt_device_type_t);
break;
case HAL_PROP_DEVICE_SERVICE_REC:
case HAL_PROP_DEVICE_VERSION_INFO:
default:
- send_props[i].len = hal_prop->len;
- send_props[i].val = hal_prop->val;
+ send_props[i].len = prop->len;
+ send_props[i].val = prop->val;
break;
}
- p += sizeof(*hal_prop) + hal_prop->len;
- hal_prop = p;
+ buf += sizeof(*prop) + prop->len;
+ prop = buf;
DBG("prop[%d]: %s", i, btproperty2str(&send_props[i]));
}
@@ -147,6 +138,28 @@ static void device_hal_props_cleanup(bt_property_t *props, uint8_t num)
}
}
+static void check_props(int num, const struct hal_property *prop, uint16_t len)
+{
+ int i;
+
+ for (i = 0; i < num; i++) {
+ if (sizeof(*prop) + prop->len > len) {
+ error("invalid properties (%zu > %u), aborting",
+ sizeof(*prop) + prop->len, len);
+ exit(EXIT_FAILURE);
+ }
+
+ len -= sizeof(*prop) + prop->len;
+ prop = ((void *) prop) + sizeof(*prop) + prop->len;
+ }
+
+ if (!len)
+ return;
+
+ error("invalid properties length (%u bytes left), aborting", len);
+ exit(EXIT_FAILURE);
+}
+
static void handle_adapter_props_changed(void *buf, uint16_t len)
{
struct hal_ev_adapter_props_changed *ev = buf;
@@ -154,17 +167,19 @@ static void handle_adapter_props_changed(void *buf, uint16_t len)
DBG("");
+ check_props(ev->num_props, ev->props, len - sizeof(*ev));
+
if (!bt_hal_cbacks->adapter_properties_cb)
return;
- adapter_props_to_hal(props, ev->props, ev->num_props, buf + len);
+ adapter_props_to_hal(props, ev->props, ev->num_props);
bt_hal_cbacks->adapter_properties_cb(ev->status, ev->num_props, props);
adapter_hal_props_cleanup(props, ev->num_props);
}
-static void handle_bond_state_change(void *buf)
+static void handle_bond_state_change(void *buf, uint16_t len)
{
struct hal_ev_bond_state_changed *ev = buf;
bt_bdaddr_t *addr = (bt_bdaddr_t *) ev->bdaddr;
@@ -176,7 +191,7 @@ static void handle_bond_state_change(void *buf)
ev->state);
}
-static void handle_pin_request(void *buf)
+static void handle_pin_request(void *buf, uint16_t len)
{
struct hal_ev_pin_request *ev = buf;
/* Those are declared as packed, so it's safe to assign pointers */
@@ -189,7 +204,7 @@ static void handle_pin_request(void *buf)
bt_hal_cbacks->pin_request_cb(addr, name, ev->class_of_dev);
}
-static void handle_ssp_request(void *buf)
+static void handle_ssp_request(void *buf, uint16_t len)
{
struct hal_ev_ssp_request *ev = buf;
/* Those are declared as packed, so it's safe to assign pointers */
@@ -221,7 +236,7 @@ static bool interface_ready(void)
return bt_hal_cbacks != NULL;
}
-static void handle_discovery_state_changed(void *buf)
+static void handle_discovery_state_changed(void *buf, uint16_t len)
{
struct hal_ev_discovery_state_changed *ev = buf;
@@ -238,10 +253,12 @@ static void handle_device_found(void *buf, uint16_t len)
DBG("");
+ check_props(ev->num_props, ev->props, len - sizeof(*ev));
+
if (!bt_hal_cbacks->device_found_cb)
return;
- device_props_to_hal(props, ev->props, ev->num_props, buf + len);
+ device_props_to_hal(props, ev->props, ev->num_props);
bt_hal_cbacks->device_found_cb(ev->num_props, props);
@@ -255,10 +272,12 @@ static void handle_device_state_changed(void *buf, uint16_t len)
DBG("");
+ check_props(ev->num_props, ev->props, len - sizeof(*ev));
+
if (!bt_hal_cbacks->remote_device_properties_cb)
return;
- device_props_to_hal(props, ev->props, ev->num_props, buf + len);
+ device_props_to_hal(props, ev->props, ev->num_props);
bt_hal_cbacks->remote_device_properties_cb(ev->status,
(bt_bdaddr_t *)ev->bdaddr,
@@ -267,7 +286,7 @@ static void handle_device_state_changed(void *buf, uint16_t len)
device_hal_props_cleanup(props, ev->num_props);
}
-static void handle_acl_state_changed(void *buf)
+static void handle_acl_state_changed(void *buf, uint16_t len)
{
struct hal_ev_acl_state_changed *ev = buf;
bt_bdaddr_t *addr = (bt_bdaddr_t *) ev->bdaddr;
@@ -279,47 +298,70 @@ static void handle_acl_state_changed(void *buf)
ev->state);
}
-/* will be called from notification thread context */
-void bt_notify_adapter(uint8_t opcode, void *buf, uint16_t len)
+static void handle_dut_mode_receive(void *buf, uint16_t len)
{
- if (!interface_ready())
- return;
-
- DBG("opcode 0x%x", opcode);
+ DBG("");
- switch (opcode) {
- case HAL_EV_ADAPTER_STATE_CHANGED:
- handle_adapter_state_changed(buf);
- break;
- case HAL_EV_ADAPTER_PROPS_CHANGED:
- handle_adapter_props_changed(buf, len);
- break;
- case HAL_EV_DISCOVERY_STATE_CHANGED:
- handle_discovery_state_changed(buf);
- break;
- case HAL_EV_DEVICE_FOUND:
- handle_device_found(buf, len);
- break;
- case HAL_EV_REMOTE_DEVICE_PROPS:
- handle_device_state_changed(buf, len);
- break;
- case HAL_EV_BOND_STATE_CHANGED:
- handle_bond_state_change(buf);
- break;
- case HAL_EV_PIN_REQUEST:
- handle_pin_request(buf);
- break;
- case HAL_EV_SSP_REQUEST:
- handle_ssp_request(buf);
- break;
- case HAL_EV_ACL_STATE_CHANGED:
- handle_acl_state_changed(buf);
- break;
- default:
- DBG("Unhandled callback opcode=0x%x", opcode);
- break;
- }
-}
+ /* TODO */
+}
+
+/* handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */
+static const struct hal_ipc_handler ev_handlers[] = {
+ { /* HAL_EV_ADAPTER_STATE_CHANGED */
+ .handler = handle_adapter_state_changed,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_adapter_state_changed)
+ },
+ { /* HAL_EV_ADAPTER_PROPS_CHANGED */
+ .handler = handle_adapter_props_changed,
+ .var_len = true,
+ .data_len = sizeof(struct hal_ev_adapter_props_changed) +
+ sizeof(struct hal_property),
+ },
+ { /* HAL_EV_REMOTE_DEVICE_PROPS */
+ .handler = handle_device_state_changed,
+ .var_len = true,
+ .data_len = sizeof(struct hal_ev_remote_device_props) +
+ sizeof(struct hal_property),
+ },
+ { /* HAL_EV_DEVICE_FOUND */
+ .handler = handle_device_found,
+ .var_len = true,
+ .data_len = sizeof(struct hal_ev_device_found) +
+ sizeof(struct hal_property),
+ },
+ { /* HAL_EV_DISCOVERY_STATE_CHANGED */
+ .handler = handle_discovery_state_changed,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_discovery_state_changed),
+ },
+ { /* HAL_EV_PIN_REQUEST */
+ .handler = handle_pin_request,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_pin_request),
+ },
+ { /* HAL_EV_SSP_REQUEST */
+ .handler = handle_ssp_request,
+ .var_len = false,
+ .data_len = sizeof(handle_ssp_request),
+ },
+ { /* HAL_EV_BOND_STATE_CHANGED */
+ .handler = handle_bond_state_change,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_bond_state_changed),
+ },
+ { /* HAL_EV_ACL_STATE_CHANGED */
+ .handler = handle_acl_state_changed,
+ .var_len = false,
+ .data_len = sizeof(struct hal_ev_acl_state_changed),
+ },
+ { /* HAL_EV_DUT_MODE_RECEIVE */
+ .handler = handle_dut_mode_receive,
+ .var_len = true,
+ .data_len = sizeof(struct hal_ev_dut_mode_receive),
+ },
+};
static int init(bt_callbacks_t *callbacks)
{
@@ -333,6 +375,9 @@ static int init(bt_callbacks_t *callbacks)
bt_hal_cbacks = callbacks;
+ hal_ipc_register(HAL_SERVICE_ID_BLUETOOTH, ev_handlers,
+ sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
if (!hal_ipc_init()) {
bt_hal_cbacks = NULL;
return BT_STATUS_FAIL;
@@ -361,6 +406,9 @@ static int init(bt_callbacks_t *callbacks)
fail:
hal_ipc_cleanup();
bt_hal_cbacks = NULL;
+
+ hal_ipc_unregister(HAL_SERVICE_ID_BLUETOOTH);
+
return status;
}
@@ -396,6 +444,8 @@ static void cleanup(void)
hal_ipc_cleanup();
bt_hal_cbacks = NULL;
+
+ hal_ipc_unregister(HAL_SERVICE_ID_BLUETOOTH);
}
static int get_adapter_properties(void)
diff --git a/android/hal.h b/android/hal.h
index 72090fe..67dad5d 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -26,7 +26,6 @@ bthh_interface_t *bt_get_hidhost_interface(void);
btpan_interface_t *bt_get_pan_interface(void);
btav_interface_t *bt_get_a2dp_interface(void);
-void bt_notify_adapter(uint8_t opcode, void *buf, uint16_t len);
void bt_thread_associate(void);
void bt_thread_disassociate(void);
void bt_notify_hidhost(uint8_t opcode, void *buf, uint16_t len);
--
1.8.4.3
^ permalink raw reply related
* [PATCH v3 1/6] android/hal: Add initial code for IPC message handlers
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1384869762-3097-1-git-send-email-szymon.janc@tieto.com>
This will allow to register and unregister handlers for IPC messages
Basic sanity check will be done in common code. Commands with variable
length will be verified against minimum size only.
---
android/hal-ipc.c | 117 ++++++++++++++++++++++++++++++++++++------------------
android/hal-ipc.h | 10 +++++
2 files changed, 89 insertions(+), 38 deletions(-)
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 5155e04..5d622e1 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -43,26 +43,86 @@ static pthread_mutex_t cmd_sk_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_t notif_th = 0;
-static void notification_dispatch(struct hal_hdr *msg, int fd)
+struct service_handler {
+ const struct hal_ipc_handler *handler;
+ uint8_t size;
+};
+
+static struct service_handler services[HAL_SERVICE_ID_MAX + 1];
+
+void hal_ipc_register(uint8_t service, const struct hal_ipc_handler *handlers,
+ uint8_t size)
+{
+ services[service].handler = handlers;
+ services[service].size = size;
+}
+
+void hal_ipc_unregister(uint8_t service)
{
- switch (msg->service_id) {
- case HAL_SERVICE_ID_BLUETOOTH:
- bt_notify_adapter(msg->opcode, msg->payload, msg->len);
- break;
- case HAL_SERVICE_ID_HIDHOST:
- bt_notify_hidhost(msg->opcode, msg->payload, msg->len);
- break;
- case HAL_SERVICE_ID_A2DP:
- bt_notify_a2dp(msg->opcode, msg->payload, msg->len);
- break;
- case HAL_SERVICE_ID_PAN:
- bt_notify_pan(msg->opcode, msg->payload, msg->len);
- break;
- default:
- DBG("Unhandled notification service=%d opcode=0x%x",
+ services[service].handler = NULL;
+ services[service].size = 0;
+}
+
+static void handle_msg(void *buf, ssize_t len)
+{
+ struct hal_hdr *msg = buf;
+ const struct hal_ipc_handler *handler;
+ uint8_t opcode;
+
+ if (len < (ssize_t) sizeof(*msg)) {
+ error("IPC: message too small (%zd bytes), aborting", len);
+ exit(EXIT_FAILURE);
+ }
+
+ if (len != (ssize_t) (sizeof(*msg) + msg->len)) {
+ error("IPC: message malformed (%zd bytes), aborting", len);
+ exit(EXIT_FAILURE);
+ }
+
+ /* if service is valid */
+ if (msg->service_id > HAL_SERVICE_ID_MAX) {
+ error("IPC: unknown service (0x%x), aborting",
+ msg->service_id);
+ exit(EXIT_FAILURE);
+ }
+
+ /* if service is registered */
+ if (!services[msg->service_id].handler) {
+ error("IPC: unregistered service (0x%x), aborting",
+ msg->service_id);
+ exit(EXIT_FAILURE);
+ }
+
+ /* if opcode fit valid range */
+ if (msg->opcode < HAL_MINIMUM_EVENT) {
+ error("IPC: invalid opcode for service 0x%x (0x%x), aborting",
msg->service_id, msg->opcode);
- break;
+ exit(EXIT_FAILURE);
+ }
+
+ /* opcode is used as table offset and must be adjusted as events start
+ * with HAL_MINIMUM_EVENT offset */
+ opcode = msg->opcode - HAL_MINIMUM_EVENT;
+
+ /* if opcode is valid */
+ if (opcode >= services[msg->service_id].size) {
+ error("IPC: invalid opcode for service 0x%x (0x%x), aborting",
+ msg->service_id, msg->opcode);
+ exit(EXIT_FAILURE);
+ }
+
+ handler = &services[msg->service_id].handler[opcode];
+
+ /* if payload size is valid */
+ if ((handler->var_len && handler->data_len > msg->len) ||
+ (!handler->var_len && handler->data_len != msg->len)) {
+ error("IPC: message size invalid for service 0x%x opcode 0x%x "
+ "(%u bytes), aborting",
+ msg->service_id, msg->opcode, msg->len);
+ exit(EXIT_FAILURE);
}
+
+ handler->handler(msg->payload, msg->len);
}
static void *notification_handler(void *data)
@@ -72,7 +132,6 @@ static void *notification_handler(void *data)
struct cmsghdr *cmsg;
char cmsgbuf[CMSG_SPACE(sizeof(int))];
char buf[BLUEZ_HAL_MTU];
- struct hal_hdr *ev = (void *) buf;
ssize_t ret;
int fd;
@@ -83,7 +142,7 @@ static void *notification_handler(void *data)
memset(buf, 0, sizeof(buf));
memset(cmsgbuf, 0, sizeof(cmsgbuf));
- iv.iov_base = ev;
+ iv.iov_base = buf;
iv.iov_len = sizeof(buf);
msg.msg_iov = &iv;
@@ -108,24 +167,6 @@ static void *notification_handler(void *data)
exit(EXIT_FAILURE);
}
- if (ret < (ssize_t) sizeof(*ev)) {
- error("Too small notification (%zd bytes), aborting",
- ret);
- exit(EXIT_FAILURE);
- }
-
- if (ev->opcode < HAL_MINIMUM_EVENT) {
- error("Invalid notification (0x%x), aborting",
- ev->opcode);
- exit(EXIT_FAILURE);
- }
-
- if (ret != (ssize_t) (sizeof(*ev) + ev->len)) {
- error("Malformed notification(%zd bytes), aborting",
- ret);
- exit(EXIT_FAILURE);
- }
-
fd = -1;
/* Receive auxiliary data in msg */
@@ -138,7 +179,7 @@ static void *notification_handler(void *data)
}
}
- notification_dispatch(ev, fd);
+ handle_msg(buf, ret);
}
close(notif_sk);
diff --git a/android/hal-ipc.h b/android/hal-ipc.h
index ea53e1c..2fbf30f 100644
--- a/android/hal-ipc.h
+++ b/android/hal-ipc.h
@@ -15,8 +15,18 @@
*
*/
+struct hal_ipc_handler {
+ void (*handler) (void *buf, uint16_t len);
+ bool var_len;
+ size_t data_len;
+};
+
bool hal_ipc_init(void);
void hal_ipc_cleanup(void);
int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,
size_t *rsp_len, void *rsp, int *fd);
+
+void hal_ipc_register(uint8_t service, const struct hal_ipc_handler *handlers,
+ uint8_t size);
+void hal_ipc_unregister(uint8_t service);
--
1.8.4.3
^ permalink raw reply related
* [PATCH v3 0/6] android: IPC improvements
From: Szymon Janc @ 2013-11-19 14:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
v3:
- fixed compilation on android 4.2
Szymon Janc (6):
android/hal: Add initial code for IPC message handlers
android/hal-bluetooth: Register IPC message handlers
android/hal-hidhost: Use generic IPC message handling for events
android/hal-pan: Use generic IPC message handling for events
android/hal-a2dp: Use generic IPC message handling for events
android/hal: Check if command socket was shutdown by peer
android/hal-a2dp.c | 41 +++++-----
android/hal-bluetooth.c | 208 ++++++++++++++++++++++++++++++------------------
android/hal-hidhost.c | 76 ++++++++++--------
android/hal-ipc.c | 123 +++++++++++++++++++---------
android/hal-ipc.h | 10 +++
android/hal-pan.c | 40 +++++-----
android/hal.h | 4 -
7 files changed, 310 insertions(+), 192 deletions(-)
--
1.8.4.3
^ permalink raw reply
* Re: [PATCH 5/5] android/hidhost: Free all connected devices in profile cleanup call
From: Ravi Kumar Veeramally @ 2013-11-19 13:55 UTC (permalink / raw)
To: linux-bluetooth, Johan Hedberg
In-Reply-To: <20131119133506.GE30863@x220.p-661hnu-f1>
Hi Johan,
On 11/19/2013 03:35 PM, Johan Hedberg wrote:
> Hi Ravi,
>
> On Tue, Nov 19, 2013, Ravi kumar Veeramally wrote:
>> ---
>> android/hidhost.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/android/hidhost.c b/android/hidhost.c
>> index 05a3fe4..20dedc4 100644
>> --- a/android/hidhost.c
>> +++ b/android/hidhost.c
>> @@ -1226,6 +1226,14 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
>> return true;
>> }
>>
>> +static void free_hid_devices(gpointer data, gpointer user_data)
>> +{
>> + struct hid_device *dev = data;
>> +
>> + bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED);
>> + hid_device_free(dev);
>> +}
>> +
>> void bt_hid_unregister(void)
>> {
>> DBG("");
>> @@ -1233,6 +1241,8 @@ void bt_hid_unregister(void)
>> if (notification_sk < 0)
>> return;
>>
>> + g_slist_foreach(devices, free_hid_devices, NULL);
> I suppose you also need to set devices = NULL; after this call?
Sure.
Thanks,
Ravi.
^ permalink raw reply
* Re: [PATCH 4/5] android/hidhost: Handle error case properly in interrupt_connect_cb
From: Ravi Kumar Veeramally @ 2013-11-19 13:53 UTC (permalink / raw)
To: linux-bluetooth, Johan Hedberg
In-Reply-To: <20131119133130.GD30863@x220.p-661hnu-f1>
Hi Johan,
On 11/19/2013 03:31 PM, Johan Hedberg wrote:
> Hi Ravi,
>
> On Tue, Nov 19, 2013, Ravi kumar Veeramally wrote:
>> ---
>> android/hidhost.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
> Could you add a bit more descriptive commit message to this one which
> explains what was broken (and how) and how your patch fixes it. When I
> get a patch with an empty commit message I expect it to be very trivial
> and instantly understandable, but that's not the case here.
I will write more details.
Regards,
Ravi.
^ permalink raw reply
* Re: [PATCH 3/5] android: Handle multiple init(register) and cleanup(unregister) calls properly
From: Ravi Kumar Veeramally @ 2013-11-19 13:52 UTC (permalink / raw)
To: linux-bluetooth, Johan Hedberg
In-Reply-To: <20131119133000.GC30863@x220.p-661hnu-f1>
Hi,
On 11/19/2013 03:30 PM, Johan Hedberg wrote:
> Hi Ravi,
>
> On Tue, Nov 19, 2013, Ravi kumar Veeramally wrote:
>> @@ -2275,6 +2275,9 @@ bool bt_bluetooth_register(int sk)
>> {
>> DBG("");
>>
>> + if (notification_sk > 0)
> 0 is a valid file descriptor value so the check should be >= 0
>
>> @@ -1190,6 +1190,9 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
>>
>> DBG("");
>>
>> + if (notification_sk > 0)
>> + return false;
> Same here.
>
>> @@ -95,6 +95,9 @@ bool bt_pan_register(int sk, const bdaddr_t *addr)
>> {
>> DBG("");
>>
>> + if (notification_sk > 0)
>> + return false;
> And here.
>
> Johan
>
Ok.
Thanks,
Ravi.
^ permalink raw reply
* Re: [PATCH 2/5] android/hal-pan: Return error in case of unsupported PAN roles
From: Ravi Kumar Veeramally @ 2013-11-19 13:51 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <20131119132753.GB30863@x220.p-661hnu-f1>
On 11/19/2013 03:27 PM, Johan Hedberg wrote:
> Hi Ravi,
>
> On Tue, Nov 19, 2013, Ravi kumar Veeramally wrote:
>> ---
>> android/hal-pan.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/android/hal-pan.c b/android/hal-pan.c
>> index 2bc560e..30facd4 100644
>> --- a/android/hal-pan.c
>> +++ b/android/hal-pan.c
>> @@ -77,6 +77,9 @@ static bt_status_t pan_enable(int local_role)
>> if (!interface_ready())
>> return BT_STATUS_NOT_READY;
>>
>> + if (!(local_role == BTPAN_ROLE_PANU || local_role == BTPAN_ROLE_PANNAP))
>> + return BT_STATUS_UNSUPPORTED;
>> +
>> cmd.local_role = local_role;
>>
>> return hal_ipc_cmd(HAL_SERVICE_ID_PAN, HAL_OP_PAN_ENABLE,
>> @@ -112,6 +115,14 @@ static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,
>> if (!interface_ready())
>> return BT_STATUS_NOT_READY;
>>
>> + if (!((local_role == BTPAN_ROLE_PANNAP &&
>> + remote_role == BTPAN_ROLE_PANU) ||
>> + (local_role == BTPAN_ROLE_PANU &&
>> + remote_role == BTPAN_ROLE_PANNAP) ||
>> + (local_role == BTPAN_ROLE_PANU &&
>> + remote_role == BTPAN_ROLE_PANU)))
>> + return BT_STATUS_UNSUPPORTED;
> First of all you've got incorrect indentation here which make this hard
> to read (the return statement being on the same column as parts of the
> if-statement. When you break lines indent at least by two tabs to make
> a clear separation from the actual branch code.
Ok.
>
> Secondly, shouldn't we be checking that the given local role has been
> enabled (through pan_enable)? Or does the daemon do that checking? In
> fact is there a clear reason not to let the daemon do all the
> verification checks and return an error status over IPC?
I thought it would be easier to do basic checks on supported combinations
at HAL level to reduce the ipc traffic.
I don't know exactly whether UI can send these combinations, but we
can at least
try with haltest tool.
>
> Thirdly, this if-statement takes a while to parse, so I'm wondering
> whether it'd be clearer to format it in a bit more readable way, e.g.:
>
> switch (local_role) {
> case BTPAN_ROLE_PANNAP:
> if (remote_role != BTPAN_ROLE_PANU)
> return BT_STATUS_UNSUPPORTED;
> break;
> case BTPAN_ROLE_PANU:
> if (remote_role != BTPAN_ROLE_PANNAP &&
> remote_role != BTPAN_ROLE_PANU)
> return BT_STATUS_UNSUPPORTED;
> break;
> default:
> return BT_STATUS_UNSUPPORTED;
> }
>
> Thoughts?
Yes, make sense to use 'switch' for more readability.
Is it ok to send _v2 with switch or better to handle in daemon?
Thanks,
Ravi.
^ permalink raw reply
* Re: [PATCH] autopair: Add special handling for printers
From: Johan Hedberg @ 2013-11-19 13:36 UTC (permalink / raw)
To: Bastien Nocera; +Cc: linux-bluetooth
In-Reply-To: <1384866940.2027.24.camel@nuvo>
Hi Bastien,
On Tue, Nov 19, 2013, Bastien Nocera wrote:
>
> As was done in gnome-bluetooth since 2009:
> https://git.gnome.org/browse/gnome-bluetooth/commit/?id=7a472c151d44a3378ecbd3c2a75c763f5c577fe9
> ---
> plugins/autopair.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 5/5] android/hidhost: Free all connected devices in profile cleanup call
From: Johan Hedberg @ 2013-11-19 13:35 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <1384863676-12358-5-git-send-email-ravikumar.veeramally@linux.intel.com>
Hi Ravi,
On Tue, Nov 19, 2013, Ravi kumar Veeramally wrote:
> ---
> android/hidhost.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/android/hidhost.c b/android/hidhost.c
> index 05a3fe4..20dedc4 100644
> --- a/android/hidhost.c
> +++ b/android/hidhost.c
> @@ -1226,6 +1226,14 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
> return true;
> }
>
> +static void free_hid_devices(gpointer data, gpointer user_data)
> +{
> + struct hid_device *dev = data;
> +
> + bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED);
> + hid_device_free(dev);
> +}
> +
> void bt_hid_unregister(void)
> {
> DBG("");
> @@ -1233,6 +1241,8 @@ void bt_hid_unregister(void)
> if (notification_sk < 0)
> return;
>
> + g_slist_foreach(devices, free_hid_devices, NULL);
I suppose you also need to set devices = NULL; after this call?
Johan
^ permalink raw reply
* Re: [PATCH 4/5] android/hidhost: Handle error case properly in interrupt_connect_cb
From: Johan Hedberg @ 2013-11-19 13:31 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <1384863676-12358-4-git-send-email-ravikumar.veeramally@linux.intel.com>
Hi Ravi,
On Tue, Nov 19, 2013, Ravi kumar Veeramally wrote:
> ---
> android/hidhost.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
Could you add a bit more descriptive commit message to this one which
explains what was broken (and how) and how your patch fixes it. When I
get a patch with an empty commit message I expect it to be very trivial
and instantly understandable, but that's not the case here.
Johan
^ permalink raw reply
* [PATCHv5 19/19] android/socket: Add SPP SDP record
From: Andrei Emeltchenko @ 2013-11-19 13:30 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384867809-18135-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/socket.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 63 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index 0c71297..dc73dd1 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -225,9 +225,69 @@ static sdp_record_t *create_pbap_record(uint8_t chan)
sdp_list_free(proto[1], NULL);
sdp_list_free(apseq, NULL);
sdp_list_free(pfseq, NULL);
+ sdp_list_free(aproto, NULL);
sdp_list_free(root, NULL);
sdp_list_free(svclass_id, NULL);
+
+ return record;
+}
+
+static sdp_record_t *create_spp_record(uint8_t chan)
+{
+ sdp_list_t *svclass_id, *apseq, *profiles, *root;
+ uuid_t root_uuid, sp_uuid, rfcomm;
+ sdp_profile_desc_t profile;
+ sdp_list_t *aproto, *proto[1];
+ sdp_data_t *channel;
+ sdp_record_t *record;
+
+ record = sdp_record_alloc();
+ if (!record)
+ return NULL;
+
+ record->handle = sdp_next_handle();
+
+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ root = sdp_list_append(NULL, &root_uuid);
+ sdp_set_browse_groups(record, root);
+
+ sdp_uuid16_create(&sp_uuid, SERIAL_PORT_SVCLASS_ID);
+ svclass_id = sdp_list_append(NULL, &sp_uuid);
+ sdp_set_service_classes(record, svclass_id);
+
+ sdp_uuid16_create(&profile.uuid, SERIAL_PORT_PROFILE_ID);
+ profile.version = 0x0100;
+ profiles = sdp_list_append(NULL, &profile);
+ sdp_set_profile_descs(record, profiles);
+
+ sdp_uuid16_create(&rfcomm, RFCOMM_UUID);
+ proto[0] = sdp_list_append(NULL, &rfcomm);
+ channel = sdp_data_alloc(SDP_UINT8, &chan);
+ proto[0] = sdp_list_append(proto[0], channel);
+ apseq = sdp_list_append(NULL, proto[0]);
+
+ aproto = sdp_list_append(NULL, apseq);
+ sdp_set_access_protos(record, aproto);
+
+ sdp_add_lang_attr(record);
+
+ sdp_set_info_attr(record, "Serial Port", "BlueZ", "COM Port");
+
+ sdp_set_url_attr(record, "http://www.bluez.org/",
+ "http://www.bluez.org/", "http://www.bluez.org/");
+
+ sdp_set_service_id(record, sp_uuid);
+ sdp_set_service_ttl(record, 0xffff);
+ sdp_set_service_avail(record, 0xff);
+ sdp_set_record_state(record, 0x00001234);
+
+ sdp_data_free(channel);
+ sdp_list_free(proto[0], NULL);
+ sdp_list_free(apseq, NULL);
sdp_list_free(aproto, NULL);
+ sdp_list_free(root, NULL);
+ sdp_list_free(svclass_id, NULL);
+ sdp_list_free(profiles, NULL);
return record;
}
@@ -266,7 +326,9 @@ static struct profile_info {
0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
- .channel = SPP_DEFAULT_CHANNEL
+ .channel = SPP_DEFAULT_CHANNEL,
+ .svc_hint = 0,
+ .create_record = create_spp_record
},
};
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 18/19] android/socket: Add PBAP SDP record
From: Andrei Emeltchenko @ 2013-11-19 13:30 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384867809-18135-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This adds SDP service record like shown below:
Service Name: OBEX Phonebook Access Server
Service RecHandle: 0x10002
Service Class ID List:
"Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
"RFCOMM" (0x0003)
Channel: 15
"OBEX" (0x0008)
Profile Descriptor List:
"Phonebook Access" (0x1130)
Version: 0x0100
---
android/socket.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 64 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index 9358d4a..0c71297 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -171,6 +171,67 @@ static sdp_record_t *create_opp_record(uint8_t chan)
return record;
}
+static sdp_record_t *create_pbap_record(uint8_t chan)
+{
+ sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+ uuid_t root_uuid, pbap_uuid, rfcomm_uuid, obex_uuid;
+ sdp_profile_desc_t profile[1];
+ sdp_list_t *aproto, *proto[2];
+ sdp_data_t *channel;
+ uint8_t formats[] = { 0x01 };
+ uint8_t dtd = SDP_UINT8;
+ sdp_data_t *sflist;
+ sdp_record_t *record;
+
+ record = sdp_record_alloc();
+ if (!record)
+ return NULL;
+
+ record->handle = sdp_next_handle();
+
+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ root = sdp_list_append(NULL, &root_uuid);
+ sdp_set_browse_groups(record, root);
+
+ sdp_uuid16_create(&pbap_uuid, PBAP_PSE_SVCLASS_ID);
+ svclass_id = sdp_list_append(NULL, &pbap_uuid);
+ sdp_set_service_classes(record, svclass_id);
+
+ sdp_uuid16_create(&profile[0].uuid, PBAP_PROFILE_ID);
+ profile[0].version = 0x0100;
+ pfseq = sdp_list_append(NULL, profile);
+ sdp_set_profile_descs(record, pfseq);
+
+ sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
+ proto[0] = sdp_list_append(NULL, &rfcomm_uuid);
+ channel = sdp_data_alloc(SDP_UINT8, &chan);
+ proto[0] = sdp_list_append(proto[0], channel);
+ apseq = sdp_list_append(NULL, proto[0]);
+
+ sdp_uuid16_create(&obex_uuid, OBEX_UUID);
+ proto[1] = sdp_list_append(NULL, &obex_uuid);
+ apseq = sdp_list_append(apseq, proto[1]);
+
+ aproto = sdp_list_append(NULL, apseq);
+ sdp_set_access_protos(record, aproto);
+
+ sflist = sdp_data_alloc(dtd, formats);
+ sdp_attr_add(record, SDP_ATTR_SUPPORTED_REPOSITORIES, sflist);
+
+ sdp_set_info_attr(record, "OBEX Phonebook Access Server", NULL, NULL);
+
+ sdp_data_free(channel);
+ sdp_list_free(proto[0], NULL);
+ sdp_list_free(proto[1], NULL);
+ sdp_list_free(apseq, NULL);
+ sdp_list_free(pfseq, NULL);
+ sdp_list_free(root, NULL);
+ sdp_list_free(svclass_id, NULL);
+ sdp_list_free(aproto, NULL);
+
+ return record;
+}
+
static struct profile_info {
uint8_t uuid[16];
uint8_t channel;
@@ -183,7 +244,9 @@ static struct profile_info {
0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
- .channel = PBAP_DEFAULT_CHANNEL
+ .channel = PBAP_DEFAULT_CHANNEL,
+ .svc_hint = SVC_HINT_OBEX,
+ .create_record = create_pbap_record
}, {
.uuid = {
0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 17/19] android/socket: Add SPP uuid to profile table
From: Andrei Emeltchenko @ 2013-11-19 13:30 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1384867809-18135-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/socket.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index e3241c9..9358d4a 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -45,6 +45,7 @@
#include "utils.h"
#include "socket.h"
+#define SPP_DEFAULT_CHANNEL 3
#define OPP_DEFAULT_CHANNEL 9
#define PBAP_DEFAULT_CHANNEL 15
#define MAS_DEFAULT_CHANNEL 16
@@ -197,7 +198,13 @@ static struct profile_info {
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
},
.channel = MAS_DEFAULT_CHANNEL
- }
+ }, {
+ .uuid = {
+ 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+ },
+ .channel = SPP_DEFAULT_CHANNEL
+ },
};
static uint32_t sdp_service_register(struct profile_info *profile)
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox