I have a virtual hid driver that would talk to an application. Application would send some command say on or off. My driver needs to remember this state. later, if the application asks what state are you in , with a querydevice, my driver needs to reply with the last state. My driver is a dummy driver, it has no device or anything (forget this part, why the design is in this way, because we have a non hid serial device mapping which we have all is an another software solution).
either ways, my question is how can i persist this state, driver is stateless, in this case, what is the best way to solve the problem of storing this state somewhere.
I was thinking I could have another application that can be connected to the driver as well.
Application 1 sends a ON to the driver.
driver sends an output report to the Application 2.
Application 2 could save it
if Application 1 request for the state
driver now needs to request the state from Application 2 and get another input report
then pass it back to application 1.
but this is complicated and possible deadlocks / a lot of issues in this design…
why we need this -
application may send ON
later application wants to know if device is on or off
it may do a query to know if the device is on or off now
device needs to return the status of on / off.
but the virtual hid driver is dummy, it really doesnt have a device to store on / off or act on this . we just use the on / off signal to manipulate a serial device which works with our application
what is the simplest way to store and save states in the driver, assuming i have no hardware to store the state?