Sending data to the device and reading the register values

Hi
I have implemented a User mode driver for my device. it is an custom HID device . i am using microsoft provided HID driver as a PDO and loaded my driver as an FDO.I have created IO targets and able to communicate with the device by using IOCTLs.
Now my question is how to send data or read from the device.ie, if i want to write to the device registers how should i form the write request or if i want to read from the device how to form a read request? …Below are the functions that i found in MSDN.

CreatePreallocatedWdfMemory
FormatRequestForWrite
Send

i dono how to use these functions to format the request to get the device register values or to write to the device registers

can anyone help in fixing this issue?

xxxxx@gmail.com wrote:

I have implemented a User mode driver for my device. it is an custom HID device . i am using microsoft provided HID driver as a PDO and loaded my driver as an FDO.I have created IO targets and able to communicate with the device by using IOCTLs.
Now my question is how to send data or read from the device.ie, if i want to write to the device registers how should i form the write request or if i want to read from the device how to form a read request? …
i dono how to use these functions to format the request to get the device register values or to write to the device registers

can anyone help in fixing this issue?

What do you mean by “device registers”? HID devices do not have
registers. As a HID FDO, you read and write HID reports. If you need
USB features that are not part of HID, then you shouldn’t be a HID FDO.
You need to be at a lower level than that, and maybe HID is the wrong
class for your device.

I’m really confused by the recent flood of questions about of custom HID
drivers. The whole point of USB HID is that you don’t need a driver at
all. If you need custom access to your device, then make it vendor
class, not HID class. Even then, you still don’t need a driver, because
WinUSB is so cool.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

My device is a custom device is detected as a HID device and the default microsoft drivers are loaded. We have taken hclient application as the reference and used hid APIs to communicate with the device and configure the registers of my device (the device communication protocol is different ie it uses serial communication,and it is connected through USB controller IC).

out application team are using control pipe for getting the Report,and write data using SET REPORT through control pipe and write report using interrupt pipe

Now i want to configure my device registers from UMDF driver.How can i do this ?

My device is a custom device is detected as a HID device and the default microsoft drivers are loaded. We have taken hclient application as the reference and used hid APIs to communicate with the device and configure the registers of my device (the device communication protocol is different ie it uses serial communication,and it is connected through USB controller IC).

our application team are using control pipe for getting the Report,and write data using SET REPORT through control pipe and write report using interrupt pipe

Now i want to configure my device registers from UMDF driver.How can i do this ?

We tried calling HidD_XXX API from our driver after getting handle using Createfile, but HidD_XXX functions are not succeeding.But if we get a handle from our driver to other HID devices in the system and use HidD_xxx funtions , then these functions are working.why?

Read the threads from this past week on sending IOCTL_HID_xxx requests, that poor fellow was doing the exact same thing

d

debt from my phone


From: xxxxx@gmail.com
Sent: 3/4/2012 9:44 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Sending data to the device and reading the register values

My device is a custom device is detected as a HID device and the default microsoft drivers are loaded. We have taken hclient application as the reference and used hid APIs to communicate with the device and configure the registers of my device (the device communication protocol is different ie it uses serial communication,and it is connected through USB controller IC).

our application team are using control pipe for getting the Report,and write data using SET REPORT through control pipe and write report using interrupt pipe

Now i want to configure my device registers from UMDF driver.How can i do this ?

We tried calling HidD_XXX API from our driver after getting handle using Createfile, but HidD_XXX functions are not succeeding.But if we get a handle from our driver to other HID devices in the system and use HidD_xxx funtions , then these functions are working.why?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

xxxxx@gmail.com wrote:

My device is a custom device is detected as a HID device and the default microsoft drivers are loaded. We have taken hclient application as the reference and used hid APIs to communicate with the device and configure the registers of my device (the device communication protocol is different ie it uses serial communication,and it is connected through USB controller IC).

our application team are using control pipe for getting the Report,and write data using SET REPORT through control pipe and write report using interrupt pipe

Now i want to configure my device registers from UMDF driver.How can i do this ?

If your device has registers, then it is not a HID device.

We tried calling HidD_XXX API from our driver after getting handle using Createfile, but HidD_XXX functions are not succeeding.But if we get a handle from our driver to other HID devices in the system and use HidD_xxx funtions , then these functions are working.why?

I’ll repeat what I said in the thread on this last week. The whole
purpose for making a custom device act like a HID device is so you can
use it without writing a driver. If you have to write a driver, then
you’ve lost that benefit. Plus, if you have registers, then you are not
really a HID device. In that case, if you’re going to go to the trouble
of writing your own driver anyway, why limit yourself by making it HID?
Just make your device completely custom, and drive it with the very cool
WinUSB APIs. Then, you can be in complete control of the transactions,
and you don’t have to write any driver code at all.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Perhaps registers is a misnomer. In theory you can use specific reports and report values to manipulate registers in firmware.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, March 05, 2012 11:09 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Sending data to the device and reading the register values

xxxxx@gmail.com wrote:

My device is a custom device is detected as a HID device and the default microsoft drivers are loaded. We have taken hclient application as the reference and used hid APIs to communicate with the device and configure the registers of my device (the device communication protocol is different ie it uses serial communication,and it is connected through USB controller IC).

our application team are using control pipe for getting the
Report,and write data using SET REPORT through control pipe and write
report using interrupt pipe

Now i want to configure my device registers from UMDF driver.How can i do this ?

If your device has registers, then it is not a HID device.

We tried calling HidD_XXX API from our driver after getting handle using Createfile, but HidD_XXX functions are not succeeding.But if we get a handle from our driver to other HID devices in the system and use HidD_xxx funtions , then these functions are working.why?

I’ll repeat what I said in the thread on this last week. The whole purpose for making a custom device act like a HID device is so you can use it without writing a driver. If you have to write a driver, then you’ve lost that benefit. Plus, if you have registers, then you are not really a HID device. In that case, if you’re going to go to the trouble of writing your own driver anyway, why limit yourself by making it HID?
Just make your device completely custom, and drive it with the very cool WinUSB APIs. Then, you can be in complete control of the transactions, and you don’t have to write any driver code at all.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron Holan wrote:

Perhaps registers is a misnomer. In theory you can use specific reports and report values to manipulate registers in firmware.

Yes, I’m being overly pedantic. It is certainly possible to wrap an
arbitrary device into the HID model, but unless the device really is
involved in human interface, if you’re going to be writing a driver
anyway, I don’t see the point in shoehorning a device into an unsuitable
model. It is, in the vernacular of a few years ago, “an impedance
mismatch”.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.