On Fri, Jul 21, 2023 at 11:43:29PM +0800, Dingyan Li wrote: > Okay, got it. The motivation should come from real-world needs. > > Just like I mentioned above, currently in libusb ioctl USBDEVFS_GET_SPEED > is still used, especially where sysfs is not supported. My original idea > was exactly trying to add this new ioctl into libusb. So in order to get 20Gbps > speed, we need extra information. The basic workflow is like below: > > // This is pretty much how libusb does it, get 10Gbps at most > ret = ioctl(USBDEVFS_GET_SPEED) > if (ret == USB_SPEED_SUPER_PLUS) then > speed = 10Gbps > // With this new ioctl, we can get 20Gbps now > ret = ioctl(USBDEVFS_GET_SSP_RATE) > if (ret == USB_SSP_GEN_2x2) > speed = 20Gbps > > libusb can be a good place to document the usage of this new ioctl if similar patch > can be accepted into it. And I can't think of other real-world users now. Of course, > like you've explained, it seems quite unnecessary when sysfs is supported. For what it's worth, many of the other ioctls in usbfs are documented (very incompletely) in Documentation/driver-api/usb/usb.rst. That's probably the best place to add any documentation for new APIs. Alan Stern