Skip to content

Update from USB 2.0 to USB 2.1 #4627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

beaufortfrancois
Copy link

Let's update USB Version from 2.0 to 2.1 so that the host could tell if the USB device exposes a Binary Object Store descriptor or not.
For info, this is where the WebUSB descriptor (and Microsoft OS Descriptor 2.0) reading sequence starts.

@NicoHood
Copy link
Contributor

NicoHood commented Mar 9, 2016

But where is the BOS coded in the usb core? As far as I understood 2.1 supports this BOS thing and enables micro$$$$ to read the BOS. But what if its not there? Is it? Never heard of that. Why would you need it? So changing just the number here doesnt solve the problem I think.

@reillyeon
Copy link
Contributor

This patch doesn't add any code to the USB core to respond to a BOS request but leaves it up to libraries using PluggableUSB to provide it. Without the version change the host OS will not request the BOS descriptor. I don't believe it will be an issue for devices to advertise this version and still return nothing in response to a GET_DESCRIPTOR(BOS) request.

@NicoHood
Copy link
Contributor

NicoHood commented Mar 9, 2016

That makes sense now. Do you have a working usecase of a pluggable usb module?

@beaufortfrancois
Copy link
Author

We do: the WebUSB Arduino library part of the WebUSB API
Checkout some of the demos at https://github.com/webusb/arduino

@beaufortfrancois
Copy link
Author

(gentle ping)

@NicoHood
Copy link
Contributor

NicoHood commented Apr 1, 2016

#4793

@beaufortfrancois
Copy link
Author

Yeah!

@beaufortfrancois
Copy link
Author

@reillyeon have a look at #4793

@samccone
Copy link

Hi! anything I can do here to help move this along? Thanks a million, very excited to no longer have to manually patch this in to utilize webusb.

@facchinm
Copy link
Member

Hi everyone,
what about setting using a define instead than an hardcoded value?

#ifndef USB_VERSION
#define USB_VERSION 0x200
#endif

and

#define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \
{ 18, 1, USB_VERSION, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }

In this way you could add a bunch of variant boards which should be exactly the same as Micro/Leonardo but defining -DUSB_VERSION=0x210 in boards.txt, leaving them out of the core.

I'm preparing a PR right now, I'll ask @reillyeon to test it and eventually update the WubUSB arduino integration howto.

@matthijskooijman
Copy link
Collaborator

@facchinm (and probably even more @beaufortfrancois), are there any downsides to just setting the USB version to 2.1? Are there additional things we need to support or do?

@facchinm
Copy link
Member

@matthijskooijman ,
windows 8.1 and 10 require a valid BOS descriptor to correctly enumerate if USB2.1 is declared. This brings a huge unwanted overhead on all other sketches.

@NicoHood
Copy link
Contributor

We could make the whole usb core pluggable/optional. This way you could also make the Leonardo sketched without usb smaller and faster. I've opened a PR about this some time ago. The people who need USB 2.1 could fork the usb core and reimplement the stuff they need. But they could still use the rest of the core.

If you ask me I'd make the whole core more like a set of libraries. For USB, Seriel, Millis, Interrupts etc. Then you have less code and more flexible in overwriting those.

@matthijskooijman
Copy link
Collaborator

Alternatively, perhaps the USB version could be determined at runtime? Either by some code (the same code that adds the BOS descriptor) setting it to 2.1, or perhaps by somehow detecting that a BOS descriptor was plugged in and doing it automatically (not sure if that is feasible, though).

@facchinm
Copy link
Member

Superseded by #5128, now the board which needs to advertise as USB 2.1 can do it with a simple extra boards.txt (see webusb/arduino#16)

@facchinm facchinm closed this Jul 22, 2016
@facchinm
Copy link
Member

Thanks everyone for the discussion and contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants