Commit e66d1fb4f6c58258d0c3cc59b4d8616c73dde078
1 parent
f85da6b1fc
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
5 other branches
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>
Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff
drivers/usb/gadget/f_fastboot.c
... | ... | @@ -2738,10 +2738,10 @@ |
2738 | 2738 | f->os_desc_table->if_id = id; |
2739 | 2739 | INIT_LIST_HEAD(&fb_os_desc.ext_prop); |
2740 | 2740 | fb_ext_prop.name_len = strlen(fb_ext_prop.name) * 2 + 2; |
2741 | - fb_os_desc.ext_prop_len = 14 + fb_ext_prop.name_len; | |
2741 | + fb_os_desc.ext_prop_len = 10 + fb_ext_prop.name_len; | |
2742 | 2742 | fb_os_desc.ext_prop_count = 1; |
2743 | - fb_ext_prop.data_len = strlen(fb_ext_prop.data); | |
2744 | - fb_os_desc.ext_prop_len += fb_ext_prop.data_len; | |
2743 | + fb_ext_prop.data_len = strlen(fb_ext_prop.data) * 2 + 2; | |
2744 | + fb_os_desc.ext_prop_len += fb_ext_prop.data_len + 4; | |
2745 | 2745 | list_add_tail(&fb_ext_prop.entry, &fb_os_desc.ext_prop); |
2746 | 2746 | |
2747 | 2747 | id = usb_string_id(c->cdev); |