[SRU][M:meta-laptop][PATCH] UBUNTU: Fix bluetooth public address

Andy Whitcroft apw at canonical.com
Thu Nov 23 09:52:39 UTC 2023


This does not feel it is in the right place.  This would mean people who
install just the kernel would not have this support. It would also preclude
having an HWE version of such a kernel (not planned admittedly).  For SGX
we did this via a new linux-base-<foo> binary package containing them (from
source linux-base) and then IIRC the linux-image-<abi> packages depend on
that.

-apw

On Wed, Nov 22, 2023 at 1:26 PM Juerg Haefliger <
juerg.haefliger at canonical.com> wrote:

> On Wed, 22 Nov 2023 13:45:02 +0100
> Thibault Ferrante <thibault.ferrante at canonical.com> wrote:
>
> > On 27-10-2023 20:26, Juerg Haefliger wrote:
> > > BugLink: https://bugs.launchpad.net/2041000
> > > BugLink: https://bugs.launchpad.net/2037534
> >
> > These URLs are missing 'bugs/'
>
> Yes. Will fix at commit-time.
>
>
> > >
> > > The X13s comes up with no BT public address, it's hidden probably in
> > > secret storage that the kernel can't get to (yet), so it needs to be
> > > set by userspace after bluez is up. For some reason, a delay is
> > > required, so do that and also calculate a unique MAC based on
> > > /etc/machine-id.
> > >
> > > Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
> > > ---
> > >   debian/install                                |  1 +
> > >   share/set-bt-public-addr                      | 34
> +++++++++++++++++++
> > >   ...laptop-image-bluetooth-public-addr.service |  3 +-
> > >   3 files changed, 37 insertions(+), 1 deletion(-)
> > >   create mode 100755 share/set-bt-public-addr
> > >
> > > diff --git a/debian/install b/debian/install
> > > index aeb5be43a521..b2825799c756 100644
> > > --- a/debian/install
> > > +++ b/debian/install
> > > @@ -3,3 +3,4 @@ hooks/* usr/share/initramfs-tools/hooks/
> > >   grub.d/* etc/default/grub.d/
> > >   rules.d/* lib/udev/rules.d/
> > >   systemd-system/* lib/systemd/system/
> > > +share/* usr/share/linux-laptop/
> > > diff --git a/share/set-bt-public-addr b/share/set-bt-public-addr
> > > new file mode 100755
> > > index 000000000000..b6443d8bff3a
> > > --- /dev/null
> > > +++ b/share/set-bt-public-addr
> > > @@ -0,0 +1,34 @@
> > > +#!/bin/sh
> > > +#
> > > +# Set X13s bluetooth public address
> > > +#
> > > +
> > > +idx=
> > > +for hci in /sys/class/bluetooth/hci* ; do
> > > +   rp=$(realpath "${hci}")
> > > +   case "${rp}" in
> > > +           */serial0/serial0-0/*)
> > > +                   idx=${rp##*/hci}
> > > +                   break
> > > +                   ;;
> > > +   esac
> > > +done
> > > +
> > > +if [ -z "${idx}" ] ; then
> > > +   echo "No serial BT adapter found"
> > > +   exit 0
> > > +fi
> > > +
> > > +
> > > +# Bytes 1-3 from /etc/machine-id
> > > +nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 1-8)
> > > +
> > > +# Qualcomm OUI
> > > +oui="f0:fd:8c"
> >
> > One of the Qualcom OUI is '8c:fd:f0', why it isn't in the same order ?
> >
> > > +
> > > +mac="${nic}:${oui}"
> >
> > Same about ordering, why nic is first here ?
>
> Because btmgmt wants the MAC in reverse order. Don't ask me why...
>
> ...Juerg
>
>
> > > +echo "Set public addr of hci${idx} to ${mac}"
> > > +
> > > +# Do not use '--index N' yet since bluez is currently broken (LP:
> #2041496)
> > > +#/usr/bin/yes 2>/dev/null | /usr/bin/btmgmt --index "${idx}"
> public-addr "${mac}"
> > > +/usr/bin/yes 2>/dev/null | /usr/bin/btmgmt public-addr "${mac}"
> > > diff --git
> a/systemd-system/linux-laptop-image-bluetooth-public-addr.service
> b/systemd-system/linux-laptop-image-bluetooth-public-addr.service
> > > index fbe57b41da07..dd13274aff1f 100644
> > > --- a/systemd-system/linux-laptop-image-bluetooth-public-addr.service
> > > +++ b/systemd-system/linux-laptop-image-bluetooth-public-addr.service
> > > @@ -3,7 +3,8 @@ Description=Set Bluetooth Address
> > >   After=bluetooth.service
> > >
> > >   [Service]
> > > -ExecStart=/bin/bash -c "/usr/bin/btmgmt --timeout 30 public-addr
> AD:5A:00:F0:FD:8C"
> > > +ExecStartPre=/usr/bin/sleep 5
> > > +ExecStart=/usr/share/linux-laptop/set-bt-public-addr
> > >
> > >   [Install]
> > >   WantedBy=bluetooth.service
> >
> >
> > --
> > Thibault
> >
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20231123/49d94474/attachment.html>


More information about the kernel-team mailing list