BluePinHelper
While there are dedicated PIN helpers for both Opie and GPE, sometimes a simpler, more robust and automatic approach is needed. While the default PIN is enough for incoming connections, a helper is needed to connect to other devices from Familiar.
The simple approach
The easiest way to do this is simply to parse the default PIN:
#!/bin/sh echo "PIN:"$(cat /etc/bluetooth/pin) exit 0
The list
Yet in many cases this is not enough. Either for security reasons, or because some devices have fixed PINs, a more diverse approach is needed. One solution to this problem is to have a file with the list of devices and pins.
The list of PINs (file)
Here the list is assumed to be in /etc/bluetooth/pins, it should contain:
-
remote device address
-
the PIN
-
some comment (mandatory)
All separated by spaces. The file is compatible with PIN helper by Dave Mielke, which I hope will become the standard for BlueZ (If you're using his script, the comment is not required).
An example:
00:00:00:00:00:00 812346 Phone 01:01:01:02:02:02 7321 PC
Basic script
The following script is a simple way to extract the correct PIN from the list.
#!/bin/sh echo "PIN:"$(grep $2 /etc/bluetooth/pins|sed s/^[a-zA-Z0-9:]*\ //| sed s/\ .*$//) exit 0
Dave Mielke's script
There is a more complex way to deal with the list.. For now the script is not yet 100% complete (99,9%). But if you want to try it, or to have both the list and the system PIN helper for Opie or GPE , you can find this script in bluz-devel mailing list archives. To use it in a simple manner you will need /etc/bluetooth/bluepin.conf (or a corresponding file if you change the name from bluepin):
prompt no command path_to_the_secondary_pinhelper