I have a driver which has an IO queue (WDFQUEUE) to receive requests
(WDFREQUEST) from usermode processes, handles them, and then calls
WdfRequestCompleteWithInformation() to complete them.
My customer has some, well, weird (I call it bullshit) semantics of I2C
communication that I have to implement: a transaction is divided into
non-atomic accesses where transactions may interleave and steal bus
access from each other. This stealing actually happens in rare
circumstances which I use to call a "race condition", and I want to
protect myself from any blames by implementing an "ownership" to detect
such errors and reject bullshit.
What I envision is to remember the thread that *starts* an I2C
transaction, and to release that owner when it *stops* the transaction -
and to reject any request from a different thread should that happen in
the middle of a transaction.
How is this done?
The WDFREQUEST objects that I receive via the WDFQUEUE are the result of
a usermode thread calling DeviceIoControl(). This usermode thread is the
one that should "own" an ongoing I2C transaction, and thus I have to
remember that thread in driver space. I can imagine that the WDFREQUEST
carries that thread's ID with it - it's just that I don't understand how
to access this information.
Can anybody help me please?
Thank you in advance,
DI JÃ¶rg Faschingbauer
Linux und Open Source - Programmierung, Beratung und Schulung http://www.faschingbauer.co.at