WebUSB | WebUSB enabled LOL shield | Runtime Evironment library

 by   edwinm JavaScript Version: Current License: MIT

kandi X-RAY | WebUSB Summary

kandi X-RAY | WebUSB Summary

WebUSB is a JavaScript library typically used in Server, Runtime Evironment, Nodejs applications. WebUSB has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

WebUSB enabled LOL shield.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              WebUSB has a low active ecosystem.
              It has 21 star(s) with 8 fork(s). There are 4 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of WebUSB is current.

            kandi-Quality Quality

              WebUSB has 0 bugs and 0 code smells.

            kandi-Security Security

              WebUSB has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              WebUSB code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              WebUSB is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              WebUSB releases are not available. You will need to build from source code and install.
              WebUSB saves you 34 person hours of effort in developing the same functionality from scratch.
              It has 91 lines of code, 0 functions and 4 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of WebUSB
            Get all kandi verified functions for this library.

            WebUSB Key Features

            No Key Features are available at this moment for WebUSB.

            WebUSB Examples and Code Snippets

            No Code Snippets are available at this moment for WebUSB.

            Community Discussions

            QUESTION

            Class properties are giving no-undef
            Asked 2021-Apr-27 at 11:36

            I'm trying to make a non-component class in ReactJS. Most tutorials I've followed on JavaScript show that when you're making a class, you can create properties simply by specifying them with this.[name].

            Something really doesn't like this, and it throws me a no-undef error for my properties.

            Here is the code in question:

            ...

            ANSWER

            Answered 2021-Apr-27 at 11:36

            In your connectDAP method you are referencing undefined variables device and transport. You probably want to use the properties defined on the instance this:

            Source https://stackoverflow.com/questions/67281873

            QUESTION

            WebUSB can not claim device on some android devices
            Asked 2021-Mar-25 at 23:39

            I have a PWA using Web Serial on those devices where it is supported (Chromium based Desktop Browsers), on all other devices (basically Android) I try to fall back to Web USB via web serial polyfill.

            This is working great for most devices, but on some (at leas one) Android devices I can not claim the device:

            ...

            ANSWER

            Answered 2021-Mar-25 at 23:39

            I believe this is a duplicate of that issue and automatically detaching drivers on Android (tracked by Chromium issue 1099521) will resolve the problem.

            Source https://stackoverflow.com/questions/66771484

            QUESTION

            Reading from an NFC reader directly into a desktop web application?
            Asked 2021-Feb-22 at 14:36

            I have LibNFC working from the Linux terminal recognising my ACR122U Reader, and I wanted to know if there was a method for it to work through Chrome on a Linux Desktop as it is really similar to Android Support, with all the NFC device handling done by libnfc and the browser just has to know about this library instead of every type usb or other device than can do NFC.

            I have tried using the WebNFC API to connect it :

            ...

            ANSWER

            Answered 2021-Feb-10 at 06:54

            Web NFC is supported on Android only as of February 2021. See https://web.dev/nfc/

            The WebUSB error suggests you're requesting an interface that implements a protected class (among those below):

            Source https://stackoverflow.com/questions/66111078

            QUESTION

            Reading GPS Receiver using WebUSB
            Asked 2021-Feb-05 at 15:52

            I am trying to use WebUSB to read GPS coordinates from a USB-connected GPS receiver from within javascript.

            I have been able to connect to the receiver; however, I am unsure how to use WebUSB to access the NMEA messages.

            So far, I have the following proof-of-concept code:

            ...

            ANSWER

            Answered 2021-Jan-29 at 02:03

            There are a couple of layers you'll need to understand in order to accomplish your goal. The first is the USB interface implemented by the device.

            In the example code you've posted there are two calls which send commands to the device. The first is a controlTransferOut() which sends the standard USB CDC-ACM SET_CONTROL_LINE_STATE request (0x22) to the device to enable the DTR signal (0x01). If your device implements the USB CDC-ACM protocol then this is the write thing to do as it signals to the device that the host software is ready to receive data. If your device doesn't implement this protocol then the command will be ignored or fail. You're already claiming the first interface, to understand USB protocol that interface implements you should check device.configuration.interfaces[0].alternates[0].interfaceClass and device.configuration.interfaces[1].alternates[0].interfaceClass. A USB CDC-ACM device will have one interface with class 2 and one with class 10. Class 2 is for the control interface while class 10 is the data interface. If your device doesn't have these two interfaces then it probably isn't implementing the USB CDC-ACM protocol and you'll have to figure out what protocol it uses first.

            The second call you make is a controlTransferIn() which sends the standard USB GET_DESCRIPTOR request (0x06) to read a string descriptor from the device. Passing 0x0302 asks it to read the string descriptor (type 3) at index 2. This will work for any USB device (assuming the index is right) and so doesn't tell you whether you've figured out what protocol the interface supports.

            Assuming this is a USB CDC-ACM interface then you'll want to look at device.configuration.interfaces[1].alternates[0].endpoints and figure out the endpoint numbers for the IN and OUT endpoints. These are what you'll pass to transferIn() and transferOut() to send and receive data from the device.

            Once you have all that figured out you'll need to figure out how to get the device to start sending NMEA messages. If you are lucky then in its default mode it will automatically send them and you can just start calling transferIn() to receive them. Otherwise you will have to figure out what command to send to the device to put it in a the right mode. If you have and documentation for the device or example code written in other languages that supports this device then that will be very helpful for figuring this out.

            Source https://stackoverflow.com/questions/65945564

            QUESTION

            WebUSB disconnects on Android after a while
            Asked 2021-Jan-26 at 00:44

            I have implemented the web USB API for the USB-to-TTL chip CH340. It works pretty good on the PC but when I connect my phone to the chip (using direct cable and/or OTG cable) the API will disconnect after a minute or two. This doesn't happen if I use a Serial Terminal App on the same phone. Same will happen on multiple Chromium based browsers.

            And as soon as I physically disconnect the chip from the phone it will freeze and restart the phone.

            Here's my beta test site: https://grovkillen.com/webusb/

            ...

            ANSWER

            Answered 2021-Jan-26 at 00:44

            This behavior shouldn't happen (especially the freezing and crashing part) and is likely a Chromium or Android bug. Please open an issue on crbug.com and include any crash IDs from chrome://crashes in the report. Reply here with the bug link so I'm sure to see it.

            Source https://stackoverflow.com/questions/65886540

            QUESTION

            Does WebUSB is supported by permissions infrastructure?
            Asked 2020-Dec-17 at 02:05

            WebUSB API documentation introduces new powerful feature with name "usb" to permissions infrastructure (https://wicg.github.io/webusb/#permission-api). But when I try to use permissions api to query permissions for "usb":

            ...

            ANSWER

            Answered 2020-Dec-17 at 02:05
            1. Does permissions api support "usb" feature? If yes, what I do wrong in upper code?

            No. While the Permissions API integration defined in the specification is implemented in Chromium-based browsers it is not exposed through the Permissions API's query() method. This is tracked by issue 638721 but has not been a priority given the available alternatives.

            1. If permissions api not yet support "usb" feature, where/how allowed devices are stored in browser? Can I programmatically get access to this storage?

            Permissions are stored in the browser's user preferences file and internal data structures which are not directly accessible to Javascript. The only way these permissions are currently exposed are through the settings UI (chrome://settings/content/usbDevices) and the navigator.usb.getDevices() method, which only returns allowed devices if they are currently connected.

            1. Can website request user to allow permissions to group of devices (in my case by vid+pid) which not only connected right now, but also can be connected in future? In other words, I want to ask user "Please, let me work with usb devices (with this vid+pid) which you connect in a future, because I don't want to bore you with permission question every time you connect new device of particular type".

            No. It is important to the security design of the API that the user make the decision based on the devices currently connected rather than a hypothetical future device.

            For enterprise managed devices the WebUsbAllowDevicesForUrls policy allows an administrator to make this type of decision on behalf of their users.

            Source https://stackoverflow.com/questions/65324956

            QUESTION

            Webusb adb shell from php node js it is possible to communicate usb device like mobile phone via website
            Asked 2020-Dec-03 at 01:20

            I am interesting in building a web application to read and write inforomation of a mobile phone using webusb or adb shell or node js to open port and communicate device with at command or adb command

            but I am struggle which the propre and secure way and i have problems of permissions

            Webusb works fine but I can't integert at command or adb shell ?

            ...

            ANSWER

            Answered 2020-Jun-16 at 00:25

            The webadb.js library provides an implementation of the ADB protocol in Javascript using WebUSB to communicate with a local device. This assumes that the device is local to the computer running the web browser.

            If you want to control the device from the server you will need to provide a way for the server to command the browser to forward commands to the device. This could be done, for example, using a Web Socket.

            If you want to use the browser to control a device connected to the server however a different approach is needed. In that case you would use a library like adbkit to connect to the device directly from Node.

            Source https://stackoverflow.com/questions/62373729

            QUESTION

            webUSB api working but the data received aren't decoded properly
            Asked 2020-Nov-30 at 14:44

            UPDATED CODE

            I'm using this code to claim the use of the serial-2-USB device. It shows up and I can query the info about it, ie. "connected to USB2.0-Serial VID: 6790 PID: 29987" (CH34x from Qinheng). To be clear, I use the winUSB driver (downloaded with zadig-2.5.exe, Windows 10) and have uninstalled the original drivers.

            I get the received data as dataview but when I do the decode it comes out gibberish. And I see that the array length pretty much corresponds to what I know my ESP8266 is posting over the serial port.

            Example of decoded data: �(#���D"D�T�b�!A#7mP�R�N����#�m93aw9 ½�d-K��b��BF+3ѡ��kag1�R�#��#!!r����g�!d��a��谛oa��399�}��1D�#��'99�����9�����'99���'99����@@譛

            I get the data as Uint8Arrays but even if I try to make my own parser the same gibberish is the end result. Do I need to care about USB stuff as in start bits, ack bits etc. etc.? All the example code out there just do a text decoder and that's it.

            serial.js + index.html

            ...

            ANSWER

            Answered 2020-Nov-20 at 18:04

            This isn't a flaw in WebUSB but with the script you are running. The serial.js script included in the Arduino examples repository is designed to work with Arduino devices where setting the baud rate in unnecessary because the port is virtual. In order to set the baud rate on a USB to serial adapter you need to send the SET_LINE_CODING control transfer. This should go before the SET_CONTROL_LINE_STATE command in your existing code. There is documentation for the structure of the control transfer here:

            https://github.com/MarkDing/lufa-efm32#311-set-line-coding

            Source https://stackoverflow.com/questions/64929987

            QUESTION

            DOMException: Unable to set device configuration Chrome 86
            Asked 2020-Oct-31 at 21:56

            WebUSB has very limited coverage, but that's okay for this project.

            The navigator.usb.requestDevice method succeeds:

            ...

            ANSWER

            Answered 2020-Oct-31 at 21:56

            Because USB–and even more so WebUSB–seems to be more fragile than the http connections I'm used, parallel to playing with the Javascript interface, I also worked at pulling in the data with PyUSB. The goal is to write data from the device to a CSV file so either could work.

            In this related post I outline some additional steps in the process including:

            • rebooting the machine
            • with the device connected
            • a good USB cable
            • checking chrome://device-log at DEBUG level
            • using a demo of the Serial App
            • checking status with kexstat, "unclaiming" with kextunload
            • looking at kernel log with dmesg

            I would love to accept a more robust "answer" than this, but I am finally seeing some data:

            Source https://stackoverflow.com/questions/64581532

            QUESTION

            Can a driver wrap another driver to use WEBUSB
            Asked 2020-Oct-24 at 19:12

            I have a device that I would like to access through WebUsb, the driver is source-closed, so Is there a way I can create my own driver to wrap the official driver ?, just to give the device visibility from chrome and WebUsb ?

            Update:

            After the answer that really helped me a lot I can say the following:

            If you don't have access to the firmware of the USB and cannot modify it so its compatible with WebUsb, the next approach is to learn how the device works at low level, you dont need to know the full USB Protocol, but at least know how to send and receive commands, and in WINDOWS is a must, that the driver for your usb device be WinUsb.sys

            You dont need to create a full new driver, only know how the comunication between the device and the computer works, and rewrite that in javascript.

            ...

            ANSWER

            Answered 2020-Oct-06 at 19:54

            WebUSB is designed to provide low-level access to USB devices, at the level of individual USB transfers. If the device has an existing driver then that should be taking care of the transfers and presenting a higher-level interface to applications on your system. Trying to wrap that in something which presented the low-level interface again would be counterproductive.

            Without more information about the device in question and its driver I can't give more precise advice.

            One option, which would be a lot of work but could be more broadly applicable would be writing a wrapper around the existing driver that would allow it to use WebUSB to connect to the device. There has been work, for example, it port user-space drivers using libusb to the web by providing a port of libusb that uses WebUSB internally. This works much more easily for open-source drivers because you can recompile them to use the wrapper. If this is a closed-source native Windows driver, for example, running that inside of an emulator on the web would be an enormous undertaking.

            Source https://stackoverflow.com/questions/64219442

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install WebUSB

            You can download it from GitHub.

            Support

            Chrome 61, released in October 2017, supports WebUSB. The idea is simple. You connect an USB device, a popup appears and clicking it will open a website. On this site, you can change settings, download data etcetera. It works on every operating system, there's no local software to install and it's always up to date. Google provides instructions to build you own WebUSB device with an Arduino Leonardo. Not all Arduino's support WebUSB, like the UNO. See the list of supported Arduino's for WebUSB support. On this same page you can read how to change an Arduino source file to make it support USB 2.1. For more information, you can read this article about WebUSB on the Google Developer website.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/edwinm/WebUSB.git

          • CLI

            gh repo clone edwinm/WebUSB

          • sshUrl

            git@github.com:edwinm/WebUSB.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link