Re: [RFC PATCH] usb: gadget: f_fs: Fix incorrect version checking of OS descs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is clear is that the value of bcdVersion actually sent to the host is
0x100, and this value is set by composite_setup() (in composite.c) as a fixed
value. That is, the value of bcdVersion written in the OS descriptor passed
to functionfs is not actually transferred. I understand that
__ffs_do_os_desc_header() is only checking the format of the descriptor
(header) received.

Please see below.
https://lore.kernel.org/linux-usb/5c049a94-f848-ff9a-ffbe-c1cf335ca644@xxxxxxxxxxx/

There are several ways to think about this.

1. Accept 0x100 as the correct value, also accept 0x1 for compatibility.

   The way in this patch. Observing the behavior, 0x100 appears to be correct,
   so we want to accept only this value.  However, we cannot break the old
   userspace driver, so we need to accept 0x1 as an exception.

2. Accept 0x100 and 0x1 in silence.

   0x1 is incorrect and is only allowed for compatibility, but it may not be
   worth bothering to tell.

3. Remove bcdVersion value check

   We are already in a tricky situation where we have to accept the correct
   value of 0x100 and the actually incorrect value of 0x1. It might be better
   to omit the bcdVersion value check and check only the wIndex value as a
   OS desc header format check.

For now, I have created this patch based on idea (1), but please let me know
if there is an appropriate way to do this.


Regards,

Yuta Hayama



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux