2017-07-05 19:05:36

by Ian Molton

[permalink] [raw]
Subject: bdaddr

Hi guys,

When changing the BDADDR why must I down/up the device after doing so?
is it not possible/sensible to change it whilst remaining up?

Could it be possible to allow the BDADDR to be written whilst the device
is down, and inject it when it comes up? Would a patch to do this be
acceptable?

Otherwise, the sequence for programming the BDADDR looks a bit naff;

hciconfig hci0 up
bdaddr -i hci0 <foo>
hciconfig hci0 down
hciconfig hci0 up

To me, it would make more sense if I could do:

hciconfig hci0 down
bdaddr -i hci0 <foo>
hciconfig hci0 up

-Ian


2017-07-08 09:07:26

by Ian Molton

[permalink] [raw]
Subject: Re: bdaddr

On 08/07/17 08:54, Marcel Holtmann wrote:
> there is a btmgmt public-addr command that does this correctly if the hdev->set_bdaddr is supported by the hardware. Using the bdaddr tool is a hack.

Oh, great - missed that, thanks.

I'll implement that in the driver.

-Ian

2017-07-08 07:54:14

by Marcel Holtmann

[permalink] [raw]
Subject: Re: bdaddr

Hi Ian,

> When changing the BDADDR why must I down/up the device after doing so?
> is it not possible/sensible to change it whilst remaining up?
>
> Could it be possible to allow the BDADDR to be written whilst the device
> is down, and inject it when it comes up? Would a patch to do this be
> acceptable?
>
> Otherwise, the sequence for programming the BDADDR looks a bit naff;
>
> hciconfig hci0 up
> bdaddr -i hci0 <foo>
> hciconfig hci0 down
> hciconfig hci0 up
>
> To me, it would make more sense if I could do:
>
> hciconfig hci0 down
> bdaddr -i hci0 <foo>
> hciconfig hci0 up

there is a btmgmt public-addr command that does this correctly if the hdev->set_bdaddr is supported by the hardware. Using the bdaddr tool is a hack.

Regards

Marcel