Open theudebart opened 2 months ago
This sounds like the crash that https://github.com/node-hid/node-hid/pull/533 fixes, perhaps the build in my npm fork will resolve this for you? https://www.npmjs.com/package/@julusian/hid
I will try this and keep you updated. As i understand I need to rebuild the node module because the changes are in the c code. As of now i don't get it to compile... Also i need to look into how to require a repository, so far i only used npm, but i will figure this out and update here.
my fork on npm includes precompiled binaries for this library, its a drop in replacement. If you're using yarn, you can setup the dependency/resolution in your package.json with "node-hid": "npm:@julusian/hid@3.0.1-0"
. Other package managers are probably similar, but I havent checked
Thank you for the help, this was easy to replace. Unfortunately this does not resolve my problem. I still get the same error. Only difference i notice is that it now always fails on opening.
Hi, do you have any other recommendation that i could try? I'm a little bit helpless here, and need hid support for my application.
I don't have any ideas currently. Could you make a small reproduction project that I can try and debug the issue with?
I stripped my project down to isolate the problem. Here is a repo with the necessary code. I tested this project and get the same error if I open a hid device that can be opened.
https://github.com/theudebart/electron-hid-test-erb-issue-540
I had encountered the same issue with the async API, and using the fork from @Julusian's resolved the problem. Is there any way to expedite https://github.com/node-hid/node-hid/issues/538?
In an Electron App i'm using the node-hid library to read hid data from a device. In the App there is a button to open / close the connection. I'm using the Async API. Most of the time the app crashes during opening or closing. Sometimes (but not very often) everything works and i receive data and can close the device gracefully.
What i was able to figure out ist that the error only occurs if an event listener to the data event is registered. If there is no
device.on('data', (data) => {console.log(data)});
then the device can be opened and closed without crashes. As soon as the event listener is registered the app crashes at start on button click or it opens correctly, outputs data and crashes on the button click to close the device.Error on open / after registering a event listener to the data event:
Error on close:
I'm not sure if this is related to #538 and https://github.com/electron/electron/issues/33868 as mentioned by @oalfroukh in https://github.com/node-hid/node-hid/issues/538#issuecomment-2028603268. I'm also not using a child window.
I'm using electron v26.2.1, node v18.18.0 on an Apple Silicon M1 with prebuilt node-hid in an development environment.
I'm hoping for some help, as i am stuck here.