Coder Social home page Coder Social logo

arduino's People

Contributors

armsp avatar basevers avatar beaufortfrancois avatar bhaveshgohel avatar bringert avatar deqingsun avatar facchinm avatar gvarisco avatar hinzundcode avatar jpliew avatar ladyada avatar oostap1 avatar reillyeon avatar samccone avatar sandeepmistry avatar tigoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino's Issues

How to make this lib to support ESP 32 and STM32F103c8t6 ?

Dear all,

After I ran the RGB demo. It worked so well and made me quite excited. I hope I can run this demo on ESP 32 and STM32F1. Here are some of my questions:

Is it possible to make this library support the ESP 32 and STM32F1? How to do it? Do you have instructions to do that?

Thank you.
Truong Nguyen

Strange behavior in demo app

Let me start off by saying that I was able to get everything working correctly with the arduino example with the help of others that posted what they found regarding windows descriptors. I've created another USB device with the appropriate descriptors to be recognized as a webusb device, however, when I try to run the demo javascript application, I get the following error message:

"Connection error: NotFoundError: The interface number provided is not supported by the device in its current configuration."

This happens in the selectAlternateInterface function AFTER the claimInterface function completes without any error messages. Based on what I've found online, it seems like this should never happen since the same check that is performed to find the interface index is the same for both. Am I missing something that would cause this behavior?

transferIn not triggered until webpage send something

Hi,
I was testing webUSB but I got no success in getting data from Arduino. So I made a simple test with console demo.
I let Arduino print ok every second. However, the transferIn in web does not trigger until I type something in console.

Tested on Mac OS 10.10.5

void loop() {
  static unsigned long previousMillis = 0;
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= 1000) {
    previousMillis = currentMillis;
    Serial.println("OK");
  }
  if (Serial && Serial.available()) {
    int byte = Serial.read();
    Serial.write(byte);
    if (byte == 'H') {
      Serial.write("\r\nTurning LED on.");
      digitalWrite(ledPin, HIGH);
    } else if (byte == 'L') {
      Serial.write("\r\nTurning LED off.");
      digitalWrite(ledPin, LOW);
    }
    Serial.write("\r\n> ");
    Serial.flush();
  }
}

no notification in windows or android

I uploaded the code to my leonardo and the web USB seems to work when I manually go to the website. But neither in Windows, Linux or in Android I get a website notification with where to go. I know this notification isn't working windows, but android should give a pop-up I guess?

like this example
image

WebUSB.h:33:2: error: "WebUSB requires a board that supports USB client device mode."

in file included from /Users/t.shivam/Downloads/arduino-gh-pages/demos/console/sketch/sketch.ino:1:0:
/Users/t.shivam/Documents/Arduino/libraries/WebUSB/WebUSB.h:33:2: error: #error "WebUSB requires a board that supports USB client device mode."
#error "WebUSB requires a board that supports USB client device mode."
^
exit status 1
Error compiling for board Arduino/Genuino Uno.

I am getting this error after loading and uploading th sketch to my arduino. I tried googling but no leads. Any idea why this is happening?

Warnings on sketch compilation

Hello!

Sketch gives me this on compilation:
C:\Users\El\Documents\Arduino\libraries\WebUSB\WebUSB.cpp: In member function 'bool WebUSB::VendorControlRequest(USBSetup&)':

C:\Users\El\Documents\Arduino\libraries\WebUSB\WebUSB.cpp:139:22: warning: narrowing conversion of '(((WebUSB*)this)->WebUSB::numAllowedOrigins + 12)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

 0x05, 0x00, 0x0c + numAllowedOrigins, 0x00, 0x01,

                  ^

C:\Users\El\Documents\Arduino\libraries\WebUSB\WebUSB.cpp:143:10: warning: narrowing conversion of '(((WebUSB*)this)->WebUSB::numAllowedOrigins + 3)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]

 0x03 + numAllowedOrigins, 0x02, pluggedInterface

      ^

arduino version is 1.6.11

And no, i can not see my leonardo in console demo..

Device not detected. Bootloader needed?

I'm running Windows 10 and v1,6.21 of the AVR core, and my device is not detected by the JS pages. I've verified it's recognized as USB 2.1.

In the device manager, there are 2 devices when I load up the console demo sketch: a serial device, and a generic USB device handled by WinUsb.

The device IDs are, I think, normal:

image

Chrome's log looks like this:

image

I've not used the boards.txt definitions from this repo. Are they needed? Where should I put them? I've noticed they reference Caterina2-Micro-WebUSB.hex but there's no such file anywhere.

Any pointers what to check next?

Document Linux udev setup in README.md

I'm attempting to get the RGB demo up and running with an Adafruit Circuit Playground board. I've already added Circuit Playground's VID and PID to serial.js as mentioned in #13. When I click the "Connect" button I can select my device, but then the error handler prints SecurityError: Access denied.

The only time SecurityError is mentioned in the WebUSB spec is in Section 4 - Device Enumeration under the section starting 'To request the "usb" permission...'

If the algorithm is not triggered by user activation, reject promise with a SecurityError and abort these steps.

I'm definitely interacting when this error occurs, so I'm not sure where my setup is going wrong.

  • Attempting at commit ff4aae6
  • On Ubuntu 17.04 64-bit
  • Using Google Chrome 58.0.3029.96 (Official Build) (64-bit) with flags --enable-experimental-web-platform-features and --enable-features=WebUSB
  • I've followed the README instructions, including editing USBCore.h to enable USB 2.1.
  • Uploaded sketch.ino to the Circuit Playground with no customizations, using Arduino IDE 1.8.1.
  • Using http-server to run the demo page at http://localhost:8000/rgb/index.html
  • Maybe notable: I don't get a notification from Chrome when I plug in the Circuit Playground.

Any ideas? Thanks!

Support for Arduino Micro

Hi, I'm trying to follow this tutorial https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web, to read and write from Arduino board from a website. I am using an Arduino Micro. When I try to load the example program to my board I get the following errors:

Arduino: 1.8.10 (Mac OS X), Board: "Arduino Micro"


/<path>/WebUSB/WebUSB.cpp: In constructor 'WebUSB::WebUSB(uint8_t, const char*)':
/<path>/WebUSB/WebUSB.cpp:257:31: error: no matching function for call to 'PluggableUSBModule::PluggableUSBModule(int, int, uint8_t [2])'
    shortName(WEBUSB_SHORT_NAME)
                               ^
In file included from /<path>/WebUSB/WebUSB.h:27:0,
                 from /<path>/WebUSB/WebUSB.cpp:26:
/<path>/WebUSB/PluggableUSB.h:29:3: note: candidate: PluggableUSBModule::PluggableUSBModule(uint8_t, uint8_t, uint32_t*)
   PluggableUSBModule(uint8_t numEps, uint8_t numIfs, uint32_t *epType) :
   ^~~~~~~~~~~~~~~~~~
/<path>/WebUSB/PluggableUSB.h:29:3: note:   no known conversion for argument 3 from 'uint8_t [2] {aka unsigned char [2]}' to 'uint32_t* {aka long unsigned int*}'
/<path>/WebUSB/PluggableUSB.h:27:7: note: candidate: constexpr PluggableUSBModule::PluggableUSBModule(const PluggableUSBModule&)
 class PluggableUSBModule {
       ^~~~~~~~~~~~~~~~~~
/<path>/WebUSB/PluggableUSB.h:27:7: note:   candidate expects 1 argument, 3 provided
/<path>/WebUSB/PluggableUSB.h:27:7: note: candidate: constexpr PluggableUSBModule::PluggableUSBModule(PluggableUSBModule&&)
/<path>/WebUSB/PluggableUSB.h:27:7: note:   candidate expects 1 argument, 3 provided
Multiple libraries were found for "WebUSB.h"
 Used: /<path>/WebUSB
exit status 1
Error compiling for board Arduino Micro.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have already upgraded to usb 2.1 and made sure the webUSB library shows in the ide. Any help would be appreciated. Thanks!

Update code to match changes in the spec

I am talking mainly about changes in the Feature Policy here: WICG/webusb@c964613 (removal of GET_ALLOWED_ORIGINS, etc.)

But maybe some other changes in the spec are relevant for this example (which is a go-to point for reference code of all hardware vendors implementing the spec).

Can't connect to SAMD boards

I can't seem to get SAMD working with the examples. I'm running Windows 10 with Chrome Cannary.
When I upload the serial example I get an unkown USB device in the device Manager, this does not change when setting the USB version to 2.1. I can still upload to it via the serial port though.

I also modified the serial.js to include the PID and VID of my board (Adafruit Metro M0 Express), makes no difference. Chrome does not list the device when I click connect.
The core the Adafruit boards use is identical to the SAMD boards the official Arduino boards use, so this should technically make no difference if the Arduino boards are supported.

WebUSB.h:36:2: error: 'InterfaceDescriptor' does not name a type

I followed the instructions from https://github.com/webusb/arduino/blob/gh-pages/README.md to build /arduino/demos/rgb/sketch/sketch.ino. However, the build fails. I'm on Ubuntu 14.04 using Arduino 1.8.0.

Below you can find the complete build log. It appears that InterfaceDescriptor, EndpointDescriptor, etc. cannot be found. Am I missing a dependency?

/home/swalter/software/arduino-1.8.0/arduino-builder -dump-prefs -logger=machine -hardware /home/swalter/software/arduino-1.8.0/hardware -tools /home/swalter/software/arduino-1.8.0/tools-builder -tools /home/swalter/software/arduino-1.8.0/hardware/tools/avr -built-in-libraries /home/swalter/software/arduino-1.8.0/libraries -libraries /home/swalter/Arduino/libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10800 -build-path /tmp/arduino_build_575522 -warnings=default -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/home/swalter/software/arduino-1.8.0/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/home/swalter/software/arduino-1.8.0/hardware/tools/avr -prefs=runtime.tools.arduinoOTA.path=/home/swalter/software/arduino-1.8.0/hardware/tools/avr -verbose /home/swalter/tmp/arduino/demos/rgb/sketch/sketch.ino
/home/swalter/software/arduino-1.8.0/arduino-builder -compile -logger=machine -hardware /home/swalter/software/arduino-1.8.0/hardware -tools /home/swalter/software/arduino-1.8.0/tools-builder -tools /home/swalter/software/arduino-1.8.0/hardware/tools/avr -built-in-libraries /home/swalter/software/arduino-1.8.0/libraries -libraries /home/swalter/Arduino/libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10800 -build-path /tmp/arduino_build_575522 -warnings=default -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/home/swalter/software/arduino-1.8.0/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/home/swalter/software/arduino-1.8.0/hardware/tools/avr -prefs=runtime.tools.arduinoOTA.path=/home/swalter/software/arduino-1.8.0/hardware/tools/avr -verbose /home/swalter/tmp/arduino/demos/rgb/sketch/sketch.ino
Using board 'uno' from platform in folder: /home/swalter/software/arduino-1.8.0/hardware/arduino/avr
Using core 'arduino' from platform in folder: /home/swalter/software/arduino-1.8.0/hardware/arduino/avr
Detecting libraries used...
"/home/swalter/software/arduino-1.8.0/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_575522/sketch/sketch.ino.cpp" -o "/dev/null"
"/home/swalter/software/arduino-1.8.0/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/variants/standard" "-I/home/swalter/software/arduino-1.8.0/libraries/WebUSB" "/tmp/arduino_build_575522/sketch/sketch.ino.cpp" -o "/dev/null"
"/home/swalter/software/arduino-1.8.0/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/variants/standard" "-I/home/swalter/software/arduino-1.8.0/libraries/WebUSB" "/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.cpp" -o "/dev/null"
Generating function prototypes...
"/home/swalter/software/arduino-1.8.0/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/variants/standard" "-I/home/swalter/software/arduino-1.8.0/libraries/WebUSB" "/tmp/arduino_build_575522/sketch/sketch.ino.cpp" -o "/tmp/arduino_build_575522/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/swalter/software/arduino-1.8.0/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_575522/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/home/swalter/software/arduino-1.8.0/hardware/tools/avr/bin/avr-g++" -c -g -Os  -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I/home/swalter/software/arduino-1.8.0/hardware/arduino/avr/variants/standard" "-I/home/swalter/software/arduino-1.8.0/libraries/WebUSB" "/tmp/arduino_build_575522/sketch/sketch.ino.cpp" -o "/tmp/arduino_build_575522/sketch/sketch.ino.cpp.o"
In file included from /home/swalter/tmp/arduino/demos/rgb/sketch/sketch.ino:1:0:
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:36:2: error: 'InterfaceDescriptor' does not name a type
  InterfaceDescriptor dif;
  ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:37:2: error: 'EndpointDescriptor' does not name a type
  EndpointDescriptor  in;
  ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:38:2: error: 'EndpointDescriptor' does not name a type
  EndpointDescriptor  out;
  ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:47:41: error: expected class-name before ',' token
 class WebUSB : public PluggableUSBModule, public Stream
                                         ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:68:27: error: 'SERIAL_BUFFER_SIZE' was not declared in this scope
  unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
                           ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:94:20: error: 'USBSetup' has not been declared
  int getDescriptor(USBSetup& setup);
                    ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:95:13: error: 'USBSetup' has not been declared
  bool setup(USBSetup& setup);
             ^
/home/swalter/software/arduino-1.8.0/libraries/WebUSB/WebUSB.h:99:28: error: 'USBSetup' has not been declared
  bool VendorControlRequest(USBSetup& setup);
                            ^
Using library WebUSB at version 1.0 in folder: /home/swalter/software/arduino-1.8.0/libraries/WebUSB 
exit status 1
Error compiling for board Arduino/Genuino Uno.

can only find devices from https://webusb.github.io

When I host the same files on another HTTPS site, it wont list devices. Works fine from the github pages site.

Also, when plugging in a Micro or Leonardo I get a notification to go to the github pages site. Where is that coming from?

Version 51.0.2666.0 canary (64-bit) Mac OS 10.10.5

Can't select the configuration with Android

Hi,

I tried your rgb example using Chrome Dev on Android, connecting my Arduino with an adapter. I can connect the Arduino Leonardo but when the script tries to select the configuration, I get an exception.

Support for java

HI,

Support for java, would it be possible? there are many ways to create a web app with java and use the connection driver such as jssc alexey sokolov local, but when the app is hosted on a remote server, as it would be possible to access the port from the browser ?

good job greetings

JS errors whilst running 'console' example

Aiming to remote console and program (using avrdude) an Arduino derivative board via WebUSB, I came across this as a good start. Having followed steps 1 and 2 from the 'getting started'. Whilst launching the console (ie http://webusb.github.io/arduino/demos/console/), I noticed the following JS errors appear in chrome:

"Uncaught TypeError: Cannot read property 'getDevices' of undefined
at Object.serial.getPorts (serial.js:7)
at HTMLDocument.document.addEventListener.event (console.js:72)"

and when I subsequently click "Connect':

"serial.js:17 Uncaught TypeError: Cannot read property 'requestDevice' of undefined
at Object.serial.requestPort (serial.js:17)
at HTMLButtonElement. (console.js:63)"

These error(s) seem to hint that 'navigator.usb.getDevices' and 'navigator.usb.requestDevice' are not supported in this version of chrome. I grabbed the latest chrome from the dev channel, as per step 1 (ended up with v55.0.2882.0) and ensured the correct flags were enabled.

My question; do you think this is a chrome issue or would it be because I do not (yet) have a board connected via USB? Not ruling out that there is something else I am missing either.

I currently can't connect my board as I 'bricked' it.. doh. I thought I'd ask the question regarding these JS error in chrome, whilst the board is being fixed.

Chrome Version and Android

Hello - I have a webUSB device that works perfectly with the latest versions of Chrome on Win 10 and Mac OS. However, the newest version of Chrome for Android will no longer work...earlier versions did.

When attempting to connect using an Android device, I get a SecurityError: Access denied message. My device will show up in the device selection window, but when I select it and attempt to connect I get a NotFoundError: No device selected.

Is there a known issue with Android and the latest version for Chrome 77.0.3865.116 ?

USB descriptor information not shown correctly in Chrome/Chromium

When I'm trying to run example console demo using Arduino Leonardo I can see that navigator.usb.getDevices() doesn't seem to work correctly. It seems to return valid product name (Arduino Leonardo) but no serial number (USBLyzer tool shows there is a serial number: "WUART") and no manufacturer field:

arduino1

It looks to me there can be some kind of the issue in the Chromium implementation which I'd like to confirm (or something missing in the USB descriptors) related to Windows 10.

The issue can be reproduced on the Windows 10 in another way:

  1. connect Arduino Leonardo with WebUSB sketch uploaded
  2. start console demo page
  3. allow using Arduino Leonardo
  4. go to second Chromium tab and navigate to: chrome://usb-internals
  5. on the 'Devices' tab you'll see Arduino Leonardo with empty fields (such as: serial number)

arduino

The navigator.usb.getDevices() seem to return all data on the Linux (i.e. CentOS 7)

Not Finding devices and warnings on Arduino M0

In file included from /Users/mrmld/Library/Arduino15/packages/arduino/hardware/samd/1.6.18/cores/arduino/Arduino.h:129:0,
from /Users/mrmld/Documents/Arduino/libraries/WebUSB/WebUSB.h:23,
from /Users/mrmld/Documents/Arduino/libraries/WebUSB/WebUSB.cpp:26:
/Users/mrmld/Documents/Arduino/libraries/WebUSB/WebUSB.cpp: In member function 'virtual int WebUSB::getInterface(uint8_t*)':
/Users/mrmld/Library/Arduino15/packages/arduino/hardware/samd/1.6.18/cores/arduino/USB/USBCore.h:36:56: warning: narrowing conversion of '(int)((WebUSB*)this)->WebUSB::.PluggableUSBModule::pluggedEndpoint' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00)
^
/Users/mrmld/Library/Arduino15/packages/arduino/hardware/samd/1.6.18/cores/arduino/USB/USBCore.h:276:10: note: in definition of macro 'D_ENDPOINT'
{ 7, 5, _addr,_attr,_packetSize, _interval }
^
/Users/mrmld/Documents/Arduino/libraries/WebUSB/WebUSB.cpp:150:14: note: in expansion of macro 'USB_ENDPOINT_OUT'
D_ENDPOINT(USB_ENDPOINT_OUT(pluggedEndpoint),USB_ENDPOINT_TYPE_BULK,0x40,0),
^
/Users/mrmld/Library/Arduino15/packages/arduino/hardware/samd/1.6.18/cores/arduino/USB/USBCore.h:37:56: warning: narrowing conversion of '((((int)((WebUSB*)this)->WebUSB::.PluggableUSBModule::pluggedEndpoint) + 1) | 128)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
#define USB_ENDPOINT_IN(addr) ((addr) | 0x80)
^
/Users/mrmld/Library/Arduino15/packages/arduino/hardware/samd/1.6.18/cores/arduino/USB/USBCore.h:276:10: note: in definition of macro 'D_ENDPOINT'
{ 7, 5, _addr,_attr,_packetSize, _interval }
^
/Users/mrmld/Documents/Arduino/libraries/WebUSB/WebUSB.cpp:151:14: note: in expansion of macro 'USB_ENDPOINT_IN'
D_ENDPOINT(USB_ENDPOINT_IN (pluggedEndpoint+1),USB_ENDPOINT_TYPE_BULK,0x40,0)
^

How to make work with other ATmega32u4 devices?

Hello, sorry that this is more of a support request and not an issue but I'm having a lot of trouble figuring out how to make the demos work with an ATmega32u4-based Arduino-compatible board. Everything works great with an official Arduino Leonardo, but I'm trying to use a board with the same CPU (Circuit Playground, https://www.adafruit.com/product/3000) and it's not showing up in the list of USB devices when you click the connect button in the console demo. Chrome (canary build from today) does pop up a notification that a web USB device was connected and recommends the URL to visit, but going to the page and clicking connect shows no device unfortunately.

My suspicion is that somewhere the VID & PID of the Arduino Leonardo are hard coded in--does that sound right? This Circuit Playground board has a different VID & PID (VID = 0x239a, PID = 0x8011) so it would make sense that something expecting to find a Leonardo wouldn't catch it. However I don't see any obvious place where there's a dependency on the VID & PID in either the sketch or demo web page code.

One thing I am curious about, what exactly is encoded in this information in the console index.html origin-trial headers? https://github.com/webusb/arduino/blob/gh-pages/demos/console/index.html#L4-L7 Is there a VID & PID embedded in that presumably base64 encoded data? Also is the format of this blob documented somewhere in the draft web USB spec? I searched around it but just came away even more confused--there doesn't seem to be any mention of the origin-trial header and this data (but I'm not really familiar with W3C specs like this so it could just be me missing something obvious).

In general though do the demos right now have a hard dependency on the Arduino Leonardo's VID & PID? And if so can you point out what to change to make the demos work with a board that has a different VID & PID (but the same ATmega32u4 processor)? Thanks!

README should mention USB 2.1 requires BOS

I'm working on WebUSB additions to the LUFA USB stack and am using this Arduino implementation as my working benchmark.

I'm affected by #4 so I was starting to poke things, and loaded a sketch which didn't #include WebUSB.h. Because I'm not providing a BOS, Windows fails to enumerate my device and I can no longer program it.

I'll dig up the ISP, but it might be worth mentioning to those who may try WebUSB then go back to an older sketch that doesn't use it. Could possibly also change the installation to use the new boards that have been defined?

Undefined vendor ID

I've tried to run project with Arduino Leonardo ETH on Linux (Ubuntu 16.04).

  1. Chrome v57
  2. Udev rules in place
  3. Getting landing page popup
    BUT devices list is empty. I see only one weird thing: vendorID is not recognized by Chrome:
    [17:53:53] USB device added: path=/dev/bus/usb/001/052 vendor=10755 "Unknown", product=32832 "Arduino Leonardo ETH", serial="WUART", guid=d9605209-bc67-4dce-8e70-800789d6a4fe
    Ubuntu shows "dog hunter AG" as company name.
    Bus 001 Device 048: ID 2a03:8040 dog hunter AG

Is there any security restrictions based on vendorID?

Add DeviceInterfaceGUIDs registry key for Windows

In order for an application to find a USB device on Windows it must have a device interface GUID. For the root USB device this will be GUID_DEVINTERFACE_USB_DEVICE however for functions of a composite device there is no standard GUID. For devices using WinUSB Microsoft recommends adding a descriptor that tells Windows what GUID to use. This value ends up in the DeviceInterfaceGUIDs registry key when the device is enumerated.

"Experimental Web Platform Features" forever

We would like to use your projekt, but unfortunately we cannot asked our users to enable "Experimental Web Platform Features".
Do you have any information if or when this can be used without this flag?

Raspberry Pi library

Hi,
First thanks for this amazing project!

Is there any plan for developing a driver for rassberry pi?

Unable to get it working with Feather M0 Express (SAMD21) despite demo by Adafruit

I am on Ubuntu 18.04 with Chrome 76. I am completely new to this and have been fiddling with it for a day but I just can't get WebUSB working with my Feather M0 Express that uses SAMD21 or my nRF52840 based Arduino Nano 33 BLE.
In the list of Compatible Hardware in WebUSB's Readme Arduino MKRZero is mentioned that has a SAMD21, so I assumed that it should work on my board too.
I believe I have followed all the correct instructions in the Getting Started.
Moreover there are couple of videos by Adafruit where they show WebUSB demo on boards that use SAMD21, however there just isn't more details about how they got it working - WebUSB1, WebUSB2

There is a tinyUSB page AND in the Arduino IDE if you click on Tools then an option called USB Stack comes where you can choose Arduino or TinyUSB. This has been confusing me. Moreover on TinyUSB's Supported Boards they have mentioned both SAMD21 and nRF52840. This is incredibly confusing to me. And then there is a Adafruit TinyUSB Library that doesn't have much documentation and a separate core for SAMD devices. But how do I fit this information to get things working.

While trying WebUSB RGB demo from Arduino IDE, I even tried changing the USB Stack to TinyUSB but that made the code fail to even compile.

Could you please shed some light here?
I am willing to do my research and get it working, but I was hoping you could clear this hodge-podge of information that I have into something discernible.

Add instructions for setting bcdUSB to 0x0210 on SAMD boards

After loading either Arduino example to my board, I do not get a notification message with the link to the landing-page. The rest of WebUSB seems to work, because I can use the console example to send messages back and forth to the board.

If I add a new "fake" device in Chrome, via chrome://usb-internals/, the landing-page notification is displayed properly.

Board: Adafruit Feather M0
OS: Mac OS X 10.13.1
Arduino version: 1.8.5
Output from chrome://device-log/ :

USB device added: vendor=9114 "Adafruit", product=32779 "Feather M0", serial="WUART", guid=193354a7-57da-49bd-b887-6ebc6054c58e

Significant delay in WebUSB::operator bool()

The delay in WebUSB::operator bool() will introduce a huge delay in the main loop if the user checks it every time.

What is the bug found by Federico? I can not find any info on Github, but there should be a better way to fix it.

Arduino Leonardo Access denied

Hi,

I've tried webusb demo with my Arduino Leonardo but once I try to connect to it I get only Access Denied error.

  1. Installed Arduino 1.8.5
  2. Copied boards definition, library
  3. Loaded console sketch and uploaded to Arduino Leonardo
  4. Opened up https://webusb.github.io/arduino/demos/console/

And once tried to connect to Leonardo I only get access denied error. Do I have to do anything else to make it run?

OS: Windows 10

Support uploading sketches over WebUSB

Once a sketch with support for WebUSB is uploaded it should be possible for updates to be uploaded over the WebUSB channel. This would allow embedded devices to be updated in the field by the same site that provides their user interface.

Chrome randomly unable to read vendor, product or serial description

@reillyeon, I am not sure if this is an issue with Chrome, Arduino WebUSB or Windows, if you have any idea where should I start to debug, please share.

Device : Arduino Leonardo
WebUSB library : Current
Chrome : Version 70.0.3538.110 (Official Build) (64-bit)
Windows : 10 and 8.1

I noticed at times, chrome://device-log have empty vendor, product or serial description. I did 12 times of plug in and unplug test and Chrome will randomly returns empty for these descriptions. At all time, the device is working properly with the demos (except not showing the device name when Chrome does not show on device-log), Windows device manager show the COM and WEBUSB device detected properly.

USBDebug[15:23:06] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:23:06] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="", guid=3a0a3e06-b5fe-45f1-abca-7110b7f8c579

USBEvent[15:23:06] Failed to submit transfer: Entity not found

USBDebug[15:23:06] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:23:06] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:23:06] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:23:02] USB device removed: guid=6b9e4085-ed46-4630-958c-b55329aa3cc5

