-
Notifications
You must be signed in to change notification settings - Fork 474
Mac OS X Version:12.4
Electron Version:13.6.7
Node.js Version :14.17.3
hidapi: Latest Version
I used the HidAPI function in V8 C++ to open the device for Node.js on the Electron platform, and I want to make hid_send_feature_report() to command the device,
first apply hid_enumerate with VID and PID to get the specified device
The receiver applies the path to the Function of hid_open_path(), but the result of Return Value is NULL (0),
After a further check for the Function of hid_open_path(), IOHIDDeviceOpen in the subroutine, the returned value is e00002e2, defined as kIOReturnNotPermitted
This only happens if Electron-Builder is packaged into an universal file, but if Electron is packaged separately into x86 (Intel) and arm64 (Apple) or if VSCode is used for debugging, the function of hid_open_path() can be successfully opened. ( The above app all have permission to open through Input Monitoring of macOS)
May I ask if I want to package it into one universal file, what can I do to be able to succesfully open it?
All reactions
Replies: 2 comments 2 replies
This sounds like some Electron-specific behavior.
There is no difference in either a separate x64/arm64 build or a Universal build of HIDAPI is used.
Both work the same way as per all my tests.
What I assume is more likely, is that your Electron application creates some kind of a container or a sandbox which doesn't have the permission to use HID devices.
But that's only an assumption, I'm not familiar with the Electron to know exactly what's going on.
All reactions
-
👍 1
Understand, I will look for behavior from the direction of Electron application.
All reactions
There are some electron examples from the node-hid project and other places. You may want to give it a try.
https://github.com/node-hid/node-hid
https://github.com/todbot/electron-hid-test
https://github.com/todbot/electron-hid-toy
https://github.com/todbot/electron-blink1-toy
All reactions
Wow, that seems like useful information, thanks!