summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiago De Franco <hiago.franco@toradex.com>2025-06-17 15:00:18 -0300
committerHiago De Franco <hiago.franco@toradex.com>2025-07-02 10:20:09 -0300
commit432dcf1a1f33637738d1a95d1f993fcff35148a3 (patch)
tree42a3cc693fa1f5f31812d5618028f72bfc35cf6d
parente16c4d739a3f4c37121be2f6efee728000191348 (diff)
libusbgx: add bbappend from meta-toradex-bsp-common
The libusbgx bbappend should be placed in the toradex-demos layer rather than in the BSP layer. This bbappend is a demo image–specific customization and should not be applied universally to all users of the BSP. Keeping this change in the toradex-demos layer ensures it only affects demo images (reference images). Related-to: ELB-6287 Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
-rw-r--r--recipes-support/libusbgx/files/g1.schema.in62
-rwxr-xr-xrecipes-support/libusbgx/files/setup-board.sh11
-rw-r--r--recipes-support/libusbgx/libusbgx-config.bbappend19
3 files changed, 92 insertions, 0 deletions
diff --git a/recipes-support/libusbgx/files/g1.schema.in b/recipes-support/libusbgx/files/g1.schema.in
new file mode 100644
index 0000000..99b39cc
--- /dev/null
+++ b/recipes-support/libusbgx/files/g1.schema.in
@@ -0,0 +1,62 @@
+attrs :
+{
+ bcdUSB = 0x200;
+ bDeviceClass = 0x2;
+ bDeviceSubClass = 0x0;
+ bDeviceProtocol = 0x0;
+ bMaxPacketSize0 = 0x40;
+ idVendor = 0x1b67;
+ bcdDevice = 0x401;
+};
+os_descs :
+{
+ config_id = 1;
+ use = 1;
+ qw_sign = "MSFT100";
+ b_vendor_code = 0xcd;
+};
+strings = (
+ {
+ lang = 0x409;
+ manufacturer = "Toradex";
+ product = "@@PRODUCT_NAME@@";
+ serialnumber = "00000000";
+ } );
+functions :
+{
+ ncm_usb0 :
+ {
+ instance = "usb0";
+ type = "ncm";
+ attrs :
+ {
+ qmult = 5;
+ };
+ os_descs = (
+ {
+ interface = "ncm";
+ compatible_id = "WINNCM";
+ sub_compatible_id = "";
+ } );
+ };
+};
+configs = (
+ {
+ id = 1;
+ name = "c";
+ attrs :
+ {
+ bmAttributes = 0xC0;
+ bMaxPower = 0x1;
+ };
+ strings = (
+ {
+ lang = 0x409;
+ configuration = "WINNCM";
+ } );
+ functions = (
+ {
+ name = "ncm.usb0";
+ function = "ncm_usb0";
+ } );
+ } );
diff --git a/recipes-support/libusbgx/files/setup-board.sh b/recipes-support/libusbgx/files/setup-board.sh
new file mode 100755
index 0000000..03f5af4
--- /dev/null
+++ b/recipes-support/libusbgx/files/setup-board.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ -f /proc/device-tree/toradex,product-id ]; then
+ product_id=$(printf "0x%X\n" $((0x4000 + 0x$(tr -d "\0" < /proc/device-tree/toradex,product-id))))
+ echo $product_id > /sys/kernel/config/usb_gadget/g1/idProduct
+fi
+
+if [ -f /proc/device-tree/serial-number ]; then
+ serial_number=$(tr -d "\0" < /proc/device-tree/serial-number)
+ echo $serial_number > /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber
+fi
diff --git a/recipes-support/libusbgx/libusbgx-config.bbappend b/recipes-support/libusbgx/libusbgx-config.bbappend
new file mode 100644
index 0000000..49daa64
--- /dev/null
+++ b/recipes-support/libusbgx/libusbgx-config.bbappend
@@ -0,0 +1,19 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+SRC_URI:append = " \
+ file://g1.schema.in \
+ file://setup-board.sh \
+"
+
+do_install:append() {
+ sed -e "s:@@PRODUCT_NAME@@:${MACHINE}:" ${UNPACKDIR}/g1.schema.in > ${UNPACKDIR}/g1.schema
+ sed -i "s:IMPORT_SCHEMAS=.*:IMPORT_SCHEMAS=\"g1\":" ${D}${sysconfdir}/default/usbgx
+
+ install -d ${D}${sysconfdir}/usbgx
+ install -m 0644 ${UNPACKDIR}/g1.schema ${D}${sysconfdir}/usbgx/g1.schema
+
+ install -d ${D}${sysconfdir}/usbgx.d
+ install -m 0755 ${UNPACKDIR}/setup-board.sh ${D}${sysconfdir}/usbgx.d
+}