Scrolling doesn't work for USB HID (mouse) in FC8

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Simon Sintobin
Posts: 2
Joined: Mon Mar 30, 2020 9:16 am
Contact:

Scrolling doesn't work for USB HID (mouse) in FC8

Postby Simon Sintobin » Tue Mar 31, 2020 8:51 am

Hi everyone

I'm using the 'USB HID' component to program a PC mouse based on data of an accelerometer (MPU-6050). My target is 'ECIO40'.
The movement on the screen and the left and right mouse buttons work very well.
I've already added variables 'Data[3]' and 'Data[4]' and I've assigned them with large, small, positive, negative values but scrolling doens't appear on the screen. I've tried every combination possible with variables 'Data[3]' and 'Data[4]'.

Does anybody know what I'm doing wrong?
I have attached the FC program which I'm using.

Thank you very much!
Simon
Attachments
USB_HID_Mouse.fcfx
(10.76 KiB) Downloaded 11 times

User avatar
Benj
Matrix Staff
Posts: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4362 times
Contact:

Re: Scrolling doesn't work for USB HID (mouse) in FC8

Postby Benj » Tue Mar 31, 2020 10:01 am

Hi Simon,

I beleive the mouse descriptor we supply is fairly basic and doesn't have a scroll wheel capability. So you will need to use the custom descriptor option instead and enter in your own HID descriptor for a mouse with a scroll wheel.

This tool generates descriptors and should be useful for you.
https://www.usb.org/document-library/hi ... iptor-tool

Let us know how you get on.
These users thanked the author Benj for the post:
kersing (Tue Mar 31, 2020 4:13 pm)
Rating: 5%
 

Simon Sintobin
Posts: 2
Joined: Mon Mar 30, 2020 9:16 am
Contact:

Re: Scrolling doesn't work for USB HID (mouse) in FC8

Postby Simon Sintobin » Wed Apr 01, 2020 9:36 am

Hi Ben

Thank you for your advice, it was very useful!

When I use this descriptor code in FC8, the 2 mouse buttons and the X and Y movement are working perfectly.

Code: Select all

0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x02, /* Usage (Mouse) */
0xA1, 0x01, /* Collection (Application) */
0x09, 0x01, /* Usage (Pointer) */
0xA1, 0x00, /* Collection (Physical) */
0x05, 0x09, /* Usage Page (Buttons) */
0x19, 0x01, /* Usage Minimum (01) */
0x29, 0x03, /* Usage Maximum (03) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0x01, /* Logical Maximum (0) */
0x95, 0x03, /* Report Count (3) */
0x75, 0x01, /* Report Size (1) */
0x81, 0x02, /* Input (Data, Variable, Absolute) */
0x95, 0x01, /* Report Count (1) */
0x75, 0x05, /* Report Size (5) */
0x81, 0x01, /* Input (Constant) ;5 bit padding */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
0x15, 0x81, /* Logical Minimum (-127) */
0x25, 0x7F, /* Logical Maximum (127) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x02, /* Report Count (2) AB (3) */         
0x81, 0x06, /* Input (Data, Variable, Relative) */
0xC0, 0xC0


When I make these small changes to the code, nothing is working anymore and no scroll wheel function is added.

Code: Select all

0x05, 0x01,
0x09, 0x02,
0xA1, 0x01,
0x09, 0x01,
0xA1, 0x00,
0x05, 0x09,
0x19, 0x01,
0x29, 0x03,
0x15, 0x00,
0x25, 0x01,
0x95, 0x03,
0x75, 0x01,
0x81, 0x02,
0x95, 0x01,
0x75, 0x05,
0x81, 0x01,
0x05, 0x01,
0x09, 0x30,
0x09, 0x31,
0x09, 0x38,      /*ADDED CODE */
0x15, 0x81,
0x25, 0x7F,
0x75, 0x08,
0x95, 0x03,      /*CHANGED CODE */
0x81, 0x06,
0xC0, 0xC0


Attached you van find my settings of the 'USB HID' component.
Should you know what I'm doing wrong?

Thank you,
Simon
Attachments
2020-04-01 10_25_45-USB_HID_Mouse.fcfx.png
2020-04-01 10_25_45-USB_HID_Mouse.fcfx.png (25.98 KiB) Viewed 397 times