diff options
author | Li Jun <jun.li@nxp.com> | 2018-11-09 15:21:41 +0800 |
---|---|---|
committer | Li Jun <jun.li@nxp.com> | 2018-11-13 14:11:21 +0800 |
commit | e66d1fb4f6c58258d0c3cc59b4d8616c73dde078 (patch) | |
tree | c5c29ef7894a5d72eb7434816310751edb2c37f9 /drivers | |
parent | f85da6b1fca7a8e6a8e0795aa38dfb9bde7a5e2d (diff) |
MLK-20305 usb: gadget: fastboot: fix GUID data length error
Current code uses strlen of string to get the property data
length, which is wrong for unicode string, also the whole
property length also should be corrected(descriptor length
minus head length, 142-10=132), detail data format of single
GUID see below table:
Table 4a: Microsoft Extended Properties Feature Descriptor
===================================================================
Value | TYPE | Description
===================================================================
0x8E, 0x00, 0x00, 0x00 | DWORD (LE) | Descriptor length
| | (142 bytes)
--------------------------------------------------------------------
0x00, 0x01 | BCD WORD (LE) | Version ('1.0')
--------------------------------------------------------------------
0x05, 0x00 | WORD (LE) | Extended Property
| | Descriptor index (5)
--------------------------------------------------------------------
0x01, 0x00 | WORD (LE) | Number of sections (1)
--------------------------------------------------------------------
0x84, 0x00, 0x00, 0x00 | DWORD (LE) | Size of the property
| | section (132 bytes)
--------------------------------------------------------------------
0x01, 0x00, 0x00, 0x00 | DWORD (LE) | Property data type
| | (1 = Unicode
| | REG_SZ,
| | see table below)
--------------------------------------------------------------------
0x28, 0x00 | WORD (LE) | Property name
| | length (40 bytes)
--------------------------------------------------------------------
0x44, 0x00, 0x65, 0x00, | NUL-terminated | Property name
(...) | Unicode String | "DeviceInterfaceGUID"
0x74, 0x00, 0x00, 0x00 | (LE) |
--------------------------------------------------------------------
0x4e, 0x00, 0x00, 0x00 | DWORD (LE) | Property data
| | length (78 bytes)
--------------------------------------------------------------------
0x7b, 0x00, 0x46, 0x00, | NUL-terminated | Property name
(...) | Unicode String | "{xxxxxxxx-xxxx-
0x7d, 0x00, 0x00, 0x00 | (LE) | xxxx-xxxx-
| | xxxxxxxxxxxx}\0"
--------------------------------------------------------------------
Details of WCID see below link:
https://github.com/pbatard/libwdi/wiki/WCID-Devices
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index bad99accc8..b4e9984353 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -2738,10 +2738,10 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f) f->os_desc_table->if_id = id; INIT_LIST_HEAD(&fb_os_desc.ext_prop); fb_ext_prop.name_len = strlen(fb_ext_prop.name) * 2 + 2; - fb_os_desc.ext_prop_len = 14 + fb_ext_prop.name_len; + fb_os_desc.ext_prop_len = 10 + fb_ext_prop.name_len; fb_os_desc.ext_prop_count = 1; - fb_ext_prop.data_len = strlen(fb_ext_prop.data); - fb_os_desc.ext_prop_len += fb_ext_prop.data_len; + fb_ext_prop.data_len = strlen(fb_ext_prop.data) * 2 + 2; + fb_os_desc.ext_prop_len += fb_ext_prop.data_len + 4; list_add_tail(&fb_ext_prop.entry, &fb_os_desc.ext_prop); id = usb_string_id(c->cdev); |