Subject: Adding an ioctl?
To: None <firstname.lastname@example.org>
From: Peter Seebach <email@example.com>
Date: 08/06/2005 13:37:52
I have a USB HID device with a surreally annoying interface, which essentially
depends on the knowledge that Windows has a fairly short buffer for inbound
This would be a tailor-made application for the USB_GET_REPORT ioctl, but the
device doesn't support it.
So, I need some way to either:
1. Flush the USB device's input buffer on command.
2. Have the driver flush things fairly aggressively automatically.
My current hack is, right before accepting bytes in uhid_intr, to call
ndflush on sc->sc_q, and flush a whole lot of bytes. It works, but it's
clearly ugly and probably wrong for every device out there.
The USB_SET_IMMED ioctl would be great, except it doesn't work on this device
because USB_GET_REPORT doesn't.
One proposal comes to mind; add an automatic ndflush() call to the
USB_SET_IMMED ioctl, which is applied before the check to make sure immediate
mode works. I am pretty sure this would never be wrong for users who really
want immediate mode; after all, once the device is in immediate mode, the
queue is never used, so flushing it is harmless.