Comment 18 for bug 1539158

Revision history for this message
Simon Fels (morphis) wrote :

Analyzed the latest log files and came to following conclusion about that is going on here:

The key point here is that the car initiates the pairing with the phone which then leads to a timing problem in ubuntu-system-settings. But step by step:

Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/adapter.c:device_found_callback() hci0 addr 84:38:35:62:28:DF, rssi -91 flags 0x0000 eir_len 72
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:device_create() dst 84:38:35:62:28:DF
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:device_new() address 84:38:35:62:28:DF
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:device_new() Creating device /org/bluez/hci0/dev_84_38_35_62_28_DF
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:device_set_legacy() legacy 0
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:device_set_rssi_with_delta() rssi -91
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:btd_device_device_set_name() /org/bluez/hci0/dev_84_38_35_62_28_DF MacBook Air de Cristina
Feb 23 09:43:45 ubuntu-phablet bluetoothd[880]: src/device.c:device_set_class() /org/bluez/hci0/dev_84_38_35_62_28_DF 0x38010C

Here we see that bluez correctly finds the device and directly continues with an pairing attempt which it gets from the remote device

Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/adapter.c:pin_code_request_callback() hci0 00:0A:30:B3:52:4B
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/device.c:device_create() dst 00:0A:30:B3:52:4B
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/device.c:device_new() address 00:0A:30:B3:52:4B
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/device.c:device_new() Creating device /org/bluez/hci0/dev_00_0A_30_B3_52_4B
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/device.c:new_auth() Requesting agent authentication for 00:0A:30:B3:52:4B
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/agent.c:agent_ref() 0xb7113930: ref=2
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/agent.c:agent_ref() 0xb7113930: ref=3

So there is basically no time span between the phone detecting the device and getting the pairing request. BlueZ then sends out the pairing request to its registered agents:

Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: Agent /com/canonical/SettingsBluetoothAgent/adapteragent replied with an error: org.bluez.Error.Rejected, The request was rejected: RequestPinCode
Feb 23 09:43:46 ubuntu-phablet bluetoothd[880]: src/adapter.c:btd_adapter_pincode_reply() hci0 addr 00:0A:30:B3:52:4B pinlen 0

.. which gets denied from settings app as it doesn't have the device in its internal list yet. See https://bazaar.launchpad.net/~system-settings-touch/ubuntu-system-settings/trunk/view/head:/plugins/bluetooth/agent.cpp#L115 for details.

We need to rework ubuntu-system-settings here to add the new device based on the object path it gets from bluez with the pairing request.