Skip to content

support multipe usage/usage-pairs on MacOS#65

Closed
fengj2006 wants to merge 2 commits intolibusb:masterfrom
fengj2006:master
Closed

support multipe usage/usage-pairs on MacOS#65
fengj2006 wants to merge 2 commits intolibusb:masterfrom
fengj2006:master

Conversation

@fengj2006
Copy link
Copy Markdown

This change supports one device has multiple usage/usage-page pairs on MacOS, which is already supported on Windows.

Copy link
Copy Markdown
Member

@Youw Youw left a comment

Choose a reason for hiding this comment

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

I happen to have a device with multiple usage pages - will review it carefully a bit later

Comment thread hidapi/hidapi.h Outdated
@Youw Youw added the macOS Related to macOS backend label Nov 15, 2019
@Youw
Copy link
Copy Markdown
Member

Youw commented Nov 15, 2019

Fixes #116

Copy link
Copy Markdown
Member

@Youw Youw left a comment

Choose a reason for hiding this comment

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

looks good overall

would be great if you could add something like:

printf("  Usage:        0x%hx 0x%hx\n",  cur_dev->usage, cur_dev->usage_page);

to hidtest.c

Comment thread mac/hid.c
cur_dev->interface_number = -1;
}
if (!dev) {
continue;
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.

Suggested change
continue;
continue;

Comment thread mac/hid.c

/* move the pointer to the tail of returnd list */
while (cur_dev->next != NULL) {
cur_dev = cur_dev->next;
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.

Suggested change
cur_dev = cur_dev->next;
cur_dev = cur_dev->next;

Comment thread mac/hid.c

IOHIDDeviceRef dev = device_array[i];
#ifdef DEBUG
// CFShow(dev);
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.

remove

Comment thread mac/hid.c
CFRelease(p);
}
#ifdef DEBUG
// CFShow(matching);
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.

remove

Comment thread mac/hid.c
continue;
}
#ifdef DEBUG
// CFShow(dict);
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.

remove

Comment thread mac/hid.c
CFArrayRef usage_pairs = get_usage_pairs(device);

#ifdef DEBUG
// CFShow(usage_pairs);
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.

remove

Comment thread mac/hid.c
cur_dev->release_number = get_int_property(dev, CFSTR(kIOHIDVersionNumberKey));

/* Interface Number (Unsupported on Mac)*/
cur_dev->interface_number = -1;
Copy link
Copy Markdown
Member

@Youw Youw Nov 15, 2019

Choose a reason for hiding this comment

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

it is supported now
please see: 00e6e45#diff-5cbb2d1918d13a205b0b45fa24166f42
update accordingly

Comment thread mac/hid.c
}

if (root == NULL) {
/* error when generating or parsing usage pairs */
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.

Suggested change
/* error when generating or parsing usage pairs */
/* error when generating or parsing usage pairs, or device/driver doesn't report usage pairs (correctly) */

@todbot
Copy link
Copy Markdown
Contributor

todbot commented Nov 23, 2019

Hi, I'm not the original submitter of this PR, but I'd like to implement the requested changes. What is the cleanest way of doing this? (I've not had experience with PRs with updates and suggested changes)

@Youw
Copy link
Copy Markdown
Member

Youw commented Nov 23, 2019

I don't think there is a way to submit your changes to this particular PR since you'd need to commit to author's PR, and you don't have write access to his copy of the repo.

But you can:

  • clone original repo (origin);
  • add git remote to fengj2006;
  • checkout this PR's branch (this and the previous one - just so you have the original changes);
  • apply your changes;
  • push your local branch to origin hidapi (or your own fork of hidapi);

Alternative - ask write permission to fengj2006s repo;

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.

4 participants