Please check out the Community Guidelines in the Announcements and Administration Category.
More Info on Driver Writing and Debugging
Thefree OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Hello, I am implementing a Sensor driver using the UMDF Framework. To control some internal stuff I have registered and implemented the EvtSensorDeviceIoControl callback function on the SENSOR_CONTROLLER_CONFIG structure. From user mode I use a CreateFile() call to get a handle to my UMDF driver, that returns a valid handle as far as I can see. But when calling the DeviceIoControl() function on that handle, I always get an error 1168 (0x490) returned "ERROR_NOT_FOUND".
I'am doing it the same way I did it before on a real kernel mode driver; and that worked well.
What might be the problem in my case. This is how is implemented:
// Open the sensor device m_hSensorDevice = CreateFile(L"\\\\.\\RotationSensor", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
..... .....
// do device io control if (m_hSensorDevice) { status = DeviceIoControl( m_hSensorDevice, // Driver handle PMS_IOCTL_ROTATE, // Control code &Orintation, // Pointer to input buffer sizeof(Orintation), // Size of input buffer NULL, // Pointer to output buffer 0, // Size of output buffer &BytesReturned, // Required when lpOverlapped is NULL NULL // Pointer to OVERLAPPED struct for asynchronous I/O );
Since the OnIoControl callback is implemnted on the SensorClassExtension, i fear that using DeviceIoControl is the wrong way. But I have not found anything on the ISensor interface that let me send an IOControl request to the sensor.
Any clou what TRACE GUID to be used for tracing the DeviceIoControl function call? I tried nearly everything ...
Comments
is there anyone who did this before?
I saw that a thread from 2016 had exactly the same issue, but unfortiently no replys at all.
Regards
Thomas.
That is ALWAYS, ALWAYS, the first step when you get to the "why doesn't X work in my WDF driver". Always. Dump the log.
Peter
OSR
@OSRDrivers
Peter Viscarola
OSR
@OSRDrivers
I spent some time Googling around, cuz I'm sorta kinda interested in the Sensor CLX. It also appears that there's tracing specific to the Sensor CLX:
<https://docs.microsoft.com/en-us/windows-hardware/drivers/sensors/collecting-and-decoding-wpp-logs>
So, I'd try that as well... At least it'll give you some more data.
Peter
OSR
@OSRDrivers
Peter Viscarola
OSR
@OSRDrivers
But I have not found anything on the ISensor interface that let me send an IOControl request to the sensor.
Any clou what TRACE GUID to be used for tracing the DeviceIoControl function call?
I tried nearly everything ...
I tried nearly everything ...
</quote>
Does that include, or NOT include, dumping the WDF Trace log as I suggested? Because, you know, you didn't bother to mention it.
<quote>
Any clou what TRACE GUID to be used
</quote>
The Sensor CLX one? c88b592b-6090-480f-a839-ca2434de5844
Peter
OSR
@OSRDrivers
Peter Viscarola
OSR
@OSRDrivers
@Thomas_Schumann: Did you find a solution for the issue?
I am facing the exact issue at the moment.
AND you are necroposting, which isn't allowed on this forum.
AND you are apparently expecting somebody who posted to this thread five years ago to answer you today.
thread locked.
Peter Viscarola
OSR
@OSRDrivers