From f5282f2ce6ddec1d1aca492153debc5505843426 Mon Sep 17 00:00:00 2001 From: Phil Manofsky Date: Mon, 14 Mar 2016 23:09:26 -0400 Subject: [PATCH 1/4] allows use of "myboard.build.vid" in boards.txt allows people to create board that depends on sam core to use their own Vendor ID instead of Arduino's --- hardware/arduino/sam/cores/arduino/Arduino.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hardware/arduino/sam/cores/arduino/Arduino.h b/hardware/arduino/sam/cores/arduino/Arduino.h index 4fae76a2a30..6194bcc2f32 100644 --- a/hardware/arduino/sam/cores/arduino/Arduino.h +++ b/hardware/arduino/sam/cores/arduino/Arduino.h @@ -209,10 +209,14 @@ extern const PinDescription g_APinDescription[] ; #include "watchdog.h" // USB Device +#ifndef USB_VID #define USB_VID 0x2341 // arduino LLC vid +#endif + #define USB_PID_LEONARDO 0x0034 #define USB_PID_MICRO 0x0035 #define USB_PID_DUE 0x003E + #include "USB/USBDesc.h" #include "USB/USBCore.h" #include "USB/USBAPI.h" From 4be3e4917230b757e49a83e79b21e62e4c0caf5d Mon Sep 17 00:00:00 2001 From: Phil Manofsky Date: Mon, 14 Mar 2016 23:16:36 -0400 Subject: [PATCH 2/4] 3rd party can use own Product/manufacturer string now "myboard.build.usb_product" and "myboard.build.usb_manufacturer" from a 3rd party board in "boards.txt" are used in source code. if they aren't defined in "boards.txt", default values are used. --- .../arduino/sam/cores/arduino/USB/USBCore.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp b/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp index 5cddc4c6ba2..e7652016d50 100644 --- a/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp +++ b/hardware/arduino/sam/cores/arduino/USB/USBCore.cpp @@ -66,27 +66,16 @@ const uint16_t STRING_LANGUAGE[2] = { }; #ifndef USB_PRODUCT -// Use a hardcoded product name if none is provided -#if USB_PID == USB_PID_DUE #define USB_PRODUCT "Arduino Due" -#else -#define USB_PRODUCT "USB IO Board" -#endif #endif const uint8_t STRING_PRODUCT[] = USB_PRODUCT; -#if USB_VID == 0x2341 -# if defined(USB_MANUFACTURER) -# undef USB_MANUFACTURER -# endif -# define USB_MANUFACTURER "Arduino LLC" -#elif !defined(USB_MANUFACTURER) -// Fall through to unknown if no manufacturer name was provided in a macro -# define USB_MANUFACTURER "Unknown" +#ifndef USB_MANUFACTURER +#define USB_MANUFACTURER "Arduino LLC" #endif -const uint8_t STRING_MANUFACTURER[12] = USB_MANUFACTURER; +const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER; #ifdef CDC_ENABLED #define DEVICE_CLASS 0x02 From 18250aec5758725b0bef54e1b06431cded3d8b60 Mon Sep 17 00:00:00 2001 From: Phil Manofsky Date: Mon, 14 Mar 2016 23:20:46 -0400 Subject: [PATCH 3/4] allows use of "myboard.build.pid" in boards.txt 3rd party boards that use sam core can have their own USB product ID that is defined in "boards.txt" --- hardware/arduino/sam/cores/arduino/Arduino.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hardware/arduino/sam/cores/arduino/Arduino.h b/hardware/arduino/sam/cores/arduino/Arduino.h index 6194bcc2f32..015c1156284 100644 --- a/hardware/arduino/sam/cores/arduino/Arduino.h +++ b/hardware/arduino/sam/cores/arduino/Arduino.h @@ -210,12 +210,12 @@ extern const PinDescription g_APinDescription[] ; // USB Device #ifndef USB_VID -#define USB_VID 0x2341 // arduino LLC vid +#define USB_VID 0x2341 // arduino LLC vid #endif -#define USB_PID_LEONARDO 0x0034 -#define USB_PID_MICRO 0x0035 -#define USB_PID_DUE 0x003E +#ifndef USB_PID +#define USB_PID 0x003E // arduino Due pid +#endif #include "USB/USBDesc.h" #include "USB/USBCore.h" From 1983f7a869a4686a2b83882a9f86c30036fd2fb5 Mon Sep 17 00:00:00 2001 From: Phil Manofsky Date: Mon, 14 Mar 2016 23:25:13 -0400 Subject: [PATCH 4/4] Update boards.txt added "build.usb_manufacturer" entry that overrides default macro in USBCore.cpp source file. this isn't really necessary since the source macro is the same as in "boards.txt", but it gives 3rd party board vendors direction in how to have their SAM3X board use their own manufacturer string during USB enumeration. --- hardware/arduino/sam/boards.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hardware/arduino/sam/boards.txt b/hardware/arduino/sam/boards.txt index 249420051ab..5503786126c 100644 --- a/hardware/arduino/sam/boards.txt +++ b/hardware/arduino/sam/boards.txt @@ -12,6 +12,7 @@ arduino_due_x_dbg.upload.wait_for_upload_port=false arduino_due_x_dbg.upload.native_usb=false arduino_due_x_dbg.build.mcu=cortex-m3 arduino_due_x_dbg.build.f_cpu=84000000L +arduino_due_x_dbg.build.usb_manufacturer="Arduino LLC" arduino_due_x_dbg.build.usb_product="Arduino Due" arduino_due_x_dbg.build.board=SAM_DUE arduino_due_x_dbg.build.core=arduino @@ -35,6 +36,7 @@ arduino_due_x.upload.wait_for_upload_port=true arduino_due_x.upload.native_usb=true arduino_due_x.build.mcu=cortex-m3 arduino_due_x.build.f_cpu=84000000L +arduino_due_x.build.usb_manufacturer="Arduino LLC" arduino_due_x.build.usb_product="Arduino Due" arduino_due_x.build.board=SAM_DUE arduino_due_x.build.core=arduino