Created
April 7, 2023 23:41
-
-
Save vitouXY/7e0678e2d4d9afb43024621a07108b40 to your computer and use it in GitHub Desktop.
RPi | Bluetooth PAN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bluetooth PAN | |
exit 0 | |
# https://raspberrypi.stackexchange.com/questions/29504/how-can-i-set-up-a-bluetooth-pan-connection-with-a-raspberry-pi-and-an-ipod | |
#apt-get install --no-install-recommends bluez-tools | |
echo -en 'list' | bluetoothctl | |
cat <<EOF> /etc/systemd/network/pan0.netdev | |
[NetDev] | |
Name=pan0 | |
Kind=bridge | |
EOF | |
cat <<EOF> /etc/systemd/network/pan0.network | |
[Match] | |
Name=pan0 | |
[Network] | |
Address=172.20.1.1/24 | |
DHCPServer=yes | |
EOF | |
cat <<EOF> /etc/systemd/system/bt-agent.service | |
[Unit] | |
Description=Bluetooth Auth Agent | |
[Service] | |
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput | |
Type=simple | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
cat <<EOF> /etc/systemd/system/bt-network.service | |
[Unit] | |
Description=Bluetooth NEP PAN | |
After=pan0.network | |
[Service] | |
ExecStart=/usr/bin/bt-network -s nap pan0 | |
Type=simple | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
#systemctl enable systemd-networkd | |
#systemctl enable bt-agent | |
#systemctl enable bt-network | |
systemctl start systemd-networkd | |
systemctl start bt-agent | |
systemctl start bt-network | |
bt-adapter --set Discoverable 1 | |
exit 0 | |
echo -en 'discoverable on' | bluetoothctl | |
echo -en 'pairable on' | bluetoothctl | |
echo -en 'agent on' | bluetoothctl | |
echo -en 'default-agent' | bluetoothctl | |
echo -en 'scan on' | bluetoothctl | |
echo -en 'pair XX:XX:XX:XX:XX:XX' | bluetoothctl | |
echo -en 'scan off' | bluetoothctl | |
echo -en 'info XX:XX:XX:XX:XX:XX' | bluetoothctl | |
#echo -en 'trust XX:XX:XX:XX:XX:XX' | bluetoothctl | |
#echo -en 'conect XX:XX:XX:XX:XX:XX' | bluetoothctl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment