Skip to content

support multiple usage/usage-pages on macOS, update of @fengj2006 PR#65 #124

Closed
todbot wants to merge 2 commits into
libusb:masterfrom
todbot:mac-multi-usage
Closed

support multiple usage/usage-pages on macOS, update of @fengj2006 PR#65 #124
todbot wants to merge 2 commits into
libusb:masterfrom
todbot:mac-multi-usage

Conversation

@todbot
Copy link
Copy Markdown
Contributor

@todbot todbot commented Nov 26, 2019

I think this includes all the requested changes, on top of the work done by @fengj2006 on #65

You can now see all the different usages as different "devices" in hid_enumerate(). When running hidtest you see them too. On a Macbook with internal keyboard/trackpad, there are many:

% ./hidtest | grep -E "(Product|Usage)"
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x3 (0xff00)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0xd (0xff00)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x2 (0x1)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x1 (0x1)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x5 (0xd)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0xc (0xff00)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x6 (0x1)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x1 (0xc)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0x6 (0xff00)
  Product:      Apple Internal Keyboard / Trackpad
  Usage (page): 0xb (0xff00)

Additionally, I've verified that an Arduino "RawHID" device with two usages shows up as two devices to hidapi

(the device is a $9 Trinket M0 running TinyUSB pretending to like Teensy in RawHID mode) You can see this here: https://github.com/todbot/hidapitester/tree/master/tinyusb_teensyrawhid_multiusage

@Youw Youw added the macOS Related to macOS backend label Nov 26, 2019
Comment thread mac/hid.c Outdated
Comment thread mac/hid.c

static int set_report(hid_device *dev, IOHIDReportType type, const unsigned char *data, size_t length)
{
const unsigned char *data_to_send = data;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@todbot:
I mean this function and all of the below shouldn't be changed at all
see 083223e and d64f6c6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! okay I will not try to use any merge tools and instead re-do this PR by hand. I didn't think fengj2006's original PR was so far back in time. sigh.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I guess it was

a hint:

  • checkout fengj2006's branch
  • save a diff only: git diff HEAD~1 > diff.diff
    so it only contain a relevant changes
  • checkout to origin/master
  • apply diff: git apply diff.diff

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, you've already done it :)

@todbot todbot closed this Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS Related to macOS backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants