Hi, thanks for the reply.
I thought that as you have the "default-agent" command in bluetoothctl, you could load your own agent.
I am trying to get my Pi to pair with and trust my Android phone automatically.
I have modified the agent thus:
Code: Select all
def RequestConfirmation(self, device, passkey):
#### my code
set_trusted(device)
return
#### my code
print("RequestConfirmation (%s, %06d)" % (device, passkey))
confirm = ask("Confirm passkey (yes/no): ")
if (confirm == "yes"):
set_trusted(device)
return
raise Rejected("Passkey doesn't match")
def RequestAuthorization(self, device):
#### my code
return
#### my code
print("RequestAuthorization (%s)" % (device))
auth = ask("Authorize? (yes/no): ")
if (auth == "yes"):
return
raise Rejected("Pairing rejected")
Which I believed would remove the necessity for me to enter a pin, and trust the phone manually.
But if I run bluetoothctl and turn on the power, pairing, and discoverability.
Then exit bluetoothctl and run my modified agent.
Then try to pair on the phone I get an incorrect pin number error.
Cheers, Ian