I've been following the Windows GPIO Driver Design Guide and have the Intel Controller Driver installed; which I downloaded from here.
I then followed the WDK GPIO simdevice sample making only changes to the inf to load for the new ACPI device I defined in a new BIOS build. My new ACPI device shows up in the Windows device manager, my simdevice peripheral driver loads for it and PrepareHardware hands me the 8 GpioIo I defined in ASL. When calling WdfCmResourceListGetDescriptor(ResourcesTranslated, index); for each resource their descriptor types are CmResourceTypeConnection; as expected. Their connection class is CM_RESOURCE_CONNECTION_CLASS_GPIO and their connection type is CM_RESOURCE_CONNECTION_TYPE_GPIO_IO. It seems like that part is working properly.
In order to send the IOCTL_GPIO_READ_PINS to the controller driver the sample indicates I need to:
- Create an IoTarget with the ParentObject set to the WDFDEVICE that my peripheral driver created. Shown here.
- Open the IoTarget specifying a RequestString and the desired access levels
- The RequestString is created by using the RESOURCE_HUB_CREATE_PATH_FROM_ID macro. I provide the ConnectionId of the GPIO I want to target. The ConnectionId was provided to my driver during PrepareHardware.
- Create a WdfRequest and WdfMemory object with the data to pass to the IOCTL.
- Format the request for the IOCTL
- Send the IOCTL
However, step 2 above is failing with a STATUS_INVALID_PARAMETER. This step is done at line 741 of the sample.
Any help in making the IOCTL_GPIO_READ_PINS and IOCTL_GPIO_WRITE_PINS calls to the controller driver would be greatly appreciated.