Commit bdcc8f76 authored by Michael Mrozek's avatar Michael Mrozek

init-hwtest.sh: Added needed modules, added some more tests.

parent ace31703
#!/bin/bash
# Pyra Testing Script v0.1
# Pyra Testing Script v0.5
SCRIPTPATH="$(dirname "$0")"
LOG_TTY=3
LOG_DEVICE="/dev/tty$LOG_TTY"
ver="2018-06-25"
ver="2018-11-10"
sd_dir=`pwd`
# Setup some functions to make the log easier.
# Setup some functions
log()
{
......@@ -27,7 +29,6 @@ log_err()
echo -en "\033[0m" > $LOG_DEVICE
}
# This is just a preparation for the summary - it's not used yet.
print_ok()
{
if $2; then
......@@ -38,18 +39,22 @@ print_ok()
}
print_status()
{
log "---------------"
print_ok "LEDs: " $leds_passed
print_ok "Sensors: " $sensors_passed
print_ok "GPS: " $gps_passed
print_ok "Modem: " $modem_passed
print_ok "SD WriteProt: " $sdprot_passed
print_ok "USB/SD2: " $mass_passed
print_ok "Bluetooth: " $bt_passed
print_ok "WiFi: " $wifi_passed
log "Pyra Version:" $pnd_version
log "---------------------"
print_ok "Barometer: " $barometer_passed
print_ok "Compass: " $compass_passed
print_ok "Gyroscope: " $gyro_passed
print_ok "Fuel Gauge: " $fuelgauge_passed
print_ok "TWL4030: " $twl_passed
print_ok "LED Controllers: " $ledc_passed
print_ok "Nub Controllers: " $nubs_passed
print_ok "4G/LTE: " $wwan_passed
print_ok "WiFi: " $wlan_passed
log "Pyra Version: " $pyr_version
log "---------------------"
}
# Setup some directories we might not have yet
[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
......@@ -67,45 +72,171 @@ mount -t tmpfs -o "noexec,nosuid,size=10%,mode=0755" tmpfs /run
mount -o remount,rw / /
# screen
# Load the needed modules
modprobe omapdss
modprobe omapdrm
modprobe encoder_tpd12s015
modprobe connector_hdmi
modprobe panel_boe_w677l
modprobe pwm_bl
modprobe leds_is31fl319x
modprobe bno055
modprobe pwm_omap_dmtimer
modprobe tsc2007
modprobe tca8418_keypad
modprobe palmas_pwrbutton
modprobe as5013
modprobe ehci_omap
modprobe bmp280_i2c
modprobe bq27xxx_battery_i2c
modprobe wlcore_sdio
modprobe wl18xx
rfkill unblock wwan
# Disable Logging on-screen and switch to TTY3, use a nicer font size
# Disable most output on the LCD and switch to TTY3, use a nicer font size, siwth off all LEDs.
chvt 3
echo 0 > /sys/module/printk/parameters/ignore_loglevel
dmesg -D
setfont Lat15-Terminus24x12.psf.gz
clear
cd /sys/class/leds
for i in *
do
echo $i
echo "none" >$i/trigger
echo 0 >$i/brightness
done
cd $SCRIPTPATH
echo 0 > /sys/class/backlight/keyboard-backlight/brightness
log ""
log "Pyra Testing Script $ver"
log "" > $LOG_DEVICE
log "This is a work-in-progress - barely anything works right now :))"
log "This is a work-in-progress - we're getting there :))"
log ""
# touchscreen
modprobe tsc2007
# keyboard
modprobe tca8418_keypad
modprobe palmas_pwrbutton
# nubs
modprobe as5013
# Setting all to false :)
#usb
modprobe ehci_omap
barometer_passed=false
compass_passed=false
gyro_passed=false
fuelgauge_passed=false
ledc_passed=false
nubs_passed=false
twl_passed=false
wwan_passed=false
wlan_passed=false
# Tests will run here.
cd $SCRIPTPATH
log "Testing Barometer..."
if ./letux/hw-test barometer > /root/log.txt; then barometer_passed=true; fi
log "Testing Compass..."
if ./letux/hw-test bno055_compass >> /root/log.txt; then compass_passed=true; fi
log "Testing Gyro..."
if ./letux/hw-test bno055_gyro >> /root/log.txt; then gyro_passed=true; fi
log "Testing Nub-Controller..."
if ./letux/hw-test nubs >> /root/log.txt; then nubs_passed=true; fi
log "Testing Fuel Gauge..."
if ./letux/hw-test fuel_gauge >> /root/log.txt; then fuelgauge_passed=true; fi
log "Testing TWL4030..."
if ./letux/hw-test power_twl4030 >> /root/log.txt; then twl_passed=true; fi
log "Testing LED Controllers..."
if ./letux/hw-test leds >> /root/log.txt; then ledc_passed=true; fi
log "Starting WLAN-Test..."
essid="PND_TEST"
testfile="ftp://192.168.1.17/AiDisk_a1/share/test"
log "Waiting for module..."
for a in `seq 20`
do
if ifconfig -a | grep -q wlan0
then
break
fi
sleep 4
done
sleep 3
if ! ifconfig -a | grep -q wlan0
then
log "Failed!"
log "Something is wrong with the WLAN-Module!!"
else
ifconfig wlan0 up
log "Connecting to the test server ($essid)..."
sleep 3
iwlist wlan0 scan
sleep 3
iwconfig wlan0 mode managed
iwconfig wlan0 essid $essid
for a in `seq 20`
do
if ! iwconfig wlan0 | grep -q 'Not-Associated'
then
break
fi
sleep 1
done
if iwconfig wlan0 | grep -q 'Not-Associated'
then
log "Couldn't connect to $essid..."
log "Is the router running?"
else
log "Waiting for IP Address (DHCP)..."
mkdir -p /var/lib/dhcp
if ! dhclient -1 wlan0
then
log "Didn't receive an IP-Address..."
else
log "Downloading testfile..."
if ! wget $testfile -O /dev/null
then
log "Testfile couldn't be downloaded!"
log "Is the USB-Stick in the router?"
else
wlan_passed=true
fi
fi
fi
fi
killall dhclient
log "Quicktest 4G/LTE Modem..."
if ./letux/hw-test test_wwan_usb >> /root/log.txt; then wwan_passed=true; fi
log "Switching all LEDs to white..."
cd /sys/class/leds
for i in *
do
echo $i
echo "default-on" >$i/trigger
echo 255 >$i/brightness
done
cd $SCRIPTPATH
echo 7 > /sys/class/backlight/keyboard-backlight/brightness
pyr_version=$(tr -d '\0' </proc/device-tree/model 2>/dev/null)
# Show the Results...
# Results will be shown here.
log "Press ENTER to start the input-tester..."
log ""
print_status
if ! $barometer_passed || ! $compass_passed || ! $gyro_passed || ! $fuelgauge_passed || \
! $ledc_passed || ! $nubs_passed || ! $twl_passed || ! $wlan_passed
then
log ""
log_err "======================================================================================="
log_err "Warning! Some critical tests have failed! Please press ENTER to start the input-tester."
log_err "======================================================================================="
read a < $LOG_DEVICE
fi
read a < $LOG_DEVICE
/usr/share/pyra/bin/pyra_test_inputs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment