mirror of
https://github.com/srlabs/blue-merle.git
synced 2024-12-22 21:59:25 -05:00
bridge blue merle functionality to the Web
This follows the pattern of opkg. I took the luci-app-opkg package and tried to follow its behaviour.
This commit is contained in:
parent
4c29fe2732
commit
3e686c79d3
40
files/usr/libexec/blue-merle
Executable file
40
files/usr/libexec/blue-merle
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/blue-merle/functions.sh
|
||||||
|
|
||||||
|
|
||||||
|
show_message() {
|
||||||
|
# There is mcu_send_message() in /lib/functions/gl_util.sh but we don't want to load the file, thinking that it will take too long
|
||||||
|
echo {\"msg\": \"$1\"} > /dev/ttyS0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$1" == "read-imei" ]; then
|
||||||
|
imei="$(READ_IMEI)"
|
||||||
|
echo -n $imei
|
||||||
|
show_message "My IMEI: $imei"
|
||||||
|
|
||||||
|
elif [ "$1" == "read-imsi" ]; then
|
||||||
|
imsi="$(READ_IMSI)"
|
||||||
|
if [ "x$imsi" == "x" ]; then
|
||||||
|
echo "No IMSI found $imsi" >&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -n $imsi
|
||||||
|
show_message "My IMSI: $imsi"
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "$1" == "random-imei" ]; then
|
||||||
|
exec /lib/blue-merle/imei_generate.py --random
|
||||||
|
|
||||||
|
elif [ "$1" == "shutdown-modem" ]; then
|
||||||
|
exec gl_modem AT AT+CFUN=4
|
||||||
|
|
||||||
|
elif [ "$1" == "write-imei" ]; then
|
||||||
|
new_imei=$2
|
||||||
|
echo -n { "action": "write" }
|
||||||
|
else
|
||||||
|
echo -n '{"msg":"Hello, World!"}'
|
||||||
|
#echo 'foo'>&2
|
||||||
|
echo 0
|
||||||
|
fi
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo Hello, World!
|
|
Loading…
Reference in New Issue
Block a user