]> git.hungrycats.org Git - linux/commit
[PATCH] USB: hiddev HIDIOCGREPORT not blocking in 2.6
authorAdam Kropelin <akropel1@rochester.rr.com>
Tue, 20 Jan 2004 08:02:17 +0000 (00:02 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 20 Jan 2004 08:02:17 +0000 (00:02 -0800)
commitf3c64148c78dd4dece18315cac7df5fc82cbd76d
treea8f9443f6566ee3f69cae56c5cb95b7f387fdd01
parentf7d793856098ce7889c0b22f27bce0d4d182cae7
[PATCH] USB: hiddev HIDIOCGREPORT not blocking in 2.6

I've noticed in 2.6 kernels that HIDIOCGREPORT does not wait for io
completion before returning to the caller. This creates a few unpleasant
issues for userspace:

First, code sequences such as...

        ioctl(fd, HIDIOCGREPORT, &rinfo);
        ioctl(fd, HIDIOCGUSAGE, &uinfo);
        ioctl(fd, HIDIOCGSTRING, &sdesc);

...that used to work in 2.4 now fail in 2.6 if the device takes more
than a few milliseconds to respond to HIDIOCGREPORT. (I'm seeing this
issue on APC UPSes, FWIW.)

Second, userspace code can easily flood the kernel with control messages
since the kernel provides no "backpressure". The result is a lot of
"hid-core.c: control queue full" errors and lost reports.

2.6 hid-core.c appears to submit the request and return immediately.
Although the 2.4 code differs significantly, I traced the call path to
usb-core.c, which seems to block with a timeout, so the code supports my
userspace observation. (Assuming I didn't misread it.)
drivers/usb/input/hid.h
drivers/usb/input/hiddev.c