Skip to content

More dynamic predefined hid descriptors #67

@perigoso

Description

@perigoso

We right now have static simple hid descriptors defined for mouse and keyboard, but some targets might want slightly different reports. For instance, 5 buttons instead of 3, pan in addition to wheel, 16 bit xy deltas.

This could always be done target side, but we could use the preprocessor to do this:

struct mouse_report {
        	u8 id;
#if defined(MOUSE_REPORT_16BIT_DELTA)
        	s16 x;
        	s16 y;
#else
        	s8 x;
        	s8 y;
#endif
        	s8 wheel;
#if defined(MOUSE_REPORT_PAN)
        	s8 wheel;
#endif
        	u8 button1 : 1;
        	u8 button2 : 1;
        	u8 button3 : 1;
#if defined(MOUSE_REPORT_5BUTTONS)
        	u8 button4 : 1;
        	u8 button5 : 1;
#endif
        } __attribute__((__packed__))

(same for the actual report descriptor)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions