problem with close
See original GitHub issueIt seems that once a ‘data’ listener is added, device can not be closed properly.
I encountered the problem with code like this. ran it in node console
>var HID = require('node-hid');
undefined
>var p = h.devices()[1].path; // had a bar code scanner connected
undefined
>var dev = new HID.HID(p);
undefined
>dev.on('data', function(d){console.log(d)});
......
>dev.removeAllListeners('data');
......
>dev.close(); //close the device
undefined
>dev = new HID.HID(p); //reopen the device, failed, seems like the device is not released
cannot open device with path \\?\hid#vi...blahblahblah
reopen is good when i skip the dev.on('data',...)
and dev.removeAllListeners('data')
statement.
Is it a bug?
Issue Analytics
- State:
- Created 9 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Close a problem
The Problem Analyst verifies that all related known errors are closed or resolved before closing the problem record. The Problem Analyst then consults...
Read more >Closing Problem Tickets : TechWeb - Boston University
Closing Problems is a manual process as it does require human intervention to ensure that all steps, tasks and changes have been completed...
Read more >Close related Incidents upon closing a Problem
Related incident are not closed when the associated problem is closed. ... OOB business rule - "SNC - ITIL - Close Related" is...
Read more >Reopen the closed problem - SDP help desk guide
Close a problem · Click the Problems tab in the header pane. · Click the Title of the problem in the Problems list...
Read more >Closing a Problem - Ivanti
1.Log in to the application as a Problem Manager. · 2.Open the Problem workspace. · 3.Open the problem that you want to close....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had this issue also, and found that I could workaround it by calling
setNonBlocking(true)
on the HID device prior to subscribing to any data.There’s an open issue from 2017 about this undocumented function: https://github.com/node-hid/node-hid/issues/216
Thanks for looking at this 😺
Changing the driver to
libusb
had no effect.The output from
lsusb -v
is:Regarding the exact hardware, it is a relatively cheap button purchased from http://usbbutton.com/, running on a proprietary hardware system (though I have no way to discover the exact hardware, sorry).
Regarding LXC usage, I did a quick google and browse, and seems like something such as https://linuxcontainers.org/lxd/getting-started-cli/#creating-and-using-your-first-container is decently straightfoward if you have a linux system somewhere.
I followed https://medium.com/@konpat/usb-passthrough-to-an-lxc-proxmox-15482674f11d to figure out how to allow the USB device through to the container. For the USB button, the exact lines I added to the container’s config were:
I suspect there’s a way to do that for a running, but I don’t know exactly how to do it, unfortunately 😿 . It looks like something akin to https://discuss.linuxcontainers.org/t/providing-access-to-loop-and-other-devices-in-containers/1352… but I have no way of discovering the exact commands, sorry, as I only get access from within the container on the proprietary system.