diff mbox series

[BlueZ] gap: Enable the external flag

Message ID 20200821070409.18037-1-sonnysasaka@chromium.org (mailing list archive)
State Changes Requested
Headers show
Series [BlueZ] gap: Enable the external flag | expand

Commit Message

Sonny Sasaka Aug. 21, 2020, 7:04 a.m. UTC
From: Joseph Hwang <josephsih@chromium.org>

This patch enables the external flag for gap so that the gap service can
be exported over D-Bus.

Tested on Chrome OS that this fixes https://crbug.com/722987 so that GAP
API can be propagated to Android apps.

Test Method 1:
  - Connect to a peripheral.
  - Use dbus methods to query the org.bluez.GattService1
    interface in managed objects.
  - Confirm that the gap 0x1800 profile was exported like:
    GattService1 path: /org/bluez/hci0/dev_xx/service0001
    service_props: dbus.String(u'UUID'):
        dbus.String(u'00001800-0000-1000-8000-00805f9b34fb'

Test Method 2:
  - Install BleManager APK attached in C#0 of https://crbug.com/722987
    to ARC++ in a chromebook.
  - Launch the application.
  - Connect to a Dash robot. Confirm that there are 3 services
    instead of 2.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>

---
 profiles/gap/gas.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Luiz Augusto von Dentz Aug. 21, 2020, 5:33 p.m. UTC | #1
Hi Sonny,

On Fri, Aug 21, 2020 at 12:08 AM Sonny Sasaka <sonnysasaka@chromium.org> wrote:
>
> From: Joseph Hwang <josephsih@chromium.org>
>
> This patch enables the external flag for gap so that the gap service can
> be exported over D-Bus.
>
> Tested on Chrome OS that this fixes https://crbug.com/722987 so that GAP
> API can be propagated to Android apps.
>
> Test Method 1:
>   - Connect to a peripheral.
>   - Use dbus methods to query the org.bluez.GattService1
>     interface in managed objects.
>   - Confirm that the gap 0x1800 profile was exported like:
>     GattService1 path: /org/bluez/hci0/dev_xx/service0001
>     service_props: dbus.String(u'UUID'):
>         dbus.String(u'00001800-0000-1000-8000-00805f9b34fb'
>
> Test Method 2:
>   - Install BleManager APK attached in C#0 of https://crbug.com/722987
>     to ARC++ in a chromebook.
>   - Launch the application.
>   - Connect to a Dash robot. Confirm that there are 3 services
>     instead of 2.
>
> Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
>
> ---
>  profiles/gap/gas.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c
> index dffa31314..abe5341c0 100644
> --- a/profiles/gap/gas.c
> +++ b/profiles/gap/gas.c
> @@ -310,6 +310,7 @@ static int gap_disconnect(struct btd_service *service)
>  static struct btd_profile gap_profile = {
>         .name           = "gap-profile",
>         .remote_uuid    = GAP_UUID,
> +       .external       = true,
>         .device_probe   = gap_probe,
>         .device_remove  = gap_remove,
>         .accept         = gap_accept,
> --
> 2.26.2

I guess you will end up exporting every single service at the end, so
perhaps we should just have an entry to main.conf
(ExportClaimedServices) where the system can define if services
claimed by plugins are allowed to be accessed over D-Bus, and we
should probably add a comment that when doing so it may cause
conflicts between the daemon and applications (especially GAP/GATT
service can be very sensitive).
diff mbox series

Patch

diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c
index dffa31314..abe5341c0 100644
--- a/profiles/gap/gas.c
+++ b/profiles/gap/gas.c
@@ -310,6 +310,7 @@  static int gap_disconnect(struct btd_service *service)
 static struct btd_profile gap_profile = {
 	.name		= "gap-profile",
 	.remote_uuid	= GAP_UUID,
+	.external	= true,
 	.device_probe	= gap_probe,
 	.device_remove	= gap_remove,
 	.accept		= gap_accept,