I used the HidAPI hid_open_path() function in V8 C++ to open the device for Node.js on the Electron platform,
HidAPI function:from here
First, execute the program in Debug Mode, and the device can be turned on successfully The recipient uses Electron Builder to package this solution into an app file on the Universal platform
When reaches this step, after opening the packaged APP and opening the permission through Input Monitoring, the specified device cannot be opened, and it cannot be opened on the x86 (Intel) or arm64(M1)platform.
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)
We have also used Electron-Packager for @electron/universal, but the result is still unable to open the device.
May I ask if I want to package it into one universal file, what can I do to be able to succesfully open it?
Here are the build information in package.json:
"build": {
"appId": "com.Myapp.application",
"productName": "Myapp",
"artifactName": "${productName}-Setup-${version}.${ext}",
"copyright": "Copyright © 2020 Myapp",
"asarUnpack": [
"./database"
],
"mac": {
"category": "com.Myapp.application",
"target": {
"target": "default",
"arch": "universal"
},
"icon": "./image/icon.icns",
"identity": "identity",
"darkModeSupport": true,
"hardenedRuntime": true,
"gatekeeperAssess": false,
"artifactName": "${productName}.${ext}"
},
"directories": {
"buildResources": "release",
"output": "Myapp"
}
},
There needs to be a way that the App on the Universal platform packaged in Electron-Builder by using HidAPI to open the device