View Single Post
Halftux's Avatar
Posts: 862 | Thanked: 2,511 times | Joined on Feb 2012 @ Germany
#20
So here comes the easy btpan application. It is designed to make a bt pan connection with forwarded gprs0 network. But it doesn't hurt when gprs network is down then it is like a network connection, for example to copy files from N900 to PC.
The application checks for bt power state and switches the power on if its needed. Then it waits until a bt event is coming from the PC. When the application closes it switches the bt power off.


In principle it is a bluetooth trigger application, it is triggered by a bt connect and it will run the script /opt/btpan/bt_on.sh and when the connection get lost or you close the application, it calls the /opt/btpan/bt_off.sh script. Be aware that these scripts will be started as root. The permission is also set to root.
It has an sudoers entry so you could run it from application manager.
Another way could be for root /usr/bin/run-standalone btpan and as a user sudo /usr/bin/run-standalone btpan.

If you would like to run the application as user only btpan should be enough and the scripts must have the permission executeable by the user. Not tested so far but would be nice if it is possible for other bt scripts which does not need root rights.

The delivered standard scripts will destroy your firewall settings so the best would be to modify them to your needs. It will flush everything and only gprs forwarding will be active, this means no firewall. I still recommend to use genwall.

If this application is what you want I can also upload the application to extras.

The task for the community is to make an icon, best would be a svg one and to choose maybe a different name, up to you all.
I could make an automatic network detection for choose wlan or gprs.

And by the way I made a clean devuan ascii install on a test machine and there was no need to modify the test-network script.

During pairing the application shouldn't run. But the bt adapter should be on and visible.

Prerequirements for btpan:
[N900]
/etc/bluetooth/main.conf
comment out this line (or remove network): DisablePlugins =network,input,hal
iptables and kernel-power
dbus-send should be available



needed packages on PC:
bluetooth
bluez-test-scripts
bluez-tools
Connect:

PC as root:
bluetoothctl
power on
agent on
when you need pairing: pairable on
when you need pairing (look for mac): scan on
when you need pairing (pair the device): pair 00:00:00:00:00:00
N900:
start btpan
PC as user replace with your N900 mac address(if input/output error do again):
cd /usr/share/doc/bluez-test-scripts/examples
./test-network 00:00:00:00:00:00:00 nap
PC as root:
dhclient bnep0
Disconnect:

PC as user:
ctrl+c
PC as root:
(pairable off)
agent off
power off
quit
N900:
close btpan
Attached Files
File Type: deb btpan_0_0_1_armel.deb (35.3 KB, 18 views)

Last edited by Halftux; 2019-09-17 at 23:58.
 

The Following 4 Users Say Thank You to Halftux For This Useful Post: