lilzz wrote:but at times pi has no keyboard and monitor, so how to automate the pairing without typing and viewing on monitor?
The PIN code is there for a reason; security. I wouldn't want just anybody pairing their computer with mine. SSH is one option for pairing to a Pi with no keyboard or monitor (a network connection is of course required).
If you REALLY want to pair without a PIN code, you can have bluez-simple-agent running in the background with the 'NoInputNoOutput' flag set
Code: Select all
sudo bluez-simple-agent -c NoInputNoOutput &
for example. The pi will still need to be 'discoverable'. You can set the discoverable timeout to '0' (no timeout) in /etc/bluetooth/main.conf, and run 'sudo hciconfig piscan' at boot time. But again, this means that anybody can pair to the Pi at any time. Better, have a button that runs the 'sudo hciconfig piscan', and leave the timeout at the default 180 seconds. That at least limits the window for unauthorized access.