Mr. Roberts, in https://www.winvistatips.com/threads/modify-usb-device-descriptor-by-filter-driver.820278/ you answered to
Since device descriptor (firmed in chip) can’t be changed, I want to modify
it in a lower filter driver before host controller driver gets my devcie
descriptor. Can this lower filter driver achieve this goal?
with:
No. The host controller driver is the bottom-most driver in the USB stack.
It performs transfers through DMA. It doesn’t send any requests down for
you to filter, because there IS no driver below it.
and said in https://community.osr.com/discussion/190849/usb-polling-rate that :
[…]there was a custom driver for Windows XP
that increased the “USB polling rate,” which magically made the games
more responsive. Maybe you even used it. That driver doesn’t work on
Vista and beyond, so you want to write one. Is that right?
What that driver did was replace the standard USB HID driver with one
that submitted smaller buffers. It didn’t poll any faster (it can’t do
so – that’s determined by the hardware), but by submitting smaller
buffers more often, it was able to get results back with lower latency.
But Cay Bremer claims, supported by SweetLow, that
It consists primarily of a lower-level filter driver to HidUsb that
listens for IOCTL_INTERNAL_USB_SUBMIT_URB requests, and when an URB of
URB_FUNCTION_SELECT_CONFIGURATION arrives, sets the member bInterval of
the first endpoint descriptor of the first interface descriptor of the
configuration descriptor to a registry-supplied value. […]
Since Windows does not allow a polling interval below 8 ms for low-speed
USB devices, the driver furthermore attempts to remove this restriction by
patching the responsible driver usbport.sys in memory.
If I cross this information with Pavel_A’s
The endpoint descriptors are read by the host USB stack, and then the HCD is programmed by the host stack (software).
The host controller does not interpret the descriptors by itself.
So yes, if you can intercept the EP descriptor and change the interval, it can help verify your theory that the device can provide more data if polled faster.
Are you referring to HidUsbF when mentionning the driver that slices buffers ? If not, am I understand from your responses that:
- The HCD schedules transfer directly, with one change per interval, interval that’s defined by the endpoint descriptor initially received by the HCD.
" the descriptor is being read and used by the host controller driver, which is in direct communication with the hardware. There is no slot into which you can insert a filter."
- There is no way to insert a filter driver “before” the HCD, as in, that alters communication between the device and the HCD.
- However, the HCD is initially configured by the software, in particular, by the driver. By writing a lower-level filter driver that intervenes before “the” driver (HidUsb in the legacy HidUsbF case, but not only anymore), you can mess with the Endpoint descriptor and get the HCD to receive altered data at initialization - which is the only shot at modifying its behaviour. Which is what HidUsbF does.
But then, why do we need a filter driver located before HidUsb instead of an alternative version of HidUsb directly ? Does it have any more rights ? Task difficulty apart, is there any reason a HidUsb clone that does the job of modifying the data it’s going to configure the HCD with itself wouldn’t work ?
As for the buffer slicing driver, I don’t get what “What that driver did was replace the standard USB HID driver with one that submitted smaller buffers.” means. What does submitting too large a buffer does ? Does you internally (at driver level) wait for enough reads to fill the buffer ? So for example, a 1000Hz-interval mice would read 8 times and then play it out by applying the result of the 8 reads in order over the next 8ms, and that driver would force the (naively expected ?) behaviour of the mice polling once a millisecond and the result being applied a.s.a.p ?
@SweetLow, if you indeed use a lower level filter driver and not buffer slicing tricks, that means the mouses you overclock above 1000Hz aren’t only mouses whose endpoint descriptor intervals were strictly below 8 to begin with, right ? (8 being 1000Hz for HighSpeed)