Tried to connect a device to web via webusb but.. Failed to claim interface: Access denied (insufficient permissions) - google-chrome

I am using the webusb API in Google Chrome to try to connect a device to the browser. It worked with webserial API, but I am having trouble getting it to work with webusb API.
I am using HTTPS (Github pages)
I enabled #new-usb-backend for my browser
I can open the device and select configuration, but device.claimInterface(0) is not working (and I can confirm that 0 is an interface number).
None of the two interfaces this device has seems to be claimed
The error I get looking at chrome://device-log is
Failed to claim interface: Access denied (insufficient permissions)
I'm not sure where to go from here. I would appreciate some help.
Thank you.

device.claimInterface(1) worked. I heard somewhere mac automatically claims interfaces. Perhaps the first interface was claimed, although the api indicated otherwise. Anyhow, something about the second interface worked that didn't work in the first.

That error message indicates that there is either an existing driver that has claimed the interface or (Windows only) the WinUSB driver hasn't attached to the interface in order to enable applications like your browser to claim it. On Windows you can use the Zadig tool to force Windows to change the drivers being used for a USB device.
If the device can be opened using the Web Serial API then that indicates that the operating system has already loaded a serial driver for the device and so it has claimed at least some of the device's interfaces.
Why, if the Web Serial API works to connect to your device, are you trying to connect to it with the WebUSB API instead? Are you now on a different operating system which doesn't provide a USB serial driver compatible with the device?

Related

Failed to claim interface: Operation not supported or unimplemented on this platform

I'm trying to use a USB Barcode Scanner on Windows 10 in Chrome v73.0.3683.86 via WebUSB.
The scanner is a Honeywell Voyager 1250g.
I can see the device via the device dialog - I can also open it and select a configuration.
However, when I try to claim interface(1) (There are 3 interfaces, but 1 is the bulk transfer) I get the error Failed to claim interface: Operation not supported or unimplemented on this platform in chrome://device-log/.
Is there a way around this, or is this scanner just not usable via WebUSB? Thanks!
Have you tried connecting to this device using WebUSB on other platforms? Windows has a particular additional requirement for applications (like Chrome) to access USB devices which is that the WinUSB.sys driver must be loaded for the interface.
I've written an article explaining the particular requirements on Windows here: https://developers.google.com/web/fundamentals/native-hardware/build-for-webusb/#windows
If you use the Windows Device Manager you can check which drivers are loaded for your device. If there is no driver loaded then you may be able to write a custom INF file as described in that article to instruct Windows to load the driver you want.

What is the difference between a Native Application & Server Application when talking about ADFS Application Groups?

I'm new to Federation Services and I'm trying to understand how ADFS works as a whole and I've started to get down into the details. I followed along with creating an app using OIDC to authenticate a user, however, within the tutorial, they specified using a "Server Application" when setting up an Application Group. This ended up not working for me so I tried setting up a "Native Application" application group for kicks and was able to successfully login.
The thing that threw me off is, I ended up hosting ADFS on a server outside of the domain in which I had my application running, so I'm confused as to how that is "native" in terms of ADFS.
I went looking for this answer within microsoft's documentation but I didn't find the information very clear.
Native Application:
"Sometimes called a public client, this is intended to be a client app that runs on a pc or device and with which the user interacts."
Server Application:
"A web application that runs on a server and is generally accessible to users via a browser. Because it is capable of maintaining its own client 'secret' or credential, it is sometimes called a confidential client."
This may seem simple to some, but I'm trying to really get a grip on what would be used when. To me it sounds like a native application is used when you're running the application natively on a pc in which the user is also using the same pc, and the server application is run remotely in which the user would not be using the same machine. Is it really that simple or am I misunderstanding?
A native application (in Microsoft speak) is something that is not browser based e.g. mobile. The code runs client side. It may use JavaScript in which case the secret key is publicly accessible. (The secret key is one of the OAuth parameters). You use ADAL / MSAL to access it.
A server application runs server side e.g a web API. The secret key is not publicly accessible. You use OWIN to access it.
These terms have no relevance to where ADFS is actually installed. Native applications typically are not domain joined.

WebUSB and RFID readers

I was wondering if anyone had any experience getting RFID readers to work through WebUSB. The reader I'm using is the https://www.parallax.com/product/28340 .
From what I've read, I'd have to write a driver to read from the device. I was just wondering if anyone has done any work regarding this and what they ended up doing.
The goal here is to read RFID tags without using another application to feed it to the web application.
Thanks!
The USB variant of that RFID reader uses an FTDI FT232R chip to provide a serial-to-USB interface. If the host operating system has a driver for this chip or the FTDI Virtual COM port drivers are installed then the browser will be unable to connect to the device when your application requests it through the WebUSB API because the USB interface presented by the device will already be claimed by the driver.
If you are able to guarantee that the Virtual COM port driver is not loaded then you will be able to write a driver using the WebUSB API to control the device.

How Google Chrome extension check if a specific app installed on the client machine or not?

i want to know if it is possible for google chrome extension to check if there is already a native app installed on the client machine or not
So we established that you control both the extension and the native app.
Note that the extension cannot access the filesystem to check for existence of files; presumably, you also want to detect the presence of the app even if it's not running, and ideally be able to launch it if it isn't.
The best way to check that the app is installed is to provide a Native Messaging host in the app. The installer would then add a registry key to let Chrome know that the native host is present, and you can connect to it.
Now, there are some considerations:
You can't check the presence of the native host without trying to launch it.
The process launched that way lives only as long as its communication port is opened in the extension.
The communication channel between the extension and the app is the STDIO.
It would not be wise to just declare your main Windows Forms app as the native host. You should write a separate utility app that can communicate according to the Native Messaging protocol (even if to just answer "I'm here"). If needed, it can launch the main app and/or communicate with it as needed using other channels. You could also just launch the main app from your native host and then communicate with it using WebSockets.

Nokia Remote Device Access

I am not able to launch the Nokia RDA, Getting this error message:
Unable to initiate server communication. Please verify that you do not have firewall software preventing the Remote Device Access process (javaw.exe) from accessing apu.ndhub.net, TCP port 1,200.
I am afraid how to do this...
In order to use that, Check these requirements
JavaScript must be enabled.
Browser must be Firefox v2+, Internet Explorer v7+, Opera v9.6+ or Safari v3.
Java Web Start must be installed.
If the problem persist, please check your Java installed version is up to date and also your browser belongs to the version required. Hope it helps you.