diff options
Diffstat (limited to 'recipes-support/libusbgx/files/usbg.service')
-rw-r--r-- | recipes-support/libusbgx/files/usbg.service | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/recipes-support/libusbgx/files/usbg.service b/recipes-support/libusbgx/files/usbg.service new file mode 100644 index 0000000..a4e6f80 --- /dev/null +++ b/recipes-support/libusbgx/files/usbg.service @@ -0,0 +1,17 @@ +[Unit] +Description=Load default USB gadget schema g1.schema +ConditionPathExists=/etc/usbg/g1.schema +Before=systemd-networkd.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/gadget-import g1 /etc/usbg/g1.schema +ExecStartPost=/bin/sh -c '/bin/echo $((0x4000+$(cat /proc/device-tree/toradex,product-id))) > \ + /sys/kernel/config/usb_gadget/g1/idProduct' +ExecStartPost=/bin/sh -c '/bin/cat /proc/device-tree/serial-number > \ + /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber' +ExecStartPost=/bin/sh -c '/bin/echo `ls /sys/class/udc/` > \ + /sys/kernel/config/usb_gadget/g1/UDC' + +[Install] +WantedBy=multi-user.target |