On Sat, 2012-02-04 at 12:32 +0100, Erwan Martin wrote: > So, I'll answer my own question: > > Here's what happens: > In src/modules/bluetooth/bluetooth-util.c: > 1) found_device() calls org.bluez.Device.GetProperties. > 2) get_properties_reply() parses the first properties, then calls > parse_device_property(). > 3) parse_device_property() sees that the device has interface > A2DP_SINK_UUID, so it calls org.bluez.AudioSink.GetProperties > asynchronously. > 4) get_properties_reply() calls its callback, load_module_for_device() > (in src/modules/bluetooth/module-bluetooth-discover.c). This callback > loads module-bluetooth-device, which creates the audio card. > > The problem is that in my configuration, the answer to > org.bluez.AudioSink.GetProperties does not come before > load_module_for_device() is called. In that case, the device is > instantiated with its properties half loaded (device->audio_state == > connected but device->audio_sink_state == invalid_state), hence no > profile is selected. > > The fact that we are dealing with a concurrency issue was why I could > not reproduce this with my other system. > > I don't have any system where I can compile and test the latest version, > so I don't know if this problem was fixed since 0.9.21. > Should I create a proper bug report? It would really help if you could test with a more recent version. 0.9.21 is more than 2 years old, and a *lot* of changes have been made since. Luiz, I see from the patch you posted that the GetProperties bit might still be racy. Could this be what Erwan is facing? -- Arun