7 Commits

7 changed files with 79 additions and 36 deletions

View File

@ -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} \

View File

@ -230,3 +230,6 @@ CONFIG_DEBUG_FS=y
# CONFIG_FTRACE is not set
# CONFIG_STRICT_DEVMEM is not set
# CONFIG_RUNTIME_TESTING_MENU is not set
CONFIG_USB_ZERO=m
CONFIG_USB_F_SS_LB=y
CONFIG_DEBUG_INFO=y

View File

@ -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

View File

@ -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

View File

@ -7,7 +7,6 @@
/* #define VERBOSE_DEBUG */
#include "linux/types.h"
#include <linux/kallsyms.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@ -21,6 +20,56 @@
#include "u_os_desc.h"
#if defined (CONFIG_GAOYANG)
#define WINUSB_IF0_WCID_PROPERTIES_SIZE (162)
const uint8_t WINUSB20_WCIDDescriptorSet [162] = {
///////////////////////////////////////
/// WCID20 descriptor set descriptor
///////////////////////////////////////
0x0a, 0x00, /* wLength */
0x00, 0x00, /* wDescriptorType */
0x00, 0x00, 0x03, 0x06, /* dwWindowsVersion */
0xa2, 0x00, /* wDescriptorSetTotalLength */
///////////////////////////////////////
/// WCID20 compatible ID descriptor
///////////////////////////////////////
0x14, 0x00, /* wLength */
0x03, 0x00, /* wDescriptorType */
/* WINUSB */
'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00, /* cCID_8 */
/* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* cSubCID_8 */
///////////////////////////////////////
/// WCID20 registry property descriptor
///////////////////////////////////////
0x84, 0x00, /* wLength */
0x04, 0x00, /* wDescriptorType */
0x07, 0x00, /* wPropertyDataType */
0x2a, 0x00, /* wPropertyNameLength */
/* DeviceInterfaceGUIDs */
'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, /* wcPropertyName_21 */
'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, /* wcPropertyName_21 */
't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, /* wcPropertyName_21 */
'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, /* wcPropertyName_21 */
'U', 0x00, 'I', 0x00, 'D', 0x00, 's', 0x00, /* wcPropertyName_21 */
0x00, 0x00, /* wcPropertyName_21 */
0x50, 0x00, /* wPropertyDataLength */
/* {1D4B2365-4749-48EA-B38A-7C6FDDDD7E26} */
'{', 0x00, '1', 0x00, 'D', 0x00, '4', 0x00, /* wcPropertyData_40 */
'B', 0x00, '2', 0x00, '3', 0x00, '6', 0x00, /* wcPropertyData_40 */
'5', 0x00, '-', 0x00, '4', 0x00, '7', 0x00, /* wcPropertyData_40 */
'4', 0x00, '9', 0x00, '-', 0x00, '4', 0x00, /* wcPropertyData_40 */
'8', 0x00, 'E', 0x00, 'A', 0x00, '-', 0x00, /* wcPropertyData_40 */
'B', 0x00, '3', 0x00, '8', 0x00, 'A', 0x00, /* wcPropertyData_40 */
'-', 0x00, '7', 0x00, 'C', 0x00, '6', 0x00, /* wcPropertyData_40 */
'F', 0x00, 'D', 0x00, 'D', 0x00, 'D', 0x00, /* wcPropertyData_40 */
'D', 0x00, '7', 0x00, 'E', 0x00, '2', 0x00, /* wcPropertyData_40 */
'6', 0x00, '}', 0x00, 0x00, 0x00, 0x00, 0x00, /* wcPropertyData_40 */
};
#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
@ -666,7 +715,6 @@ static int bos_desc(struct usb_composite_dev *cdev)
struct usb_dcd_config_params dcd_config_params;
struct usb_bos_descriptor *bos = cdev->req->buf;
#if defined (CONFIG_GAOYANG)
#if defined (CONFIG_GAOYANG_WCID20)
/* WCID20 device capability descriptor */
#define USB_CAP_TYPE_WCID 5
#define USB_CAP_WCID_SIZE 0x1C
@ -693,29 +741,7 @@ static int bos_desc(struct usb_composite_dev *cdev)
uint32_t winusb20_wcidbos_version = 0x06030000;
struct usb_cap_wcid20_descriptor *usb_cap_wcid;
#endif // !defined (CONFIG_GAOYANG_WCID20)
/* WCID10 device capability descriptor */
#define USB_OS_SIZE 0x12
#define USB_DT_OS USB_DT_STRING
#define WCID_VENDOR_CODE 0x00
struct usb_cap_wcid10_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u16 MicrosoftString[7];
__u8 bVendorCode;
union {
__u8 bPad;
__u8 bFlags;
};
} __attribute__((packed));
uint8_t os_string[] = {
0x4D, 0x00, 0x53, 0x00, 0x46, 0x00, 0x54,
0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00
};
struct usb_cap_wcid10_descriptor *usb_os = cdev->req->buf;
#endif // defined (CONFIG_GAOYANG)
unsigned int besl = 0;
@ -724,15 +750,6 @@ static int bos_desc(struct usb_composite_dev *cdev)
bos->wTotalLength = cpu_to_le16(USB_DT_BOS_SIZE);
bos->bNumDeviceCaps = 0;
#if defined (CONFIG_GAOYANG)
usb_os->bLength = USB_OS_SIZE;
usb_os->bDescriptorType = USB_DT_OS;
usb_os->bVendorCode = WCID_VENDOR_CODE;
memcpy(usb_os->MicrosoftString, os_string, sizeof(os_string));
bos->wTotalLength = cpu_to_le16(USB_OS_SIZE);
bos->bNumDeviceCaps = 0;
#endif // defined (CONFIG_GAOYANG_WCID20)
/* Get Controller configuration */
if (cdev->gadget->ops->get_config_params) {
@ -770,7 +787,6 @@ static int bos_desc(struct usb_composite_dev *cdev)
USB_BESL_SUPPORT | besl);
#if defined (CONFIG_GAOYANG)
#if defined (CONFIG_GAOYANG_WCID20)
usb_cap_wcid = cdev->req->buf + le16_to_cpu(bos->wTotalLength);
le16_add_cpu(&bos->wTotalLength, USB_CAP_WCID_SIZE);
bos->bNumDeviceCaps++;
@ -782,7 +798,6 @@ static int bos_desc(struct usb_composite_dev *cdev)
usb_cap_wcid->wDescriptorSetTotalLength = cpu_to_le32(WINUSB20_WCID_DESC_SET_SIZE);
usb_cap_wcid->bVendorCode = WINUSB20_WCID_VENDOR_CODE;
memcpy(usb_cap_wcid->bPlatformCapabilityUUID_16, winusb20_wcidbos_uuid, sizeof(winusb20_wcidbos_uuid));
#endif // !defined (CONFIG_GAOYANG_WCID20)
#endif // defined (CONFIG_GAOYANG)
/*
* The Superspeed USB Capability descriptor shall be implemented by all

View File

@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/usb/composite.h>
#include <linux/err.h>
#include "configfs.h"
#include "g_zero.h"
#include "u_f.h"
@ -1237,12 +1238,17 @@ static void source_sink_free_instance(struct usb_function_instance *fi)
struct f_ss_opts *ss_opts;
ss_opts = container_of(fi, struct f_ss_opts, func_inst);
kfree(ss_opts->sslb_interf_group); /* single VLA chunk */
kfree(ss_opts);
}
static struct usb_function_instance *source_sink_alloc_inst(void)
{
struct f_ss_opts *ss_opts;
struct usb_os_desc *descs[1];
struct config_group *sslb_interf_group;
char *names[1];
ss_opts = kzalloc(sizeof(*ss_opts), GFP_KERNEL);
if (!ss_opts)
@ -1258,6 +1264,18 @@ static struct usb_function_instance *source_sink_alloc_inst(void)
config_group_init_type_name(&ss_opts->func_inst.group, "",
&ss_func_type);
INIT_LIST_HEAD(&ss_opts->sslb_os_desc.ext_prop);
ss_opts->sslb_os_desc.ext_compat_id = ss_opts->sslb_ext_compat_id;
names[0] = "sslb";
descs[0] = &ss_opts->sslb_os_desc;
sslb_interf_group = usb_os_desc_prepare_interf_dir(&ss_opts->func_inst.group, 1, descs, names, THIS_MODULE);
if (IS_ERR(sslb_interf_group)) {
source_sink_free_instance(&ss_opts->func_inst);
return ERR_CAST(sslb_interf_group);
}
ss_opts->sslb_interf_group = sslb_interf_group;
return &ss_opts->func_inst;
}
DECLARE_USB_FUNCTION(SourceSink, source_sink_alloc_inst,

View File

@ -45,6 +45,10 @@ struct f_ss_opts {
*/
struct mutex lock;
int refcnt;
struct config_group *sslb_interf_group;
struct usb_os_desc sslb_os_desc;
char sslb_ext_compat_id[16];
};
struct f_lb_opts {