Hi Tanu, On Thu, Dec 20, 2012 at 1:07 PM, Tanu Kaskinen <tanuk at iki.fi> wrote: > On Wed, 2012-12-19 at 13:58 +0100, Mikel Astiz wrote: >> From: Mikel Astiz <mikel.astiz at bmw-carit.de> >> >> The function is used to make sure some basic information has already >> been gathered before the device is being used. At this point profile >> states can be ignored, since their initial value will be >> PA_BT_AUDIO_STATE_INVALID and thus effectively similar to >> PA_BT_AUDIO_STATE_DISCONNECTED due to audio_state_to_transport_state(). > > Is it necessary to check d->audio_state either? audio_state must be checked but we could move that into pa_bluetooth_device_any_audio_connected(), where other similar conditions are checked. > > Also, the function name doesn't seem very appropriate. If the purpose of > the function is to check whether the device properties have been > received, I think it should be called device_is_initialized() or > something like that. In this case the function could be removed entirely by directly checking device_info_valid, as you suggest, which would make the code more readable. Functions like pa_bluetooth_discovery_get_by_address() would return the device no matter the state of the audio interface. This make sense IMO and it would make no difference in the current codebase since modules make use of devices only after the discovery hook has been triggered. > Btw, this doesn't seem BlueZ 5 specific... Yes, that's why it was first in the patchset. Cheers, Mikel