Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you show an example for communicating with a simple mouse? #467

Open
Videogamer555 opened this issue Apr 25, 2021 · 1 comment
Open

Comments

@Videogamer555
Copy link

I would like to get the raw movement and button click reports from my mouse using your hidapi.dll but I don't know the correct format to send the request for the movement and button reports. I know that for every time I call the hid_read function to receive a report, I must first have called the hid_write function to send a request for that report. What is the correct format for the mouse movement report request that the computer must send to the mouse, prior to actually receiving the report? I see a lot of documentation online about HID report "descriptors" for the mouse report like documented at https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/mouse-collection-report-descriptor but this is the report descriptor, not the report request. Where does the descriptor fit into the whole request/response scheme for getting an HID report? Is the descriptor the same thing that I've been referring to as the "report request"? An actual example of this would be nice, as it would far more practical than the current HID example given on the main page of this Github project (the current example being for some device I've never heard of called "Microchip USB Generic HID").

@Youw
Copy link

Youw commented Apr 25, 2021

Windows exclusively captures special input devices like mouse or keyboard so those cannot be opened as a raw HID devices, i.e. hidapi cannot open mouses or keyboards.

On Windows only a focused window can receive mouse/keyboard events, and only using WinAPI, like WM_MOUSEMOVE. Otherwise any background application could capture when you enter your password(s)/credit card credentials, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants