Repository navigation
Rework cdba to support controlling device via external program - #9
Conversation
|
@andersson gracious ping |
|
Rebased on top of current master branch. |
3e2b372 to
165adac
Compare
19e598d to
5626b18
Compare
superna9999
left a comment
There was a problem hiding this comment.
The last patch fixes the external support or fixes in all cases ? If it fixes all cases it should got in a separate or right ?
It is a generic fix, but I stumbled upon it only with the "external" driver, since other drivers do not output a lot. |
|
Is it possible to combine this with the qcomlt debug board? For the phones I have a Pi Pico exposing a compatible serial control interface, but for USB VBUS I need to use PPPS control... |
|
@calebccff here is (an excerpt) of the script that I have here for the relays and PPPS hub: #!/bin/sh
#set -x
set -e
if [ "$#" != 3 ]
then
echo "Usage: $0 [board] [command] [on/off]"
exit 1
fi
echo "Called $1 $2 $3"
case "$1" in
"rb5-2" )
HUBLOC="10-1"
HUBPORT="1"
LAURENT="REL,1"
;;
"db820c-1" )
HUBLOC="10-1"
HUBPORT="2"
LAURENT="REL,2"
;;
"rb1-1" )
HUBLOC="10-1"
HUBPORT="3"
LAURENT="REL,3"
;;
* )
echo "Unknown board $1"
exit 2
esac
uhubctl() {
sudo uhubctl -l $HUBLOC -p $HUBPORT -a $1
if [ "$1" = "off" ] ; then
sudo udevadm trigger --action=remove /sys/bus/usb/devices/${HUBLOC}.${HUBPORT}/ || true
fi
}
laurent() {
curl "http://laurent.lan/cmd.cgi?psw=$LAURENTPW&cmd=$LAURENT,$1"
}
#echo "$2-$3" >> /tmp/cdba-log
case "$2-$3" in
"power-off" )
uhubctl off
#sleep 1
laurent 0
#sleep 1
;;
"power-on" )
uhubctl off
#sleep 1
laurent 0
#sleep 1
laurent 1
;;
"usb-on" )
uhubctl on
;;
"usb-off" )
uhubctl off
sleep 1
;;
"key-power-on" | "key-power-off" )
# ignore
;;
*)
echo "Unknown command $2-$3"
exit 2
;;
esac |
|
I hooked up my pico to control the enable pin of the buck converter I have as a battery replacement, this makes all the button wrangling unecessary as I can just erase the boot partition and the devices always boot straight to fastboot mode. There is maybe some value in this PR for someone else, but given the amount of finesse necessary to get this to work reliably, I'm not gonna stick with it... See #33 Edit: oops, I meant to leave this comment on #21 |
Allow PPPS function even if there is no device->usb callback. PPPS is useable even with no control interface. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Separate backend operations into control and console operations. Main idea is that each device has single set of console ops (conmux or console) and at most one way to control it. Each backend driver exports a structure with the set of callbacks. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Remove headers declaring internal backends API. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Now as each backend exports data structure, mark all functions as static. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Control the board using external program. It will be called with 3 arguments: <board> <command> <on/off>, where command is one of "power", "usb", "key-fastboot", "key-power". Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
If we got to device_close(), the parent SSH might have been exited, making standard file descriptors unusable. Rebind them to /dev/null, so that any output during device_close (both from the cdba server and the helpers) doesn't cause SIGPIPE. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Here are the changes that I have here to allow controlling devices through the external script.