I am trying to implement an USB HID mouse for my custom board (to move the mouse pointer on my display). Right now, I am able to read the descriptors.
I found the logical min and max to be -127 and +127. After reading the documentation for HID, I got confused.
- What is physical min and max of a device?
- What is its role?
If I want to calibrate my mouse to a given display, where to give the coordinates? Also, when the mouse action takes place, I am getting coordinate values (X and Y and buttons) two or three times.
Is it because the values returned by the mouse are continuous and I have to implement some averaging? Or is it like the mouse coordinates returned are relative and I have to initialize my mouse coordinates as (0,0) and from the previous position I have to calculate the current position?
Thanks for the reply. But from which field of the descriptor I can find the unit, means whenever I move a mouse I will get the X and Y, how to find out what is the unit it has moved?(inch or meter). Because the HID descriptor I am getting consists of the following fields:
Usage Page- 05 01 Usage Mouse- 09 02 Collection(App)-a1 01 Usage(Pointer)-09 01 Collection(Physical)-a1 00 Usage Page(Button)-05 09 Usage Min- 19 01 Usage Max-29 05 Logical Min-15 00 Logical Max-25 01 Report Count-95 05 Report Size-75 01 Input(Data,Variable,Absolute)-81 02 Report Count- 95 00 Input-81 03 Usage Page-05 01 Usage X- 09 30 Usage Y- 09 31 Wheel - 09 38 Logical Min-15 81 Logical Max-25 7f Report Size -75 08 Report Count-95 03 Input-81 06 05 0c 0a 38 02 95 01 81 06 c0 c0
I dont know what are the values after the input field.
This is what I am getting as hid descriptor from my logitech mouse. I understand it is relatve(from 81 06).And in addition to it, I get coordinates(X and Y) and buttons whenever I move or click. But where to get the unit and unit exponent(for finding the resolution and how much the mouse has moved)?? Thanks again