mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-28 22:54:14 +08:00
Restrucure pincode_cb logic for readability
This commit is contained in:
parent
cdf87d611f
commit
2108bac22c
@ -167,17 +167,26 @@ static void pincode_cb(struct agent *agent, DBusError *derr,
|
||||
bdaddr_t sba, dba;
|
||||
int err;
|
||||
|
||||
adapter_get_address(adapter, &sba);
|
||||
device_get_address(device, &dba);
|
||||
|
||||
err = btd_adapter_pincode_reply(adapter, &dba, derr ? NULL : pincode);
|
||||
if (err < 0) {
|
||||
error("pincode_reply: %s (%d)", strerror(-err), -err);
|
||||
if (derr) {
|
||||
err = btd_adapter_pincode_reply(adapter, &dba, NULL);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
return;
|
||||
}
|
||||
|
||||
if (derr == NULL)
|
||||
set_pin_length(&sba, strlen(pincode));
|
||||
err = btd_adapter_pincode_reply(adapter, &dba, pincode);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
adapter_get_address(adapter, &sba);
|
||||
set_pin_length(&sba, strlen(pincode));
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
error("Sending PIN code reply failed: %s (%d)", strerror(-err), -err);
|
||||
}
|
||||
|
||||
int hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci)
|
||||
|
Loading…
Reference in New Issue
Block a user