Hi, On Fri, Oct 08, 2021 at 11:29:51PM +0000, Ryan McClue wrote: > Hi there, > > PROBLEM: > > I'm on a laptop, with 2 connected keyboards (built-in and USB). > When I hit keys on each keyboard simultaneously in a program like firefox, > gnome-terminal etc. stalling/lag occurs. > It only happens for keyboards it seems as moving an external mouse and trackpad > together causes no issues. > > TO REPRODUCE: > To investigate the problem I wrote a simple C file > (see attached 'evdev-lag.c', compile with $(gcc evdev-lag.c -o evdev-lag)) > The program finds keyboard devices under /dev/input/event and uses epoll to > poll them for input via the evdev interface. > > If I start entering keys on one keyboard and then switch to the other, the > program stalls briefly. > If I simultaneously enter keys on each keyboard the program stalls indefinitely > until I stop entering keys. I do not observe stalls but did you mean to essentially busy-loop in your program? epoll_wait with 0 timeout causes it return immediately, you want to use -1 if you want to wait indefinitely or give it a real timeout. Thanks. -- Dmitry