On Thu, Jun 17, 2021 at 9:11 AM Aleksandr Mezin <mezin.alexander@xxxxxxxxx> wrote: > > Hello. > > I've noticed that corsair-cpro communicates with the device in > request-reply pattern, and also exposes hidraw interface, so userspace > can also send requests. How does the driver figure out that the > current input report is a response to the request sent by the driver, > and not for some other request from userspace? Also if userspace reads > from hidraw, how can it be sure that the report it read is the > response to its last request, and not to some driver's request? > > I do not have the hardware, I was just looking at corsair-cpro as a > reference - I'm working on a driver for a similar device (nzxt rgb & > fan controller) Oops, there's a comment about this exact issue at the beginning of the file, and I missed it somehow. Sorry for the noise. I wonder if the driver can synchronize the access through hidraw somehow, i. e. make hidraw read/write block while mutex is locked.