Add Mac-specific API to get device location ID #378

Merged
triplef merged 1 commit from darwin-location-id into master 2022-02-25 02:54:28 -06:00
triplef commented 2022-02-08 10:32:33 -06:00 (Migrated from github.com)

As discussed in https://github.com/libusb/hidapi/discussions/252#discussioncomment-2089707.

Not sure if there’s a simpler way to do this, but as I need the location ID during enumeration it seems I first need to create a IOHIDDeviceRef from the path in order to get the location ID.

As discussed in https://github.com/libusb/hidapi/discussions/252#discussioncomment-2089707. Not sure if there’s a simpler way to do this, but as I need the location ID during enumeration it seems I first need to create a `IOHIDDeviceRef` from the path in order to get the location ID.
Youw (Migrated from github.com) reviewed 2022-02-08 11:50:36 -06:00
Youw (Migrated from github.com) left a comment

Thanks!

Just a few comments

Thanks! Just a few comments
Youw (Migrated from github.com) commented 2022-02-08 11:43:56 -06:00

revert

autotools are deprecated now
we don't want to develope/support new feature for it - that will be a good motivation to migrate to CMake for projects that are still using it autotools and are actively developed

revert autotools are deprecated now we don't want to develope/support new feature for it - that will be a good motivation to migrate to CMake for projects that are still using it autotools and are actively developed
@ -0,0 +1,50 @@
/*******************************************************
Youw (Migrated from github.com) commented 2022-02-08 11:50:14 -06:00

make it a:

int HID_API_EXPORT_CALL hid_darwin_get_location_id(hid_device *dev, uint32_t *location_id);

returns -1 on failure - like all other function


and if someone wants to use it with path: use hid_open_path -> hid_darwin_get_location_id -> hid_close

make it a: `int HID_API_EXPORT_CALL hid_darwin_get_location_id(hid_device *dev, uint32_t *location_id);` returns `-1` on failure - like all other function --- and if someone wants to use it with `path`: use `hid_open_path` -> `hid_darwin_get_location_id` -> `hid_close`
triplef commented 2022-02-09 05:55:08 -06:00 (Migrated from github.com)

Looks like the AppVeyor build failed spuriously:

Error uploading artifact to the storage: The request was aborted: Could not create SSL/TLS secure channel.

Looks like the AppVeyor build failed spuriously: > Error uploading artifact to the storage: The request was aborted: Could not create SSL/TLS secure channel.
Youw commented 2022-02-09 06:21:03 -06:00 (Migrated from github.com)

That is not an issue for us

That is not an issue for us
Youw (Migrated from github.com) approved these changes 2022-02-09 06:24:10 -06:00
Youw (Migrated from github.com) commented 2022-02-09 06:23:05 -06:00

I'm pretty sure that the location_id is an unsigned int property
lets add a get_uint_property function, to be strictly correct

I'm pretty sure that the `location_id` is an unsigned int property lets add a `get_uint_property` function, to be strictly correct
triplef (Migrated from github.com) reviewed 2022-02-09 11:45:29 -06:00
triplef (Migrated from github.com) commented 2022-02-09 11:45:29 -06:00

Yes I also think it’s an unsigned property, and the return parameter is declared as such (uint32_t *location_id).

Since it’s the same bit size I don’t see any reason to add a separate getter. In fact get_int_property() is already used in get_vendor_id() to return an unsigned property the same way. But I added a cast just to be explicit.

Yes I also think it’s an unsigned property, and the return parameter is declared as such (`uint32_t *location_id`). Since it’s the same bit size I don’t see any reason to add a separate getter. In fact `get_int_property()` is already used in `get_vendor_id()` to return an unsigned property the same way. But I added a cast just to be explicit.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!378
No description provided.