USBDebug[15:22:55] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:22:55] USB device added: vendor=9025 "Arduino LLC", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=6b9e4085-ed46-4630-958c-b55329aa3cc5

USBDebug[15:22:55] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:22:55] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:22:55] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:22:52] USB device removed: guid=4d85f157-9e54-41ca-a62f-18eb7ee15f33

USBDebug[15:22:26] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:22:26] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=4d85f157-9e54-41ca-a62f-18eb7ee15f33

USBEvent[15:22:26] Failed to submit transfer: Entity not found

USBDebug[15:22:26] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:22:26] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:22:26] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:22:23] USB device removed: guid=233d71b3-6348-43b3-a2da-a4d97337d744

USBDebug[15:22:15] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:22:15] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=233d71b3-6348-43b3-a2da-a4d97337d744

USBEvent[15:22:15] Failed to submit transfer: Entity not found

USBDebug[15:22:15] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:22:15] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:22:15] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:22:11] USB device removed: guid=3b572545-dd80-4bde-b5e3-322a4f920f84

USBDebug[15:22:03] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:22:03] USB device added: vendor=9025 "Arduino LLC", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=3b572545-dd80-4bde-b5e3-322a4f920f84

USBDebug[15:22:03] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:22:03] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:22:03] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:21:59] USB device removed: guid=bb0730ba-0739-4f73-acb2-0c5e3e0b0327

USBDebug[15:21:51] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:21:51] USB device added: vendor=9025 "Arduino LLC", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=bb0730ba-0739-4f73-acb2-0c5e3e0b0327

USBDebug[15:21:51] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:21:51] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:21:51] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:21:48] USB device removed: guid=e819014a-68ef-432b-8485-f8000f3d04bb

USBDebug[15:21:41] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:21:41] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=e819014a-68ef-432b-8485-f8000f3d04bb

USBEvent[15:21:41] Failed to submit transfer: Entity not found

USBDebug[15:21:41] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:21:41] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:21:41] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:21:37] USB device removed: guid=b395001c-4d19-4aea-8708-747b061ae866

USBDebug[15:21:28] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:21:28] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=b395001c-4d19-4aea-8708-747b061ae866

USBEvent[15:21:28] Failed to submit transfer: Entity not found

USBDebug[15:21:28] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:21:28] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:21:28] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:21:24] USB device removed: guid=fd61c03e-9c53-40b1-9fb7-068c34a5c3f5

USBDebug[15:21:13] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:21:13] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="", guid=fd61c03e-9c53-40b1-9fb7-068c34a5c3f5

USBEvent[15:21:13] Failed to read BOS descriptor.

USBEvent[15:21:13] Failed to submit transfer: Entity not found

