On Tue, Mar 26, 2019 at 12:07:04AM +0100, Benjamin Valentin wrote: > Nice! With this applied the remote feels a lot more snugly. > > In the forum thread you talked about a toggle bit to distiguish new > button presses from held down buttons. > The packet send by the Xbox Remote includes how much time has passed > since the last packet was sent. > > u16 last_press_ms = le16_to_cpup((__le16 *)(data + 4)); > > If the button was held down, this value will always be 64 or 65 ms, if > the button was released in between, it will be higher than that. > (If you leave the remote idle, it will count to 65535 and stop there) > > Maybe this is helpful, I'm not sure what's the right knob to turn with > this information. > > Anyway, thank you a lot for the fix! Thanks a lot for testing! And also thanks a lot for the info on the last_press_ms field, I had already been wondering which values it'd contain. It seems that doesn't add much info that we already have from the current system time - and as the key handling uses timers using the delays provided last_press_ms would be tricky too. Every time the driver calls rc_keydown a timer is armed to fire after 74ms (64ms period plus 10ms timeout). If another scancode is received within that time the timer is re-armed. If the timer expires a keyup event is sent to the linux input layer. So the current implementation in the driver is very close to the optimum, timing wise. The toggle bit of eg the rc-5 and rc-6 protocols can help when dealing with very long timeouts (eg 100-200ms) as people can easily press faster than the (about 200-300-ms) total timeout. With the toggle bit repeated button presses can be reliably distinguished from long ones. With the recent optimizations in rc core the toggle bit has become less important than before, as now rc core tries to set the timeout as low as possible. For some IR receivers which don't support low timeout values the toggle bit is still quite useful, though. so long, Hias > > Acked-by: Benjamin Valentin <benpicco@xxxxxxxxxxxxxx>