On Thu, Aug 03, 2023 at 02:13:33PM +0800, Dingyan Li wrote: > > At 2023-07-26 22:39:32, "Hans de Goede" <hdegoede@xxxxxxxxxx> wrote: > >Right, so the reason why IOCTL USBDEVFS_GET_SPEED was added is so > >that a confined qemu process which gets just a fd for a /dev/bus/usb/ > >device passed by a more privileged process can still get the speed > >despite it not having sysfs access. This is necessary for correct > >pass-through of USB devices. > > > >Since USBDEVFS_GET_SPEED now no longer tells the full story I believe > >that the proposed USBDEVFS_GET_SSP_RATE ioctl makes sense. > > > >The current patch however misses moving the enum usb_ssp_rate > >declaration from include/linux/usb/ch9.h to > >include/uapi/linux/usb/ch9.h so that needs to be fixed in a version > >2. Assuming that with the above explanation of why this is necessary > >Greg and Alan are ok with adding the ioctl. > > > >Regards, > > > >Hans > > > > Hi Greg and Alan, > > Could you please share your opinions about Hans' justification? Instead of adding a new ioctl or modifying an existing one, how about increasing the set of constants in enum usb_device_speed? Then the existing ioctls could return the newly defined values when appropriate, with no other changes necessary. (This doesn't mean just moving the definition of usb_ssp_rate from one header file to the other. The usb_device_speed enumeration should be extended with the new members. Perhaps omitting USB_SSP_GEN_UNKNOWN since we already have USB_SPEED_SUPER_PLUS, or setting the first equal to the second.) I don't think there was ever a requirement in the API that the set of values in usb_device_speed could never increase (and in fact it has increased in the past). Such a requirement wouldn't make any sense, given how the USB-IF keeps defining newer and faster USB bus implementations. Hans, would that play well with libusb? Alan Stern