Patch adds new option to main.conf - NameResolving. If NameResolving=false
then we don't ask remote devices for their names after inquiry. Default
value is true.
Agent may quit/unregister while a response was already received but not
processed which may cause bluetoothd to misinterpret the response and unmark
temporary flag.
Now that the plugins are loaded before any adapter is initialized it is
not necessary to monitor bluetoothd startup using the "starting" variable
anymore.
During initial startup if InitiallyPowered=false we might not get the
"write class of device complete" HCI event before bluetoothd puts the
adapter DOWN. In this case the correct class never gets written to storage
but stays in adapter->svc_cache instead. This patch makes sure that the
right class is always set in adapter_up().
The workaround is necessary to identify situations when there is no device
around but periodic inquiry is active which would prevent DeviceDisappered
signals from being emitted.
With the BtIO API the way to abort some operation is by calling
g_io_channel_shutdown. This will cause the corresponding file descriptor to be
closed and G_IO_NVAL to be reported to the BtIO internal watch callback. When
BtIO gets G_IO_NVAL it knows not to call back to the application since the
operation is considered aborted.
There's unfortunately a race condition associated with this. The G_IO_NVAL will
get reported only in the next main loop iteration that follows the one where
the file descriptor was closed. So, if there was input or an error for the file
descriptor in the same iteration where it was closed the BtIO internal watch
will get called with something other than G_IO_NVAL. In other words calling
g_io_channel_shutdown doesn't provide a 100% guarantee that the application
callback will not get called.
This patch fixes the problem by doing a secondary check for POLLNVAL by calling
poll() with a zero timeout in the BtIO internal watch functions.