diff options
5 files changed, 30 insertions, 122 deletions
diff --git a/recipes-support/libusbgx/files/0001-libusbgx-Add-interface-name-for-NCM-Feature-Descript.patch b/recipes-support/libusbgx/files/0001-libusbgx-Add-interface-name-for-NCM-Feature-Descript.patch deleted file mode 100644 index 9f01f33..0000000 --- a/recipes-support/libusbgx/files/0001-libusbgx-Add-interface-name-for-NCM-Feature-Descript.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 4f3f2ad08e6ca132bd1dd388e02b57223bf4219d Mon Sep 17 00:00:00 2001 -From: Ming Liu <ming.liu@toradex.com> -Date: Sun, 11 Dec 2022 14:11:49 +0100 -Subject: [PATCH] libusbgx: Add interface name for NCM Feature Descriptors - -In commit: abf422bffca4a4767e7e242c44910dbf5ef7094f -[ -Author: Stefan Agner <stefan.agner@toradex.com> -Date: Tue Jan 24 14:22:25 2017 -0800 - - libusbgx: Add interface name for Feature Descriptors - - This adds interface name required for "Feature Descriptors". If - specified, we can assume that a Feature Descriptor with the - interface name of the specified string is understood by the - kernel (e.g. interface.rndis). -] - -it only added Feature Descriptors for RNDIS, NCM also needs that, or -else it could not be recognized by Windows systems. - -Add Feature Descriptors interface name for NCM. - -Upstream-Status: Submitted [https://github.com/linux-usb-gadgets/libusbgx/pull/73] - -Signed-off-by: Ming Liu <ming.liu@toradex.com> ---- - src/function/ether.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/function/ether.c b/src/function/ether.c -index b1fe1d2..a9eaf33 100644 ---- a/src/function/ether.c -+++ b/src/function/ether.c -@@ -184,8 +184,14 @@ struct usbg_function_type usbg_f_type_subset = { - ETHER_FUNCTION_OPTS - }; - -+static char *ncm_os_desc_ifnames[] = { -+ "ncm", -+ NULL -+}; -+ - struct usbg_function_type usbg_f_type_ncm = { - .name = "ncm", -+ .os_desc_iname = ncm_os_desc_ifnames, - ETHER_FUNCTION_OPTS - }; - --- -2.25.1 - 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/files/usbg.service b/recipes-support/libusbgx/files/usbg.service deleted file mode 100644 index 860587b..0000000 --- a/recipes-support/libusbgx/files/usbg.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=Load default USB gadget schema g1.schema -ConditionPathExists=/etc/usbg/g1.schema -Before=systemd-networkd.service - -[Service] -Type=oneshot -ExecStartPre=-/sbin/modprobe libcomposite -ExecStartPre=-/bin/mount -t configfs configfs /sys/kernel/config -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' -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=usb-gadget.target diff --git a/recipes-support/libusbgx/libusbgx-config.bbappend b/recipes-support/libusbgx/libusbgx-config.bbappend new file mode 100644 index 0000000..33ef5b7 --- /dev/null +++ b/recipes-support/libusbgx/libusbgx-config.bbappend @@ -0,0 +1,19 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +PACKAGE_ARCH:tdx = "${MACHINE_ARCH}" + +SRC_URI:append:tdx = " \ + file://g1.schema.in \ + file://setup-board.sh \ +" + +do_install:append:tdx() { + sed -e "s:@@PRODUCT_NAME@@:${MACHINE}:" ${WORKDIR}/g1.schema.in > ${WORKDIR}/g1.schema + sed -i "s:IMPORT_SCHEMAS=.*:IMPORT_SCHEMAS=\"g1\":" ${D}${sysconfdir}/default/usbgx + + install -d ${D}${sysconfdir}/usbgx + install -m 0644 ${WORKDIR}/g1.schema ${D}${sysconfdir}/usbgx/g1.schema + + install -d ${D}${sysconfdir}/usbgx.d + install -m 0755 ${WORKDIR}/setup-board.sh ${D}${sysconfdir}/usbgx.d +} diff --git a/recipes-support/libusbgx/libusbgx_git.bb b/recipes-support/libusbgx/libusbgx_git.bb deleted file mode 100644 index b7c248a..0000000 --- a/recipes-support/libusbgx/libusbgx_git.bb +++ /dev/null @@ -1,51 +0,0 @@ -SUMMARY = "USB Gadget neXt Configfs Library" - -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c" - -inherit autotools pkgconfig systemd - -DEPENDS = "libconfig" - -EXTRA_OECONF = "--includedir=${includedir}/usbgx" - -PV = "0.2.0+git${SRCPV}" -SRCREV = "36e71e1e1ea9fb18d4765d0376329dcde90c8c91" -SRCBRANCH = "master" -SRC_URI = " \ - git://github.com/libusbgx/libusbgx.git;branch=${SRCBRANCH};protocol=https \ - file://0001-libusbgx-Add-interface-name-for-NCM-Feature-Descript.patch \ - file://usbg.service \ - file://g1.schema.in \ -" - -S = "${WORKDIR}/git" - -MACHINE_NAME ?= "${MACHINE}" -do_compile:append () { - sed -e "s:@@PRODUCT_NAME@@:${MACHINE_NAME}:" ${WORKDIR}/g1.schema.in > ${WORKDIR}/g1.schema -} - -do_install:append () { - if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then - install -d ${D}${systemd_unitdir}/system/ - install -m 0644 ${WORKDIR}/usbg.service ${D}${systemd_unitdir}/system - fi - - install -d ${D}${sysconfdir}/usbg/ - install -m 0644 ${WORKDIR}/g1.schema ${D}${sysconfdir}/usbg/g1.schema -} - -SYSTEMD_PACKAGES = "${PN}-examples" -SYSTEMD_SERVICE:${PN}-examples = "usbg.service" - -PACKAGES =+ "${PN}-examples" -PACKAGE_ARCH = "${MACHINE_ARCH}" - -FILES:${PN}-examples = " \ - ${bindir}/gadget-* \ - ${bindir}/show-gadgets \ - ${bindir}/show-udcs \ - ${sysconfdir}/usbg/g1.schema \ -" |