Reputation: 1
I am trying to access a smart card reader on the client with the Web USB API in order to establish a connection with the server and be able to send commands to the smart card, but it fails to execute device.open(). I attached this code to a button click, and I tried to arrest other applications who were claiming the device but with no fortune. I know this is possible because of other web applications working similar but i am stuck. I think the problem is that some other windows process is requestiong the device and chrome can't access it because of it. Here is what i have:
async function requestDevice() {
const vendorId = 0x04E8;
const productId = 0x5780;
navigator.usb.requestDevice({ filters: [{ vendorId, productId }] })
.then(device => {
return device.open()
.then(
console.log(device.name);
)
})
.catch(error => console.error(error));
}
On the console: DOMException: Failed to execute 'open' on 'USBDevice': Access denied.
Upvotes: 0
Views: 2648