Problem with StopDiscovery() via dbus-send
Hello All,
Maybe it's a bug?
I'm trying to manage Bluetooth using dbus-send command,
I send command for start discovery:
dbus-send --system --reply-timeout=5000 --type=method_call --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter1.StartDiscovery
Discovery process NOT stop!!! in btmgmt i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
and it goes on continuously!
How can I stop the search process? "StopDiscovery" not work from dbus-send command.
---------------------
Best regards,
Aleksandr Proklov
Luiz Augusto von Dentz
maintainerHi Aleksandr,
On Fri, Sep 15, 2017 at 6:25 AM, =D0=9F=D1=80=D0=BE=D0=BA=D0=BB=D0=BE=D0=B2=
=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80 =D0=92=D0=B0=D0=BB=
=D0=B5=D1=80=D1=8C=D0=B5=D0=B2=D0=B8=D1=87
Quoted 7 lines · <[email protected]> wrote:
Hello All,
Maybe it's a bug?
I'm trying to manage Bluetooth using dbus-send command,
I send command for start discovery:
dbus-send --system --reply-timeout=3D5000 --type=3Dmethod_call --dest=3Do=
rg.bluez
Quoted 1 line
/org/bluez/hci0 org.bluez.Adapter1.StartDiscovery
dbus-send disconnects from the bus so the discovery is stopped because there is no client to report the devices found.
Quoted 11 lines
Discovery process NOT stop!!! in btmgmt i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering onand it goes on continuously!
How can I stop the search process? "StopDiscovery" not work from dbus-sen=
d
Quoted 8 lines
command.
---------------------
Best regards,
Aleksandr Proklov
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
"
Quoted 3 lines
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--=20
Luiz Augusto von Dentz
15.09.2017 14:27, Luiz Augusto von Dentz пишет:
Quoted 8 lines
Hi Aleksandr,
Quoted 4 lines · Проклов Александр Валерьевич
Hello All,
Maybe it's a bug?
Quoted 8 lines
Quoted 4 lines
I'm trying to manage Bluetooth using dbus-send command,
I send command for start discovery:
dbus-send --system --reply-timeout=5000 --type=method_call --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter1.StartDiscoverydbus-send disconnects from the bus so the discovery is stopped because there is no client to report the devices found.
Discovery not stopped, see my log from btmgmt. I not start discovery via "btmgmt find". Command "btmgmt stop-find" not help me.
Now i add to code for stop discovery process:
btmgmt power off
sleep 2
btmgmt power on
Quoted 25 lines
Quoted 22 lines
Discovery process NOT stop!!! in btmgmt i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering onand it goes on continuously!
How can I stop the search process? "StopDiscovery" not work from dbus-send command.---------------------
Best regards,
Aleksandr Proklov
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Luiz Augusto von Dentz
maintainerHi Aleksandr,
On Fri, Sep 15, 2017 at 11:35 AM, =D0=9F=D1=80=D0=BE=D0=BA=D0=BB=D0=BE=D0= =B2 =D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80 =D0=92=D0=B0=D0= =BB=D0=B5=D1=80=D1=8C=D0=B5=D0=B2=D0=B8=D1=87
Quoted 5 lines · <[email protected]> wrote:
15.09.2017 14:27, Luiz Augusto von Dentz =D0=BF=D0=B8=D1=88=D0=B5=D1=82:
Quoted 4 lines
Hi Aleksandr,
On Fri, Sep 15, 2017 at 6:25 AM, =D0=9F=D1=80=D0=BE=D0=BA=D0=BB=D0=BE=D0=
=B2 =D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80 =D0=92=D0=B0=D0= =BB=D0=B5=D1=80=D1=8C=D0=B5=D0=B2=D0=B8=D1=87
Quoted 17 lines
Quoted 13 lines
Quoted 10 lines · <[email protected]> wrote:
Hello All,
Maybe it's a bug?
I'm trying to manage Bluetooth using dbus-send command, I send command for start discovery:
dbus-send --system --reply-timeout=3D5000 --type=3Dmethod_call --dest=3Dorg.bluez
/org/bluez/hci0 org.bluez.Adapter1.StartDiscoveryQuoted 3 lines
dbus-send disconnects from the bus so the discovery is stopped because there is no client to report the devices found.
Quoted 7 lines
Discovery not stopped, see my log from btmgmt. I not start discovery via "btmgmt find". Command "btmgmt stop-find" not help me.
Now i add to code for stop discovery process:
btmgmt power off
sleep 2
btmgmt power on
Ive just a set of patches adressing race condition with StartDiscovery and StopDiscovery, please have a try. Also it is not a good idea to mix usage of D-Bus with btmgmt, they might not play well together especially when it comes to discovery.
Quoted 31 lines
Quoted 17 lines
Quoted 17 lines
Discovery process NOT stop!!! in btmgmt i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering onand it goes on continuously!
How can I stop the search process? "StopDiscovery" not work from dbus-send
command.Quoted 13 lines
Quoted 9 lines
---------------------
Best regards,
Aleksandr Proklov
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
"
Quoted 3 lines
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--=20
Luiz Augusto von Dentz
15.09.2017 16:46, Luiz Augusto von Dentz пишет:
Quoted 5 lines
Ive just a set of patches adressing race condition with StartDiscovery and StopDiscovery, please have a try. Also it is not a good idea to mix usage of D-Bus with btmgmt, they might not play well together especially when it comes to discovery.
Thank you, I add "patch v2 adapter: Refactor code around discovery" to source bluez-5.47 and compile it.
My test results:
1. btmgmt after "find" command NOT set org.bluez.Adapter1 string:Discovering =1 . But the Discovery process is already running, why he does not do it? btmgmt not use dbus for managment?
2. If i send method StartDiscovery via dbus-send command, i see org.bluez.Adapter1 string:Discovering =1 status. But I can not stop the process, method StopDiscovery - has no effect. "btmgmt stop-find" - has no effect, in therminal i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
after btmgmt power off and btmgmt power on
org.bluez.Adapter1 string:Discovering =0
I assume that the method StopDiscovery must completely terminate the process StartDiscovery, regardless of the way the scan was started (btmgmt, dbus-send, hcitool, bluetoothctl or more other).
Luiz Augusto von Dentz
maintainerHi,
On Mon, Sep 18, 2017 at 5:50 AM, =D0=9F=D1=80=D0=BE=D0=BA=D0=BB=D0=BE=D0=B2=
=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80 =D0=92=D0=B0=D0=BB=
=D0=B5=D1=80=D1=8C=D0=B5=D0=B2=D0=B8=D1=87
Quoted 8 lines · <[email protected]> wrote:
15.09.2017 16:46, Luiz Augusto von Dentz =D0=BF=D0=B8=D1=88=D0=B5=D1=82:
Quoted 6 lines
Ive just a set of patches adressing race condition with StartDiscovery and StopDiscovery, please have a try. Also it is not a good idea to mix usage of D-Bus with btmgmt, they might not play well together especially when it comes to discovery.
Quoted 6 lines
Thank you, I add "patch v2 adapter: Refactor code around discovery" to source bluez-5.47 and compile it.
My test results:
1. btmgmt after "find" command NOT set org.bluez.Adapter1 string:Discover=
ing
Quoted 1 line
=3D1 . But the Discovery process is already running, why he does not do i=
t?
Quoted 1 line
btmgmt not use dbus for managment?
btmgmt uses the kernel management interface not D-Bus, this is why I said it may not play well with bluetoothd.
Quoted 3 lines
2. If i send method StartDiscovery via dbus-send command, i see org.bluez.Adapter1 string:Discovering =3D1 status. But I can not stop the process, method StopDiscovery - has no effect.
The StopDiscovery can only stop discovery started by the client, if you use btmgmt to start then it can only be stopped by btmgmt.
Quoted 8 lines
"btmgmt stop-find" - has no effect, in therminal i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
Quoted 4 lines
after btmgmt power off and btmgmt power on
org.bluez.Adapter1 string:Discovering =3D0I assume that the method StopDiscovery must completely terminate the proc=
ess
Quoted 2 lines
StartDiscovery, regardless of the way the scan was started (btmgmt, dbus-send, hcitool, bluetoothctl or more other).
Only if StartDiscovery was initiated by the same D-Bus connection/process, and in case you are wondering there is proper support for discovery in bluetoothctl which does use D-Bus to control the discovery.
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
"
Quoted 3 lines
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--=20
Luiz Augusto von Dentz
18.09.2017 14:53, Luiz Augusto von Dentz пишет:
Quoted 24 lines
Hi,
Quoted 8 lines · Проклов Александр Валерьевич
15.09.2017 16:46, Luiz Augusto von Dentz пишет:
Quoted 6 lines
Ive just a set of patches adressing race condition with StartDiscovery and StopDiscovery, please have a try. Also it is not a good idea to mix usage of D-Bus with btmgmt, they might not play well together especially when it comes to discovery.
Quoted 8 lines
Thank you, I add "patch v2 adapter: Refactor code around discovery" to source bluez-5.47 and compile it.
My test results:
1. btmgmt after "find" command NOT set org.bluez.Adapter1 string:Discovering =1 . But the Discovery process is already running, why he does not do it? btmgmt not use dbus for managment?
btmgmt uses the kernel management interface not D-Bus, this is why I said it may not play well with bluetoothd.
Quoted 6 lines
Quoted 3 lines
2. If i send method StartDiscovery via dbus-send command, i see org.bluez.Adapter1 string:Discovering =1 status. But I can not stop the process, method StopDiscovery - has no effect.
The StopDiscovery can only stop discovery started by the client, if you use btmgmt to start then it can only be stopped by btmgmt.
No i not use btmgmt, I would like to stop the process through Dbus. My btmgmt example only for show process.
Quoted 12 lines
Quoted 12 lines
"btmgmt stop-find" - has no effect, in therminal i see:
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering on
hci0 type 7 discovering off
hci0 type 7 discovering onafter btmgmt power off and btmgmt power on
org.bluez.Adapter1 string:Discovering =0
Quoted 9 lines
Quoted 3 lines
I assume that the method StopDiscovery must completely terminate the process StartDiscovery, regardless of the way the scan was started (btmgmt, dbus-send, hcitool, bluetoothctl or more other).
Only if StartDiscovery was initiated by the same D-Bus connection/process, and in case you are wondering there is proper support for discovery in bluetoothctl which does use D-Bus to control the discovery.
Use Dbus from script is difficult, but now, it is not possible to use.
Quoted 8 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines
Quoted 10 lines
15.09.2017 16:46, Luiz Augusto von Dentz пишет:
Quoted 6 lines
Ive just a set of patches adressing race condition with StartDiscovery and StopDiscovery, please have a try. Also it is not a good idea to mix usage of D-Bus with btmgmt, they might not play well together especially when it comes to discovery.
May be add time delay after the StarDiscovery (for example 60 sec) and bluetoothd automatically turn off the Discovery process? I do not know when it would be required to start the process for a time longer than 60 seconds.
This will help solve the problem with the call StartDiscovery through the script via dbus-send. My method through power off, power on not help me, after power off founded adapters deleted from dbus tree.
My script is finished at 80%. It remains only to make the Discovery and network connection via bluetooth (GN, PANU, PAN).
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
15.09.2017 16:46, Luiz Augusto von Dentz пишет:
Quoted 6 lines
Ive just a set of patches adressing race condition with StartDiscovery and StopDiscovery, please have a try. Also it is not a good idea to mix usage of D-Bus with btmgmt, they might not play well together especially when it comes to discovery.
Quoted 5 lines
May be add time delay after the StarDiscovery (for example 60 sec) and bluetoothd automatically turn off the Discovery process? I do not know when it would be required to start the process for a time longer than 60 seconds.
This will help solve the problem with the call StartDiscovery through the script via dbus-send. My method through power off, power on not help me, after power off founded adapters deleted from dbus tree.
My script is finished at 80%. It remains only to make the Discovery and network connection via bluetooth (GN, PANU, PAN).
Dear Luiz Augusto von Dentz, please consider the possibility of implementing this option.