--- /bin/on_ac_power 2019-07-20 16:43:51.000000000 +0100
+++ ./on_ac_power 2022-09-22 01:44:53.412558622 +0100
@@ -28,6 +28,17 @@ type="$(cat "${FN}/type")"
case "${type}" in Mains|USB*|BrickID|Wireless)
+# If USB, is it input or output?
+#
+ case "${type}" in
+ USB*)
+ if test -r "${FN}/usb_type"; then
+ usb_type=`cat "${FN}/usb_type"`
+ case "${usb_type}" in
+ *PD*) continue ;;
+ esac
+ fi
+ esac
if [ -r "${FN}/online" ]; then online="$(cat "${FN}/online")" [ "$online" = 1 ] && exit 0
(sorry - the indentation spaces after any + are being eaten)
Possibly this?
--- /bin/on_ac_power 2019-07-20 16:43:51.000000000 +0100
type= "$(cat "${FN}/type")"
Mains| USB*|BrickID| Wireless)
online= "$(cat "${FN}/online")"
[ "$online" = 1 ] && exit 0
+++ ./on_ac_power 2022-09-22 01:44:53.412558622 +0100
@@ -28,6 +28,17 @@
case "${type}" in
+# If USB, is it input or output?
+#
+ case "${type}" in
+ USB*)
+ if test -r "${FN}/usb_type"; then
+ usb_type=`cat "${FN}/usb_type"`
+ case "${usb_type}" in
+ *PD*) continue ;;
+ esac
+ fi
+ esac
if [ -r "${FN}/online" ]; then
(sorry - the indentation spaces after any + are being eaten)