Skip to content

Commit 6723757

Browse files
committed
USB: allow populating VID/PID dynamically
1 parent 90b2922 commit 6723757

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cores/arduino/USB/PluggableUSBDevice.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,13 @@ const uint8_t *arduino::PluggableUSBDevice::configuration_desc(uint8_t index)
300300

301301
arduino::PluggableUSBDevice& PluggableUSBD()
302302
{
303+
#ifndef BOARD_VENDORID
304+
uint16_t vid = _getVid_();
305+
uint16_t pid = _getPid_();
306+
static arduino::PluggableUSBDevice obj(vid, pid);
307+
#else
303308
static arduino::PluggableUSBDevice obj(BOARD_VENDORID, BOARD_PRODUCTID);
309+
#endif
304310
return obj;
305311
}
306312

0 commit comments

Comments
 (0)