cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the resolution of USB HID mouse

HKhan.2
Associate II

I am using STM32f3 discovery kit with STM32 cube ide to interface the kit as USB HID mouse. I am trying to change the resolution of the mouse. The default resolution given in the Report descriptor is 400 dpi . (0x15, 0x81,     //   LOGICAL_MINIMUM (-127)- 0x81

  0x25, 0x7f,     //   LOGICAL_MAXIMUM (127)- 0x7f

It is possible to change the value of the report descriptor to increase the resolution of the USB HID mouse.

5 REPLIES 5
HKhan.2
Associate II

@Community member​ Please can you give any tips on this problem

Not really a USB/HID expert. Check that the endian order is correct, that the descriptor has right number of bytes, checksums, etc.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The endian order is correct.

uint8_t mousebuffer[4];

mousebuffer[0]=0; // Left and right click (0: None, 1: Left click, 2: Right Click

 mousebuffer[1]=0; // X movement 0:, not moving, +ve : Right movement ,-ve :left movement

 mousebuffer[2]=0; // Y movement 0: not moving ,+ve : Down movement ,-ve :up movement

 mousebuffer[3]=0; // Scroll 0: not moving ,+ve : Up movement, -ve :Down movement

USBD_HID_SendReport(&hUsbDeviceFS,mousebuffer,4);

The mousebuffer declaration is uint8_t which limit the range to -127 to 127 for max. and min. value of the x axis and y axis movement of the mouse which is also specified in the report descriptor . I want to define the mouse buffer to uint16_t to increase the range of x and y movement which will increase the resolution of the USB HID mouse . I tried to change the defination in the USB library but could not get any solution.

Can the hardware support this changes on the library to increase the resolution of the USB HID mouse??

HKhan.2
Associate II

@Yohann M.​  Please can you give any tips on this problem

> The mousebuffer declaration is uint8_t which limit the range to -127 to 127 f

You can define the HID report descriptor so that the number of bits for X,Y is larger.

For example 16 x 16 or 12 x 12.

Find any mice with high resolution, copy their descriptor and study.

Of course, if X or Y do not fit in one byte, the mouse is not legacy-compatible.

-- pa