From 0a3ea3f78910781db63e66e7cbbf64688a6c6f1d Mon Sep 17 00:00:00 2001 From: gaoyang3513 Date: Tue, 31 Dec 2024 21:00:07 +0800 Subject: [PATCH] [Bak] Backup 241231 --- build/Makefile | 2 + ...sg2000_milkv_duos_glibc_arm64_sd_defconfig | 1 + .../generic/br_overlay/common/etc/run_usb.sh | 2 +- linux_5.10/drivers/usb/gadget/composite.c | 65 +++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/build/Makefile b/build/Makefile index c253ba6a9..5936caa8f 100644 --- a/build/Makefile +++ b/build/Makefile @@ -301,6 +301,8 @@ ifeq ($(patsubst "%",%,$(CONFIG_ARCH)),arm64) # Since we will support aarch32 user space even if the kernel is aarch64, install aarch32 headers also ${Q}$(MAKE) -j${NPROC} -C ${KERNEL_PATH} ARCH=arm headers_install INSTALL_HDR_PATH=${KERNEL_PATH}/${KERNEL_OUTPUT_FOLDER}/arm/usr endif + ${Q}mkdir -p ${KERNEL_PATH}/${KERNEL_OUTPUT_FOLDER}/tools + ${Q}$(MAKE) -j${NPROC} -C ${KERNEL_PATH}/tools O=${KERNEL_PATH}/${KERNEL_OUTPUT_FOLDER}/tools usb DTS_DEFATUL_PATHS := \ ${BUILD_PATH}/boards/default/dts/${CHIP_ARCH_L} \ diff --git a/build/boards/cv181x/sg2000_milkv_duos_glibc_arm64_sd/sg2000_milkv_duos_glibc_arm64_sd_defconfig b/build/boards/cv181x/sg2000_milkv_duos_glibc_arm64_sd/sg2000_milkv_duos_glibc_arm64_sd_defconfig index d532054e6..361978f37 100644 --- a/build/boards/cv181x/sg2000_milkv_duos_glibc_arm64_sd/sg2000_milkv_duos_glibc_arm64_sd_defconfig +++ b/build/boards/cv181x/sg2000_milkv_duos_glibc_arm64_sd/sg2000_milkv_duos_glibc_arm64_sd_defconfig @@ -27,3 +27,4 @@ CONFIG_TARGET_PACKAGE_MTD-UTILS=y # CONFIG_TARGET_PACKAGE_RSYSLOG is not set CONFIG_TARGET_PACKAGE_BUSYBOX_SYSLOGD_SCRIPT=y CONFIG_TARGET_PACKAGE_NTP=y +CONFIG_USB_F_SS_LB=y diff --git a/device/generic/br_overlay/common/etc/run_usb.sh b/device/generic/br_overlay/common/etc/run_usb.sh index 91e1f5cd0..85984c190 100755 --- a/device/generic/br_overlay/common/etc/run_usb.sh +++ b/device/generic/br_overlay/common/etc/run_usb.sh @@ -256,7 +256,7 @@ start() { mkdir /dev/usb-ffs/adb -p mount -t functionfs adb /dev/usb-ffs/adb if [ -f $ADBD_PATH/adbd ]; then - $ADBD_PATH/adbd & + $ADBD_PATH/adbd & fi else # Start the gadget driver diff --git a/linux_5.10/drivers/usb/gadget/composite.c b/linux_5.10/drivers/usb/gadget/composite.c index 764509ef2..2226ad76b 100644 --- a/linux_5.10/drivers/usb/gadget/composite.c +++ b/linux_5.10/drivers/usb/gadget/composite.c @@ -20,6 +20,71 @@ #include "u_os_desc.h" +//#if defined (CONFIG_GAOYANG) +// (struct usb_descriptor_header *) &WINUSB_WCIDDescriptor, +//#endif // defined (CONFIG_GAOYANG) +#if defined (CONFIG_GAOYANG) + #define WINUSB_IF0_WCID_PROPERTIES_SIZE (142) + + const uint8_t WINUSB_IF0_WCIDProperties [142] = { + /////////////////////////////////////// + /// WCID property descriptor + /////////////////////////////////////// + 0x8e, 0x00, 0x00, 0x00, /* dwLength */ + 0x00, 0x01, /* bcdVersion */ + 0x05, 0x00, /* wIndex */ + 0x01, 0x00, /* wCount */ + + /////////////////////////////////////// + /// registry propter descriptor + /////////////////////////////////////// + 0x84, 0x00, 0x00, 0x00, /* dwSize */ + 0x01, 0x00, 0x00, 0x00, /* dwPropertyDataType */ + 0x28, 0x00, /* wPropertyNameLength */ + /* DeviceInterfaceGUID */ + 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, /* wcName_20 */ + 'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, /* wcName_20 */ + 't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, /* wcName_20 */ + 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, /* wcName_20 */ + 'U', 0x00, 'I', 0x00, 'D', 0x00, 0x00, 0x00, /* wcName_20 */ + 0x4e, 0x00, 0x00, 0x00, /* dwPropertyDataLength */ + /* {1D4B2365-4749-48EA-B38A-7C6FDDDD7E26} */ + '{', 0x00, '1', 0x00, 'D', 0x00, '4', 0x00, /* wcData_39 */ + 'B', 0x00, '2', 0x00, '3', 0x00, '6', 0x00, /* wcData_39 */ + '5', 0x00, '-', 0x00, '4', 0x00, '7', 0x00, /* wcData_39 */ + '4', 0x00, '9', 0x00, '-', 0x00, '4', 0x00, /* wcData_39 */ + '8', 0x00, 'E', 0x00, 'A', 0x00, '-', 0x00, /* wcData_39 */ + 'B', 0x00, '3', 0x00, '8', 0x00, 'A', 0x00, /* wcData_39 */ + '-', 0x00, '7', 0x00, 'C', 0x00, '6', 0x00, /* wcData_39 */ + 'F', 0x00, 'D', 0x00, 'D', 0x00, 'D', 0x00, /* wcData_39 */ + 'D', 0x00, '7', 0x00, 'E', 0x00, '2', 0x00, /* wcData_39 */ + '6', 0x00, '}', 0x00, 0x00, 0x00, /* wcData_39 */ + }; + + #define WINUSB_WCID_DESCRIPTOR_SIZE (40) + const uint8_t WINUSB_WCIDDescriptor [40] = { + /////////////////////////////////////// + /// WCID descriptor + /////////////////////////////////////// + 0x28, 0x00, 0x00, 0x00, /* dwLength */ + 0x00, 0x01, /* bcdVersion */ + 0x04, 0x00, /* wIndex */ + 0x01, /* bCount */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* bReserved_7 */ + + /////////////////////////////////////// + /// WCID function descriptor + /////////////////////////////////////// + 0x00, /* bFirstInterfaceNumber */ + 0x01, /* bReserved */ + /* WINUSB */ + 'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00, /* cCID_8 */ + /* */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* cSubCID_8 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* bReserved_6 */ + }; +#endif // defined (CONFIG_GAOYANG) + /** * struct usb_os_string - represents OS String to be reported by a gadget * @bLength: total length of the entire descritor, always 0x12