summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMing Liu <ming.liu@toradex.com>2023-08-14 10:54:48 +0200
committerMing Liu <ming.liu@toradex.com>2023-08-14 11:24:52 +0200
commit6c5ba7ace720437f5977ae07e43a16b8d5af024f (patch)
treec934387e64d7ae826894fe28919401beae458f0b
parentc91a1b80c24712f835b1d7b9c83947727583749c (diff)
libusbgx: usbgx.service: use Type=oneshot
A regression was introduced by commit: ``` commit 82b92298bead3a93fa905d1724ff17e0affbebc8 Author: Ming Liu <ming.liu@toradex.com> Date: Fri May 12 11:01:15 2023 +0200 libusbgx: fix systemd service - Drop '/sbin/modprobe libcomposite' and '/bin/mount -t configfs configfs /sys/kernel/config' from ExecStartPre, they are redundant since libcomposite would be automatically loaded during system starting up due to the following setting in linux-toradex recipe: KERNEL_MODULE_AUTOLOAD += "libcomposite", insteadly, now let usbg.service require and run after sys-kernel-config.mount. - Since we have "WantedBy=usb-gadget.target" in systemd service, that ensures when udev trigger UDC rules, usbgx.service would run as well so the "Before=systemd-networkd.service" condition could be dropped from usbg.service. - Use "Type=simple" rather than "Type=oneshot", this ensures usbg.service would not hang on failures, failures could happen in many conditions, like if the end user has manually configured something in configfs, or start usbg.service twice, or someting wrong in /etc/usbg/g1.schema. Signed-off-by: Ming Liu <ming.liu@toradex.com> ``` In the case when 'Type=simple' is set, 'ExecStartPost=' will execute right after the process in 'ExecStart=' is started, but we need it execute after the last 'ExecStart=' process exited successfully, so change back to "Type=oneshot". Related-to: ELB-5338 Signed-off-by: Ming Liu <ming.liu@toradex.com>
-rw-r--r--recipes-support/libusbgx/files/usbg.service2
1 files changed, 1 insertions, 1 deletions
diff --git a/recipes-support/libusbgx/files/usbg.service b/recipes-support/libusbgx/files/usbg.service
index 9ed5100..8a1893c 100644
--- a/recipes-support/libusbgx/files/usbg.service
+++ b/recipes-support/libusbgx/files/usbg.service
@@ -5,7 +5,7 @@ Requires=sys-kernel-config.mount
After=sys-kernel-config.mount
[Service]
-Type=simple
+Type=oneshot
ExecStart=/usr/bin/gadget-import g1 /etc/usbg/g1.schema
ExecStartPost=/bin/sh -c '/bin/echo $((0x4000+$(expr $(tr -d "\0" < /proc/device-tree/toradex,product-id) + 0))) > \
/sys/kernel/config/usb_gadget/g1/idProduct'