On Wed, Sep 05, 2012 at 10:09:57PM +0200, Vojtěch Boček wrote: > Hi, > > 2012/9/5 Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> > > So what guarantees that joystick events will arrive in time, before > > joydev_generate_startup_event() is called? It looks like your solution > > is racy... > > > > I wonder if we should not generate the startup event until we have seen > > at least one EV_SYN, i.e. entire device state has been transmitted to > > us. > > I just tried to delay read() until first EV_SYN arrives as you suggested, > but that was not the problem, at least not the main one. First joystick > input events arrives immediately after it is plugged in and driver is loaded, > but when that happens, joydev may not be (and most likely is not) > opened yet, which means the events will never reach joydev because of > "if (!handle->open)" check in input_pass_event. > > I wonder how to handle this. Is "if(!handle->open)" valid check? I think so, > my guess is that joydev is the only handler with internal buffer, and it > is useless to update that buffer when the device is not opened. > I think reloading abs values on joydev open should be okay. > > I suppose that if we reload abs values on joydev open, waiting for first > sync is not needed, yes? > > So the patch could look like this: This makes sense. Just to confirm - have you tried the patch and verified it works for you? Thanks. -- Dmitry -- 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