To make it easier for clients to know when SDP has completed, and to
make the property consistent with the timing of the Device1.Pair()
method return it makes sense to delay the "Paired" property change until
SDP has completed.
The HID 1.1 spec requires a host to attempt a reconnection when a
HID device goes out of range and comes back. There is test (see
TP/HCE/BV-04-I [Host Initiated Re-connection]) to ensure that the
host initiates the connection when that happens.
This patch adds a reconnection timer for HID devices trying to
reconnect every 30s for a maximum of 3 minutes after the connection
to a HID device with a ReconnectMode of "host" or "any" is closed.
If the struct input_device is destroyed while a hidp_connad_req
is pending, the input_device will be destroyed leaking the associated
memory.
==30790== 492 (168 direct, 324 indirect) bytes in 1 blocks are definitely lost in loss record 199 of 216
==30790== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==30790== by 0x4E7FAE0: g_malloc0 (gmem.c:189)
==30790== by 0x4378E4: hidp_add_connection (device.c:365)
==30790== by 0x438055: input_device_connected (device.c:525)
==30790== by 0x4380DA: interrupt_connect_cb (device.c:548)
==30790== by 0x443508: connect_cb (btio.c:230)
==30790== by 0x4E79D52: g_main_context_dispatch (gmain.c:2539)
==30790== by 0x4E7A09F: g_main_context_iterate.isra.23 (gmain.c:3146)
==30790== by 0x4E7A499: g_main_loop_run (gmain.c:3340)
==30790== by 0x448CCC: main (main.c:583)
The "Connectability" of a HID device, as defined by the HID spec,
governs the way the host may and should connect to a HID device or
expect a connection from it. In the comon case of mice and keyboards
the HIDNormallyConnectable is FALSE and HIDReconnectInitiate is TRUE,
since those devices only attempt a connection to the host when they
have some data to transfer. A connection attempt initiated from the
host after the device drops the connection (while still paired) will
result in a Page timeout.
This patch exposes a new property called "ReconnectMode" combining the
those two SDP attributes as shown in the Connectability section of the
HID spec (see section 5.4.2). The property can have one of the following
four values: "None", "Device", "Host", "Any", and is derived from the
SDP cached value on device creation even if the device is off.
This fixes not sending methods calls to players, it now copies the
contents of the original message into the copy instead of relying on
dbus_message_copy and send the reply back.
Parse the service attributes mas_instance_id and supported_message_types
from the transport's service attributes as soon as a connection is
established.
Now to exit from gatttool at interactive mode, user must use SIGTERM(15)
or press Ctrl+D. SIGINT(2) or Ctrl+C just flushes typed characters and
breaks line.
When trying to connect, the "connecting" message is not set as prompt
anymore. Instead, it is printed just like other status messages and the
prompt is kept, allowing the user to send commands while connection is
being established.
Use rl_printf() from bluetoothctl to consistently display messages. This
is specially important for asynchronous callbacks, where using printf()
may mess up the prompt created by readline.
Removes the never used constants AUDIO_SINK_INTERFACE and
AUDIO_SOURCE_INTERFACE which are defined to "org.bluez.AudioSink" and
"org.bluez.AudioSource", respectively.