Skip to content

Commit f58cba0

Browse files
committed
Add support for custom VID/PID and Board name to show in ArduinoIDE ports list
1 parent 38057d6 commit f58cba0

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

boards.txt

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ menu.Revision=Board Revision
1414
##############################################################
1515

1616
esp32s2.name=ESP32S2 Dev Module
17+
esp32s2.vid.0=0x303a
18+
esp32s2.pid.0=0x0002
1719

1820
esp32s2.upload.tool=esptool_py
1921
esp32s2.upload.maximum_size=1310720

libraries/USB/src/USB.cpp

+21-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@
1717
#if CONFIG_USB_ENABLED
1818
#include "usb_persist.h"
1919

20+
#ifndef USB_VID
21+
#define USB_VID USB_ESPRESSIF_VID
22+
#endif
23+
#ifndef USB_PID
24+
#define USB_PID 0x0002
25+
#endif
26+
#ifndef USB_MANUFACTURER
27+
#define USB_MANUFACTURER "Espressif Systems"
28+
#endif
29+
#ifndef USB_PRODUCT
30+
#define USB_PRODUCT ARDUINO_BOARD
31+
#endif
32+
#ifndef USB_SERIAL
33+
#define USB_SERIAL ""
34+
#endif
35+
2036
extern "C" {
2137
#include "tinyusb.h"
2238
}
@@ -97,11 +113,11 @@ void tud_resume_cb(void){
97113
}
98114

99115
ESPUSB::ESPUSB(size_t task_stack_size, uint8_t event_task_priority)
100-
:vid(USB_ESPRESSIF_VID)
101-
,pid(0x0002)
102-
,product_name(ARDUINO_BOARD)
103-
,manufacturer_name("Espressif Systems")
104-
,serial_number("")
116+
:vid(USB_VID)
117+
,pid(USB_PID)
118+
,product_name(USB_PRODUCT)
119+
,manufacturer_name(USB_MANUFACTURER)
120+
,serial_number(USB_SERIAL)
105121
,fw_version(0x0100)
106122
,usb_version(0x0200)// at least 2.1 or 3.x for BOS & webUSB
107123
,usb_class(TUSB_CLASS_MISC)

0 commit comments

Comments
 (0)