Ticket #499 (new defect)
Time gap between bluetooth resource request and bluez fully running
|Reported by:||pespin||Owned by:||mickey|
|Keywords:||resource bluetooth bluez||Cc:|
Writing a bluetooth manager in C for the openmoko I arrived to this problem: There's a gap of time between the app receiving a response message from frameworkd after requsting Bluetooth resource and bluez actually start running.
I had a function in Bluetooth request callback which starts using bluez and sends a message to get the default adapter. However, it seems that as the function is immediatelly after the bluetooth request, bluez hasn't have time to start operating in dbus. As a consequence, the bluez method I call returns a null pointer to a reply message, and this dbus error:
Error: org.freedesktop.DBus.Error.ServiceUnknown? - The name org.bluez was not provided by any .service files.
According to mickey in irc:
<mickey|XmasCold?> ok, i think i know what happens
<mickey|XmasCold?> FSO turns it on
<mickey|XmasCold?> then returns
<mickey|XmasCold?> bluetooth is a USB device on the FR
<mickey|XmasCold?> meaning it appears on the bus
<mickey|XmasCold?> gets enumerated
<mickey|XmasCold?> and registered by bluez
<mickey|XmasCold?> only some time after it's powered on
Some solutions I can think of:
- replymessage from RequestResource?() message should only arrive when bluez is correctly running
- add a signal to know when it is working?