USBDebug[15:21:13] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:21:13] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:21:13] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:21:08] USB device removed: guid=ffa86fbb-50cf-4808-9a5d-5d7fb9983bb3

USBDebug[15:20:59] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:20:59] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=ffa86fbb-50cf-4808-9a5d-5d7fb9983bb3

USBEvent[15:20:59] Failed to submit transfer: Entity not found

USBDebug[15:20:59] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:20:59] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:20:59] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:20:55] USB device removed: guid=7b286e51-e40d-4f99-9954-ae6af3f5eda6

USBDebug[15:20:43] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:20:43] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=7b286e51-e40d-4f99-9954-ae6af3f5eda6

USBEvent[15:20:43] Failed to submit transfer: Entity not found

USBDebug[15:20:43] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:20:43] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:20:43] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

USBUser[15:20:39] USB device removed: guid=a5df0b83-d501-4ab7-9001-55a270933627

USBDebug[15:20:17] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{dee824ef-729b-4a0e-9c14-b7117d33a817} is WINUSB.

USBUser[15:20:17] USB device added: vendor=9025 "", product=32822 "Arduino Leonardo WebUSB", serial="WUART", guid=a5df0b83-d501-4ab7-9001-55a270933627

USBEvent[15:20:17] Failed to submit transfer: Entity not found

