-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
devices/ssc335de_lite_uniview-c1l-2wn-g/general/overlay/etc/init.d/S97qrscan
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
case "$1" in | ||
start) | ||
qrscan.sh >/dev/null 2>&1 & | ||
;; | ||
esac |
Binary file added
BIN
+122 KB
devices/ssc335de_lite_uniview-c1l-2wn-g/general/overlay/usr/lib/sounds/ready_48k.pcm
Binary file not shown.
29 changes: 29 additions & 0 deletions
29
devices/ssc335de_lite_uniview-c1l-2wn-g/general/overlay/usr/sbin/qrscan.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
gpio=64 # RED COLOR LED, BLUE = 65 | ||
n=0 | ||
|
||
gpio set 64 | ||
gpio set 65 | ||
|
||
gpio clear ${gpio} | logger -t gpio | ||
|
||
while true ; do | ||
if [ "$n" -ge 30 ]; then | ||
logger -t qrscan "Recognition timeout exceeded, reboot camera and try again..." | ||
gpio set ${gpio} | logger -t gpio | ||
exit 1 | ||
fi | ||
timeout 1 wget -q -O /tmp/image.jpg http://127.0.0.1/image.jpg | ||
data=$(qrscan -p /tmp/image.jpg) | ||
if [[ -n "$data" ]] && $(echo "$data" | grep -q wlan); then | ||
fw_setenv $(echo $data | cut -d " " -f 1 | sed 's/=/ /') | ||
fw_setenv $(echo $data | cut -d " " -f 2 | sed 's/=/ /') | ||
logger -t qrscan "Recognition successfully, wlanssid and wlanpass is writed to env. Reboot required." | ||
curl --data-binary @/usr/lib/sounds/ready_48k.pcm http://localhost/play_audio | ||
sleep 3 | ||
reboot -f | ||
fi | ||
sleep 1 | ||
n=$((n + 1)) | ||
done |
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