Paolo Bonzini writes ("[PATCH v2] add event queueing to USB HID"): > For v2 I changed the head/tail implementation of the FIFO buffer > (which was buggy when the queue became full) to head/count. > I then removed "have_data", which is the same as count>0 > for pointer devices and the same as "changed" for keyboards. > This made event merging more correct than in Ian's code and > easier to understand than my v1.
Thanks. Was my code buggy then ? It's possible; the event merging case is not easy to trigger in testing. > I left the "changed" member in USBHIDState, rather than moving it > to the keyboard, because it is useful to handle the idle period > (in USB_TOKEN_IN) in a device-independent way. Without it the > code became more messy. This leaves the same information recorded in the driver in two places and is therefore IMO a bad idea. I still think the way I did this is best: have a common helper function used by the keyboard and pointer code to deal with the idle handling. Ian.