WICG / webusb

Connecting hardware to the web.
https://wicg.github.io/webusb/
Other
1.3k stars 126 forks source link

Access Denied in device.open : Webusb #184

Closed crazyjavatricks closed 4 years ago

crazyjavatricks commented 4 years ago

Hi,

I used WebUsb to connect USB printer. Device is listing in the permission screen, but while connecting to the same am getting an error like Uncaught (in promise): SecurityError: Access denied.

attaching the screen shots. If anyone know the solution please update.

image

image

Code image

beaufortfrancois commented 4 years ago

According to source code, it looks like "The operating system denied access to the device."

crazyjavatricks commented 4 years ago

@beaufortfrancois Thanks for your response. Is there any way forward.?how can i make it workable..?

beaufortfrancois commented 4 years ago

I'm not sure. Do you see any improvements when enabling the "new-usb-backend" flag at about:flags and restart Chrome? You may want to use Chrome canary.

crazyjavatricks commented 4 years ago

Only after changing the "new-usb-backend" flag, printer got listed in permission screen.

reillyeon commented 4 years ago

See this StackOverflow question for a solution.

On Windows you will get the "Access denied" error if the winusb.sys driver is not loaded. You can use the Zadig tool to force that driver to replace the default one for this device.

crazyjavatricks commented 4 years ago

@reillyeon Thanks for the information. will check this too..

beaufortfrancois commented 4 years ago

reillyeon@ Shall we update the error message so that web developers have actionable insights?

if OS = "windows"
  errorMessage = "Access denied. Consider using Zadig tool to force driver to replace the default one for this device"
gametheworld commented 3 years ago

@reillyeon Hello, this driver must be modified?

gametheworld commented 3 years ago

image @reillyeon

reillyeon commented 3 years ago

@gametheworld this appears to be a problem with the Zadig tool or your system configuration which is outside the scope of issues we can address in this forum.

danny-does-stuff commented 1 year ago

On Windows you will get the "Access denied" error if the winusb.sys driver is not loaded. You can use the Zadig tool to force that driver to replace the default one for this device.

@reillyeon I was able to install the winusb driver using Zadig, but I am still getting the "Access denied" error. Do you have any more insights on how to get this working?

reillyeon commented 1 year ago

@reillyeon I was able to install the winusb driver using Zadig, but I am still getting the "Access denied" error. Do you have any more insights on how to get this working?

Check chrome://device-log. That will contain information from the USB device discovery process including which driver was found for each interface.

danny-does-stuff commented 1 year ago

Ok thank you @reillyeon ! I was able to get the correct driver selected as you can see from my screenshot, but then calling controlTransferOut is causing the error "Transfer failed: A device attached to the system is not functioning." The same call is working fine on a mac. The call to controlTransferOut looks like this

controlTransferOut({requestType: 'class', recipient: 'interface', request: 0x22, value: 0x01, index: 0x00})

image

reillyeon commented 1 year ago

I'm not sure what the root cause of that error would be. Using Wireshark to view the USB traffic when the transfer is submitted might be helpful.

ketan-pcs commented 1 year ago

use this software zadig go to this link : https://zadig.akeo.ie step-1 : download zadig step-2 : go to options and select list all devices step-3 : select your device step-4 : replace driver step-5 : done

lesauf commented 7 months ago

Hum, didn't worked for me. After replacing drivers with Zadig, my printer went offline and no way to wake it up. I have to reinstall the officials drivers (Zebra GK420d) label printer.