Skip to content

Commit 6aeb80b

Browse files
committed
Merge pull request arduino#4693 from philmanofsky/master
allow 3rd party boards that depend on sam core to use their own USB vid/pid and manufacturer/product strings
2 parents afaea11 + 1983f7a commit 6aeb80b

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

Diff for: hardware/arduino/sam/boards.txt

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ arduino_due_x_dbg.upload.wait_for_upload_port=false
1212
arduino_due_x_dbg.upload.native_usb=false
1313
arduino_due_x_dbg.build.mcu=cortex-m3
1414
arduino_due_x_dbg.build.f_cpu=84000000L
15+
arduino_due_x_dbg.build.usb_manufacturer="Arduino LLC"
1516
arduino_due_x_dbg.build.usb_product="Arduino Due"
1617
arduino_due_x_dbg.build.board=SAM_DUE
1718
arduino_due_x_dbg.build.core=arduino
@@ -35,6 +36,7 @@ arduino_due_x.upload.wait_for_upload_port=true
3536
arduino_due_x.upload.native_usb=true
3637
arduino_due_x.build.mcu=cortex-m3
3738
arduino_due_x.build.f_cpu=84000000L
39+
arduino_due_x.build.usb_manufacturer="Arduino LLC"
3840
arduino_due_x.build.usb_product="Arduino Due"
3941
arduino_due_x.build.board=SAM_DUE
4042
arduino_due_x.build.core=arduino

Diff for: hardware/arduino/sam/cores/arduino/Arduino.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,14 @@ extern const PinDescription g_APinDescription[] ;
209209
#include "watchdog.h"
210210

211211
// USB Device
212-
#define USB_VID 0x2341 // arduino LLC vid
213-
#define USB_PID_LEONARDO 0x0034
214-
#define USB_PID_MICRO 0x0035
215-
#define USB_PID_DUE 0x003E
212+
#ifndef USB_VID
213+
#define USB_VID 0x2341 // arduino LLC vid
214+
#endif
215+
216+
#ifndef USB_PID
217+
#define USB_PID 0x003E // arduino Due pid
218+
#endif
219+
216220
#include "USB/USBDesc.h"
217221
#include "USB/USBCore.h"
218222
#include "USB/USBAPI.h"

Diff for: hardware/arduino/sam/cores/arduino/USB/USBCore.cpp

+3-14
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,16 @@ const uint16_t STRING_LANGUAGE[2] = {
6666
};
6767

6868
#ifndef USB_PRODUCT
69-
// Use a hardcoded product name if none is provided
70-
#if USB_PID == USB_PID_DUE
7169
#define USB_PRODUCT "Arduino Due"
72-
#else
73-
#define USB_PRODUCT "USB IO Board"
74-
#endif
7570
#endif
7671

7772
const uint8_t STRING_PRODUCT[] = USB_PRODUCT;
7873

79-
#if USB_VID == 0x2341
80-
# if defined(USB_MANUFACTURER)
81-
# undef USB_MANUFACTURER
82-
# endif
83-
# define USB_MANUFACTURER "Arduino LLC"
84-
#elif !defined(USB_MANUFACTURER)
85-
// Fall through to unknown if no manufacturer name was provided in a macro
86-
# define USB_MANUFACTURER "Unknown"
74+
#ifndef USB_MANUFACTURER
75+
#define USB_MANUFACTURER "Arduino LLC"
8776
#endif
8877

89-
const uint8_t STRING_MANUFACTURER[12] = USB_MANUFACTURER;
78+
const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER;
9079

9180
#ifdef CDC_ENABLED
9281
#define DEVICE_CLASS 0x02

0 commit comments

Comments
 (0)