tinyusb
tinyusb copied to clipboard
HID Mouse with absolute positioning
The current mouse support is limited to relative positioning.
This PR adds absolute mouse descriptor template and descriptors.
@tobozo Please fix test errors.
@FallingSnow fetching upstream fixed it on my fork
https://github.com/tobozo/tinyusb/runs/6149927028?check_suite_focus=true
@earlephilhower thanks for the suggestion :+1: should I also add the C function in hid_device.c ?
bool tud_hid_n_abs_mouse_report(uint8_t instance, uint8_t report_id, uint8_t buttons, int16_t x, int16_t y, int8_t vertical, int8_t horizontal)
{
hid_abs_mouse_report_t report =
{
.buttons = buttons,
.x = x,
.y = y,
.wheel = vertical,
.pan = horizontal
};
return tud_hid_n_report(instance, report_id, &report, sizeof(report));
}
Yes, that would be needed since we only have the prototype otherwise which will make the linker unhappy. :)
ideally the touch zone should have a shape proportional to the target screen so it's not exactly as intuitive as using the relative mouse, especially when the desktop has multiple screens :sweat:
there are a lot of use cases anyway, I remember exploring those with an ESP32-S2:
- physical mouse
- physical touchpad (e.g. using a XPT2046)
- mouse server (e.g. forwards mouse reports from a http client to the host)
- scripted mouse (e.g. drawing hand in an image editor)
@earlephilhower May I know what's blocking this merge?
@doge-gif this isn't my repo or PR, so you'll need to ask @hathach . 😄 I've implemented it in the arduino-pico core already and will undo my private hacks once this PR merges and the Raspberry Pi team updates their SDK to include it.
@me-no-dev does this need further review? Looks like it's missing your approval
poke @hathach
Sorry @tobozo ! Done.
Please can this get merged
What's the status of this PR? is it going to be merged?
Unfortunately, I still havent got time to look at this. Will do whenever possible
It's nearly 50 lines and a year ago :) Hope you get time to check it out. By the way, can we use the same device for absolute and relative in the same descriptor or it has to be 2 different devices?
@thewh1teagle actually this PR will soon be two years old, but no worries as it's already available on rp2040 and esp32 various core versions so it's very likely it has been tested in live projects and doesn't need to wait for sponsor approval.
If you need to implement that outside the tinyusb source tree just let me know and I'll happily help.