Skip to content

Commit

Permalink
Merge pull request arduino#110 from facchinm/pluggableUSB_bcd
Browse files Browse the repository at this point in the history
PluggableUSB: modules modify bcdDevice value
  • Loading branch information
facchinm authored Jan 8, 2021
2 parents 14e0f40 + 301d69d commit b86aaa7
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions cores/arduino/USB/PluggableUSBDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ bool arduino::PluggableUSBDevice::plug(internal::PluggableUSBModule*node)

node->pluggedInterface = lastIf;
lastIf += node->numInterfaces;
product_release += node->getProductVersion();
return true;
}

Expand Down
1 change: 1 addition & 0 deletions cores/arduino/USB/PluggableUSBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class PluggableUSBModule {
virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
virtual void init(EndpointResolver& resolver);
virtual const uint8_t *string_iinterface_desc();
virtual uint8_t getProductVersion();

uint8_t pluggedInterface;

Expand Down
5 changes: 5 additions & 0 deletions cores/arduino/USB/USBCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ const uint8_t *USBCDC::string_iinterface_desc()
return (const uint8_t *)extraDescriptor;
}

uint8_t USBCDC::getProductVersion()
{
return 1;
}

const uint8_t *USBCDC::string_iproduct_desc()
{
static const uint8_t stringIproductDescriptor[] = {
Expand Down
7 changes: 7 additions & 0 deletions cores/arduino/USB/USBCDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ class USBCDC: public internal::PluggableUSBModule{
*/
virtual const uint8_t *string_iproduct_desc();

/*
* Get string product version
*
* Every module must declare a different number
*/
virtual uint8_t getProductVersion();

/*
* Get string interface descriptor
*
Expand Down
7 changes: 7 additions & 0 deletions libraries/USBAudio/PluggableUSBAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ class USBAudio: protected internal::PluggableUSBModule {
virtual const uint8_t *string_iinterface_desc();
virtual const uint8_t *configuration_desc(uint8_t index);

/*
* Get string product version
*
* Every module must declare a different number
*/
virtual uint8_t getProductVersion();

private:

class AsyncWrite;
Expand Down
5 changes: 5 additions & 0 deletions libraries/USBAudio/USBAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ const uint8_t *USBAudio::configuration_desc(uint8_t index)
return _config_descriptor;
}

uint8_t USBAudio::getProductVersion()
{
return 2;
}

const uint8_t *USBAudio::string_iinterface_desc()
{
static const uint8_t stringIinterfaceDescriptor[] = {
Expand Down
7 changes: 7 additions & 0 deletions libraries/USBHID/PluggableUSBHID.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ class USBHID: public internal::PluggableUSBModule {
*/
virtual uint16_t report_desc_length();

/*
* Get string product version
*
* Every module must declare a different number
*/
virtual uint8_t getProductVersion();

/*
* Get string product descriptor
*
Expand Down
4 changes: 4 additions & 0 deletions libraries/USBHID/USBHID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ void USBHID::callback_set_interface(uint16_t interface, uint8_t alternate)
assert_locked();
}

uint8_t USBHID::getProductVersion()
{
return 4;
}

const uint8_t *USBHID::string_iinterface_desc()
{
Expand Down
7 changes: 7 additions & 0 deletions libraries/USBMSD/PluggableUSBMSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ class USBMSD: public internal::PluggableUSBModule {
// space for config descriptor
uint8_t _configuration_descriptor[32];

/*
* Get string product version
*
* Every module must declare a different number
*/
virtual uint8_t getProductVersion();

virtual const uint8_t *string_iproduct_desc();
virtual const uint8_t *string_iinterface_desc();
virtual const uint8_t *configuration_desc(uint8_t index);
Expand Down
4 changes: 4 additions & 0 deletions libraries/USBMSD/USBMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ void USBMSD::callback_set_interface(uint16_t interface, uint8_t alternate)
//complete_set_interface(success);
}

uint8_t USBMSD::getProductVersion()
{
return 8;
}

const uint8_t *USBMSD::string_iinterface_desc()
{
Expand Down

0 comments on commit b86aaa7

Please sign in to comment.