[ARDrone] Add support firmware 1.6.6
The binary is available in owlps-data (dwc_otg.ko and libioctl.so)
This commit is contained in:
parent
f14ae6e351
commit
82e65d375d
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
# Copie du fichier wifi_setup.sh pour un mode recovery en cas de pb reseau
|
||||
#cp /bin/wifi_setup.sh.orig /bin/wifi_setup.sh
|
||||
|
||||
export LD_PRELOAD=/data/libioctl_arm.so
|
||||
|
||||
UPDATE_PATH=/update/ardrone_update.plf
|
||||
VERSION_PATH=/update/version.txt
|
||||
ERR_PATH=/update/err.log
|
||||
|
||||
echo "Copy version.txt file in ftp directory"
|
||||
cp /firmware/version.txt $VERSION_PATH
|
||||
|
||||
echo "Check if update is necessary ..."
|
||||
if [ -e $UPDATE_PATH ] ; then
|
||||
VERSION=`cat $VERSION_PATH`
|
||||
|
||||
if [ -e $ERR_PATH ] ; then
|
||||
CHECK_ERR=`cat $ERR_PATH`
|
||||
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||
CHECK_PLF=`/bin/checkplf $UPDATE_PATH $VERSION`
|
||||
if [ "$CHECK_PLF" = "NEED_TO_FLASH" ] ; then
|
||||
echo "ERR=FLASH_KO" > $ERR_PATH
|
||||
else
|
||||
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||
fi
|
||||
else
|
||||
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||
fi
|
||||
else
|
||||
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||
fi
|
||||
|
||||
CHECK_ERR=`cat $ERR_PATH`
|
||||
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||
echo "File $UPDATE_PATH exists... Start updating..."
|
||||
pinst_trigger
|
||||
echo "Rebooting..."
|
||||
reboot
|
||||
else
|
||||
if [ "$CHECK_ERR" = "VERSION_OK" ] ; then
|
||||
echo "Version OK"
|
||||
elif [ "$CHECK_ERR" = "ERR=FLASH_KO" ] ; then
|
||||
echo "Error during Updating... Removing..."
|
||||
else
|
||||
echo "File $UPDATE_PATH not valid... Removing..."
|
||||
fi
|
||||
rm -Rf $UPDATE_PATH
|
||||
echo "Start Drone software..."
|
||||
inetd
|
||||
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||
fi
|
||||
else
|
||||
echo "File $UPDATE_PATH doesn't exists... Start Drone software..."
|
||||
if [ -e $ERR_PATH ] ; then
|
||||
rm -Rf $ERR_PATH
|
||||
fi
|
||||
inetd
|
||||
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||
fi
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
# Copie du fichier wifi_setup.sh pour un mode recovery en cas de pb reseau
|
||||
#cp /bin/wifi_setup.sh.orig /bin/wifi_setup.sh
|
||||
|
||||
export LD_PRELOAD=/data/libioctl_arm.so
|
||||
|
||||
UPDATE_PATH=/update/ardrone_update.plf
|
||||
VERSION_PATH=/update/version.txt
|
||||
ERR_PATH=/update/err.log
|
||||
|
||||
echo "Copy version.txt file in ftp directory"
|
||||
cp /firmware/version.txt $VERSION_PATH
|
||||
|
||||
echo "Check if update is necessary ..."
|
||||
if [ -e $UPDATE_PATH ] ; then
|
||||
VERSION=`cat $VERSION_PATH`
|
||||
|
||||
if [ -e $ERR_PATH ] ; then
|
||||
CHECK_ERR=`cat $ERR_PATH`
|
||||
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||
CHECK_PLF=`/bin/checkplf $UPDATE_PATH $VERSION`
|
||||
if [ "$CHECK_PLF" = "NEED_TO_FLASH" ] ; then
|
||||
echo "ERR=FLASH_KO" > $ERR_PATH
|
||||
else
|
||||
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||
fi
|
||||
else
|
||||
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||
fi
|
||||
else
|
||||
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||
fi
|
||||
|
||||
CHECK_ERR=`cat $ERR_PATH`
|
||||
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||
echo "File $UPDATE_PATH exists... Start updating..."
|
||||
pinst_trigger
|
||||
echo "Rebooting..."
|
||||
reboot
|
||||
else
|
||||
if [ "$CHECK_ERR" = "VERSION_OK" ] ; then
|
||||
echo "Version OK"
|
||||
elif [ "$CHECK_ERR" = "ERR=FLASH_KO" ] ; then
|
||||
echo "Error during Updating... Removing..."
|
||||
else
|
||||
echo "File $UPDATE_PATH not valid... Removing..."
|
||||
fi
|
||||
rm -Rf $UPDATE_PATH
|
||||
echo "Start Drone software..."
|
||||
inetd
|
||||
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||
fi
|
||||
else
|
||||
echo "File $UPDATE_PATH doesn't exists... Start Drone software..."
|
||||
if [ -e $ERR_PATH ] ; then
|
||||
rm -Rf $ERR_PATH
|
||||
fi
|
||||
inetd
|
||||
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||
fi
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Script to setup drone pairing
|
||||
#
|
||||
|
||||
# Getting Iphone's MAC address from config.ini file.
|
||||
NULL_MAC=00:00:00:00:00:00
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
if [ -s /data/config.ini ]
|
||||
then
|
||||
MAC_ADDR=`grep owner_mac /data/config.ini | awk -F "=" '{print $2}'`
|
||||
else
|
||||
MAC_ADDR=$NULL_MAC
|
||||
fi
|
||||
else
|
||||
MAC_ADDR=$1
|
||||
fi
|
||||
|
||||
echo "Owner's MAC address is: $MAC_ADDR"
|
||||
|
||||
# [Stephane] Exits if owner MAC address is already being filtered
|
||||
# (changing iptables rules too often may crash the drone for a undetermined reason)
|
||||
CURRENTLY_ALLOWED_MAC_ADDR=`iptables -L | grep MAC | awk -F " " '{print $7}'`
|
||||
if [ "$CURRENTLY_ALLOWED_MAC_ADDR" = "$MAC_ADDR" ]
|
||||
then
|
||||
echo "Drone is already paired with $MAC_ADDR"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $MAC_ADDR != $NULL_MAC ]
|
||||
then
|
||||
echo "Setting pairing for: $MAC_ADDR"
|
||||
# Clearing all rules
|
||||
iptables -P INPUT ACCEPT
|
||||
iptables -F
|
||||
# Allowing only owner's traffic
|
||||
iptables -A INPUT -m mac --mac-source $MAC_ADDR -j ACCEPT
|
||||
# allowing ICMP (ping), ftp, nfs and telnet traffic for everyone.
|
||||
iptables -A INPUT --protocol icmp -j ACCEPT
|
||||
#iptables -A INPUT --protocol tcp --dport 23 -j ACCEPT
|
||||
iptables -A INPUT --protocol tcp --dport 21 -j ACCEPT
|
||||
iptables -A INPUT --protocol tcp --dport 2049 -j ACCEPT
|
||||
# Blocking all incoming traffic by default
|
||||
iptables -P INPUT DROP
|
||||
else
|
||||
echo "Clearing pairing rule"
|
||||
# Switching rad LED on
|
||||
gpio 63 -d ho 1
|
||||
|
||||
# Clearing all rules
|
||||
iptables -F
|
||||
# Allows incoming connections from anywhere outside
|
||||
iptables -P INPUT ACCEPT
|
||||
|
||||
# Switching rad LED off
|
||||
gpio 63 -d ho 0
|
||||
fi
|
|
@ -0,0 +1,127 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Script to see if an IP adress is already used or not
|
||||
#
|
||||
# Getting SSID from config.ini file.
|
||||
|
||||
#initializing random generator
|
||||
cat /data/random_mac.txt > /dev/urandom
|
||||
/bin/random_mac > /data/random_mac.txt
|
||||
|
||||
|
||||
#echo 2 > /proc/cpu/alignment
|
||||
#export WORKAREA=/
|
||||
#export ATH_PLATFORM=ardrone
|
||||
#/usr/sbin/recEvent /data/athdbg.log&
|
||||
|
||||
|
||||
if [ -s /factory/mac_address.txt ]
|
||||
then
|
||||
MAC_ADDR=`cat /factory/mac_address.txt`
|
||||
else
|
||||
MAC_ADDR=`cat /data/random_mac.txt`
|
||||
fi
|
||||
|
||||
loadAR6k.sh --setmac $MAC_ADDR
|
||||
#loadtestcmd.sh
|
||||
|
||||
# Waiting 2s for the wifi chip to be ready
|
||||
sleep 2
|
||||
|
||||
# Increasing scan time to help detecting wifi networks
|
||||
wmiconfig -i ath0 --scan --maxact=80
|
||||
# Setting retry limits to 6
|
||||
wmiconfig -i ath0 --setretrylimits 2 0 6 off
|
||||
# Limiting available rates to 11, 24 or 54 Mb/s
|
||||
wmiconfig -i ath0 --setfixrates 3 8 11
|
||||
# Disabling powersaving
|
||||
wmiconfig -i ath0 --power maxperf
|
||||
|
||||
|
||||
SSID=`grep ssid_single_player /data/config.ini | awk -F "=" '{print $2}'`
|
||||
|
||||
# Removing leading and trailing spaces
|
||||
SSID=`echo $SSID`
|
||||
if [ -n "$SSID" ]
|
||||
then
|
||||
echo "SSID=$SSID"
|
||||
else
|
||||
#default SSID.
|
||||
SSID=ardrone_wifi
|
||||
echo "SSID=\"$SSID\""
|
||||
fi
|
||||
|
||||
|
||||
export NETIF=ath0
|
||||
RANDOM_CHAN=`/bin/channelselector`
|
||||
|
||||
echo "Create/Join Ad-Hoc Network $SSID"
|
||||
|
||||
#iwconfig ath0 mode ad-hoc
|
||||
#iwconfig ath0 channel $RANDOM_CHAN
|
||||
#iwconfig ath0 essid "$SSID"
|
||||
|
||||
iwconfig ath0 mode ad-hoc essid owl_2 channel auto
|
||||
|
||||
OK=0
|
||||
BASE_ADRESS=192.168.1.
|
||||
PROBE=1
|
||||
|
||||
while [ $OK -eq 0 ]
|
||||
do
|
||||
#configuring interface.
|
||||
ifconfig ath0 $BASE_ADRESS$PROBE
|
||||
ifconfig ath0:0 192.168.11.1
|
||||
arping -I ath0 -q -f -D -w 2 $BASE_ADRESS$PROBE
|
||||
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
if [ -s /data/old_adress.txt ]
|
||||
then
|
||||
# Testing previously given adress.
|
||||
PROBE=`cat /data/old_adress.txt`
|
||||
else
|
||||
#generating random odd IP address
|
||||
PROBE=`/bin/random_ip`
|
||||
fi
|
||||
/bin/random_ip > /data/old_adress.txt
|
||||
else
|
||||
echo $PROBE > /data/old_adress.txt
|
||||
OK=1
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#Configuring DHCP server.
|
||||
echo "Using address $BASE_ADRESS$PROBE"
|
||||
echo "start $BASE_ADRESS`expr $PROBE + 1`" > /tmp/udhcpd.conf
|
||||
echo "end $BASE_ADRESS`expr $PROBE + 4`" >> /tmp/udhcpd.conf
|
||||
echo "interface ath0" >> /tmp/udhcpd.conf
|
||||
echo "decline_time 1" >> /tmp/udhcpd.conf
|
||||
echo "conflict_time 1" >> /tmp/udhcpd.conf
|
||||
echo "opt subnet 255.255.255.0" >> /tmp/udhcpd.conf
|
||||
#echo "opt router $BASE_ADRESS$PROBE" >> /tmp/udhcpd.conf
|
||||
echo "opt lease 1200" >> /tmp/udhcpd.conf
|
||||
|
||||
/bin/pairing_setup.sh
|
||||
|
||||
# Saving random info for initialization at next reboot
|
||||
date > /dev/urandom
|
||||
/bin/random_mac > /data/random_mac.txt
|
||||
|
||||
iwconfig ath0 rate 54M
|
||||
iwconfig ath0 rate auto
|
||||
|
||||
telnetd -l /bin/sh
|
||||
udhcpd /tmp/udhcpd.conf
|
||||
#diversity&
|
||||
|
||||
# Adding route for multicast-packet
|
||||
# note : ! should be runned after hostapd is initialized !
|
||||
route add -net 224.0.0.0 netmask 240.0.0.0 dev ath0
|
||||
|
||||
#Adding routing table iptable
|
||||
iptables -t nat -A POSTROUTING -p UDP --sport 8884 -j SNAT --to 192.168.1.254:5554
|
||||
iptables -t nat -A PREROUTING -p UDP -d 192.168.1.254 --dport 5554 -j DNAT --to 192.168.1.1:8884
|
||||
iptables -t nat -A POSTROUTING -p UDP --sport 8886 -j SNAT --to 192.168.1.254:5556
|
||||
optables -t nat -A PREROUTING -p UDP -d 192.168.1.254 --dport 5556 -j DNAT --to 192.168.1.1:8886
|
|
@ -0,0 +1,20 @@
|
|||
# Switch Wifi mode depending on value into /data/config.ini
|
||||
#
|
||||
|
||||
WIFI_MODE=`grep wifi_mode /data/config.ini | awk -F "=" '{ gsub(/ */,"",$2); print $2}'`
|
||||
|
||||
case $WIFI_MODE in
|
||||
0)
|
||||
/bin/wifi_adhoc.sh
|
||||
;;
|
||||
1)
|
||||
/bin/wifi_infra.sh
|
||||
;;
|
||||
2)
|
||||
/bin/wifi_managed.sh
|
||||
;;
|
||||
*)
|
||||
/bin/wifi_adhoc.sh
|
||||
;;
|
||||
esac
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Initialization script for Arduino stuff
|
||||
#
|
||||
# Loads modules and launches proxy server application
|
||||
# required for communication with Arduino module.
|
||||
#
|
||||
|
||||
echo Enabling 5V
|
||||
|
||||
echo Enabling USB Port
|
||||
gpio 127 -d ho 1
|
||||
gpio 127 -d i
|
||||
|
||||
echo Loading dwc_otg.ko
|
||||
insmod /data/dwc_otg.ko
|
||||
|
||||
echo Waiting 3s for the device to be ready
|
||||
sleep 3
|
||||
|
||||
echo Setting correct baud rate of 38400 for /dev/ttyPA0
|
||||
stty -F /dev/ttyPA0 raw speed 38400 -crtscts cs8 -cstopb -parenb
|
||||
|
||||
#echo Activate log
|
||||
#cat /dev/ttyPA0 >> /data/video/gps.log.0 &
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/sh
|
||||
|
||||
# IP_ADDR - this target IP address using CIDR notation:
|
||||
# <target-ip>/<target-bitmask>
|
||||
#
|
||||
# For example:
|
||||
echo init started...
|
||||
|
||||
/bin/mount -t tmpfs tmp /tmp
|
||||
/bin/mount -t proc proc /proc
|
||||
/bin/mount -o remount,rw /
|
||||
/bin/mount -t tmpfs dev /dev
|
||||
/bin/mkdir -p /dev/shm /dev/pts
|
||||
/bin/mount -t devpts devpts /dev/pts
|
||||
/bin/mount -t sysfs sys /sys
|
||||
|
||||
#don't allow overcommit (allocate more memory that the physical one)
|
||||
echo 2 > /proc/sys/vm/overcommit_memory
|
||||
echo 90 > /proc/sys/vm/overcommit_ratio
|
||||
|
||||
#in case of unaligned access print a message and send a SIGBUS
|
||||
echo 5 > /proc/cpu/alignment
|
||||
|
||||
#reboot after 1s after a panic
|
||||
echo 1 > /proc/sys/kernel/panic
|
||||
|
||||
#panic when an oops or BUG is encountered
|
||||
#disable this for developer
|
||||
echo 1 > /proc/sys/kernel/panic_on_oops
|
||||
|
||||
echo 4 > /sys/module/p6_camif/parameters/lines_per_irq
|
||||
echo -1 > /proc/sys/kernel/sched_rt_runtime_us
|
||||
|
||||
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
|
||||
/sbin/mdev -s
|
||||
|
||||
# Don't show kernel messages
|
||||
dmesg -n1
|
||||
|
||||
/bin/mkdir -p /update
|
||||
/bin/mount -a
|
||||
/bin/mkdir -p /data/video
|
||||
|
||||
/bin/hostname -F /etc/hostname
|
||||
/sbin/ifconfig lo 127.0.0.1 up
|
||||
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
|
||||
/bin/factory_reset_cb&
|
||||
modprobe p6_sdhci
|
||||
/bin/wifi_setup.sh
|
||||
|
||||
#Copy the licenses.txt file to the ftp directory so users can find it.
|
||||
cp /licenses/licenses.txt /data/video
|
||||
|
||||
# Patch to enable button management.
|
||||
ln -s /dev /dev/input
|
||||
|
||||
/data/gps.sh
|
||||
|
||||
#mount -o nolock,proto=tcp -t nfs 192.168.0.11:/mnt/video /home/default
|
||||
/bin/check_update.sh
|
||||
|
||||
echo init exit
|
||||
echo if you want to customize init look at target/generic/target_skeleton/etc files
|
||||
echo if crtl+c does not work look at the Linux FAQ section.
|
Loading…
Reference in New Issue