USBDebug[15:20:17] Driver for \\?\usb#vid_2341&pid_8036&mi_02#6&19617b49&0&0002#{975f44d9-0d08-43fd-8b3e-127ca8afff9d} is WINUSB.

USBDebug[15:20:17] Driver for \\?\usb#vid_2341&pid_8036&mi_00#6&19617b49&0&0000#{86e0d1e0-8089-11d0-9ce4-08003e301f73} is usbser.

USBDebug[15:20:17] Driver for \\?\usb#vid_2341&pid_8036#wuart#{a5dcbf10-6530-11d2-901f-00c04fb951ed} is usbccgp.

Compile time errors via WebUSB

Arduino: 1.6.9 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/sam/Downloads/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware "/Users/sam/Downloads/Arduino.app/Contents/Java/hardware" -tools "/Users/sam/Downloads/Arduino.app/Contents/Java/tools-builder" -tools "/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr" -built-in-libraries "/Users/sam/Downloads/Arduino.app/Contents/Java/libraries" -libraries "/Users/sam/Documents/Arduino/libraries" -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10609 -build-path "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "/Users/sam/Documents/Arduino/sketch_jul16a/sketch_jul16a.ino"
/Users/sam/Downloads/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware "/Users/sam/Downloads/Arduino.app/Contents/Java/hardware" -tools "/Users/sam/Downloads/Arduino.app/Contents/Java/tools-builder" -tools "/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr" -built-in-libraries "/Users/sam/Downloads/Arduino.app/Contents/Java/libraries" -libraries "/Users/sam/Documents/Arduino/libraries" -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10609 -build-path "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "/Users/sam/Documents/Arduino/sketch_jul16a/sketch_jul16a.ino"
"/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/sketch/sketch_jul16a.ino.cpp" -o "/dev/null"
"/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "-I/Users/sam/Documents/Arduino/libraries/WebUSB" "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/sketch/sketch_jul16a.ino.cpp" -o "/dev/null"
"/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "-I/Users/sam/Documents/Arduino/libraries/WebUSB" "/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.cpp" -o "/dev/null"
"/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "-I/Users/sam/Documents/Arduino/libraries/WebUSB" "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/sketch/sketch_jul16a.ino.cpp" -o "/dev/null"
"/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "-I/Users/sam/Documents/Arduino/libraries/WebUSB" "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/sketch/sketch_jul16a.ino.cpp" -o "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Users/sam/Downloads/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10609 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/sam/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "-I/Users/sam/Documents/Arduino/libraries/WebUSB" "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/sketch/sketch_jul16a.ino.cpp" -o "/var/folders/b_/806_3h_n3c55c248zv0jjnf80000gn/T/builde7a627ea25a066f21d619c2282567dad.tmp/sketch/sketch_jul16a.ino.cpp.o"
In file included from /Users/sam/Documents/Arduino/sketch_jul16a/sketch_jul16a.ino:1:0:
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:36:2: error: 'InterfaceDescriptor' does not name a type
  InterfaceDescriptor dif;
  ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:37:2: error: 'EndpointDescriptor' does not name a type
  EndpointDescriptor  in;
  ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:38:2: error: 'EndpointDescriptor' does not name a type
  EndpointDescriptor  out;
  ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:47:41: error: expected class-name before ',' token
 class WebUSB : public PluggableUSBModule, public Stream
                                         ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:68:27: error: 'SERIAL_BUFFER_SIZE' was not declared in this scope
  unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
                           ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:94:20: error: 'USBSetup' has not been declared
  int getDescriptor(USBSetup& setup);
                    ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:95:13: error: 'USBSetup' has not been declared
  bool setup(USBSetup& setup);
             ^
