Skip to content

Instantly share code, notes, and snippets.

@KonradIT
Last active May 22, 2024 19:09
Show Gist options
  • Save KonradIT/99d887210dec002111e1 to your computer and use it in GitHub Desktop.
Save KonradIT/99d887210dec002111e1 to your computer and use it in GitHub Desktop.
GoPro HERO3 Black's interesting executable / wifi configuration / script files, most of them are from /usr/local/share/script
#!/bin/sh
cd /
umount /pref
echo 3 > /proc/sys/vm/drop_caches
#wifi mode is specified
if [ "${1}" == "ap" ]; then
echo -e "\nPress CTRL+C now if you want to skip hibernation"
echo "killall hostapd"
killall hostapd
echo "sleep 1"
sleep 1
elif [ "${1}" == "p2p" ]; then
echo -e "\nPress CTRL+C now if you want to skip hibernation"
echo "killall wpa_supplicant wpa_cli wpa_event.sh"
killall wpa_supplicant wpa_cli wpa_event.sh
echo "sleep 1"
sleep 1
killall -9 wpa_supplicant wpa_cli wpa_event.sh 2>/dev/null
rm -f /tmp/wpa_p2p_done /tmp/wpa_last_event
fi
echo disk > /sys/power/state
#/pref
mountpref=`cat /proc/mounts |grep "ubi0:pref"`
if [ "${mountpref}" == "" ]; then
mount -t ubifs ubi0:pref /pref
fi
#send AMSG_CMD_BOSS_BOOTED
boot_done
#fix: boss qboot during video recording, wifi needs time to bringup
AR6K=`lsmod | grep ar6`
if [ "${AR6K}" != "" ] && [ -e /sys/bus/sdio/devices/mmc1:0001:1 ]; then
n=0
ifconfig wlan0
waitagain=$?
while [ $n -ne 60 ] && [ $waitagain -ne 0 ]; do
n=$(($n + 1))
echo $n
sleep 1
ifconfig wlan0
waitagain=$?
done
fi
#wifi mode is specified, skip auto-detection and recovery
if [ "${1}" == "ap" ]; then
hostapd -B /tmp/hostapd.conf && boot_done 1 2 1
exit 0
elif [ "${1}" == "p2p" ]; then
wpa_supplicant -i wlan0 -c /tmp/p2p.conf -D ar6003 -B
wpa_cli -B -a /usr/local/share/script/wpa_event.sh
wpa_cli p2p_set ssid_postfix "_AMBA"
wpa_cli p2p_find
boot_done 1 2 1
exit 0
fi
#recover wlan0 softap
hostapd_cmd=`ps www|grep hostapd|grep -v grep|tr -s ' '|cut -d ' ' -f 5-`
if [ "${hostapd_cmd}" != "" ]; then
dnsmasq_cmd=`ps www|grep dnsmasq|grep -v grep|tr -s ' '|cut -d ' ' -f 5-`
killall hostapd; sleep 1
killall -9 dnsmasq
${hostapd_cmd} &
if [ "${dnsmasq_cmd}" != "" ]; then
${dnsmasq_cmd} &
fi
#Wifi Ready on SoftAP mode
#SendToItron 0xf403002c 2 0
boot_done 1 2 1
fi
#recover p2p
wpa_event=`ps www|grep wpa_event|grep -v grep`
if [ "${wpa_event}" != "" ]; then
killall wpa_supplicant wpa_cli wpa_event.sh; sleep 1
killall -9 wpa_supplicant wpa_cli wpa_event.sh 2>/dev/null
rm -f /tmp/wpa_p2p_done /tmp/wpa_last_event
wpa_supplicant -i wlan0 -c /tmp/p2p.conf -D ar6003 -B
wpa_cli -B -a /usr/local/share/script/wpa_event.sh
wpa_cli p2p_set ssid_postfix "_AMBA"
wpa_cli p2p_find
boot_done 1 2 1
fi
udhcpc_cmd=`ps www|grep udhcpc|grep -v grep|tr -s ' '|cut -d ' ' -f 5-`
if [ "${udhcpc_cmd}" != "" ]; then
killall udhcpc
${udhcpc_cmd} &
if [ "${wpa_supplicant_cmd}" != "" ]; then
#Wifi Ready on Station mode
SendToItron 0xf403002c 1 0
fi
fi
#recover eth0
eth0_up=`ifconfig eth0 | grep "inet addr"`
if [ "${eth0_up}" != "" ]; then
ifconfig eth0 down
ifconfig eth0 up
fi
#!/bin/sh
reset_conf()
{
echo "config corrupted, reset wifi.conf"
cp /usr/local/share/script/wifi.conf /pref/wifi.conf
cat /pref/wifi.conf | sed -e 's/$/\r/' > /tmp/fuse_d/MISC/wifi.conf
killall hostapd dnsmasq 2>/dev/null
}
apply_ap_conf()
{
#Load the parameter settings
conf=`cat /pref/wifi.conf | grep -Ev "^#"`
#LOCAL_IP
LOCAL_IP=`echo "${conf}" | grep LOCAL_IP | cut -c 10-`
echo "LOCAL_IP=${LOCAL_IP}"
killall udhcpc
ifconfig wlan0 $LOCAL_IP
if [ $? -ne 0 ]; then
reset_conf
return 1
fi
route add default gw $LOCAL_IP
#LOCAL_NETMASK
LOCAL_NETMASK=`echo "${conf}" | grep LOCAL_NETMASK | cut -c 15-`
echo "LOCAL_NETMASK=${LOCAL_NETMASK}"
ifconfig wlan0 netmask $LOCAL_NETMASK
if [ $? -ne 0 ]; then
reset_conf
return 1
fi
#DHCP_IP_START DHCP_IP_END
DHCP_IP_START=`echo "${conf}" | grep DHCP_IP_START | cut -c 15-`
echo "DHCP_IP_START=${DHCP_IP_START}"
DHCP_IP_END=`echo "${conf}" | grep DHCP_IP_END | cut -c 13-`
echo "DHCP_IP_END=${DHCP_IP_END}"
dnsmasq -5 -K -R -n --dhcp-range=$DHCP_IP_START,$DHCP_IP_END,1h
if [ $? -ne 0 ]; then
reset_conf
return 1
fi
#generate hostapd.conf
echo "interface=wlan0" > /tmp/hostapd.conf
echo "ctrl_interface=/var/run/hostapd" >> /tmp/hostapd.conf
echo "beacon_int=100" >> /tmp/hostapd.conf
echo "dtim_period=1" >> /tmp/hostapd.conf
echo "preamble=0" >> /tmp/hostapd.conf
#AP_SSID
AP_SSID=`echo "${conf}" | grep AP_SSID | cut -c 9-`
echo "AP_SSID=${AP_SSID}"
echo "ssid=${AP_SSID}" >> /tmp/hostapd.conf
#AP_MAXSTA
AP_MAXSTA=`echo "${conf}" | grep AP_MAXSTA | cut -c 11-`
echo "AP_MAXSTA=${AP_MAXSTA}"
echo "max_num_sta=${AP_MAXSTA}" >> /tmp/hostapd.conf
#AP_CHANNEL
AP_CHANNEL=`echo "${conf}" | grep AP_CHANNEL | cut -c 12-`
echo "AP_CHANNEL=${AP_CHANNEL}"
if [ ${AP_CHANNEL} -lt 0 ]; then
reset_conf
return 1
fi
if [ $AP_CHANNEL -ne 0 ]; then
echo "channel_num=${AP_CHANNEL}" >> /tmp/hostapd.conf
fi
#WEP, WPA, No Security
AP_PUBLIC=`echo "${conf}" | grep AP_PUBLIC | cut -c 11-`
echo "AP_PUBLIC=${AP_PUBLIC}"
AP_WEP=`echo "${conf}" | grep AP_WEP | cut -c 8-`
echo "AP_WEP=${AP_WEP}"
if [ "${AP_PUBLIC}" != "yes" ] && [ "${AP_PUBLIC}" != "Yes" ] && [ "${AP_PUBLIC}" != "YES" ]; then
if [ "${AP_WEP}" != "yes" ] && [ "${AP_WEP}" != "Yes" ] && [ "${AP_WEP}" != "YES" ]; then
#WPA
WPA_VERSION=`echo "${conf}" | grep WPA_VERSION | cut -c 13-`
echo "WPA_VERSION=${WPA_VERSION}"
echo "wpa=${WPA_VERSION}" >> /tmp/hostapd.conf
WPA_PAIRWISE=`echo "${conf}" | grep WPA_PAIRWISE | cut -c 14-`
echo "WPA_PAIRWISE=${WPA_PAIRWISE}"
echo "wpa_pairwise=${WPA_PAIRWISE}" >> /tmp/hostapd.conf
AP_PASSWD=`echo "${conf}" | grep AP_PASSWD | cut -c 11-`
echo "AP_PASSWD=${AP_PASSWD}"
echo "wpa_passphrase=${AP_PASSWD}" >> /tmp/hostapd.conf
echo "wpa_key_mgmt=WPA-PSK" >> /tmp/hostapd.conf
else
#WEP
WEP_DEFAULT_KEY=`echo "${conf}" | grep WEP_DEFAULT_KEY | cut -c 17-`
echo "WEP_DEFAULT_KEY=${WEP_DEFAULT_KEY}"
echo "wep_default_key=${WEP_DEFAULT_KEY}" >> /tmp/hostapd.conf
WEP_KEY0=`echo "${conf}" | grep WEP_KEY0 | cut -c 10-`
echo "WEP_KEY0=${WEP_KEY0}"
echo "wep_key0=${WEP_KEY0}" >> /tmp/hostapd.conf
WEP_KEY1=`echo "${conf}" | grep WEP_KEY1 | cut -c 10-`
echo "WEP_KEY1=${WEP_KEY1}"
echo "wep_key1=${WEP_KEY1}" >> /tmp/hostapd.conf
WEP_KEY2=`echo "${conf}" | grep WEP_KEY2 | cut -c 10-`
echo "WEP_KEY2=${WEP_KEY2}"
echo "wep_key2=${WEP_KEY2}" >> /tmp/hostapd.conf
WEP_KEY3=`echo "${conf}" | grep WEP_KEY3 | cut -c 10-`
echo "WEP_KEY3=${WEP_KEY3}"
echo "wep_key3=${WEP_KEY3}" >> /tmp/hostapd.conf
AUTH_ALGS=`echo "${conf}" | grep AUTH_ALGS | cut -c 11-`
echo "AUTH_ALGS=${AUTH_ALGS}"
echo "auth_algs=${AUTH_ALGS}" >> /tmp/hostapd.conf
fi
fi
hostapd -B /tmp/hostapd.conf
if [ $? -ne 0 ]; then
reset_conf
return 1
fi
if [ $AP_CHANNEL -eq 0 ]; then
#ACS (Automatic Channel Selection) between 1, 6, 11
iwconfig wlan0 channel 0
iwconfig wlan0 commit
fi
#send wifi status update message (Wifi On, AP mode, need to do wifi_postproc)
#SendToItron 0xf403002c 2 1
boot_done 1 2 1
return 0
}
apply_ap_conf
rval=$?
echo -e "rval=${rval}\n"
if [ ${rval} -ne 0 ]; then
killall -9 hostapd dnsmasq 2>/dev/null
apply_ap_conf
fi
#!/bin/sh
pid_dnsmasq=`ps | grep dnsmasq | grep -v grep| awk '{print $1;}'`
killall hostapd
kill -9 $pid_dnsmasq
# Server
#
server!bind!1!port = 80
server!timeout = 180
server!keepalive = 1
server!keepalive_max_requests = 5000
server!chunked_encoding = 1
server!server_tokens = full
server!panic_action = /sbin/cherokee-panic
server!pid_file = /var/run/cherokee.pid
# Default virtual server
#
vserver!1!nick = default
#vserver!1!collect_statistics = 0
vserver!1!document_root = /var/www
vserver!1!directory_index = index.html
vserver!1!rule!1!match = default
vserver!1!rule!1!handler = common
vserver!1!rule!1!handler!iocache = 1
vserver!1!rule!2!match = directory
vserver!1!rule!2!match!directory = /icons
vserver!1!rule!2!handler = file
vserver!1!rule!2!document_root = /usr/share/cherokee/icons
vserver!1!rule!3!match = directory
vserver!1!rule!3!match!directory = /cherokee_themes
vserver!1!rule!3!document_root = /usr/share/cherokee/themes
vserver!1!rule!3!handler = file
#
# 20120424JY - cgi bin for hd2media and hd2thumbnail
#
vserver!1!rule!4!document_root = /usr/local/gopro/cgi-bin
vserver!1!rule!4!handler = cgi
vserver!1!rule!4!match = directory
vserver!1!rule!4!match!directory = /gp
# Icons
#
vserver!1!rule!1!match = default
vserver!1!rule!1!no_log = 1
vserver!1!rule!1!only_secure = 0
icons!default = page_white.png
icons!directory = folder.png
icons!parent_directory = arrow_turn_left.png
icons!suffix!film.png = mp4,ts
icons!suffix!camera.png = jpg,jpeg,jpe
# Mime types
#
mime!image/jpeg!extensions = jpeg,jpg,jpe
mime!video/mp4!extensions = mp4,lrv,MP4,LRV
mime!video/ts!extensions = ts
#!/bin/sh
# udhcpc script edited by Tim Riker <[email protected]>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
/sbin/ifconfig $interface 0.0.0.0
;;
renew|bound)
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
for i in $router ; do
route add default gw $i dev $interface
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0
#!/bin/sh
pid_dnsmasq=`ps | grep dnsmasq | grep -v grep| awk '{print $1;}'`
killall hostapd
kill -9 $pid_dnsmasq
rmmod ar6003
#!/bin/sh
rmmod ar6003
insmod /lib/modules/ar6003.ko
sleep 3;
killall udhcpc
ifconfig wlan0 192.168.42.1
hostapd /tmp/hostapd.conf &
dnsmasq --no-daemon --no-resolv --no-poll --dhcp-range=192.168.42.2,192.168.42.5,1h &
#==============================================================================#
[global]
media_path=/tmp/fuse_d/DCIM/
#==============================================================================#
[gpStream]
# Buffer size to read preview ts files. default 400000. TCP Only
buffer_size=400000
# on = 1, off = 0
log_level=0
# TCP or UDP
ip_protocol=UDP
# TCP or UDP port (will be deprecated)
server_port=8554
# How long camera send ts files without keep alive signal from client (in secs)
keep_alive_threshold=10
# latest ts file check poll wait in micro sec. default = 5000
ts_poll_wait=1000
# Temp setting for testing
client_ip_address=192.168.1.33
# Deprecated Options
# ts header on: 1/off: 0 (next_seg_no:ts_seg_size). TCP only.
#ts_header=1
# use mmap or fread & memory
#use_mmap=0
# use minumum scan and auto increment of segment
#use_minscan=0
# How often client send keep alive signal to camera (number of ts files)
#keep_alive=10
#==============================================================================#
[gpMediaCache]
mod=0
size=1
# run memcached as
user=root
# file socket for memcached
socket=/tmp/mc.sock
# memcached memory size in MB
cache_size=2
#==============================================================================#
[gpBroadcaster]
# gpBroadcaster.conf file
# Location: /usr/local/gopro/etc/gpBroadcaster.conf
#
# How many retries if gpBroadcaster does not get oauth token from server
oauth_token_get_retries=3
# How many retires if gpBroadcaster does not get broadcast token from server
broadcast_token_get_retries=3
# How many retries if gpBroadcaster is not able to upload ts files to server
# (Not for the same file retries. It always uploads latest ts files)
# Only consecutive failure will result in exiting of gpBroadcaster.
upload_ts_retries=120
# log off: 0, log on:1, more log:2
log_level=0
# Location of OAuth token file
oauth_token_file=/pref/cloud_token
# Curl protocol
curl_protocol=http
# Curl port to bypass BP
curl_port=80
# Cloud IP address. Leave it blank not to use IP address.
cloud_ip=127.0.0.1
# Media path to ts files (Do not omit / at the end of path)
media_path=/var/www/live/
# status 1: on 0: off
status=1
# Full path to stats file
status_file=/tmp/fuse_d/broadcaster_state.csv
# Number of segments to aggregate in stats before output to a file (default = 8)
status_interval=8
#==============================================================================#
[gpUploader]
# gpUploader.conf file
# Location: /usr/local/gopro/etc/gpUploader.conf
#
# How many retries if gpBroadcaster does not get oauth token from server
oauth_token_get_retries=3
# How many retires if gpBroadcaster does not get broadcast token from server
broadcast_token_get_retries=3
# How many retries if gpBroadcaster is not able to upload ts files to server
# (Not for the same file retries. It always uploads latest ts files)
# Only consecutive failure will result in exiting of gpBroadcaster.
upload_ts_retries=120
# log off: 0, log on:1, more log:2
log_level=0
# Location of OAuth token file
oauth_token_file=/pref/cloud_token
# Curl protocol
curl_protocol=http
# Curl port to bypass BP
curl_port=80
# Cloud Upload URL
cloud_upload_url=api.sandbox.staging.gopro.com/v1/tickets
# Upload queue file location (Do not omit / at the end of path)
#upload_queue_path=/tmp/fuse_d/MISC/
upload_queue_path=/pref/
# gpUploader upload history file location (Do not omit / at the end of path)
upload_history_path=/tmp/fuse_d/MISC/
# gpUploader idle temp file
gpuploader_idle_file=/tmp/gpuploader_idle_file
#==============================================================================#
<script type="text/JavaScript">
<!--
var newImage = new Image();
newImage.src = "./amba.jpg?ts=1";
num = 1;
function reloadImage()
{
if(newImage.complete) {
document.viewfinder.src = newImage.src;
newImage = new Image();
newImage.src = "./amba.jpg?ts=" + new Date().getTime();
}
setTimeout(reloadImage, 66);
}
-->
</script>
<html>
<head>
</head>
<body onload="JavaScript:reloadImage()">
<img src="./amba.jpg?ts=0" name="viewfinder" />
</body>
</html>
#!/bin/sh
mkdir -p /oem
# mtd12 (add partition)
MTDNUM=$(cat /proc/mtd | grep add | awk -F':' '{print $1}' | sed 's/mtd//')
ubiattach /dev/ubi_ctrl -m ${MTDNUM}
mount -t ubifs ubi1:oem /oem
chroot /oem mount -t proc none /proc
chroot /oem
#!/bin/sh
device_name=`cat /pref/wifi.conf | grep -Ev "^#" | grep P2P_DEVICE_NAME | cut -c 17- | tr ' ' '-'`
if [ "${device_name}" == "" ]; then
postmac=`ifconfig wlan0 | grep HWaddr | awk '{print $NF}' | sed 's/://g' | cut -c 6- | tr 'A-Z' 'a-z'`
device_name=amba-${postmac}
fi
echo "device_name=${device_name}" > /tmp/p2p.conf
echo "ctrl_interface=/var/run/wpa_supplicant" >> /tmp/p2p.conf
echo "device_type=6-0050F204-1" >> /tmp/p2p.conf
echo "config_methods=display push_button keypad" >> /tmp/p2p.conf
wpa_supplicant -i wlan0 -c /tmp/p2p.conf -D ar6003 -B
wpa_cli -B -a /usr/local/share/script/wpa_event.sh
wpa_cli p2p_set ssid_postfix "_AMBA"
wpa_cli p2p_find
boot_done 1 2 1
#!/bin/sh
killall -9 cherokee-worker
#cherokee-worker -a -C /etc/cherokee.conf -j -d
. /tmp/start_webserver.sh
#!/bin/sh
SSID=`cat /pref/wifi.conf | grep -Ev "^#" | grep ESSID | cut -c 7-`
PSK=`cat /pref/wifi.conf | grep -Ev "^#" | grep PASSWORD | cut -c 10-`
echo "$@" > /dev/console
WPA_SCAN ()
{
wpa_supplicant -Dwext -iwlan0 -C /var/run/wpa_supplicant -B
wpa_cli scan
sleep 3
scan_result=`wpa_cli scan_r`
killall wpa_supplicant
echo "${scan_result}" > /dev/console
}
WPA_SCAN
scan_entry=`echo "${scan_result}" | tr '\t' ' ' | grep " ${SSID}$" | tail -n 1`
if [ "${scan_entry}" == "" ]; then
echo "failed to detect SSID ${SSID}, please try to get close to the AP" > /dev/console
exit 1
fi
echo "ctrl_interface=/var/run/wpa_supplicant" > /tmp/wpa_supplicant.conf
echo "network={" >> /tmp/wpa_supplicant.conf
echo "ssid=\"${SSID}\"" >> /tmp/wpa_supplicant.conf
WEP=`echo "${scan_entry}" | grep WEP`
WPA=`echo "${scan_entry}" | grep WPA`
WPA2=`echo "${scan_entry}" | grep WPA2`
CCMP=`echo "${scan_entry}" | grep CCMP`
TKIP=`echo "${scan_entry}" | grep TKIP`
if [ "${WPA}" != "" ]; then
#WPA2-PSK-CCMP (11n requirement)
#WPA-PSK-CCMP
#WPA2-PSK-TKIP
#WPA-PSK-TKIP
echo "key_mgmt=WPA-PSK" >> /tmp/wpa_supplicant.conf
if [ "${WPA2}" != "" ]; then
echo "proto=WPA2" >> /tmp/wpa_supplicant.conf
else
echo "proto=WPA" >> /tmp/wpa_supplicant.conf
fi
if [ "${CCMP}" != "" ]; then
echo "pairwise=CCMP" >> /tmp/wpa_supplicant.conf
else
echo "pairwise=TKIP" >> /tmp/wpa_supplicant.conf
fi
echo "psk=\"${PSK}\"" >> /tmp/wpa_supplicant.conf
fi
if [ "${WEP}" != "" ] && [ "${WPA}" == "" ]; then
echo "key_mgmt=NONE" >> /tmp/wpa_supplicant.conf
echo "wep_key0=${PSK}" >> /tmp/wpa_supplicant.conf
echo "wep_tx_keyidx=0" >> /tmp/wpa_supplicant.conf
fi
if [ "${WEP}" == "" ] && [ "${WPA}" == "" ]; then
echo "key_mgmt=NONE" >> /tmp/wpa_supplicant.conf
fi
echo "}" >> /tmp/wpa_supplicant.conf
killall -9 wpa_supplicant 2>/dev/null
wpa_supplicant -Dwext -iwlan0 -c/tmp/wpa_supplicant.conf -B
# setup_preview.sh
#
# 20121112JY - move preview setup code to script out of uI code
ifconfig usb0 up
ifconfig usb0 10.9.9.1 netmask 255.255.255.0
route add default gw 10.9.9.9
mount --bind /tmp/fuse/live /var/www/live
# mount --bind /tmp/fuse_d /var/www/videos
# mount --bind /tmp/fuse/shutter /var/www/shutter
cherokee-worker -a -C /usr/local/gopro/etc/cherokee.conf &
#!/bin/sh
if [ -f /tmp/fuse_d/MISC/tcp_tuner.sh ]; then
/bin/sh /tmp/fuse_d/MISC/tcp_tuner.sh
fi
#!/bin/sh
echo "AMBA TCP Stack Parameters"
ifconfig wlan0 txqueuelen 10000
#echo 10777216 > /proc/sys/net/core/rmem_max
echo 16777216 > /proc/sys/net/core/rmem_max
echo 16777216 > /proc/sys/net/core/wmem_max
#echo '4096 87380 10777216' > /proc/sys/net/ipv4/tcp_rmem
echo '4096 87380 16777216' > /proc/sys/net/ipv4/tcp_rmem
echo '4096 87380 16777216' > /proc/sys/net/ipv4/tcp_wmem
echo 8000 > /proc/sys/net/core/netdev_max_backlog
echo 0 > /proc/sys/net/ipv4/tcp_timestamps
echo 0 > /proc/sys/net/ipv4/tcp_keepalive_probes
echo 0 > /proc/sys/net/ipv4/tcp_sack
##### Wifi configuration file ##########################################
## Empty lines and lines starting with # are ignored
# ap: SoftAP mode
# sta: Station mode
# p2p: Enable Wifi Direct Support for peer-to-peer connectibity
WIFI_MODE=ap
##### STA mode configuration ##########################################
# SSID
ESSID=amba_boss
# Passphrase. Leave empty at no security mode
PASSWORD=1234567890
##### Wifi Direct configuration ##########################################
# Find devices with correct name prefix and automatically connect at startup
P2P_AUTO_CONNECT=yes
# Auto-connect with devices if the name prefix matches
P2P_CONNECT_PREFIX=amba
# Do not enable this optional field unless you are certain, please provide a unique name amoung multiple devices to prevent confusion
#P2P_DEVICE_NAME=amba-1
##### SoftAP configuration ##########################################
# SSID (1 ~ 32 characters)
AP_SSID=amba_boss
# IP address
LOCAL_IP=192.168.42.1
# IP subnet mask
LOCAL_NETMASK=255.255.255.0
# IP pool starting address of DHCP server
DHCP_IP_START=192.168.42.2
# IP pool end address of DHCP server
DHCP_IP_END=192.168.42.6
# Wifi channel number, set 0 to use Auto Channel Selection
AP_CHANNEL=0
# Maximum number of stations allowed in station table
AP_MAXSTA=5
# If you say yes here, all WPA/WEP settings will be ignored
AP_PUBLIC=no
# WPA Passphrase (8 ~ 63 characters)
AP_PASSWD=1234567890
##### Advanced WPA configuration ##########################################
## Do not modify this section unless you are certain
# This is a bit field, bit0 = WPA, bit1 = WPA2
WPA_VERSION=2
# This is a space separated list of encryption algorithms, TKIP CCMP
WPA_PAIRWISE=CCMP
##### Advanced WEP configuration ##########################################
## Do not modify this section unless you are certain
# If you say yes here, AP_PASSWD, WPA_VERSION, WPA_PAIRWISE will be ignored
AP_WEP=no
# Bit fields of allowed authentication algorithms, bit 0 = Open System, bit 1 = Shared Key
AUTH_ALGS=1
# The key number to use when transmitting. It must be between 0 and 3, and the corresponding key must be set.
WEP_DEFAULT_KEY=0
# A key may be a quoted string (5 or 13 characters) or unquoted hexadecimal digits (10 or 26 digits), depending on whether 64-bit or 128-bit WEP is used
WEP_KEY0=1234567890
WEP_KEY1="vwxyz"
WEP_KEY2=0102030405060708090a0b0c0d
WEP_KEY3=".2.4.6.8.0.23"
#!/bin/sh
#sync config
card_config=0
if [ -e /tmp/fuse_d/MISC/wifi.conf ]; then
card_config=1
echo "==> Load wifi.conf from SD/MISC..."
cat /tmp/fuse_d/MISC/wifi.conf | sed -e 's/\r$//' > /pref/wifi.conf
elif [ -e /tmp/fuse_d/misc/wifi.conf ]; then
card_config=2
echo "==> Load wifi.conf from SD/MISC..."
cat /tmp/fuse_d/misc/wifi.conf | sed -e 's/\r$//' > /pref/wifi.conf
fi
if [ ! -e /pref/wifi.conf ]; then
cp /usr/local/share/script/wifi.conf /pref/wifi.conf
fi
if [ $card_config -eq 0 ]; then
mkdir -p /tmp/fuse_d/MISC
cat /pref/wifi.conf | sed -e 's/$/\r/' > /tmp/fuse_d/MISC/wifi.conf
fi
#check wifi mode
WIFI_MODE=`cat /pref/wifi.conf | grep -Ev "^#" | grep WIFI_MODE | cut -c 11-`
/usr/local/share/script/load.sh "${WIFI_MODE}"
sleep 1
#fix: boss boot during video recording, wifi needs time to bringup
if [ -e /sys/bus/sdio/devices/mmc1:0001:1 ]; then
n=0
ifconfig wlan0
waitagain=$?
while [ $n -ne 60 ] && [ $waitagain -ne 0 ]; do
n=$(($n + 1))
echo $n
sleep 1
ifconfig wlan0
waitagain=$?
done
fi
if [ $waitagain -ne 0 ]; then
echo "There is no WIFI interface!"
exit 1
fi
echo "found WIFI interface!"
if [ "${WIFI_MODE}" == "p2p" ] ; then
/usr/local/share/script/p2p_start.sh
elif [ "${WIFI_MODE}" == "sta" ] ; then
/usr/local/share/script/sta_start.sh
else
/usr/local/share/script/ap_start.sh
fi
#!/bin/sh
wmiconfig -i wlan0 --sethostmode asleep
wmiconfig -i wlan0 --setwowmode enable
if [ "${1}" == "" ]; then
wmiconfig -i wlan0 --addwowpattern 0 2 20 0800 FFFF
else
MAC=`ifconfig wlan0 | grep HWaddr | awk '{print $NF}' | sed 's/://g'`
echo "Only filter match MAC address: ${MAC}"
wmiconfig -i wlan0 --addwowpattern 0 6 0 ${MAC} FFFFFFFFFFFF
wmiconfig -i wlan0 --addwowpattern 0 6 6 ${MAC} FFFFFFFFFFFF
fi
@SilverCory
Copy link

Is there a way to invoke wifi_start.sh? I've been trying with ash files without luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment