The first three patches are small unrelated tidy-ups that I made while working on the main patch. The unrelated patches are nevertheless included in this series, because if they are not applied first, the fourth patch might not apply cleanly. The fourth patch delays bluetooth card creation until all profiles are connected (or until the 3 second timeout has expired). The fifth patch removes the code from module-card-restore that conflicts with module-bluetooth-policy. I tested this with BlueZ 5. However, my headset doesn't work properly: usually only the A2DP profile gets connected, and in some rare instances only HSP gets connected initially, and A2DP gets connected much later (maybe around 15 seconds, I didn't measure, and this case is difficult to reproduce). Therefore, I don't know if the 3 second timeout is large enough for common cases. For the same reason I couldn't test that module-card-restore works as expected. Testing by people with a better-working bluetooth setup would be very welcome. This may very well cause a regression for BlueZ 4, because I didn't make the corresponding changes there. The code isn't identical with BlueZ 5, and it would be a bit difficult for me to test with BlueZ 4. What do others think - should I nevertheless try to install BlueZ 4 and update the BlueZ 4 code too, or can we let the BlueZ 4 code just rot? Tanu Kaskinen (5): bluetooth: don't allow creating transports for invalid devices bluetooth: remove a redundant assignment bluetooth: update device's valid flag after parsing properties bluetooth: wait for all profiles to connect before creating card card-restore: don't switch profiles when availability changes src/modules/bluetooth/backend-native.c | 5 +- src/modules/bluetooth/backend-ofono.c | 3 + src/modules/bluetooth/bluez5-util.c | 124 ++++++++++++++++++++++++++++++++- src/modules/bluetooth/bluez5-util.h | 2 + src/modules/module-card-restore.c | 32 --------- 5 files changed, 131 insertions(+), 35 deletions(-) -- 2.8.1