Commit 49daaef8 authored by aTc's avatar aTc

update letux scripts

parent dd6e6d8d
......@@ -20,7 +20,7 @@ then
shift
fi
case $(cat /proc/device-tree/model) in
case $(tr -d '\0' </proc/device-tree/model) in
Pyra-Handheld* )
PADCONF=0x4a0028f6 # OMAP5
GPIOMODE=0x011e
......
......@@ -8,7 +8,7 @@
# -s: experiments for address shift register and enable command2
# -t: test if we can write single bytes through MIPI (yes we can - if command2 and address shift is already enabled)
if ! [ "$(cat /proc/device-tree/ocp/dss@58000000/encoder@58004000/lcd/compatible)" = "omapdss,mipi,debug" ]
if ! [ "$(tr -d '\0' </proc/device-tree/ocp/dss@58000000/encoder@58004000/lcd/compatible)" = "omapdss,mipi,debug" ]
then
echo this script needs the mipi-debug driver!
echo use panelselect to choose the '-n' driver
......
......@@ -4,7 +4,7 @@
# it needs special hardware for the OTP programming voltage
#
if ! [ "$(cat /proc/device-tree/ocp/dss@58000000/encoder@58004000/lcd/compatible)" = "omapdss,mipi,debug" ]
if ! [ "$(tr -d '\0' </proc/device-tree/ocp/dss@58000000/encoder@58004000/lcd/compatible)" = "omapdss,mipi,debug" ]
then
echo this script needs the mipi-debug driver!
echo use ./panelselect and choose the 'n' driver
......
......@@ -2,7 +2,7 @@
# scan bluetooth
#
case $(cat /proc/device-tree/model) in
case $(tr -d '\0' </proc/device-tree/model) in
*Pyra-Handheld* ) # WL183x
# enables the 32kHz clock
......@@ -37,24 +37,40 @@ case $(cat /proc/device-tree/model) in
;;
* )
echo "unknown model $(cat /proc/device-tree/model)"
echo "unknown model $(tr -d '\0' </proc/device-tree/model)"
exit 1
;;
esac
# override
[ -r /dev/ttyBT0 ] && UART=/dev/ttyBT0
rfkill unblock bluetooth
# load TI Shared Transport driver (if configured into the kernel)
modprobe -r st_drv
# start daemon
if ! hciconfig | fgrep -q hci0
then # bluetooth support not configured into kernel - needs to start hciattach
if ! ps -ef | fgrep hciattach | fgrep -v -q grep
then # hciattach is not yet running
# note we should never kill hciattach or a reattach will fail
echo starting: hciattach $FLAGS $UART $MODE $BTBAUD $ARGS
if ! hciattach $FLAGS $UART $MODE $BTBAUD $ARGS </dev/null
then
echo hciattach failed
exit 1
fi
fi
fi
killall hciattach 2>/dev/null
if hciattach $FLAGS $UART $MODE $BTBAUD $ARGS
if ! hciconfig hci0 up
then
hciconfig hci0 up || exit 1
hcitool scan --info
bt-adapter -d
echo hciconfig hci0 up failed
exit 1
fi
timeout --foreground -k 3 30 hcitool scan --info
# reports in a different format
# timeout --foreground -k 3 30 bt-adapter -d
#
# start camera demo
# see also http://projects.goldelico.com/p/gta04-kernel/page/Camera/
#
# some background information what happens here:
#
# http://processors.wiki.ti.com/index.php/UserGuideOmap35xCaptureDriver_PSP_04.02.00.07#Software_Design_Interfaces_2
# http://labs.isee.biz/index.php/How_to_setup_tvp5151_video_decoder#Steps_to_configure_the_ISP_and_TVP5151
# http://wiki.buglabs.net/index.php/Software:Camera_Module_V4L2_Usage
# http://git.ideasonboard.org/media-ctl.git/tree
# http://www.mail-archive.com/linux-media@vger.kernel.org/msg20004.html
#
# Unfortunately there is no good documentation. Except the kernel and media-ctl sources.
# So be prepared for a lot of trial-and-error if you want to improve anything.
#
# for recent kernels we need a modern media-ctl found in the v4l-utils package
# or built from source: https://git.linuxtv.org/v4l-utils.git
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
[ "$(which media-ctl)" ] || apt-get install -y v4l-utils
[ "$(which mplayer)" ] || apt-get install -y mplayer
. /root/x # set DISPLAY
. /root/camera-setup # load setup script
[ -d $HOME/.mplayer ] || mkdir -p $HOME/.mplayer
[ -r $HOME/.mplayer/input.conf ] || ( echo MOUSE_BTN0 quit ) >$HOME/.mplayer/input.conf
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
MODE=$1; [ "$MODE" ] || MODE=sxga
. /root/x
setup "$MODE"
# CAMERA="ov9650" # driver name not camera model! use media-ctl -p to find out
CAMERA='"ov9650"' # driver name not camera model! use media-ctl -p to find out
CAM=$(echo "$CAMERA" | tr -d '"') # remove inner quotes needed for media-ctl command
CPATH="$(media-ctl -e "$CAM")"
if [ ! -r "$CPATH" ]
then
echo "Camera $CAM not found!"
exit
fi
function media-reset {
echo media-ctl -r
media-ctl -r
}
function media-link { # $1 = from $2... = to
echo media-ctl -l \'"$1 -> $2"\'
media-ctl -l "$1 -> $2"
}
function media-format { # $1 = entity, $2 = format $3 = widthxheight
echo media-ctl -V \'"$1 [$2 $3]"\'
media-ctl -V "$1 [$2 $3]"
}
echo "### starting mplayer in $MODE mode ###"
echo Camera: $CPATH
[ "$(which mplayer)" ] || apt-get install -y mplayer
echo "### starting mplayer in $MODE mode ###"
[ -d $HOME/.mplayer ] || mkdir -p $HOME/.mplayer
[ -r $HOME/.mplayer/input.conf ] || ( echo MOUSE_BTN0 quit ) >$HOME/.mplayer/input.conf
case "$MODE" in
sxga ) # bypassing OMAP ISP (almost)
# media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-reset
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP CCDC output":0[1]'
# media-ctl -V '"'"$CAMERA"'":0 [UYVY2X8 1280x1024]'
# media-ctl -V '"OMAP3 ISP CCDC":0 [UYVY2X8 1280x1024]' # is set automatically
# media-format '"OMAP3 ISP CCDC":0' UYVY2X8 1280x1024
# media-ctl -V '"OMAP3 ISP CCDC":1 [UYVY 1280x1024]'
media-format '"OMAP3 ISP CCDC":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
# mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=1280:height=1024:fps=15 -vo x11
mplayer -tv driver=v4l2:outfmt=uyvy:width=1280:height=1024:fps=15:device=$DEVICE -vo x11 -vf rotate=2 tv://
;;
sxga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1280x1024]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=1280:height=1024:fps=15 -vo x11
;;
qvga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 320x240], "OMAP3 ISP CCDC":2 [SGRBG10 320x240], "OMAP3 ISP preview":1 [UYVY 320x240], "OMAP3 ISP resizer":1 [UYVY 320x240]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=320:height=240:fps=30 -vo x11
;;
cif-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 352x288], "OMAP3 ISP CCDC":2 [SGRBG10 352x288], "OMAP3 ISP preview":1 [UYVY 352x288], "OMAP3 ISP resizer":1 [UYVY 352x288]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=352:height=288:fps=30 -vo x11
;;
vga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 640x480], "OMAP3 ISP CCDC":2 [SGRBG10 640x480], "OMAP3 ISP preview":1 [UYVY 640x480], "OMAP3 ISP resizer":1 [UYVY 640x480]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=640:height=480:fps=30 -vo x11
;;
vga-resizer | vga-r* )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [UYVY2X8 1280x1024]'
media-ctl -V '"OMAP3 ISP CCDC":1 [UYVY2X8 1280x1024]'
media-ctl -V '"OMAP3 ISP resizer":1 [UYVY 640x480]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=640:height=480:fps=30 -vo x11
;;
vga ) # try bypassing OMAP ISP by programming the camera to VGA mode (is not completely supported by kernel driver!)
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [UYVY2X8 640x480]'
# media-ctl -V '"OMAP3 ISP CCDC":0 [UYVY2X8 640x480]'
media-ctl -V '"OMAP3 ISP CCDC":1 [UYVY 640x480]'
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=640:height=480:fps=30 -vo x11
;;
esac
\ No newline at end of file
echo mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=$FORMAT:width=$WIDTH:height=$HEIGHT:fps=$FPS -vo x11
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=$FORMAT:width=$WIDTH:height=$HEIGHT:fps=$FPS -vo x11
#
# camera setup for GTA04 (omap3 isp)
#
# see also http://projects.goldelico.com/p/gta04-kernel/page/Camera/
#
# some background information about what happens here:
#
# http://processors.wiki.ti.com/index.php/UserGuideOmap35xCaptureDriver_PSP_04.02.00.07#Software_Design_Interfaces_2
# http://labs.isee.biz/index.php/How_to_setup_tvp5151_video_decoder#Steps_to_configure_the_ISP_and_TVP5151
# http://wiki.buglabs.net/index.php/Software:Camera_Module_V4L2_Usage
# http://git.ideasonboard.org/media-ctl.git/tree
# http://www.mail-archive.com/linux-media@vger.kernel.org/msg20004.html
# http://mediawiki.compulab.com/w/index.php5/CM-T3730:_Linux:_Camera#Setting_up_ISP_pipeline
#
# Unfortunately there is no good documentation. Except the kernel and media-ctl sources.
# So be prepared for a lot of trial-and-error if you want to improve anything.
#
# For recent kernels we need a modern media-ctl found in the v4l-utils package
# or built from source: https://git.linuxtv.org/v4l-utils.git
[ "$(which media-ctl)" ] || apt-get install -y v4l-utils
CAM=ov965x # driver name not camera model! use media-ctl -p to find out
CAMERA='"'$CAM'"' # sometimes we need quotes in the variable value
CPATH="$(media-ctl -e "$CAM")"
if [ ! -r "$CPATH" ]
then
echo "Camera $CAM not found!"
exit 1
fi
echo "Camera: $CPATH"
function media-reset {
echo media-ctl -r
media-ctl -r
}
function media-link { # $1 = from $2... = to
echo media-ctl -l \'"$1 -> $2"\'
media-ctl -l "$1 -> $2"
}
function media-format { # $1 = entity, $2 = format $3 = widthxheight
echo media-ctl -V \'"$1 [$2 $3]"\'
media-ctl -V "$1 [$2 $3]"
}
function setup { # $1 = video mode
echo "Setting mode $1"
media-reset
case "$1" in
sxga ) # bypassing OMAP ISP (almost)
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP CCDC output":0[1]'
media-format "$CAMERA:0" UYVY2X8 1280x1024
media-format '"OMAP3 ISP CCDC":0' UYVY2X8 1280x1024
media-format '"OMAP3 ISP CCDC":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
FORMAT=uyvy
WIDTH=1280
HEIGHT=1024
FPS=15
;;
vga ) # try bypassing OMAP ISP by programming the camera to VGA mode (is not completely supported by kernel driver!)
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP CCDC output":0[1]'
media-format "$CAMERA:0" UYVY2X8 640x480
media-format '"OMAP3 ISP CCDC":0' UYVY2X8 640x480
media-format '"OMAP3 ISP CCDC":1' UYVY 640x480
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
FORMAT=uyvy
WIDTH=640
HEIGHT=480
FPS=30
;;
vga-resizer | vga-r* )
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP resizer":0[1]'
media-link '"OMAP3 ISP resizer":1' '"OMAP3 ISP resizer output":0[1]'
media-format "$CAMERA:0" UYVY2X8 1280x1024
media-format '"OMAP3 ISP CCDC":1' UYVY 1280x1024
media-format '"OMAP3 ISP resizer":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
FORMAT=uyvy
WIDTH=640
HEIGHT=480
FPS=30
;;
# old code
sxga-old )
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":2' '"OMAP3 ISP preview":0[1]'
media-link '"OMAP3 ISP preview":1' '"OMAP3 ISP resizer":0[1]'
media-link '"OMAP3 ISP resizer":1' '"OMAP3 ISP resizer output":0[1]'
media-format "$CAMERA:0" SGRBG10 1280x1024
media-format '"OMAP3 ISP CCDC":2' SGRBG10 1280x1024
media-format '"OMAP3 ISP preview":1' UYVY 1280x1024
media-format '"OMAP3 ISP resizer":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
FORMAT=uyvy
WIDTH=1280
HEIGHT=1024
FPS=15
;;
# old code not converted
qvga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 320x240], "OMAP3 ISP CCDC":2 [SGRBG10 320x240], "OMAP3 ISP preview":1 [UYVY 320x240], "OMAP3 ISP resizer":1 [UYVY 320x240]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=320:height=240:fps=30 -vo x11
;;
cif-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 352x288], "OMAP3 ISP CCDC":2 [SGRBG10 352x288], "OMAP3 ISP preview":1 [UYVY 352x288], "OMAP3 ISP resizer":1 [UYVY 352x288]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=352:height=288:fps=30 -vo x11
;;
vga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 640x480], "OMAP3 ISP CCDC":2 [SGRBG10 640x480], "OMAP3 ISP preview":1 [UYVY 640x480], "OMAP3 ISP resizer":1 [UYVY 640x480]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=640:height=480:fps=30 -vo x11
;;
* )
echo Unknown camera mode $1
exit 1
;;
esac
}
......@@ -167,7 +167,7 @@ echo type: $(cat $SUPPLY/type 2>/dev/null)
echo online: $(cat $SUPPLY/online 2>/dev/null)
echo status: $(cat $SUPPLY/status 2>/dev/null)
echo mode: $(cat $SUPPLY/mode 2>/dev/null)
echo volt: $(cat /sys$SUPPLY/voltage_now 2>/dev/null)uV
echo volt: $(cat $SUPPLY/voltage_now 2>/dev/null)uV
echo current: $(cat $SUPPLY/current_now 2>/dev/null)uA
echo max_current: $(cat $SUPPLY/input_current_limit 2>/dev/null)uA
echo
......
This diff is collapsed.
mount | fgrep -q debugfs || mount -t debugfs none /sys/kernel/debug
case "$1" in
dsi )
cat /sys/kernel/debug/omapdss/clk
cat /sys/kernel/debug/omapdss/dispc
cat /sys/kernel/debug/omapdss/dsi1_irqs
cat /sys/kernel/debug/omapdss/dsi1_regs
;;
mmc )
for i in /sys/kernel/debug/mmc*
do
echo "$(basename "$i"):"
cat $i/ios
cat $i/regs
done
;;
esac
......@@ -28,13 +28,17 @@ MODULES=$(mkimage -l "$UIMAGE" | fgrep "Image Name:" | sed 's/Image Name: *//' |
# copy only the modules we need to boot on this device
THEMODULES="-C /"
case "$(cat /proc/device-tree/model)" in
# modules we even install if they are currently not loaded
FIXEDMODULES="hso ov9650 v4l2_common omap3_isp videodev videobuf2_core videobuf2_v4l2 media"
case "$(tr -d '\0' </proc/device-tree/model)" in
*GTA04* ) # take all that are currently loaded
echo "find really used kernel modules"
LOADEDMODULES=$(lsmod | while read MODULE SIZE REFCNT USEDBY
LOADEDMODULES=$( { lsmod; echo $FIXEDMODULES; } | while read MODULE SIZE REFCNT USEDBY
do
[ "$MODULE" != "Module" ] && modprobe -v -D $MODULE | awk '{ print "."$2 }'
done | sort -u)
done | sort -u )
# some modules may not yet be loaded while flashing
echo "stripping kernel modules"
(cd / && strip --strip-debug $LOADEDMODULES)
THEMODULES+=" $LOADEDMODULES"
......
......@@ -5,7 +5,8 @@
SERIAL=$(/root/gps-on)
echo "### starting gpsd ###"
echo "### starting gpsd $SERIAL ###"
killall gpsd # kill any existing
gpsd $SERIAL
rfkill unblock gps # potentially enable VSIM
......@@ -26,5 +27,5 @@ esac
[ -r /sys/class/gpio/gpio144/value ] && echo 144 >/sys/class/gpio/unexport 2>/dev/null
echo "### starting foxtrot gps ###"
. x
. /root/x
dbus-launch foxtrotgps
......@@ -7,7 +7,10 @@
case "$(cat /sys/firmware/devicetree/base/model)" in
*GTA04*/Letux* )
echo /dev/ttyO1
if [ -r /dev/ttyGPS0 ]
then echo /dev/ttyGPS0
else echo /dev/ttyO1
fi
exit
;;
esac
......
#
# GTA04 hardware test script
# (c) Golden Delicious Computers GmbH&Co. KG, 2011-2016
# GTA04/Pyra hardware test script
#
# (c) Golden Delicious Computers GmbH&Co. KG, 2011-2017
# licenced under GPL
#
# usage: hw-test [-t] [testname]
#
TESTER_VERSION="6.0"
TESTER_RECOMMENDED_KERNEL="4.7"
TESTER_DATE="10 Aug 2016"
TESTER_VERSION="6.2"
TESTER_RECOMMENDED_KERNEL="4.10"
TESTER_DATE="09 Jun 2017"
MODEL=$(cat /proc/device-tree/model 2>/dev/null)
MODEL=$(tr -d '\0' </proc/device-tree/model 2>/dev/null)
function findregulator {
for regulator in /sys/class/regulator/regulator.*
......@@ -52,6 +53,10 @@ for dev in /sys/class/thermal/thermal_zone*
done
}
function i2c-probe { # bus hex-address
[ "$(i2cdetect -y -r $1 0x$2 0x$2 | fgrep $2 | (read ADDR FOUND; echo $FOUND))" ]
}
ANYNOK=false
function report { # $1: result $2: test-name $3: values $4: message
......@@ -59,7 +64,7 @@ function report { # $1: result $2: test-name $3: values $4: message
if [ "$1" == 0 ]
then # successful
SEQUENCE=$(expr $SEQUENCE + 1)
echo $SEQUENCE $2 ok $3 $4
echo -e "$SEQUENCE\t$2\tok\t$3\t$4"
return 0;
else # not successful - outcome depends on device/variant
# this can be seen as a "database" which knows about hardware variations
......@@ -75,9 +80,12 @@ function report { # $1: result $2: test-name $3: values $4: message
| test_bmc150*-*GTA04A5* \
| test_eeprom_*-*Pyra* \
| test_camera-*GTA04* \
| test_cpu_cpuid-*GTA04* \
| test_cpu_lpae-* \
| test_gpu-* \
) # optional feature
SEQUENCE=$(expr $SEQUENCE + 1)
echo $SEQUENCE $2 nfnd $3 $4
echo -e "$SEQUENCE\t$2\tnfnd\t$3\t$4"
return 1;
;;
test_lis302-* \
......@@ -95,13 +103,13 @@ function report { # $1: result $2: test-name $3: values $4: message
| test_eeprom_1-*GTA04A5* \
| test_wwan_usb_gemalto-*GTA04* \
| test_wwan_hwmon_off-*GTA04* \
| test_wwan_usb_option-*Pyra* \
| test_power_twl4030_batt_hdq-*GTA04b* \
| test_hmc5883-*Pyra* \
| test_itg3200-*Pyra* \
| test_camera-*Pyra* \
| test_si47xx-*Pyra* \
| test_tps61050-*Pyra* \
| test_wwan_usb_option-*Pyra* \
| test_leds_on-*Pyra* \
| test_rootfs-*Pyra* \
| test_uboot-*Pyra* \
......@@ -109,13 +117,15 @@ function report { # $1: result $2: test-name $3: values $4: message
| test_cpu_id-*Pyra* \
| test_cpu_mpurate-*Pyra* \
| test_power_twl4030*-*Pyra* \
| test_wlan_libertas-*Pyra* \
| test_wlan_libertas-*GTA04A5* \
) # known to be never available on these models
: no message about failure
return 0
;;
* ) # function is missing on device
SEQUENCE=$(expr $SEQUENCE + 1)
echo $SEQUENCE $2 nok $3 $4
echo -e "$SEQUENCE\t$2\tnok\t$3\t$4"
ANYNOK=true
return 1
;;
......@@ -150,6 +160,10 @@ function test_rootfs {
fi
}
function test_distro {
report 0 "Debian $(cat /etc/debian_version)" ""
}
function test_device_tree {
if [ -r /proc/device-tree ]
then report 0 ${FUNCNAME} "with DT"
......@@ -166,6 +180,7 @@ function test_startup {
test_version
test_kernel
test_rootfs
test_distro
test_device_tree
test_model
}
......@@ -338,12 +353,13 @@ function test_inputs {
function test_camera {
[ -r "/dev/v4l-subdev8" ]
report $? ${FUNCNAME} "" "Camera device"
report $? ${FUNCNAME} "optional" "Camera device"
}
function test_tps61050 {
[ -r "/sys/bus/i2c/devices/1-0033" ]
report $? ${FUNCNAME} "" "Torch/Flash controller [no kernel driver]"
# [ -r "/sys/bus/i2c/devices/1-0033" ]
i2c-probe 1 33
report $? ${FUNCNAME} "1-0033" "Torch/Flash controller [no kernel driver]"
}
function test_eeprom { # $1: bus number
......@@ -389,21 +405,38 @@ function test_power_twl4030 {
report $? ${FUNCNAME}_batt_status "$STATUS" "USB charging status"
TEMP=$(cat ${MADC}/in_temp1_input 2>/dev/null)
[ "${TEMP:=-1}" -ge 20 -a "$TEMP" -le 55 ]
report $? ${FUNCNAME}_batt_temp "${TEMP} °C" "battery temperature [may not be real value if there is no NTC and if not charging]"
[ "${TEMP:=-1}" -ge 10 -a "$TEMP" -le 55 ]
report $? ${FUNCNAME}_batt_temp "${TEMP} °C" "battery temperature [may not be real value if there is no NTC and while not charging]"
TYPE=$(cat ${MADC}/in_voltage0_input 2>/dev/null)
[ "$TYPE" ]
report $? ${FUNCNAME}_batt_type "$TYPE" "battery identification"
report $? ${FUNCNAME}_batt_type "$TYPE mV" "battery identification"
VOLT=$(cat ${MADC}/in_voltage9_input 2>/dev/null)
[ "${VOLT:=-1}" -ge 200 -a "$VOLT" -le 3250 ]
[ "${VOLT:=-1}" -ge 200 -a "$VOLT" -le 3300 ]
report $? ${FUNCNAME}_batt_backup "${VOLT} mV" "backup battery voltage"
}
function test_power_hdq {
GAUGE=/sys/class/power_supply/bq27000-battery
# if gta04 - for pyra use different device name
STATUS=$(cat ${GAUGE}/status 2>/dev/null)
[ "$STATUS" ]
report $? ${FUNCNAME}_status "$STATUS" "Status"
SOC=$(cat ${GAUGE}/capacity 2>/dev/null)
[ "${SOC:=-1}" -ge 0 -a "$SOC" -le 100 ]
report $? ${FUNCNAME}_fuel "$SOC %" "Fuel level"
TEMP=$(cat ${GAUGE}/temp 2>/dev/null)
TEMP="$(expr "${TEMP:-0}" / 10)"
[ "${TEMP:=-1}" -ge 10 -a "$TEMP" -le 55 ]
report $? ${FUNCNAME}_temp "$TEMP °C" "Temperature"
VOLT=$(cat /sys/class/power_supply/bq27000-battery/voltage_now 2>/dev/null)
VOLT=$(cat ${GAUGE}/voltage_now 2>/dev/null)
VOLT="$(expr "${VOLT:-0}" / 1000)"
[ "${VOLT:=-1}" -ge 3100 -a "$VOLT" -le 4300 ]
report $? ${FUNCNAME}_batt_hdq "${VOLT} mV" "main battery voltage [hdq]"
report $? ${FUNCNAME}_volt "${VOLT} mV" "main battery voltage"
}
function test_power_generic {
......@@ -415,6 +448,7 @@ function test_power_generic {
function test_power {
test_power_generic
test_power_twl4030
test_power_hdq
}
function test_memory {
......@@ -442,6 +476,11 @@ function test_cpu_temperature {
report $? ${FUNCNAME} "$(expr "${VAL:-0}" / 1000) °C" "cpu temperature"
}
function test_cpu_lpae {
grep Features /proc/cpuinfo | head -1 | fgrep -q lpae
report $? ${FUNCNAME} "$(gunzip </proc/config.gz | fgrep CONFIG_ARM_LPAE)" "CPU7Kernel support of LPAE"
}
function test_cpu {
read VAL < <(fw_printenv 'dieid#' 2>/dev/null | sed "s/dieid#=//g" 2>/dev/null)
[ "$VAL" ]
......@@ -453,6 +492,7 @@ function test_cpu {
test_cpu_frequency
test_cpu_temperature
test_cpu_lpae
}
function test_gpu {
......@@ -469,7 +509,7 @@ function test_uboot {
function test_si47xx {
(cd /root && make si4721 >/dev/null 2>&1)
VAL=$(echo $(/root/si4721 -d -up -dn))
VAL=$(echo $(/root/si4721 -i /dev/i2c-1 -d -up -dn))
case "$VAL" in
"init resp: 80 get_chiprev resp: 80 1532300000323042 powered off" | \
"init resp: 80 get_chiprev resp: 80 0532300000323042 powered off" )
......@@ -493,15 +533,26 @@ function test_vibra {
report $? ${FUNCNAME} "" "running rumble effect demo"
}
function test_audio {
./twl -d - >/dev/null 2>&1
report $? ${FUNCNAME} "" "running audio demo"
}
function test_mic {
false
report $? ${FUNCNAME} "" "microphone demo"
}
function test_sound {
test_si47xx
test_vibra
# test audio
test_audio