Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Can't open device #3

Open
devyaz opened this issue Dec 8, 2018 · 11 comments
Open

Can't open device #3

devyaz opened this issue Dec 8, 2018 · 11 comments

Comments

@devyaz
Copy link

devyaz commented Dec 8, 2018

i used to run the same code in an Electron App without problems, now after 2 system upgrades am getting the below error

Uncaught Exception: Error: cannot open device with vendor id 0x4b4 and product id 0xbca1 at new HID (/home/martin/Electron/electron-api-demos/node_modules/node-hid/nodehid.js:54:17) at new UsbScanner (/home/martin/Electron/electron-api-demos/node_modules/usb-barcode-scanner/dist/usb-barcode-scanner.js:31:25)
i tried removing node-modules and yarn to re-install but still cant open device if i either use deviceId or path!
EDIT
Node HID reports a different devID vendID from what i get with const getDevices= require('usb-barcode-scanner').getDevices console.log(getDevices()); the above code gives { vendorId: 1204, productId: 48289, path: '/dev/hidraw0', serialNumber: '', manufacturer: 'Guest', product: 'Barcode Reader', release: 594, interface: 0 } and Node HID reports vendor id 0x46d and product id 0xc52f
which is hexadecimal for 1133 and prodID 50479 which is my mouse BT dongle yet i provided my vendor Id and product id of 1204 and 48289 even if i remove the bluetoth dongle for wireless mouse

@mikerovers
Copy link
Owner

@devyaz I can not come up with a direct solutions at the moment. Have you made any progress with this issue in the past days?

@devyaz
Copy link
Author

devyaz commented Dec 29, 2018 via email

@dimitrisal
Copy link

I have the same issue in windows, when I run the nodejs with sudo in ubuntu it works but i get the same value twice per scan.

@devyaz
Copy link
Author

devyaz commented Mar 21, 2019

@dimitrisal can you show code! So we can help

@dimitrisal
Copy link

@devyaz I am using the example code. With the same code if i run the nodejs as sudo in the linux work but without sudo or in windows doesnt work i get the same error (with different vendor id and product id)

Error: cannot open device with vendor id 0x4b4 and product id 0xbca1

`let UsbScanner = require('usb-barcode-scanner').UsbScanner;

let scanner = new UsbScanner({
vendorId: 1155,
productId: 22352
});

scanner.on('data', (data) => {
console.log(data);
});

scanner.startScanning();`

@devyaz
Copy link
Author

devyaz commented Mar 23, 2019

It needs sudo to run in linux since it has to access devices on the pc which require permission i guess it might as well run in windows if CMD is run ad administrator

@devyaz
Copy link
Author

devyaz commented Mar 23, 2019

It might be something in linux or Electron update thats breaking escpos. Perhaps @mikerovers you need to upgrade it?, Unfortunately i haven't tried using Node 8 i think it worked then

@mikerovers
Copy link
Owner

@devyaz @dimitrisal I am facing the same problems on Windows (node v11.12.0). I will try to look for differences in HID usage in Windows and Unix for a start.

@mikerovers
Copy link
Owner

mikerovers commented Mar 30, 2019

I was unable to find a working solutions for this at the moment. I would suggest trying another package of making your application Unix only.

@DeathTrooperr
Copy link

@mikerovers

I have just run into the same problem on windows and despite my best efforts to enable permissions extra, I have not been able to fix the problem. Have you been able to solve this problem?

Thanks in advance!

@DeathTrooperr
Copy link

I think I might have found the answer. Please see this response to a similar issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants