Am Donnerstag, 17. Juni 2021, 05:11:10 CEST schrieben Sie: > 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) > Hello, Sadly, it doesn't. There is no way to distinguish where the reply is coming from. The hardware should probably use report ids in the first byte of the reply for something like this, but it does not. I thought about possibilities to stop hidraw before a request and restart it after the reply, but there is (as far as I know) no way to do this without changing the hid-driver. Maybe I should have a look at this idea again. The choice was either to allow it or block most userspace tools. I also tried to get false readings and it can be done, albeit highly unlikely. As a "solution" I slapped a comment at the beginning of the driver to point out the problem. I do not know, what your device is doing, but the (similar) corsair-psu driver has the same problem. This device uses an echo of the command in the answer and if they don't match it returns an error. This could maybe lead to a false error when the replies are switched, but is probably preferable. Greetings Marius