Skip to contentSkip to conversation

libusbgx: check scripts in /etc/usbgx.d

PATCH New [email protected] 1 participant 1 message May 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libusbgx: check scripts in /etc/usbgx.d

From: Ming Liu <[email protected]>

Sometimes an end user might want to change some values in /sys/kernel/config/usb_gadget/ at runtime, for instance, a product id or serial number must be read from /proc/device-tree, and so on.

Support that by letting gadget-start run all scripts in /etc/usbgx.d after importing the schemas.

---
 meta-oe/recipes-support/libusbgx/libusbgx/gadget-start | 4 ++++
 1 file changed, 4 insertions(+)
meta-oe/recipes-support/libusbgx/libusbgx/gadget-start +4 -0
index 9e22671a9..e80cb2c34 100755
@@ -6,6 +6,10 @@ for i in $IMPORT_SCHEMAS; do
     /usr/bin/gadget-import "$i" /etc/usbgx/"$i".schema
 done
 
+for script in $(find -L /etc/usbgx.d -type f -exec test -e {} \; -print 2>/dev/null); do
+    $script
+done
+
 for i in $ENABLED_SCHEMAS; do
     configured_udc=$(eval 'echo ${UDC_FOR_SCHEMA_'"$i"'}')
     if [ -n "${configured_udc}" ] && [ -e "/sys/class/udc/${configured_udc}" ]; then
Signature · 1 line
2.25.1