All of lore.kernel.org
 help / color / mirror / Atom feed
* Using BDADDR efivar to set bd_addr for bci_hcm devices?
@ 2018-03-19 21:16 Hans de Goede
  2018-03-19 22:13 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2018-03-19 21:16 UTC (permalink / raw)
  To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, Lukas Wunner
  Cc: linux-bluetooth, linux-serial, linux-acpi

Hi All,

While fixing the bluetooth on the meegopad t08 I noticed that
it (and other devices) have a BDADDR efivar with the same guid
as used for the nvram variable which contains the wifi's
nvram settings for sdio broadcom wifi chips (if present):

hexdump -C /sys/firmware/efi/efivars/BDADDR-74b00bd9-805a-4d61-b51f-43268123d113
00000000  07 00 00 00 ac 83 f3 37  39 af                    |.......79.|

Booting into Windows shows the bluetooth using
an address of ac 83 f3 37  39 af, which makes
sense as the meegopad has an AMPAK AP6234 wifi
module and the ac 83 f3 prefix belongs to AMPAK.

Getting the contents from an efivar from within the kernel is
not that hard, so I was thinking that maybe we need to teach
the hci_bcm code to check for this and use the bd_addr from
there so that we have the same bd_addr as Windows, OTOH not
having the same bd_addr is an advantage because this allows
devices which can be paired to multiple bt hosts to be paired
with both Windows and Linux at the same time using a different
key.

So what do you think about adding support for the BDADDR efivar
and using it to set bd_addr?

1) Good idea?
2) Good idea, but make it optional (compile and/or runtime) ?
3) Bad idea ?

Regards,

Hans

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using BDADDR efivar to set bd_addr for bci_hcm devices?
  2018-03-19 21:16 Using BDADDR efivar to set bd_addr for bci_hcm devices? Hans de Goede
@ 2018-03-19 22:13 ` Marcel Holtmann
  2018-03-20  9:09   ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2018-03-19 22:13 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Gustavo F. Padovan, Johan Hedberg, Lukas Wunner, linux-bluetooth,
	linux-serial, linux-acpi

Hi Hans,

> While fixing the bluetooth on the meegopad t08 I noticed that
> it (and other devices) have a BDADDR efivar with the same guid
> as used for the nvram variable which contains the wifi's
> nvram settings for sdio broadcom wifi chips (if present):
> 
> hexdump -C /sys/firmware/efi/efivars/BDADDR-74b00bd9-805a-4d61-b51f-43268123d113
> 00000000  07 00 00 00 ac 83 f3 37  39 af                    |.......79.|
> 
> Booting into Windows shows the bluetooth using
> an address of ac 83 f3 37  39 af, which makes
> sense as the meegopad has an AMPAK AP6234 wifi
> module and the ac 83 f3 prefix belongs to AMPAK.
> 
> Getting the contents from an efivar from within the kernel is
> not that hard, so I was thinking that maybe we need to teach
> the hci_bcm code to check for this and use the bd_addr from
> there so that we have the same bd_addr as Windows, OTOH not
> having the same bd_addr is an advantage because this allows
> devices which can be paired to multiple bt hosts to be paired
> with both Windows and Linux at the same time using a different
> key.
> 
> So what do you think about adding support for the BDADDR efivar
> and using it to set bd_addr?
> 
> 1) Good idea?
> 2) Good idea, but make it optional (compile and/or runtime) ?
> 3) Bad idea ?

I am all for using the BD_ADDR from EFI variables. That way this become how it was intended. If we want to be flexible, we can add a module parameter to disable it and have it stick with the default one.

If we can do it directly from within the kernel automatically, then lets do it. Some similar code was added to hci_ll.c for DT entries from the boot loader. Alternative, this can be always done from userspace via Set Public Address mgmt command.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using BDADDR efivar to set bd_addr for bci_hcm devices?
  2018-03-19 22:13 ` Marcel Holtmann
@ 2018-03-20  9:09   ` Hans de Goede
  0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2018-03-20  9:09 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Gustavo F. Padovan, Johan Hedberg, Lukas Wunner, linux-bluetooth,
	linux-serial, linux-acpi

HI,

On 19-03-18 23:13, Marcel Holtmann wrote:
> Hi Hans,
> 
>> While fixing the bluetooth on the meegopad t08 I noticed that
>> it (and other devices) have a BDADDR efivar with the same guid
>> as used for the nvram variable which contains the wifi's
>> nvram settings for sdio broadcom wifi chips (if present):
>>
>> hexdump -C /sys/firmware/efi/efivars/BDADDR-74b00bd9-805a-4d61-b51f-43268123d113
>> 00000000  07 00 00 00 ac 83 f3 37  39 af                    |.......79.|
>>
>> Booting into Windows shows the bluetooth using
>> an address of ac 83 f3 37  39 af, which makes
>> sense as the meegopad has an AMPAK AP6234 wifi
>> module and the ac 83 f3 prefix belongs to AMPAK.
>>
>> Getting the contents from an efivar from within the kernel is
>> not that hard, so I was thinking that maybe we need to teach
>> the hci_bcm code to check for this and use the bd_addr from
>> there so that we have the same bd_addr as Windows, OTOH not
>> having the same bd_addr is an advantage because this allows
>> devices which can be paired to multiple bt hosts to be paired
>> with both Windows and Linux at the same time using a different
>> key.
>>
>> So what do you think about adding support for the BDADDR efivar
>> and using it to set bd_addr?
>>
>> 1) Good idea?
>> 2) Good idea, but make it optional (compile and/or runtime) ?
>> 3) Bad idea ?
> 
> I am all for using the BD_ADDR from EFI variables. That way this become how it was intended. If we want to be flexible, we can add a module parameter to disable it and have it stick with the default one.

Ok.

> If we can do it directly from within the kernel automatically, then lets do it. Some similar code was added to hci_ll.c for DT entries from the boot loader. Alternative, this can be always done from userspace via Set Public Address mgmt command.

Accessing the efivar from the kernel is easy (the internal API for this
is a bit clunky but usable), so we can do this within the kernel automatically.

I've put writing a patch for this on my TODO.

Regards,

Hans

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-20  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 21:16 Using BDADDR efivar to set bd_addr for bci_hcm devices? Hans de Goede
2018-03-19 22:13 ` Marcel Holtmann
2018-03-20  9:09   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.