#!/bin/sh # exit 0 : Ok # exit 1 : Skript läuft momentan und kann nicht nochmal aufgerufen werden # exit 2 : wpa_supplicant konnte nicht gestartet werden -> Neustart versuchen # exit 3 : Keine Verbindung zum AP -> Konfiguration pruefen # exit 4 : Konfiguration: nicht bekanntes Attribut -> Konfiguration pruefen # exit 5 : FCC Test Modus aktiv ExitCode1=1 ExitCode2=2 ExitCode3=3 ExitCode4=4 ExitCode5=5 loggerName=tiWlan-install.sh name="tiWlanApp.elf" WLAN_IF="tiwlan0" PROGNAME=$(basename "$0") LOCKFILE=/var/run/wlan.lock LOCK_FD=200 MFUAKTIV=0 WLAN_DIAG_PATH=/var/run/diag/tiwlan WLAN_DIAG_INTERFACE=$WLAN_DIAG_PATH/interface WLAN_DIAG_FCC=$WLAN_DIAG_PATH/fccmode WLAN_DIAG_CONSTAT=$WLAN_DIAG_PATH/constatus WLAN_DIAG_RSSI=$WLAN_DIAG_PATH/rssi DHCP_CLIENT=/etc/udhcpc/./startdhcpclient.sh WLAN_PATH=/opt/ti-wireless/WL6.1.6.0.3/ WLAN_CONFIG=/home/tool/config/wlan.json WLAN_SUPPL_PATH=/home/tool/config/wlan/suppl WPA_SUPPLICANT_CONF=/home/tool/config/wlan/suppl/wpa_supplicant.txt WLAN_INI="tiwlan.ini" WL1271_INI="wl1271-tiwlan.ini" WL1273_INI="wl1273-tiwlan.ini" WL1273_ETSI_INI="TIWI5-LSR-ETSI.ini" WL1273_ETSI_INI2="TIWI5-LSR-ETSI-2.ini" WL1273_FCC_INI="TIWI5-LSR-FCC.ini" WL1273_INI_WORK="TIWI-INI.work" # Tix Revision # AAx Revision C # ABx Revision D WPA_OPEN=/opt/ti-wireless/WL6.1.6.0.3/wpa/OPEN_AUTH.txt WPA_PSK=/opt/ti-wireless/WL6.1.6.0.3/wpa/WPA_WPA2_PSK.txt WPA_EAP_PEAP=/opt/ti-wireless/WL6.1.6.0.3/wpa/EAP_PEAP.txt WPA_EAP_TLS=/opt/ti-wireless/WL6.1.6.0.3/wpa/EAP_TLS.txt WPA_EAP_TTLS=/opt/ti-wireless/WL6.1.6.0.3/wpa/EAP_TTLS.txt WLAN_CERT_PATH="\/home\/tool\/config\/wlan\/cert\/" lock(){ eval "exec $LOCK_FD>$LOCKFILE" # acquier the lock flock -n $LOCK_FD && return 0 || return 1 } unlock(){ flock -u $LOCK_FD rm -f "$LOCKFILE" } eexit() { local error_str="$@" echo $error_str exit $ExitCode1 } f_exit(){ logger -s -t $loggerName "Exit Code <$1>" # wl_stop unlock exit $1 } # sed 's/-$//' loescht letztes Zeichen einer Zeile # sed 's/"//g' loescht die Hochkommas # Sonderzeichen (& / \) in Strings müssen für sed behandelt werden ( escapen -> sed -e 's/[\/&]/\\&/g' ) # da der WebGui-Parser das Backslash Zeichen schon escaped -> hier rausnehmen! # # Beachte letzte Zeichen in einer Zeile -> mit Kommma und Leerzeichen oder nicht ..! f_parse_bssid(){ bssid=`grep '"bssid":' $WLAN_CONFIG | awk '{print $2}' | sed 's/.$//' | sed 's/"//g'` sed -i "s/#bssid\b.*/bssid=$bssid/g" $WPA_SUPPLICANT_CONF } f_parse_ssid(){ ssid=`grep '"ssid":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2-` ssid_esc=$(echo $ssid | sed -e 's/[/&]/\\&/g') sed -i "s/\bssid\b.*/ssid=$ssid_esc/g" $WPA_SUPPLICANT_CONF } f_parse_anonymous_identity(){ anonymous_identity=`grep '"anonymous_identity":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//'` anonymous_identity_esc=$(echo $anonymous_identity | sed -e 's/[/&]/\\&/g') sed -i "s/#anonymous_identity.*/anonymous_identity=$anonymous_identity_esc/" $WPA_SUPPLICANT_CONF } f_parse_passphrase(){ passphrase=`grep '"passphrase":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//'` #passphrase_esc=$(echo $passphrase | sed -e 's/[\/&]/\\&/g') passphrase_esc=$(echo $passphrase | sed -e 's/[/&]/\\&/g') # sed -i "s/psk.*/psk=$passphrase_esc/g" $WPA_SUPPLICANT_CONF sed -i "/ssid/!s/psk.*/psk=$passphrase_esc/g" $WPA_SUPPLICANT_CONF } f_parse_password(){ password=`grep '"password":' $WLAN_CONFIG| awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//'` password_esc=$(echo $password | sed -e 's/[/&]/\\&/g') sed -i "s/password.*/password=$password_esc/g" $WPA_SUPPLICANT_CONF } f_parse_private_key_passwd() { # nach cut stehen am Ende ein Komma ',' und ein Leerzeichen -> 2 Zeichen entfernen ( die 2 letzten sed Befehle ) private_key_passwd=`grep '"private_key_passwd":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//'` private_key_passwd_esc=$(echo $private_key_passwd | sed -e 's/[/&]/\\&/g') sed -i "s/\bprivate_key_passwd\b.*/private_key_passwd=$private_key_passwd_esc/g" $WPA_SUPPLICANT_CONF } f_parse_identity(){ identity=`grep '"username":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2-` identity_esc=$(echo $identity | sed -e 's/[/&]/\\&/g') sed -i "s/\bidentity\b.*/identity=$identity_esc/g" $WPA_SUPPLICANT_CONF } f_parse_client_cert(){ client_cert=`grep '"client_cert":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//' | sed 's/"//g'` client_cert_esc=$(echo $client_cert | sed -e 's/[/&]/\\&/g') client_cert=\"$WLAN_CERT_PATH$client_cert_esc\" sed -i "s/client_cert.*/client_cert=$client_cert/g" $WPA_SUPPLICANT_CONF } f_parse_private_key(){ private_key=`grep '"private_key":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//' | sed 's/"//g'` private_key_esc=$(echo $private_key | sed -e 's/[/&]/\\&/g') private_key=\"$WLAN_CERT_PATH$private_key_esc\" sed -i "s/\bprivate_key\b.*/private_key=$private_key/g" $WPA_SUPPLICANT_CONF } f_parse_ca_cert_opt(){ ca_cert_opt=`grep '"ca_cert":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//' | sed 's/"//g'` ca_cert_opt_esc=$(echo $ca_cert_opt | sed -e 's/[/&]/\\&/g') ca_cert_opt=\"$WLAN_CERT_PATH$ca_cert_opt_esc\" sed -i "s/#ca_cert.*/ca_cert=$ca_cert_opt/g" $WPA_SUPPLICANT_CONF } f_parse_ca_cert(){ ca_cert=`grep '"ca_cert":' $WLAN_CONFIG | awk -F: '{print $2}' | cut -c2- | sed 's/.$//' | sed 's/.$//' | sed 's/"//g'` ca_cert_esc=$(echo $ca_cert | sed -e 's/[/&]/\\&/g') ca_cert=\"$WLAN_CERT_PATH$ca_cert_esc\" sed -i "s/ca_cert.*/ca_cert=$ca_cert/g" $WPA_SUPPLICANT_CONF } f_del_tkip(){ sed -i 's/\bpairwise=\b.*/pairwise=CCMP/' $WPA_SUPPLICANT_CONF sed -i 's/\bgroup=\b.*/group=CCMP/' $WPA_SUPPLICANT_CONF } f_start_wpasupplicant(){ cd $WLAN_PATH # wpa_suppl Logdatei jedesmal neu anlegen Size=`du -k /var/log/wpa_supp.log | awk '{print $1}'` logger -s -t $loggerName "wpa_supplicant log Size <$Size kB>" if [ $Size -gt 10000 ]; then rm -r /var/log/wpa_supp.log > /dev/null 2>&1 fi ./wpa_supplicant -t -Dwext -itiwlan0 -c $WLAN_SUPPL_PATH/wpa_supplicant.txt -ddddd >> /var/log/wpa_supp.log & if [ "$?" -eq "0" ]; then logger -s -t $loggerName "start wpa_supplicant success" else logger -s -t $loggerName "Error: start wpa_supplicant failed (Neustart versuchen) exit 1" f_exit $ExitCode2 fi sleep 5 # ./wpa_cli -i tiwlan0 -a /opt/ti-wireless/WL6.1.6.0.3/wpa_action.sh -B # if [ "$?" -eq "0" ]; then # logger -s -t $loggerName "start wpa_cli success" # else # logger -s -t $loggerName "Error: start wpa_cli failed" # fi # sleep 2 } wl_start(){ #####################################MFU-Boot Modus pruefen################ ls -al /mnt/mmc/mmcblk0p1/MFU-Pruefung.jpg > /dev/null 2>&1 if [ "$?" -eq "0" ]; then #echo "/mnt/mmc/mmcblk0p1/MFU-Pruefung.jpg vorhanden !" md5sum /mnt/mmc/mmcblk0p1/MFU-Pruefung.jpg | grep 'f74814a601657c72c55613e3062b8a62' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then echo "****************************************************************" echo "************** M F U - M O D U S - PLANT *********************" echo "****************************************************************" MFUAKTIV=1 else md5sum /mnt/mmc/mmcblk0p1/MFU-Pruefung.jpg | grep 'ec4e963ee76a84fa488a62593ab19329' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then echo "****************************************************************" echo "************** M F U - M O D U S - SERVICE *******************" echo "****************************************************************" MFUAKTIV=2 else MFUAKTIV=0 fi fi else MFUAKTIV=0 fi ########################################################################### # Wenn FCC-TEST-MODE aktiv Skript abbrechen fcctest=`grep '"fcc-test-mode":' $WLAN_CONFIG | awk '{print $2}' | sed 's/"//g' | sed 's/,//'` if [ $fcctest = "true" ]; then logger -s -t $loggerName "***** fcc-test-mode exit skript******" echo true > $WLAN_DIAG_FCC f_exit $ExitCode5 else echo false > $WLAN_DIAG_FCC fi # ggf dhcp client pid abschiessen PID=`ps | grep "[u]dhcpc -i tiwlan0" | awk '{print $1}'` kill -SIGUSR2 $PID &> /dev/null kill -SIGTERM $PID &> /dev/null PID=`ps | grep "[u]dhcpc -i tiwlan0" | awk '{print $1}'` kill -SIGUSR2 $PID &> /dev/null kill -SIGTERM $PID &> /dev/null PID=`ps | grep "[u]dhcpc -i tiwlan0" | awk '{print $1}'` kill -SIGUSR2 $PID &> /dev/null kill -SIGTERM $PID &> /dev/null cat $WLAN_CONFIG | grep '"interface": true' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then # Debugging ? cat $WLAN_CONFIG | grep '"debug": true' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then cd $WLAN_PATH/debug ./install.sh restart & exit 0 fi echo true > $WLAN_DIAG_INTERFACE # hostname setzen host_name=`grep '"hostname":' $WLAN_CONFIG | awk '{print $2}' | sed 's/"//g' | sed 's/.$//'` echo $host_name > /etc/hostname hostname $host_name # nvs_map.bin einlesen # #################### cd $WLAN_PATH if [ $MFUAKTIV -eq "0" ]; then /usr/bin/python nvsmap.py if [ "$?" -eq "0" ]; then logger -s -t $loggerName "nvs_map Success" else logger -s -t $loggerName "nvs_map Failed" fi else echo "****************************************************************" echo "* Lege temporaer nvs_map.bin mit MAC-ID fuer MFU-Pruefung an *" echo "****************************************************************" cp /opt/ti-wireless/WL6.1.6.0.3/nvs_map.mfu /opt/ti-wireless/WL6.1.6.0.3/nvs_map.bin fi HwRev=`cat /var/run/diag/hardware/tix` if [ "$?" -ne "0" ]; then logger -s -t $loggerName "Nicht moeglich die HW Revision zu lesen" fi cat /var/run/diag/hardware/tix | grep -e AA if [ "$?" -ne "0" ]; then # D- Revison oder höher -> TIWI-5!!! logger -s -t $loggerName "TIWI-05 Modul" # Auswahl regulatory-domain ########################### RegDom=`cat $WLAN_CONFIG | grep "regulatory-domain" | awk '{print $2}' | sed 's/"//g' | sed 's/,//' ` # Alte Dateien loeschen rm tiwlan.ini rm $WL1273_INI_WORK logger -s -t $loggerName "Regulatory Domain $RegDom" case "$RegDom" in ETSI) # ETSI - European Telecommunications Standards Institute cp $WL1273_ETSI_INI $WL1273_INI_WORK ;; FCC) # FCC - Federal Communication Commission cp $WL1273_FCC_INI $WL1273_INI_WORK ;; TI) # Texas Instruments File cp $WL1273_INI $WL1273_INI_WORK ;; CAN) # Canada -> FCC cp $WL1273_FCC_INI $WL1273_INI_WORK # dito FCC ;; BRA) # Brasil/Mexico -> FCC cp $WL1273_FCC_INI $WL1273_INI_WORK # dito FCC ;; CHN) # China -> FCC cp $WL1273_FCC_INI $WL1273_INI_WORK sed -i 's/.*SmeScanGChannelList.*/SmeScanGChannelList = 1,2,3,4,5,6,7,8,9,10,11,12,13 /g' $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64,149,153,157,161,165 /g' $WL1273_INI_WORK ;; IND) # India -> ETSI cp $WL1273_ETSI_INI $WL1273_INI_WORK sed -i 's/.*SmeScanGChannelList.*/SmeScanGChannelList = 1,2,3,4,5,6,7,8,9,10,11,12,13 /g' $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64 /g' $WL1273_INI_WORK ;; AUS-NZL) # Australia/New Zealand -> FCC cp $WL1273_FCC_INI $WL1273_INI_WORK sed -i 's/.*SmeScanGChannelList.*/SmeScanGChannelList = 1,2,3,4,5,6,7,8,9,10,11,12,13 /g' $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64,149,153,157,161,165 /g' $WL1273_INI_WORK ;; ZAF) # South Africa -> ETSI cp $WL1273_ETSI_INI $WL1273_INI_WORK # dito ETSI ;; THA) # Thailand -> ETSI cp $WL1273_ETSI_INI $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,165 /g' $WL1273_INI_WORK ;; KOR) # Korea -> FCC cp $WL1273_FCC_INI $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,149,153,157,161,165 /g' $WL1273_INI_WORK ;; MYS) # Malaysia -> ETSI cp $WL1273_ETSI_INI $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,165 /g' $WL1273_INI_WORK ;; ARG) # Argentina -> FCC cp $WL1273_FCC_INI $WL1273_INI_WORK sed -i 's/.*SmeScanAChannelList.*/SmeScanAChannelList = 36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,165 /g' $WL1273_INI_WORK ;; esac # Link fuer das Ini-File setzen ln -s $WL1273_INI_WORK $WLAN_INI INI=$WL1273_INI_WORK # Auswahl dot11NetworkType -> 2 - A only mode, 3 - B/G mode, 4 - A/G Dual mode ############################################################################### Band=`cat $WLAN_CONFIG | grep "band" | awk '{print $2}' | sed 's/"//g' | sed 's/,//' ` logger -s -t $loggerName "Bandeinstellung $Band" case "$Band" in 802.11b/g) sed -i 's/.*dot11NetworkType.*/dot11NetworkType = 3 /g' $INI ;; 802.11a/g) sed -i 's/.*dot11NetworkType.*/dot11NetworkType = 4 /g' $INI ;; 802.11a) sed -i 's/.*dot11NetworkType.*/dot11NetworkType = 2 /g' $INI ;; esac else # C-Revison oder kleiner -> TIWI-2 logger -s -t $loggerName "TIWI-02 Modul" rm tiwlan.ini ln -s $WL1271_INI $WLAN_INI fi lsmod | grep 'sdio' if [ "$?" -ne "0" ]; then insmod sdio.ko if [ "$?" -eq "0" ]; then logger -s -t $loggerName "sdio.ko Success" else echo "sdio.ko Failed" if [ "$?" -ne 0 ]; then logger -s -t $loggerName "sdio" fi fi fi sleep 1 insmod tiwlan_drv.ko if [ "$?" -eq "0" ]; then logger -s -t $loggerName "tiwlan_drv.ko Success" else logger -s -t $loggerName "tiwlan_drv.ko Failed" if [ "$?" -ne 0 ]; then rmmod tiwlan_drv fi fi sleep 1 ./tiwlan_loader if [ "$?" -eq "0" ]; then logger -s -t $loggerName "loading firmware Success" else logger -s -t $loggerName "loading firmware Failed" if [ "$?" -ne 0 ]; then rmmod tiwlan_drv #rmmod bmtrace rmmod sdio fi fi sleep 1 ifconfig $WLAN_IF up # Wenn IP Konfiguration auf manuell steht, # gleich hier dem IF die Adresse verpassen .... cat $WLAN_CONFIG | grep 'man' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then cat $WLAN_CONFIG | grep '"garp": true' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then echo 1 > /proc/sys/net/ipv4/conf/$WLAN_IF/arp_notify fi IPADDR=`cat $WLAN_CONFIG | grep ipadr | awk '{print $2}' | sed 's/"//g' | sed 's/,//'` SUBNET=`cat $WLAN_CONFIG | grep subnet | awk '{print $2}' | sed 's/"//g' | sed 's/,//'` GATEWAY=`cat $WLAN_CONFIG | grep gateway | awk '{print $2}' | sed 's/"//g' | sed 's/,//'` ifconfig $WLAN_IF $IPADDR netmask $SUBNET up route add default gw $GATEWAY netmask 0.0.0.0 # statische route anlegen # route add -net 10.23.233.200 netmask 255.255.255.0 gw 10.23.233.1 dev tiwlan0 fi method=`grep '"method":' $WLAN_CONFIG | grep -v "dhcp" | grep -v "man" | awk '{print $2}' | sed 's/"//g' | sed 's/,//' ` case "$method" in Open-Network) logger -s -t $loggerName "Open-Network" # wpa_supplicant.conf kopieren & konfigurieren cp $WPA_OPEN $WPA_SUPPLICANT_CONF f_parse_ssid cat $WLAN_CONFIG | grep '"bssid": ""' &> /dev/null if [ "$?" -ne "0" ]; then f_parse_bssid fi f_start_wpasupplicant ;; # Open-Network WPA/WPA2-Personal) logger -s -t $loggerName "WPA/WPA2-Personal" # wpa_supplicant.conf kopieren & konfigurieren cp $WPA_PSK $WPA_SUPPLICANT_CONF cat $WLAN_CONFIG | grep '"tkip": false' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then f_del_tkip fi f_parse_ssid cat $WLAN_CONFIG | grep '"bssid": ""' &> /dev/null if [ "$?" -ne "0" ]; then f_parse_bssid fi f_parse_passphrase f_start_wpasupplicant ;; # WPA/WPA2-Personal) WPA/WPA2-Enterprise) logger -s -t $loggerName "WPA/WPA2-Enterprise" # EAP Methode Eap=`grep '"auth":' $WLAN_CONFIG | awk '{print $2}' | sed 's/"//g' | sed 's/,//' ` case "$Eap" in 13) logger -s -t $loggerName "EAP-TLS" rm $WPA_SUPPLICANT_CONF cp $WPA_EAP_TLS $WPA_SUPPLICANT_CONF cat $WLAN_CONFIG | grep '"tkip": false' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then f_del_tkip fi f_parse_ssid # bssid ? cat $WLAN_CONFIG | grep '"bssid": ""' &> /dev/null if [ "$?" -ne "0" ]; then f_parse_bssid fi f_parse_identity f_parse_private_key_passwd f_parse_client_cert f_parse_private_key # Optional - ca_cert (Root Zertifikat) cat $WLAN_CONFIG | grep '"ca_cert": ""' &> /dev/null if [ "$?" -ne "0" ]; then f_parse_ca_cert_opt fi ;; 21) logger -s -t $loggerName "EAP-TTLS" cp $WPA_EAP_TTLS $WPA_SUPPLICANT_CONF cat $WLAN_CONFIG | grep '"tkip": false' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then f_del_tkip fi f_parse_ssid # bssid ? cat $WLAN_CONFIG | grep '"bssid": ""' &> /dev/null if [ "$?" -ne "0" ]; then f_parse_bssid fi f_parse_identity f_parse_password f_parse_ca_cert # optional anonymous_identity cat $WLAN_CONFIG | grep '"anonymous_identity": ""' > /dev/null 2>&1 if [ "$?" -ne "0" ]; then f_parse_anonymous_identity fi ;; 25) logger -s -t $loggerName "EAP-PEAP" # wpa_supplicant.conf kopieren & konfigurieren cp $WPA_EAP_PEAP $WPA_SUPPLICANT_CONF cat $WLAN_CONFIG | grep '"tkip": false' > /dev/null 2>&1 if [ "$?" -eq "0" ]; then f_del_tkip fi f_parse_ssid # bssid ? cat $WLAN_CONFIG | grep '"bssid": ""' &> /dev/null if [ "$?" -ne "0" ]; then f_parse_bssid fi f_parse_identity f_parse_password # optional anonymous_identity cat $WLAN_CONFIG | grep '"anonymous_identity": ""' > /dev/null 2>&1 if [ "$?" -ne "0" ]; then f_parse_anonymous_identity fi # Optionla ca_cert (Root Zertifikat) cat $WLAN_CONFIG | grep '"ca_cert": ""' > /dev/null 2>&1 if [ "$?" -ne "0" ]; then f_parse_ca_cert_opt fi ;; esac # Supplicant starten f_start_wpasupplicant ;; #WPA/WPA2-Enterprise) *) logger -s -t $loggerName "wlan method nicht bekannt <$method> " f_exit $ExitCode4 ;; # default esac else echo false > $WLAN_DIAG_INTERFACE fi cd /home/tool/ killall -SIGTERM $name # export VALGRIND_LIB=/opt/debug/valgrind/lib/valgrind # process="/opt/debug/valgrind/bin/./valgrind /home/tool/bin/$name" process="bin/"$name logger -s -t $loggerName "Startup $name" $process & # Wlan Interrupts ändern ######################## #chrt -fp 50 `ps | grep [i]rq/309 | awk '{print $1}'` #chrt -fp 50 `ps | grep [i]rq/86 | awk '{print $1}'` #chrt -fp 49 `ps | grep [i]rq/335 | awk '{print $1}'` #chrt -fp 49 `ps | grep [i]rq/39 | awk '{print $1}'` } # wl_start wl_restart(){ wl_stop sleep 5 wl_start } # wl_restart wl_stop(){ dbus-send --system --type=signal /WlanObj com.rexroth.akku.WlanInterface.changed_connection int32:4 rm /var/run/diag/tiwlan/* rm /var/run/cli.log PID=`ps | grep "[t]iWlanApp.elf" | awk '{print $1}'` kill -SIGTERM $PID > /dev/null 2>&1 PID=`ps | grep "[w]pa_supplicant" | awk '{print $1}'` kill -SIGTERM $PID > /dev/null 2>&1 PID=`ps | grep "[u]dhcpc -i tiwlan0" | awk '{print $1}'` kill -SIGUSR2 $PID &> /dev/null kill -SIGTERM $PID &> /dev/null rmmod tiwlan_drv rmmod sdio cp $WLAN_SUPPL_PATH/wpa_supplicant.txt $WLAN_SUPPL_PATH/wpa_supplicant.backup.txt cp $WLAN_SUPPL_PATH/wpa_supplicant_default.txt $WLAN_SUPPL_PATH/wpa_supplicant.txt echo false > $WLAN_DIAG_INTERFACE echo 4 > $WLAN_DIAG_CONSTAT echo 0 > $WLAN_DIAG_RSSI } # wl_stop lock || eexit "Only one instance of $PROGNAME can run at one time." case "$1" in start) logger -s -t $loggerName "Wlan Start" wl_start ;; stop) logger -s -t $loggerName "Wlan Stop" wl_stop ;; restart) logger -s -t $loggerName "Wlan Restart" wl_restart ;; *) logger -s -t $loggerName "Invalid Command" ;; esac unlock logger -s -t $loggerName "Exit 0" exit 0 # end