From d985dcb55c9ce51f1c962d045d285f6b705cf329 Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Tue, 10 Aug 2021 16:27:49 -0400 Subject: [PATCH] fixes bluez 0.55 service registration. muka/go-bluetooth does some magic so you can use short UUIDs and it'll auto expand them to the full 128 bit uuid. setting these flags disables that behavior. related issues: - allows updating muka library to resolve https://github.com/tinygo-org/bluetooth/issues/35 - fixes the regression the upgrade caused https://github.com/tinygo-org/bluetooth/issues/46 - commit causing the regression in upstream https://github.com/muka/go-bluetooth/commit/1c4c1c86132bee2694386657a9e821c41b41d9ac --- gatts_linux.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gatts_linux.go b/gatts_linux.go index 0422c44..21a4c81 100644 --- a/gatts_linux.go +++ b/gatts_linux.go @@ -24,6 +24,13 @@ func (a *Adapter) AddService(s *Service) error { return err } + // disable magic uuid generation because we send through a fully formed UUID. + // muka/go-bluetooth does some magic so you can use short UUIDs and it'll auto + // expand them to the full 128 bit uuid. + // setting these flags disables that behavior. + app.Options.UUIDSuffix = "" + app.Options.UUID = "" + bluezService, err := app.NewService(s.UUID.String()) if err != nil { return err