Commit 77ee9668 authored by aTc's avatar aTc

update letux scripts

parent e1f0c287
......@@ -3,11 +3,12 @@ DURATION="$1"
## check DT model
# GTA04
TWL4030_MADC=$(/root/findiio "48070000.i2c:twl@48:madc") # OMAP3
# GTA04 defaults
TWL4030_MADC=$(/root/findiio "48070000.i2c:twl@48:madc") # OMAP3
CHARGER=/sys/class/power_supply/twl4030_usb
BATTERY=/sys/class/power_supply/bq27000-battery
# Pyra
# alternatives
TWL6037_GPADC=$(/root/findiio "palmas-gpadc") # OMAP5
[ -r "$CHARGER" ] || CHARGER=/sys/class/power_supply/bq24297
[ -r "$BATTERY" ] || BATTERY=/sys/class/power_supply/bq27621-0
[ -r "$BATTERY" ] || BATTERY=/sys/class/power_supply/bq27421-0
......@@ -15,23 +16,40 @@ BATTERY=/sys/class/power_supply/bq27000-battery
while true
do
VBUS=$(cat $TWL4030_MADC/in_voltage8_input 2>/dev/null)
VCHG=$(cat $TWL4030_MADC/in_voltage11_input 2>/dev/null)
# system ADCs (report mV)
if [ -r "$TWL6037_GPADC" ]
then
VBUS=$(cat $TWL6037_GPADC/in_voltage10_input 2>/dev/null)
VSYS=$(cat $TWL6037_GPADC/in_voltage7_input 2>/dev/null)
VBAT=$(cat $TWL6037_GPADC/in_voltage6_input 2>/dev/null)
TEMP=$(cat $TWL6037_GPADC/in_temp1_input 2>/dev/null)
IDPIN=$(cat $TWL6037_GPADC/in_voltage14_input 2>/dev/null)mV
else
VBUS=$(cat $TWL4030_MADC/in_voltage8_input 2>/dev/null)
VCHG=$(cat $TWL4030_MADC/in_voltage11_input 2>/dev/null)
VBAT=$(cat $TWL4030_MADC/in_voltage12_input 2>/dev/null)
VSYS="$VBAT"
ICHG=$(cat $TWL4030_MADC/in_current10_input 2>/dev/null)
TEMP=$(cat $TWL4030_MADC/in_temp1_input 2>/dev/null)
IDPIN=$(cat /dev/usb_id 2>/dev/null)
fi
[ "$VBAT" ] && CHG=$(expr \( "$VBAT" - 3200 \) \* 100 / 1050) # estimate from VBAT
# charger
CHGVOLT=$(cat $CHARGER/voltage_now 2>/dev/null)
[ "$CHGVOLT" ] && CHGVOLT=$(expr "$CHGVOLT" / 1000)
VBAT=$(cat $TWL4030_MADC/in_voltage12_input 2>/dev/null)
STATUS=$(cat $CHARGER/status 2>/dev/null)
# fuel gauge (reports µV)
BQVBAT=$(cat $BATTERY/voltage_now 2>/dev/null)
[ "$BQVBAT" ] && BQVBAT=$(expr "$BQVBAT" / 1000)
[ "$VBAT" ] && CHG=$(expr \( "$VBAT" - 3200 \) \* 100 / 1050)
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 $BATTERY/current_now 2>/dev/null)
[ "$BQVBAT" ] && BQVBAT=$(expr "$BQVBAT" / 1000)
[ "$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
[ "$BQTEMP" ] && BQTEMP=$(expr "$BQTEMP" / 10)
echo "$(date) - ${VBUS}/${CHGVOLT}/${VBAT}/${BQVBAT}/${VCHG}mV - ${CHG}/${BQCHG}% - ${VSYS}mV - ${TEMP}/${BQTEMP}C - ${ICHG}/${BQCICHG}mA - ${IDPIN}" | tee -a battlog
sync
sleep $DURATION
done
done
\ No newline at end of file
#!/bin/bash
#
# scan bluetooth
# scan for bluetooth clients
#
case $(tr -d '\0' </proc/device-tree/model) in
rfkill unblock bluetooth
*Pyra-Handheld* ) # WL183x
# enables the 32kHz clock
ifconfig wlan0 up
# load firmware if needed
FIRMWARE=/lib/firmware/ti-connectivity/TIInit_11.8.32.bts
[ -r $FIRMWARE ] || wget -O $FIRMWARE https://git.ti.com/ti-bt/service-packs/blobs/raw/5f73abe7c03631bb2596af27e41a94abcc70b009/initscripts/TIInit_12.8.32.bts
# set parameters
UART=/dev/ttyO1 # uart2
BTBAUD=115200 # for firmware download
FLAGS=
MODE=texas
ARGS=
;;
# load TI Shared Transport driver (if configured into the kernel)
*GTA04A5* | *Neo900* | *GTA04b7* ) # WL183x
FIRMWARE=/lib/firmware/ti-connectivity/TIInit_11.8.32.bts
[ -r $FIRMWARE ] || wget -O $FIRMWARE https://git.ti.com/ti-bt/service-packs/blobs/raw/5f73abe7c03631bb2596af27e41a94abcc70b009/initscripts/TIInit_12.8.32.bts
UART=/dev/ttyO0 # uart1
BTBAUD=115200 # for firmware download
FLAGS=
MODE=texas
ARGS=
;;
modprobe -r st_drv
*GTA04* ) # W2CBW003
UART=/dev/ttyO0 # uart1
BTBAUD=3000000
FLAGS="-s $BTBAUD"
MODE=any
ARGS=flow
;;
if ! hciconfig | fgrep -q hci0
then # bluetooth support not configured into kernel or not yet running - needs to start hciattach
* )
echo "unknown model $(tr -d '\0' </proc/device-tree/model)"
exit 1
;;
case $(tr -d '\0' </proc/device-tree/model) in
esac
# override
[ -r /dev/ttyBT0 ] && UART=/dev/ttyBT0
*Pyra-Handheld* ) # WL183x
# enables the 32kHz clock
ifconfig wlan0 up
# load firmware if needed
FIRMWARE=/lib/firmware/ti-connectivity/TIInit_11.8.32.bts
[ -r $FIRMWARE ] || wget -O $FIRMWARE https://git.ti.com/ti-bt/service-packs/blobs/raw/5f73abe7c03631bb2596af27e41a94abcc70b009/initscripts/TIInit_12.8.32.bts
# set parameters
UART=/dev/ttyO1 # uart2
BTBAUD=115200 # for firmware download
FLAGS=
MODE=texas
ARGS=
;;
rfkill unblock bluetooth
*GTA04A5* | *Neo900* | *GTA04b7* ) # WL183x
FIRMWARE=/lib/firmware/ti-connectivity/TIInit_11.8.32.bts
[ -r $FIRMWARE ] || wget -O $FIRMWARE https://git.ti.com/ti-bt/service-packs/blobs/raw/5f73abe7c03631bb2596af27e41a94abcc70b009/initscripts/TIInit_12.8.32.bts
UART=/dev/ttyO0 # uart1
BTBAUD=115200 # for firmware download
FLAGS=
MODE=texas
ARGS=
;;
# load TI Shared Transport driver (if configured into the kernel)
*'UDOO Neo'* ) # WL1831
FIRMWARE=/lib/firmware/ti-connectivity/TIInit_11.8.32.bts
[ -r $FIRMWARE ] || wget -O $FIRMWARE https://git.ti.com/ti-bt/service-packs/blobs/raw/5f73abe7c03631bb2596af27e41a94abcc70b009/initscripts/TIInit_12.8.32.bts
UART=/dev/ttymxc2 # uart3
BTBAUD=115200 # for firmware download
FLAGS=
MODE=texas
ARGS=
;;
modprobe -r st_drv
*GTA04* ) # W2CBW003
UART=/dev/ttyO0 # uart1
BTBAUD=3000000
FLAGS="-s $BTBAUD"
MODE=any
ARGS=flow
;;
* )
echo "unknown model $(tr -d '\0' </proc/device-tree/model)"
exit 1
;;
esac
# override if wi2wi,w2cbw003-bluetooth driver is loaded
[ -r /dev/ttyBT0 ] && UART=/dev/ttyBT0
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
......
......@@ -2,6 +2,7 @@
TWL4030_MADC=$(/root/findiio "48070000.i2c:twl@48:madc") # OMAP3
TWL6030_GPADC=$(/root/findiio "48070000.i2c:twl@48:adc") # OMAP4
TWL6037_GPADC=$(/root/findiio "palmas-gpadc") # OMAP5
INA231=$(/root/findhwmon ina231) # Pyra modem monitor
function fuel-level { # $1 is mV; $2 is mA charging current; $3 is resistance, return is % [0..100]
......@@ -24,22 +25,19 @@ if [ -d "$TWL4030_MADC" ]
then # OMAP3 with TWL4030 / TPS65950
# see http://www.mjmwired.net/kernel/Documentation/hwmon/twl4030-madc-hwmon for a list of channels
echo "TWL4030 Main Battery"
echo "===================="
echo "TWL4030 System Status"
echo "============≠========"
echo VBUS: $(cat "$TWL4030_MADC/in_voltage8_input")mV
echo VCHG: $(cat "$TWL4030_MADC/in_voltage11_input")mV
VOLT=$(cat "$TWL4030_MADC/in_voltage12_input")
echo volt: ${VOLT}mV
echo current: $(cat "$TWL4030_MADC/in_current10_input")mA
AMP=$(cat "$TWL4030_MADC/in_current10_input")
# fixme: subtract 400mA from USB current
echo fuel level: ca. $(fuel-level "$VOLT" $(cat "$TWL4030_MADC/in_current10_input") 0.1)%
echo VBATT: ${VOLT}mV ca. $(fuel-level "$VOLT" "AMP" 0.1)%
echo IBATT: ${AMP}mA
echo VBKUP: $(cat "$TWL4030_MADC/in_voltage9_input")mV
echo temp: $(cat "$TWL4030_MADC/in_temp1_input")°C
echo type: $(cat "$TWL4030_MADC/in_voltage0_input")mV
echo micsense: $(cat "$TWL4030_MADC/in_voltage7_input")mV
echo VBUS: $(cat "$TWL4030_MADC/in_voltage8_input")mV
echo VCHG: $(cat "$TWL4030_MADC/in_voltage11_input")mV
echo
echo "TWL4030 Backup battery"
echo "======================"
echo volt: $(cat "$TWL4030_MADC/in_voltage9_input")mV
echo
fi
......@@ -65,28 +63,22 @@ then # OMAP4 with twl6030
# 14 USB ID line voltage
# 15 test network
echo "TWL6030 System Voltage"
echo "======================"
echo "TWL6030 System Status"
echo "====================="
echo VSYS: $(cat $TWL6030_GPADC/in_voltage7_input)mV
echo
echo "TWL6030 Main Battery"
echo "===================="
echo VBUS: $(cat $TWL6030_GPADC/in_voltage10_input)mV
echo VCHG: $(cat $TWL6030_GPADC/in_voltage9_input)mV
VOLT=$(cat $TWL6030_GPADC/in_voltage7_input)
echo volt: ${VOLT}mV ca. $(fuel-level "$VOLT" $TWL6030_GPADC/in_voltage11_input 0.1)%
# NOTE: the driver reports mV and not mA or °C!
# NOTE: in_voltage11_input is missing on Pandaboard
AMP=$(cat $TWL6030_GPADC/in_voltage11_input)
echo VBATT: ${VOLT}mV ca. $(fuel-level "$VOLT" "$AMP" 0.1)%
echo VBKUP: $(cat $TWL6030_GPADC/in_voltage8_input)mV
# echo current: $(cat $TWL6030_GPADC/in_voltage11_input)mA
echo temp: $(cat $TWL6030_GPADC/in_temp1_raw)°C
echo temp: $(cat $TWL6030_GPADC/in_temp1_raw)mV
echo type: $(cat $TWL6030_GPADC/in_voltage0_input)mV
echo VBUS: $(cat $TWL6030_GPADC/in_voltage10_input)mV
echo VCHG: $(cat $TWL6030_GPADC/in_voltage9_input)mV
echo audio: $(cat $TWL6030_GPADC/in_voltage2_input)mV
echo usb id: $(cat $TWL6030_GPADC/in_voltage14_input)mV
echo
echo "TWL6030 Backup battery"
echo "======================"
echo volt: $(cat $TWL6030_GPADC/in_voltage8_input)mV
echo
fi
......@@ -111,26 +103,28 @@ then # OMAP5 with Palmas (TWL6037)
# 14 USB ID line voltage
# 15 test network
echo "Palmas System Voltage"
echo "====================="
echo "Palmas System STATUS"
echo "===================="
echo VSYS: $(cat $TWL6037_GPADC/in_voltage7_input)mV
echo
echo "Palmas Main Battery"
echo "==================="
VOLT=$(cat $TWL6037_GPADC/in_voltage6_input)
echo volt: ${VOLT}mV ca. $(fuel-level "$VOLT" $(cat "$TWL6037_GPADC/in_voltage11_input") 0.1)%
# NOTE: the driver reports mV and not mA or °C!
echo current: $(cat $TWL6037_GPADC/in_voltage11_input)mA
echo temp: $(cat $TWL6037_GPADC/in_temp1_raw)°C
echo type: $(cat $TWL6037_GPADC/in_voltage0_input)mV
echo VBUS: $(cat $TWL6037_GPADC/in_voltage10_input)mV
echo VCHG: $(cat $TWL6037_GPADC/in_voltage9_input)mV
VOLT=$(cat $TWL6037_GPADC/in_voltage6_input)
AMP=$(cat $TWL6037_GPADC/in_voltage11_input)
echo VBATT: ${VOLT}mV ca. $(fuel-level "$VOLT" "AMP" 0.1)%
echo IBATT: ${AMP}mA
echo VBKUP: $(cat $TWL6037_GPADC/in_voltage8_input)mV
echo temp: $(cat $TWL6037_GPADC/in_temp1_raw)mV
echo type: $(cat $TWL6037_GPADC/in_voltage0_input)mV
echo audio: $(cat $TWL6037_GPADC/in_voltage2_input)mV
echo usb id: $(cat $TWL6037_GPADC/in_voltage14_input)mV
echo
echo "Palmas Backup battery"
echo "====================="
echo volt: $(cat $TWL6037_GPADC/in_voltage8_input)mV
if [ "$INA231" ]
then
# echo "shunt resistor: $(cat $INA231/shunt_resistor) uOhm"
# echo "across shunt voltage: $(cat $INA231/in0_input) mV"
echo "VMODEM: $(cat $INA231/in1_input) mV"
echo "IMODEM: $(cat $INA231/curr1_input) mA"
echo "PMODEM: $(cat $INA231/power1_input) uW"
fi
echo
fi
......@@ -150,6 +144,8 @@ 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
TEMP=$(cat $SUPPLY/temp 2>/dev/null)
[ "$TEMP" ] && echo temperature: $(LC_ALL=C LANGUAGE=C perl -e "print ${TEMP}0 / 100")°C
echo ID: $(cat /dev/usb_id 2>/dev/null)
echo
......
mount | fgrep -q debugfs || mount -t debugfs none /sys/kernel/debug
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
......@@ -6,14 +6,16 @@
# -hs: enable headset
# -hw: use hardware voice routing (GTA04A4++ only)
# -sw: use software routing (arecord | aplay) [default]
#
# to hang up: dial -
#
# to unlock with pin, use the ./pin script
# to unlock with pin, use the /root/pin script
#
IF="$(/root/wwan-on)"
MODE="-sw" # default
HANDSFREE=false
HANDSFREE=-nhf
HEADSET=false
while true
......@@ -23,7 +25,7 @@ do
MODE="$1"
shift
;;
-hf ) HANDSFREE=true
-hf ) HANDSFREE=
shift
;;
-hs ) HEADSET=true
......@@ -47,86 +49,47 @@ case "$IF" in
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) | /root/femtocom $IF
}
trap "turnoff" EXIT
trap "exit 1" SIGHUP SIGINT SIGTERM
# enable phone mixer
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 30%
amixer set 'Earpiece Mixer AudioL1' off
amixer set 'Earpiece Mixer AudioL2' on
amixer set 'Earpiece Mixer AudioR1' off
#amixer set 'Earpiece Mixer AudioR2' off # does not exist
amixer set 'Analog' 5
amixer set TX1 'Analog'
amixer set 'TX1 Digital' 12
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
amixer set 'HandsfreeL Mux' AudioL2
amixer set 'HandsfreeR Mux' AudioR2
amixer set HandsfreeL on
amixer set HandsfreeR on
else
amixer set HandsfreeL off
amixer set HandsfreeR off
fi
NUM=$(/root/findsoundcard "gta04")
if $HEADSET
then
./tvout 0 # disable tvout
amixer set 'Analog Left Main Mic' nocap
amixer set 'Analog Left Headset Mic' cap
/root/tvout 0 # disable tvout
amixer -c "$NUM" set 'Analog Left Main Mic' nocap
amixer -c "$NUM" set 'Analog Left Headset Mic' cap
else
amixer set 'Analog Left Main Mic' cap
amixer set 'Analog Left Headset Mic' nocap
amixer -c "$NUM" set 'Analog Left Main Mic' cap
amixer -c "$NUM" set 'Analog Left Headset Mic' nocap
fi
if [ "$MODE" = "-hw" ] # not available on GTA04A3 boards
then
amixer set 'AVADC Clock Priority' 'Voice high priority'
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
amixer -c "$NUM" set 'AVADC Clock Priority' 'Voice high priority'
amixer -c "$NUM" set 'Voice PCM Interface' 'active'
amixer -c "$NUM" set 'Voice PCM Out' on
amixer -c "$NUM" set 'DAC Voice Analog Downlink' unmute
amixer -c "$NUM" set 'DAC Voice Analog Downlink' 16
amixer -c "$NUM" set 'DAC Voice Digital Downlink' 44
amixer -c "$NUM" set 'Earpiece Mixer Voice' on
amixer -c "$NUM" set 'HeadsetL Mixer Voice' on
amixer -c "$NUM" set 'HeadsetR Mixer Voice' on
else
amixer set 'Earpiece Mixer Voice' off
amixer set 'HeadsetL Mixer Voice' off
amixer set 'HeadsetR Mixer Voice' off
amixer -c "$NUM" set 'Earpiece Mixer Voice' off
amixer -c "$NUM" set 'HeadsetL Mixer Voice' off
amixer -c "$NUM" set 'HeadsetR Mixer Voice' off
fi
(
if [ "$NUMBER" == "-" ]
then
echo "AT+CHUP"; sleep 3
amixer set 'Voice PCM Out' off
amixer -c "$NUM" set 'Voice PCM Out' off
else
#echo "AT+CPIN=XXXX"; sleep 1 # use the ./pin script to unlock the SIM card
#echo "AT+CPIN=XXXX"; sleep 1 # use the /root/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 # handset profile
......@@ -137,11 +100,11 @@ function turnoff {
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
arecord -Ddefault:CARD=gta04 -fS16_LE -r8000 | aplay -Ddefault:CARD=Telephony & # microphone -> modem
arecord -Ddefault:CARD=Telephony -fS16_LE -r8000 | /root/twl $HANDSFREE -stdin # modem -> earpiece, speaker, headset
else
echo "please ctl-C to end the call" >&2
arecord -fS16_LE -r8000 >/dev/null # enable micbias
arecord -Ddefault:CARD=gta04 -fS16_LE -r8000 >/dev/null # just enable micbias
# sleep 99999 # we can't easily detect end of call (without monitoring femtocom output)
fi
fi
......@@ -150,27 +113,25 @@ function turnoff {
/dev/ttyACM[0-4] | /dev/ttyUSB[0-4] ) # Neo900 / Pyra
# FIXME: set up voice PCM by programming twl4030/6040
(
NUM=$(/root/findsoundcard "L15")
if [ "$NUMBER" == "-" ]
then
echo "AT+CHUP"; sleep 3
else
#echo "AT+CPIN=XXXX"; sleep 1 # use the ./pin script to unlock the SIM card
# FIXME: set up commands to use PCM interface of PHS8/PLS8
#echo "AT+CPIN=XXXX"; sleep 1 # use the /root/pin script to unlock the SIM card
echo "AT+COPS"; sleep 1
echo "ATD$NUMBER;"; sleep 1
echo "AT^SAIC=3,1,1,0,1,0,1,0"; 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
arecord -Ddefault:CARD=L15 -fS16_LE -r8000 | aplay -Ddefault:CARD=Telephony & # microphone -> modem
arecord -Ddefault:CARD=Telephony -fS16_LE -r8000 | /root/twl $HANDSFREE -stdin # modem -> earpiece, speaker, headset
else
echo "please ctl-C to end the call" >&2
arecord -fS16_LE -r8000 >/dev/null # enable micbias
amixer set 'Voice PCM Out' on
arecord -Ddefault:CARD=L15 -fS16_LE -r8000 >/dev/null # enable micbias
amixer -c "$NUM" set 'Voice PCM Out' on
sleep 99999
fi
fi
......
......@@ -2,11 +2,12 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/select.h>
#include <termios.h>
main(int argc, char *argv[])
int main(int argc, char *argv[])
{
int fd;
int sendcrlf=0;
......@@ -20,7 +21,7 @@ main(int argc, char *argv[])
argv++;
}
if(!argv[1]) {
fprintf(stderr, "usage: %s [-s] [-r] /dev/ttyHS?\n", arg0);
fprintf(stderr, "usage: %s [-s] [-r] /dev/tty???\n", arg0);
fprintf(stderr, " -s send \\n as \\n and not as \\r\\n\n");
fprintf(stderr, " -r receive \\r and don't ignore\n");
return 1;
......@@ -34,27 +35,29 @@ main(int argc, char *argv[])
perror("tcgetattr");
return 1;
}
tc.c_cflag &= ~(CSIZE | PARENB | CSTOPB | CSIZE);
tc.c_cflag |= CS8;
tc.c_cflag &= ~(CSIZE | PARENB | CSIZE);
tc.c_cflag |= CS8 | CSTOPB;
tc.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | INPCK | ISIG);
tc.c_iflag |= IGNBRK | IGNPAR | ICRNL | INLCR;
tc.c_iflag |= IGNBRK | IGNPAR | ICRNL | INLCR | IXANY;
tc.c_oflag &= ~OPOST;
tc.c_cc[VMIN] = 1;
tc.c_cc[VTIME] =0;
if(tcsetattr(fd, TCSANOW, &tc) < 0) { /* tried to modify */
tc.c_cc[VTIME] = 0;
cfsetspeed(&tc, B115200);
if(tcsetattr(fd, TCSANOW, &tc) < 0) { /* failed to modify */
perror("tcsetattr");
return 1;
}
while(1) {
fd_set rfd, wfd, efd;
FD_SET(0, &rfd);
FD_SET(fd, &rfd);
FD_SET(1, &wfd);
FD_SET(fd, &wfd);
FD_ZERO(&rfd);
FD_ZERO(&wfd);
FD_ZERO(&efd);
FD_SET(0, &rfd); // stdin, i.e. keyboard
FD_SET(fd, &rfd); // our /dev/tty
if(select(fd+1, &rfd, &wfd, &efd, NULL) > 0)
{ // wait for input from either end and forward to the other
char buf[1];
if(FD_ISSET(0, &rfd) && FD_ISSET(fd, &wfd))
if(FD_ISSET(0, &rfd))
{ /* echo stdin -> tty */
int n=read(0, buf, 1);
if(n < 0)
......@@ -69,15 +72,16 @@ main(int argc, char *argv[])
}
write(fd, buf, n);
}
if(FD_ISSET(fd, &rfd) && FD_ISSET(1, &wfd))
if(FD_ISSET(fd, &rfd))
{ /* echo tty -> stdout */
int n=read(fd, buf, 1);
if(n < 0)
return 3; /* read error */
if(n == 0)
continue;
if(!passcr && buf[0] == '\r')
continue; /* ignore received \r and take \n only */
if(n > 0)
write(1, buf, n);
write(1, buf, n);
}
}
}
......
# find input event by name
LIST=false
if [ "$1" = "-a" ]
then
LIST=true
shift
fi
for dev in /sys/class/input/input*
do
$LIST && cat $dev/name
if [ "$(cat $dev/name 2>/dev/null)" = "$1" ]
then echo /dev/input/$(basename $dev/event*)
exit 0
fi
done
$LIST || exit 1
\ No newline at end of file
# find sound card by name
LIST=false
if [ "$1" = "-a" ]
then
LIST=true
shift
fi
for dev in /proc/asound/card[0-9]*
do
$LIST && cat $dev/id
if [ "$(cat $dev/id 2>/dev/null)" = "$1" ]
then echo $(basename $dev) | sed 's/card//g'
exit 0
fi
done
$LIST || exit 1
\ No newline at end of file
......@@ -5,6 +5,28 @@
# works only if booted from SD
#
case "$(tr -d '\0' </proc/device-tree/model)" in
*GTA04* )
;;
*Pyra* | *GTA15* | *LC15* | *"TI OMAP5 uEVM"* )
# switch to eMMC
./txs e
## find out what the eMMC device is
DEV=/dev/mmcblk0p
mount ${DEV}1 /mnt/mmc0.1
mount ${DEV)2 /mnt/mmc0.2
# copy uImage and device tree
### mount boot partition from SD card
# copy rootfs
echo not yet done automatically
<