tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

HID Mouse with absolute positioning

Open tobozo opened this issue 3 years ago • 14 comments

The current mouse support is limited to relative positioning.

This PR adds absolute mouse descriptor template and descriptors.

tobozo avatar Mar 02 '22 14:03 tobozo

@tobozo Please fix test errors.

FallingSnow avatar Apr 24 '22 22:04 FallingSnow

@FallingSnow fetching upstream fixed it on my fork

https://github.com/tobozo/tinyusb/runs/6149927028?check_suite_focus=true

tobozo avatar Apr 24 '22 23:04 tobozo

@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));
}

tobozo avatar Mar 30 '23 19:03 tobozo

Yes, that would be needed since we only have the prototype otherwise which will make the linker unhappy. :)

earlephilhower avatar Mar 30 '23 19:03 earlephilhower

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)

tobozo avatar Mar 30 '23 21:03 tobozo

@earlephilhower May I know what's blocking this merge?

doge-gif avatar Jul 13 '23 10:07 doge-gif

@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.

earlephilhower avatar Jul 13 '23 17:07 earlephilhower

@me-no-dev does this need further review? Looks like it's missing your approval

poke @hathach

image

tobozo avatar Oct 05 '23 08:10 tobozo

Sorry @tobozo ! Done.

me-no-dev avatar Oct 05 '23 08:10 me-no-dev

Please can this get merged

ithinkido avatar Oct 26 '23 10:10 ithinkido

What's the status of this PR? is it going to be merged?

thewh1teagle avatar Dec 29 '23 02:12 thewh1teagle

Unfortunately, I still havent got time to look at this. Will do whenever possible

hathach avatar Dec 29 '23 03:12 hathach

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 avatar Dec 29 '23 11:12 thewh1teagle

@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.

tobozo avatar Jan 12 '24 11:01 tobozo