/Users/sam/Documents/Arduino/libraries/WebUSB/WebUSB.h:99:28: error: 'USBSetup' has not been declared
  bool VendorControlRequest(USBSetup& setup);
                            ^
Using library WebUSB at version 1.0 in folder: /Users/sam/Documents/Arduino/libraries/WebUSB 
exit status 1
Error compiling for board Arduino/Genuino Uno.

Nano 33 iot vs BLE

I see the Arduino Nano 33 iot listed as a compatible board. Is there a reason the 33 Nano BLE is not ? I cannot get it to compile with the latter board but wondering if there is a change to a .h file I can make which would make it compile.

A little doc?

I use the Lib and it works fine, despite the lack of coment in the examples which made them not very easy to understand. :)
My question is about the WebUSB WebUSBSerial(1, "url"); call. I notice the url is not mandatory and if you don't add it, Chrome don't display its small Box. But what about the first parameter? Can you explain its meaning and possible values?
Thanks!

"No device found" for unlisted atmega32u4 board

Hi,

I am trying to use webusb with another atmega32u4 board.

Can you help me ?

Sparkfun Pro Micro 3.3V 8MHz board.
Windows 10
Chrome 80.0.3987.149

The issue is "No device found" and no connection.

Installation steps;

  1. Installed WebUSB arduino library. I didn't transfer webusb/avr hardware package to arduino hardware folder yet.
  2. Copied website files to my Github Page
  3. demos > serial.js, in filters ADDED LINE: { 'vendorId': 0x1B4F, 'productId': 0x9204 }, // Sparkfun Pro Micro 3.3V 8MHZ
    Tried also only Vendor ID, { 'vendorId': 0x1B4F }, // Sparkfun
  4. ..avr > core > arduino > USBCore.h, MODIFIED LINE #130: #define USB_VERSION 0x210
  5. Arduino IDE, selected Sparkfun Pro Micro 3.3V 8MHz board and uploaded RGB demo sketch to board.

Device manager here;

device manager

Officially support using the WebUSB versions of board definitions

The WebUSB library provides all the extra low-level USB code necessary for WebUSB support except for one thing: Your device must be upgraded from USB 2.0 to USB 2.1. To do this go into the SDK installation directory and open hardware/arduino/avr/cores/arduino/USBCore.h. Then find the line #define v. That's it!

This change is not needed because the file webusb\avr\boards.txt in this repo has already defined the correct USB_VERSION.

Just need to add a missing instruction in README.md to copy the folder webusb to arduino\hardware folder.

Notification doesn't appear in Chrome but board connects automatically

I have a strange issue. Everything is working fine. The board connects, the data transfer happens, the demos work but I never get a notification from Chrome.
I have to manually goto the website and when I do I see my device automatically Connected.

What is even more mind boggling is that when I run WebUSB examples from Adafruit_TinyUSB Library then I do get the notifications.
Any clue why it behaves this way?

I am testing it on Ubuntu 18.04.3 LTS with Chrome 76.0.3809.100

Are 4 endpoints really neccessary?

I am trying to understand the demo - from what I can see there are two devices created - CDC (with 2 endpoints) and WebUSB (also with two endpoints). There is a comment saying that:

only try to send bytes if the high-level CDC connection itself is open (not just the pipe)

Does it mean we need to have twice more endpoints than for native (i.e. C++ Windows) serial comm implementation? Can number of endpoints be limited to minimum (which is 2 in the demo)?

Allow sketch to override URLs

It should be possible for a sketch to set the landing page URL and set of allowed origins. This currently requires an understanding of the WebUSB descriptor format and editing WebUSB.cpp within the library.

How to upgrade to USB 2.1 from Arduino Web Editor?

The WebUSB library provides all the extra low-level USB code necessary for WebUSB support except for one thing: Your device must be upgraded from USB 2.0 to USB 2.1. To do this go into the SDK installation directory and open hardware/arduino/avr/cores/arduino/USBCore.h. Then find the line #define USB_VERSION 0x200 and change 0x200 to 0x210. That's it!

Is it possible to do this from Arduino Web Editor?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.