Commit 2c2ac25c authored by aTc's avatar aTc

Update letux scripts

parent e54cbb78
......@@ -4,12 +4,14 @@ DURATION="$1"
## check DT model
# GTA04
TWL4030_MADC=/sys/devices/platform/68000000.ocp/48070000.i2c/i2c-0/0-0048/48070000.i2c:twl@48:madc/iio:device0
TWL4030_MADC=$(/root/findiio "48070000.i2c:twl@48:madc") # OMAP3
CHARGER=/sys/class/power_supply/twl4030_usb
BQ27000=/sys/class/power_supply/bq27000-battery
BATTERY=/sys/class/power_supply/bq27000-battery
# Pyra
[ -r "$CHARGER" ] || CHARGER=/sys/class/power_supply/bq24297
[ -r "$BQ27000" ] || BQ27000=/sys/class/power_supply/bq27621-0
[ -r "$BATTERY" ] || BATTERY=/sys/class/power_supply/bq27621-0
[ -r "$BATTERY" ] || BATTERY=/sys/class/power_supply/bq27421-0
[ -r "$BATTERY" ] || BATTERY=/sys/class/power_supply/generic-adc-batt
while true
do
......@@ -18,16 +20,16 @@ do
CHGVOLT=$(cat $CHARGER/voltage_now 2>/dev/null)
[ "$CHGVOLT" ] && CHGVOLT=$(expr "$CHGVOLT" / 1000)
VBAT=$(cat $TWL4030_MADC/in_voltage12_input 2>/dev/null)
BQVBAT=$(cat $BQ27000/voltage_now 2>/dev/null)
BQVBAT=$(cat $BATTERY/voltage_now 2>/dev/null)
[ "$BQVBAT" ] && BQVBAT=$(expr "$BQVBAT" / 1000)
[ "$VBAT" ] && CHG=$(expr \( "$VBAT" - 3200 \) \* 100 / 1050)
BQCHG=$(cat $BQ27000/capacity 2>/dev/null)
TEMP=$(cat $TWL4030_MADC/int_temp1_input 2>/dev/null)
BQTEMP=$(cat $BQ27000/temp 2>/dev/null)
BQCHG=$(cat $BATTERY/capacity 2>/dev/null)
TEMP=$(cat $TWL4030_MADC/in_temp1_input 2>/dev/null)
BQTEMP=$(cat $BATTERY/temp 2>/dev/null)
IDPIN=$(cat /dev/usb_id 2>/dev/null)
[ "$BQTEMP" ] && BQTEMP=$(expr "$BQTEMP" / 10)
ICHG=$(cat $TWL4030_MADC/in_current10_input 2>/dev/null)
BQCICHG=$(cat $BQ27000/current_now 2>/dev/null)
BQCICHG=$(cat $BATTERY/current_now 2>/dev/null)
[ "$BQCICHG" ] && BQCICHG=$(expr "$BQCICHG" / 1000)
echo "$(date) - ${VBUS}/${CHGVOLT}/${VBAT}/${BQVBAT}/${VCHG}mV - ${CHG}/${BQCHG}% - ${TEMP}/${BQTEMP}C - ${ICHG}/${BQCICHG}mA - ${IDPIN}" | tee -a battlog
sync
......
......@@ -4,8 +4,9 @@
* daemon to read the ambient light sensor and control
* backlight intensity for Ortustech Blanview display
*
* (c) H. N. Schaller, Golden Delicious Comp. GmbH&Co. KG, 2013
* (c) H. N. Schaller <hns@goldelico.com>
* Lukas Märdian <lukas@goldelico.com>
* Golden Delicious Comp. GmbH&Co. KG, 2013-16
* Licence: GNU GPL2
*/
......@@ -13,12 +14,15 @@
#include <string.h>
#include <errno.h>
#define MAX_BL 10 /* defined by device tree */
int main(int argc, char *argv[])
{
char debug=0;
int prev_bl=-1;
char *file;
FILE *in, *out;
char file[256];
FILE *in=NULL, *out;
int i, n;
if(argv[1] != NULL && strcmp(argv[1], "-d") == 0)
{
fprintf(stderr, "debug mode\n");
......@@ -30,9 +34,9 @@ int main(int argc, char *argv[])
return 1;
}
#if 1
file="/sys/class/backlight/backlight/brightness";
strcpy(file, "/sys/class/backlight/backlight/brightness");
#else
file="/sys/class/backlight/backlight/max_brightness";
strcpy(file, "/sys/class/backlight/backlight/max_brightness");
#endif
out=fopen(file, "w");
if(!out)
......@@ -40,13 +44,36 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s: %s\n", file, strerror(errno));
return 1;
}
for(i=0; i<100; i++)
{
char c;
sprintf(file, "/sys/bus/iio/devices/iio:device%d/name", i);
if(debug)
fprintf(stderr, "trying %s\n", file);
in=fopen(file, "r");
if(!in)
break;
n=fscanf(in, "tsc2007%c", &c);
if(debug)
fprintf(stderr, "n=%d\n", n);
fclose(in);
if(n == 1)
break; // found
in=NULL;
}
if(!in)
{
fprintf(stderr, "no tsc2007 iio device found\n");
return 1;
}
sprintf(file, "/sys/bus/iio/devices/iio:device%d/in_voltage4_raw", i);
if(debug)
fprintf(stderr, "iio device=%s\n", file);
while(1)
{
int i, n;
unsigned short aux;
unsigned short ambient_light;
unsigned short bl;
file="/sys/bus/iio/devices/iio:device1/in_voltage4_raw";
in=fopen(file, "r");
if(!in)
{
......@@ -61,17 +88,17 @@ int main(int argc, char *argv[])
fprintf(stderr, "aux=%d", aux);
if(aux > 2048) // max ambient light
ambient_light = 1;
ambient_light = 0;
else if(aux > 1024)
ambient_light = 2;
ambient_light = 1;
else if(aux > 512)
ambient_light = 3;
ambient_light = 2;
else if(aux > 256)
ambient_light = 4;
ambient_light = 3;
else // min ambient light
ambient_light = 5;
ambient_light = 4;
bl = ambient_light*20;
bl = 1+((MAX_BL-1)*ambient_light)/4;
if(debug)
fprintf(stderr, " ->");
while(prev_bl != bl)
......
......@@ -24,7 +24,7 @@ then
fi
# make sure the panel is active before trying to send commands
echo nostream >dcs # if it was on before
echo nostream >dcs || exit 1 # if it was on before
echo stop >dcs # stop if it was already running
echo nopower >dcs # enable is unused
echo reset >dcs # reset panel
......@@ -40,7 +40,7 @@ echo start >dcs # start MIPI interface
sleep .2
# show some DCS status
echo status >dcs
echo status >dcs || exit 1
# for i in 05 0a 0b 0c 0d 0e 0f 13 20 52 54 5f 68 a1rrrr da db dc; do echo $i r >dcs; done
# program panel here
......@@ -51,7 +51,7 @@ then
# enable command2 and address shift
if [ "$1" = "-s" ]
then
echo g0000 >dcs # write address shift register
echo g0000 >dcs || exit 1 # write address shift register
echo gff12 >dcs # write FF00h
echo g0001 >dcs # write address shift register
echo gff83 >dcs # write FF01h
......@@ -59,7 +59,7 @@ echo g0002 >dcs # write address shift register
echo gff01 >dcs # write FF02h
shift
else
echo g0000 >dcs # write address shift register
echo g0000 >dcs || exit 1 # write address shift register
echo gff128301 >dcs # write FF00h
fi
......
......@@ -13,60 +13,104 @@
# 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 media-ctl
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
[ "$(which media-ctl)" ] || apt-get install -y v4l-utils
[ "$(which mplayer)" ] || apt-get install -y mplayer
[ -d $HOME/.mplayer ] || mkdir -p $HOME/.mplayer
[ -r $HOME/.mplayer/input.conf ] || ( echo MOUSE_BTN0 quit ) >$HOME/.mplayer/input.conf
MODE=$1; [ "$MODE" ] || MODE=sxga
export XAUTHORITY=/.Xauthority
. /root/x
# 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 Camera: $CPATH
echo "### starting mplayer in $MODE mode ###"
case "$MODE" in
sxga ) # bypassing OMAP ISP (almost)
media-ctl -r -l '"ov9655 2-0030":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -V '"ov9655 2-0030":0 [UYVY2X8 1280x1024]'
# 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-ctl -V '"OMAP3 ISP CCDC":1 [UYVY 1280x1024]'
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$(media-ctl -e "OMAP3 ISP CCDC output"):outfmt=uyvy:width=1280:height=1024:fps=15 -vo x11
# 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 '"ov9655 2-0030":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]'
export DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
media-ctl -V '"ov9655 2-0030":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1280x1024]'
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$(media-ctl -e "OMAP3 ISP resizer output"):outfmt=uyvy:width=1280:height=1024:fps=15 -vo x11
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 '"ov9655 2-0030":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]'
export DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
media-ctl -V '"ov9655 2-0030":0 [SGRBG10 320x240], "OMAP3 ISP CCDC":2 [SGRBG10 320x240], "OMAP3 ISP preview":1 [UYVY 320x240], "OMAP3 ISP resizer":1 [UYVY 320x240]'
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$(media-ctl -e "OMAP3 ISP resizer output"):outfmt=uyvy:width=320:height=240:fps=30 -vo x11
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 '"ov9655 2-0030":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]'
export DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
media-ctl -V '"ov9655 2-0030":0 [SGRBG10 352x288], "OMAP3 ISP CCDC":2 [SGRBG10 352x288], "OMAP3 ISP preview":1 [UYVY 352x288], "OMAP3 ISP resizer":1 [UYVY 352x288]'
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$(media-ctl -e "OMAP3 ISP resizer output"):outfmt=uyvy:width=352:height=288:fps=30 -vo x11
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 '"ov9655 2-0030":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 '"ov9655 2-0030":0 [SGRBG10 640x480], "OMAP3 ISP CCDC":2 [SGRBG10 640x480], "OMAP3 ISP preview":1 [UYVY 640x480], "OMAP3 ISP resizer":1 [UYVY 640x480]'
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$(media-ctl -e "OMAP3 ISP resizer output"):outfmt=uyvy:width=640:height=480:fps=30 -vo x11
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 '"ov9655 2-0030":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]'
export DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
media-ctl -V '"ov9655 2-0030":0 [UYVY2X8 1280x1024]'
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 '"ov9655 2-0030":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
export DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
media-ctl -V '"ov9655 2-0030":0 [UYVY2X8 640x480]'
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
......@@ -3,24 +3,31 @@
# see also http://projects.goldelico.com/p/gta04-kernel/page/Camera/
#
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
make capture
case "$(uname -r)" in
2.6.* )
export DEVICE=/dev/video0
;;
3.* )
# media-ctl -r -l '"ov9655 2-0030":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 '"ov9655 2-0030":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1024x768]'
# export DEVICE=/dev/video6
media-ctl -r -l '"ov9655 2-0030":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -V '"ov9655 2-0030":0 [UYVY2X8 1280x1024]'
# media-ctl -V '"OMAP3 ISP CCDC":0 [UYVY2X8 1280x1024]' # is set automatically
media-ctl -V '"OMAP3 ISP CCDC":1 [UYVY 1280x1024]'
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
;;
esac
echo "### capturing $DEVICE to snapshot.jpg ###"
./capture -d $DEVICE
[ "$(which media-ctl)" ] || apt-get install -y v4l-utils
CAMERA="ov9650" # driver name not camera model! use media-ctl -p to find out
CPATH="$(media-ctl -e "$CAMERA")"
if [ ! -r "$CPATH" ]
then
echo "Camera $CAMERA not found!"
exit
fi
echo Camera: $CPATH
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 1024x768]'
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 1280x1024]'
# media-ctl -V '"OMAP3 ISP CCDC":0 [UYVY2X8 1280x1024]' # is set automatically
media-ctl -V '"OMAP3 ISP CCDC":1 [UYVY 1280x1024]'
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
echo "### capturing $CAMERA at $DEVICE ###"
./capture -d $DEVICE # -o snapshot.jpg
......@@ -23,10 +23,6 @@ function fuel-level { # $1 is mV; $2 is mA charging current; $3 is resistance, r
if [ -d "$TWL4030_MADC" ]
then # OMAP3 with TWL4030 / TPS65950
# enable high charging current if GTA04 is connected to USB
echo 800000 >/sys/class/power_supply/twl4030_usb/input_current_limit
# see http://www.mjmwired.net/kernel/Documentation/hwmon/twl4030-madc-hwmon for a list of channels
echo "TWL4030 Main Battery"
echo "===================="
......@@ -150,11 +146,18 @@ echo "==================="
echo type: $(cat $SUPPLY/type)
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 $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 ID: $(cat /dev/usb_id 2>/dev/null)
echo
# enable higher charging current limit for GTA04 and/or Pyra
case "$SUPPLY" in
*twl4030* ) echo 800000 >$SUPPLY/input_current_limit;;
*bq2429* ) echo 2000000 >$SUPPLY/input_current_limit;;
esac
;;
Mains )
......@@ -163,6 +166,7 @@ echo "=================="
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 current: $(cat $SUPPLY/current_now 2>/dev/null)uA
echo max_current: $(cat $SUPPLY/input_current_limit 2>/dev/null)uA
......
......@@ -44,19 +44,29 @@ case "$IF" in
;;
/dev/ttyHS* ) # GTA04 with OPTION GTM601W
killall arecord
trap "killall arecord aplay; (echo "AT+CHUP"; sleep 1) | ./femtocom $IF" EXIT
function turnoff {
killall arecord
killall arecord aplay
amixer set 'Voice PCM Out' off
amixer set 'Voice PCM Interface' 'inactive'
amixer set 'Earpiece Mixer Voice' off
amixer set 'HeadsetL Mixer Voice' off
amixer set 'HeadsetR Mixer Voice' off
(echo "AT+CHUP"; sleep 1) | ./femtocom $IF
}
trap "turnoff" EXIT
trap "exit 1" SIGHUP SIGINT SIGTERM
# enable phone mixer
amixer set 'Voice route' 'Voice to SoC'
amixer set 'Voice PCM Interface' 'inactive'
amixer set 'Voice PCM Out' off
amixer set 'AVADC Clock Priority' 'HiFi high priority'
amixer set 'DAC1 Analog' off
amixer set 'DAC2 Analog' on
#amixer set 'Codec Operation Mode' 'Option 1 (audio)'
amixer set 'Codec Operation Mode' 'Option 2 (voice/audio)'
amixer set 'Earpiece Mixer Voice' off
amixer set Earpiece 100%
amixer set Earpiece 30%
amixer set 'Earpiece Mixer AudioL1' off
amixer set 'Earpiece Mixer AudioL2' on
amixer set 'Earpiece Mixer AudioR1' off
......@@ -67,6 +77,10 @@ case "$IF" in
amixer set 'Analog Left AUXL' nocap
amixer set 'Analog Right AUXR' nocap
amixer set 'Analog Left Main Mic' cap
amixer set 'HeadsetL Mixer AudioL1' off
amixer set 'HeadsetL Mixer AudioL2' off
amixer set 'HeadsetR Mixer AudioR1' off
amixer set 'HeadsetR Mixer AudioR2' off
if $HANDSFREE
then
......@@ -92,33 +106,43 @@ case "$IF" in
if [ "$MODE" = "-hw" ] # not available on GTA04A3 boards
then
amixer set 'AVADC Clock Priority' 'Voice high priority'
amixer set 'Voice route' 'Voice to twl4030'
amixer set 'Voice PCM Interface' 'active'
amixer set 'Voice PCM Out' on
amixer set 'DAC Voice Analog Downlink' unmute
amixer set 'DAC Voice Analog Downlink' 16
amixer set 'DAC Voice Digital Downlink' 44
amixer set 'Earpiece Mixer Voice' on
amixer set 'HeadsetL Mixer Voice' on
amixer set 'HeadsetR Mixer Voice' on
else
amixer set 'Earpiece Mixer Voice' off
amixer set 'HeadsetL Mixer Voice' off
amixer set 'HeadsetR Mixer Voice' off
fi
(
if [ "$NUMBER" == "-" ]
then
echo "AT+CHUP"; sleep 3
amixer set 'Voice PCM Out' off
else
#echo "AT+CPIN=XXXX"; sleep 1 # use the ./pin script to unlock the SIM card
echo "AT_ODO=0"; sleep 1
echo "AT_OPCMENABLE=1"; sleep 1
echo "AT_OPCMPROF=0"; sleep 1
echo "AT_OPCMPROF=0"; sleep 1 # handset profile
echo "AT_OLCC=1"; sleep 1 # report connection status
echo "AT+VIP=0"; sleep 1 # compatible to S16_LE
echo "AT+COPS"; sleep 1
echo "ATD$NUMBER;"; sleep 1
echo "AT+CLVL=4"; sleep 1
echo "ATD$NUMBER;"; sleep 1 # make voice call (the ; is important)
if [ "$MODE" = "-sw" ]
then
arecord -fS16_LE -r8000 | aplay -Ddefault:CARD=voice & # microphone -> modem
arecord -Ddefault:CARD=voice -fS16_LE -r8000 | aplay # modem -> earpiece, speaker, headset
else
echo "please ctl-C to end the call"
sleep 9999 # we can't easily detect end of call by a shell script
echo "please ctl-C to end the call" >&2
arecord -fS16_LE -r8000 >/dev/null # enable micbias
# sleep 99999 # we can't easily detect end of call (without monitoring femtocom output)
fi
fi
) | ./femtocom $IF
......@@ -126,7 +150,7 @@ case "$IF" in
/dev/ttyACM[0-4] | /dev/ttyUSB[0-4] ) # Neo900 / Pyra
# set up voice channel by programming twl4030/6040
# FIXME: set up voice PCM by programming twl4030/6040
(
if [ "$NUMBER" == "-" ]
......@@ -134,9 +158,9 @@ case "$IF" in
echo "AT+CHUP"; sleep 3
else
#echo "AT+CPIN=XXXX"; sleep 1 # use the ./pin script to unlock the SIM card
echo "AT_ODO=0"; sleep 1
echo "AT_OPCMENABLE=1"; sleep 1
echo "AT_OPCMPROF=0"; sleep 1
# FIXME: set up commands to use PCM interface of PHS8/PLS8
echo "AT+COPS"; sleep 1
echo "ATD$NUMBER;"; sleep 1
if [ "$MODE" = "-sw" ]
......@@ -144,8 +168,10 @@ case "$IF" in
arecord -fS16_LE -r8000 | aplay -Ddefault:CARD=voice & # microphone -> modem
arecord -Ddefault:CARD=voice -fS16_LE -r8000 | aplay # modem -> earpiece, speaker, headset
else
echo "please ctl-C to end the call"
sleep 9999 # we can't easily detect end of call by a shell script
echo "please ctl-C to end the call" >&2
arecord -fS16_LE -r8000 >/dev/null # enable micbias
amixer set 'Voice PCM Out' on
sleep 99999
fi
fi
) | ./femtocom $IF
......
......@@ -7,11 +7,12 @@ then
shift
fi
for dev in /sys/class/hwmon/hwmon*
for dev in /sys/class/hwmon/hwmon*/name /sys/class/hwmon/hwmon*/device/name
do
$LIST && cat $dev/name
if [ "$(cat $dev/name 2>/dev/null)" = "$1" ]
then echo $dev
[ -r $dev ] || continue
$LIST && cat $dev
if [ "$(cat $dev)" = "$1" ]
then echo $(dirname $dev)/
exit 0
fi
done
......
#
# clone the currently running system to NAND/OneNAND
# for GTA04 devices (and BeagleBoard with NAND)
#
# works only if booted from SD
#
# do sanity tests
# - that the rootfs is not already coming from nand
# - that boot.scr does not overwrite U-Boot
# DEFAULT="-x -b -k -j" ### we can't write X-Loader yet
DEFAULT="-k -u"
[ "$1" == "" ] && set - $DEFAULT
if [ ! -x /usr/sbin/nandwrite ]
then
echo "mtd-utils not installed (apt-get install mtd-utils)"
exit 1
fi
UIMAGE="/boot/uImage" # the uImage on the SD card
# copy only modules for the current kernel
MODULES=$(mkimage -l "$UIMAGE" | fgrep "Image Name:" | sed 's/Image Name: *//' | sed 's/Linux-//')
# copy only the modules we need to boot on this device
THEMODULES="-C /"
case "$(cat /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
do
[ "$MODULE" != "Module" ] && modprobe -v -D $MODULE | awk '{ print "."$2 }'
done | sort -u)
echo "stripping kernel modules"
(cd / && strip --strip-debug $LOADEDMODULES)
THEMODULES+=" $LOADEDMODULES"
THEMODULES+=" $(cd /; echo ./lib/modules/$MODULES/modules.*)"
;;
* ) # no restriction - copy full file tree
THEMODULES+=" ./lib/modules/$MODULES "
;;
esac
# OS files for rootfs (without locales)
TAR_SRC="--exclude ./flash-test"
TAR_SRC+=" --exclude lost+found"
TAR_SRC+=" --exclude .bash_history"
TAR_SRC+=" --exclude .cache"
TAR_SRC+=" --exclude *.mp3"
TAR_SRC+=" --exclude ./mnt"
TAR_SRC+=" --exclude ./media"
TAR_SRC+=" --exclude ./var/cache"
TAR_SRC+=" --exclude ./var/log"
TAR_SRC+=" --exclude ./var/spool"
TAR_SRC+=" --exclude ./tmp"
TAR_SRC+=" --exclude ./proc"
TAR_SRC+=" --exclude ./sys"
TAR_SRC+=" --exclude ./boot"
TAR_SRC+=" --exclude ./lib/modules"
TAR_SRC+=" --exclude ./debian-*"
TAR_SRC+=" --exclude ./usr/share/man/??"
TAR_SRC+=" --exclude ./usr/share/man/??_*"
TAR_SRC+=" --exclude ./usr/share/doc"
TAR_SRC+=" -cf - -C / ."
# check if requested components are available and fit into given space
for cmd
do
case "$cmd" in
-f ) # force flashing by skipping sanity checks
break
;;
-x )
echo "flashing X-Loader from Linux not available (HW-ECC kernel support needed)"
exit 1
if [ ! -r /boot/x-load.flash ]
then
echo x-loader missing
exit 1
fi
# MLO is not stored in NAND but should be in rootfs
# so that we can create bootable SD cards
if [ ! -r /boot/MLO ]
then
echo MLO missing
exit 1
fi
;;
-b )
echo "flashing U-Boot from Linux not available (HW-ECC kernel support needed)"
exit 1