trezor / cython-hidapi

:snake: Python wrapper for the HIDAPI
Other
285 stars 110 forks source link

Darwin: enable non-exclusive device usage #178

Open ilyalasy opened 4 months ago

ilyalasy commented 4 months ago

When I use device.open(), device inputs are not accessible on any application other than my script code. How can I fix that? Platform: macOS (ARM)

prusnak commented 4 months ago

Duplicate of https://github.com/libusb/hidapi/issues/27

It seems that the underlying library does not allow it

ilyalasy commented 4 months ago

This PR fixes it, isn't it?

prusnak commented 4 months ago

So it seems that all we need to do is export the following functions and set them accordingly.

void HID_API_EXPORT_CALL hid_darwin_set_open_exclusive(int open_exclusive)
int HID_API_EXPORT_CALL hid_darwin_get_open_exclusive(void)
int HID_API_EXPORT_CALL hid_darwin_is_device_open_exclusive(hid_device *dev)

@ilyalasy would you like to create a PR for this?

ilyalasy commented 4 months ago

So it seems that all we need to do is export the following functions and set them accordingly.

void HID_API_EXPORT_CALL hid_darwin_set_open_exclusive(int open_exclusive)
int HID_API_EXPORT_CALL hid_darwin_get_open_exclusive(void)
int HID_API_EXPORT_CALL hid_darwin_is_device_open_exclusive(hid_device *dev)

@ilyalasy would you like to create a PR for this?

Don't have experience with cython, but I can try