18 lines
424 B
Plaintext
18 lines
424 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# (1) Get iface name #
|
||
|
iface="`hciconfig | awk '{print $1'} | grep -P ':$' | sed 's/://' | head -n 1`";
|
||
|
|
||
|
# (2) Enable secure pairing #
|
||
|
sudo hciconfig $iface sspmode 1;
|
||
|
sudo hciconfig $Iface piscan;
|
||
|
|
||
|
# (3) Find device mac addr #
|
||
|
macaddr="`hcitool scan | grep -vP '^Scan'`";
|
||
|
|
||
|
# If nothing found -> exit
|
||
|
|
||
|
# (4) Pair with device #
|
||
|
# newiface target channel
|
||
|
sudo rfcomm bind /dev/rfcomm1 $macaddr 1;
|