If RFCOMM is disabled on the kernel, headset_server_probe() fails.
Relevant log messages:
audio/manager.c:headset_server_probe() path /org/bluez/499/hci0
src/adapter.c:btd_adapter_ref() 0x4bb4f78: ref=6
audio/manager.c:audio_adapter_ref() 0x4ca3010: ref=1
socket(STREAM, RFCOMM): Protocol not supported (93)
audio/manager.c:audio_adapter_unref() 0x4ca3010: ref=0
src/adapter.c:btd_adapter_unref() 0x4bb4f78: ref=5
audio-headset: Operation not permitted (1)
The powered callback should only be registered if adapter driver probe
was successful. The callback unregister was moved to the beginning of
headset_server_remove() for consistency.
This fixes this memory leak:
==499== 8 bytes in 1 blocks are definitely lost in loss record 44 of 182
==499== at 0x4826444: malloc (vg_replace_malloc.c:263)
==499== by 0x4877243: g_malloc (gmem.c:132)
==499== by 0x488D088: g_slice_alloc (gslice.c:836)
==499== by 0x488E8A5: g_slist_append (gslist.c:230)
==499== by 0x18AEEE: btd_adapter_register_powered_callback
(adapter.c:3416)
==499== by 0x11AF61: headset_server_probe (manager.c:919)
==499== by 0x18B67B: probe_driver (adapter.c:2033)
==499== by 0x1908F5: adapter_init (adapter.c:2048)
==499== by 0x189D20: btd_manager_register_adapter (manager.c:397)
==499== by 0x1649AF: mgmt_cmd_complete (mgmtops.c:1075)
==499== by 0x16665E: mgmt_event (mgmtops.c:1780)
==499== by 0x48B2EFA: g_io_unix_dispatch (giounix.c:162)
If a plugin pincode callback sets the display parameter to TRUE, send
the generated PIN to the agent for display using the new DisplayPinCode
agent method, including its fallback to RequestPinCode.
Pass a display parameter to the plugin pincode callback, a plugin
may set this to TRUE to indicate the PIN it generates should be
displayed on the screen for entry into the remote device.
This new authentication type accepts a pincode and calls the
DisplayPinCode agent method, a fallback is provided so that if the
method is not implemented the older RequestPinCode method is used
instead.
Due to this fallback, the agent_pincode_cb is used and calling
functions should send the pincode passed to the callback to the
adapter, which may differ from that generated.
In constrast to DisplayPasskey, this sends a UTF-8 string PIN code
to the agent; also we support a callback for the case where the
Agent doesn't implement this new method so we can fallback.
This allows alternate data of a different type to be passed to
device_request_authentication() for other notification types such
as those that require a PIN.
Add missing include glib-compat.h to deviceinfo.c. deviceinfo_free
is using g_slist_free_full() which is not available in old glib
resulting in compilation error.
deviceinfo/deviceinfo.c: In function ‘deviceinfo_free’:
deviceinfo/deviceinfo.c:66: error: implicit declaration of function ‘g_slist_free_full’
Add connection logic to the Device Information Plugin. When the
driver is loaded, it will request a connection to the remote device
and release the connection request when destroyed.
This patch fixes the adapter discovering state while powering off.
Without this fix, BlueZ sends incorrect discovering state to upper
layers while switching off.
watcher_free() will be automatically called when removing the D-Bus
watch (it was set as the destroy callback when adding the watch),
therefore it is only necessary to remove the watch.
destroy_watcher() will be automatically called when removing the D-Bus
watch (it was set as the destroy callback when adding the watch),
therefore it is only necessary to remove the watch.
Even though service watches accepted a "destroy" callback, they were
being ignored. This fix properly pass them along so they are called when
the watch is removed.
Any new header files (att-database.h in this case) need to be added to
Makefile.am.
Fixes this "make distcheck" error:
CC attrib/bluetoothd-gatt-service.o
../attrib/gatt-service.c:35:26: fatal error: att-database.h: No such
file or directory
compilation terminated.
make[2]: *** [attrib/bluetoothd-gatt-service.o] Error 1
make[1]: *** [all] Error 2
make: *** [distcheck] Error 1
Use a device driver to track all GATT supporting devices and register
a D-Bus interface per remote device.
Implement the "GetProperties" method of the D-Bus interface by querying
the alert level of the remote device in the link-loss and
immediate-alert proximity profiles. The default alert level values for
non-connected devices are "none".
The profile is implemented in immalert.[ch]. A GATT service is
registered with a write callback on the immediate alert level attribute.
This attribute is write-only and is maintained per remote device.
When a remote device write a raises or lowers the alert level,
an appropriate PropertyChanged signal is emitted. When the alert level
of a device is non-zero, a callback is registered on its disconnection.
When the callback is called, the alert level of the device is reset to
zero and an appropriate signal is emitted.
The profile is implemented in linkloss.[ch]. A GATT service is
registered with read/write callbacks on the link-loss alert level
attribute. The alert level is maintained per device. It is returned
on read and updated on write.
When the alert level is non-zero, a callback is registered on the
disconnection of the remote device. If a device with non-zero alert
state is disconnected, an appropriate PropertyChanged signal is emitted
with the alert level previously set by the device. We avoid emitting
a signal when the disconnection was requested by us.