On Tue, Jan 11, 2011 at 2:53 PM, Benjamin Tissoires <benjamin.tissoires@xxxxxxx> wrote: > On Tue, Jan 11, 2011 at 2:00 PM, Henrik Rydberg <rydberg@xxxxxxxxxxx> wrote: >>> >> [...] >> >>> >> + if (value) >>> >> + td->num_expected = value - 1; >>> > >>> > The - 1 should be dropped here. >>> >>> Here is the really tricky one: >>> >>> if I drop -1, >>> >>> the test below will be: >>> if (field->index == td->last_field_index >>> && td->num_received >= td->num_expected) >>> >>> but during the init of the device, the kernel receive 1 event though >>> the driver is not ready. >> >> So the current code really needs to also check whether the driver is >> ready to events. Adding a state for it would be appropriate. As it >> stands, an unrelated syntatic oddity is covering up this fact. >> >>> >>> During this time, num_expected is at 0, and when we receive the >>> last_field_index: segfault! >>> >>> To sum up, no, we can't. >> >> Yes we can. :-) > > I'll look into it but I promise nothing. > Hehe, I found the bug: My tests aginst last field in slot and last field in report were not guarded by (hid->claimed & HID_CLAIMED_INPUT). Now it works without the -1. Cheers, Benjamin >>> >> + if (field->index == td->last_field_index >>> >> + && td->num_received > td->num_expected) >>> > >>> > A ">=" here. >> >> still applies then. >> >> Thanks, >> Henrik >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-input" in >> the body of a message to majordomo@xxxxxxxxxxxxxxx >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html