All of lore.kernel.org
 help / color / mirror / Atom feed
* Serial communication over BT using the DBus API
@ 2018-10-09 19:30 Sylvain Leroux
  2018-10-09 20:30 ` Barry Byford
  0 siblings, 1 reply; 6+ messages in thread
From: Sylvain Leroux @ 2018-10-09 19:30 UTC (permalink / raw)
  To: linux-bluetooth

Hi everyone,

I'm trying to establish a serial communication between two hosts over
Bluetooth.

Things go well if I start the `bluetoothd` on the server in
_compatibility mode_. That way, I can attach the "serial port" profile
to the channel. Then, using `rfcomm watch` and `rfcomm connect` to
establish the connection between the server and the client, I can
receive "raw" data sent by the server:

----
# Server side
/usr/lib/bluetooth/bluetoothd -C
sdptool add --channel=1 SP
rfcomm watch hci0 1 bash -c 'cat somefile > /dev/rfcomm0'
----

----
#Client side
sudo rfcomm connect /dev/rfcomm0 BB:CC:DD:EE:FF:11 1
sudo cat /dev/rfcomm0
-----

If I do _not_ run the `bluetoothd` server in compatibility mode, SDP is
no longer supported and the data I receive seems to modified by the BT
stack, leading to my data being mixed with garbage--exactly like when I
don't set the "serial port" profile while running in compatibility mode.


I don't like the idea of depending on a deprecated interface. And from
what I read, I understand the new way to go is to use the DBus API.  Any
solution using bluetoothctl, busctl, dbus-send or similar tools would do
the trick. But I can't manage to understand the sequence of operations
required to transmit raw data between the server and the client *from a
shell script* using that new API.

Could you give me some example or point me to the relevant documentation?

Regards,
- Sylvain Leroux

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Problem with StopDiscovery() via dbus-send
@ 2018-08-24  1:58 Проклов Александр Валерьевич
  2018-08-24  8:19 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 6+ messages in thread
From: Проклов Александр Валерьевич @ 2018-08-24  1:58 UTC (permalink / raw)
  To: linux-bluetooth

  Hello All,

Thanks for your work. Since version bluez-5.50 start-stop discovery work 
from command line and scripts:
#bluetoothctl scan on
#bluetoothctl scan off
(see mail-list "Problem with StopDiscovery() via dbus-send")

--------------------------------------------

My next task is to do pair with device from bash script. I tried several 
ways:
1. #bluetoothctl pair 11:22:33:44:55:66 does not work because the agent 
is not created.
2. Make  agent via Dbus:
#dbus-send --system --print-reply --type=method_call --dest=org.bluez 
/org/bluez org.bluez.AgentManager1.RegisterAgent 
objpath:/org/bluez/agent1 string:KeyboardOnly
the command works, but I do not see in Dbus /org/bluez/agent1 created.
3. Make agent via bluetoothctl:
[bluetooth]#agent on
the command works, but I do not see in Dbus agent path!.

May be possible to set a default pin code via /etc/bluetooth/main.conf
if it is available, do not make a request for a pin from the command 
line? I think that then #bluetoothctl pair 11:22:33:44:55:66 will be 
able to work fine.

---------------------
Best regards,
Aleksandr Proklov

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

end of thread, other threads:[~2018-11-01  2:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 19:30 Serial communication over BT using the DBus API Sylvain Leroux
2018-10-09 20:30 ` Barry Byford
2018-10-09 20:56   ` Sylvain Leroux
2018-10-09 21:09     ` Barry Byford
2018-10-10 12:53       ` Sylvain Leroux
  -- strict thread matches above, loose matches on Subject: below --
2018-08-24  1:58 Problem with StopDiscovery() via dbus-send Проклов Александр Валерьевич
2018-08-24  8:19 ` Luiz Augusto von Dentz
2018-11-01  3:44   ` Serial communication over BT using the DBus API Проклов Александр Валерьевич

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.