fruit-bat / pico-hid-host

Library to host HID devices on Pico Pi alongside TinyUSB
1 stars 1 forks source link

Mouse scroll wheel #5

Open UKTailwind opened 3 days ago

UKTailwind commented 3 days ago

Hi

I've got an equivalent coding in MMBasic on the Pico which is working well. https://github.com/UKTailwind/PicoMiteAllVersions USBKeyboard.c The one thing I haven't managed to solve is how to enable the scroll wheel on a mouse. I know some mice return a 4 byte report by default but many don't. I can do it on a PS2 mouse but can't find the magic for a USB version. If you have solved this and could point me to the relevant code it would be greatly appreciated.

Thanks

fruit-bat commented 3 days ago

Yup, see: https://github.com/fruit-bat/pico-hid-host/blob/main/src/hid_host_mouse.c

By default, TinyUSB talks to mice in 'boot protocol', which does not include the mouse wheel. To read the mouse wheel, requires interpreting a HID report description and using it to decode the subsequent HID reports. It's what this repo is about, along with interpreting joystick HID reports so PC joysticks can be used.

If you can just 'use' this repo then we could both work to improve it... but feel free to do what ever as long as it helps :-)

fruit-bat commented 3 days ago

There is a sample app you can build to see it in action: https://github.com/fruit-bat/pico-hid-host/blob/main/apps/hid_host_serial_test/src/main.c

Sends output to the serial port.