Skip to content

Add VID/PID configuration to usb_config.h #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/cdc_acm/usb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#ifndef USB_CONFIG_H__
#define USB_CONFIG_H__

/* Uncomment these lines only if you have purchased a valid
* VID/PID pair. Do not attempt to use a VID/PID pair that
* you do not own or that has not been sub-licensed to you.
* A VID/PID pair should only be used for a single device,
* and should not be re-used between multiple projects. */
//#define MY_VID 0xA0A0
//#define MY_PID 0x0004

/* Number of endpoint numbers besides endpoint zero. It's worth noting that
and endpoint NUMBER does not completely describe an endpoint, but the
along with the DIRECTION does (eg: EP 1 IN). The #define below turns on
Expand Down
26 changes: 24 additions & 2 deletions apps/cdc_acm/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@
#define ROMPTR
#endif

/* VID/PID Descriptor Definitions
*
* Utilize user-defined VID/PID values if provided in usb_config.h
* otherwise, defaults are provided by the stack. The defaults are
* only intended for testing purposes, and a unique VID/PID pair
* should be provided for an end-product release, otherwise driver
* issues may occur due to VID/PID conflicts.
*/
#ifdef MY_VID
#define DESC_VID MY_VID
#else
#define DESC_VID 0xA0A0
#warning "No user-defined VID, using the default instead. MY_VID should be set in usb_config.h"
#endif

#ifdef MY_PID
#define DESC_PID MY_PID
#else
#define DESC_PID 0x0004
#warning "No user-defined PID, using the default instead. MY_PID should be set in usb_config.h"
#endif

/* Configuration Packet
*
* This packet contains a configuration descriptor, one or more interface
Expand Down Expand Up @@ -91,8 +113,8 @@ const ROMPTR struct device_descriptor this_device_descriptor =
Association Descriptor Device Class Code and Use Model" */
0x01, // Protocol. See document referenced above.
EP_0_LEN, // bMaxPacketSize0
0xA0A0, // Vendor
0x0004, // Product
DESC_VID, // Vendor ID: Defined in usb_config.h
DESC_PID, // Product ID: Defined in usb_config.h
0x0001, // device release (1.0)
1, // Manufacturer
2, // Product
Expand Down
8 changes: 8 additions & 0 deletions apps/hid_composite/usb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#ifndef USB_CONFIG_H__
#define USB_CONFIG_H__

/* Uncomment these lines only if you have purchased a valid
* VID/PID pair. Do not attempt to use a VID/PID pair that
* you do not own or that has not been sub-licensed to you.
* A VID/PID pair should only be used for a single device,
* and should not be re-used between multiple projects. */
//#define MY_VID 0xA0A0
//#define MY_PID 0x0003

/* Number of endpoint numbers besides endpoint zero. It's worth noting that
and endpoint NUMBER does not completely describe an endpoint, but the
along with the DIRECTION does (eg: EP 1 IN). The #define below turns on
Expand Down
26 changes: 24 additions & 2 deletions apps/hid_composite/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@
#define ROMPTR
#endif

/* VID/PID Descriptor Definitions
*
* Utilize user-defined VID/PID values if provided in usb_config.h
* otherwise, defaults are provided by the stack. The defaults are
* only intended for testing purposes, and a unique VID/PID pair
* should be provided for an end-product release, otherwise driver
* issues may occur due to VID/PID conflicts.
*/
#ifdef MY_VID
#define DESC_VID MY_VID
#else
#define DESC_VID 0xA0A0
#warning "No user-defined VID, using the default instead. MY_VID should be set in usb_config.h"
#endif

#ifdef MY_PID
#define DESC_PID MY_PID
#else
#define DESC_PID 0x0003
#warning "No user-defined PID, using the default instead. MY_PID should be set in usb_config.h"
#endif

/* Configuration Packet
*
* This packet contains a configuration descriptor, one or more interface
Expand Down Expand Up @@ -87,8 +109,8 @@ const ROMPTR struct device_descriptor this_device_descriptor =
0x00, // Device Subclass
0x00, // Protocol.
EP_0_LEN, // bMaxPacketSize0
0xA0A0, // Vendor
0x0003, // Product
DESC_VID, // Vendor ID: Defined in usb_config.h
DESC_PID, // Product ID: Defined in usb_config.h
0x0001, // device release (1.0)
1, // Manufacturer
2, // Product
Expand Down
8 changes: 8 additions & 0 deletions apps/hid_mouse/usb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#ifndef USB_CONFIG_H__
#define USB_CONFIG_H__

/* Uncomment these lines only if you have purchased a valid
* VID/PID pair. Do not attempt to use a VID/PID pair that
* you do not own or that has not been sub-licensed to you.
* A VID/PID pair should only be used for a single device,
* and should not be re-used between multiple projects. */
//#define MY_VID 0xA0A0
//#define MY_PID 0x0003

/* Number of endpoint numbers besides endpoint zero. It's worth noting that
and endpoint NUMBER does not completely describe an endpoint, but the
along with the DIRECTION does (eg: EP 1 IN). The #define below turns on
Expand Down
26 changes: 24 additions & 2 deletions apps/hid_mouse/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@
#define ROMPTR
#endif

/* VID/PID Descriptor Definitions
*
* Utilize user-defined VID/PID values if provided in usb_config.h
* otherwise, defaults are provided by the stack. The defaults are
* only intended for testing purposes, and a unique VID/PID pair
* should be provided for an end-product release, otherwise driver
* issues may occur due to VID/PID conflicts.
*/
#ifdef MY_VID
#define DESC_VID MY_VID
#else
#define DESC_VID 0xA0A0
#warning "No user-defined VID, using the default instead. MY_VID should be set in usb_config.h"
#endif

#ifdef MY_PID
#define DESC_PID MY_PID
#else
#define DESC_PID 0x0003
#warning "No user-defined PID, using the default instead. MY_PID should be set in usb_config.h"
#endif

/* Configuration Packet
*
* This packet contains a configuration descriptor, one or more interface
Expand Down Expand Up @@ -80,8 +102,8 @@ const ROMPTR struct device_descriptor this_device_descriptor =
0x00, // Device Subclass
0x00, // Protocol.
EP_0_LEN, // bMaxPacketSize0
0xA0A0, // Vendor
0x0003, // Product
DESC_VID, // Vendor ID: Defined in usb_config.h
DESC_PID, // Product ID: Defined in usb_config.h
0x0001, // device release (1.0)
1, // Manufacturer
2, // Product
Expand Down
8 changes: 8 additions & 0 deletions apps/msc_test/usb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#ifndef USB_CONFIG_H__
#define USB_CONFIG_H__

/* Uncomment these lines only if you have purchased a valid
* VID/PID pair. Do not attempt to use a VID/PID pair that
* you do not own or that has not been sub-licensed to you.
* A VID/PID pair should only be used for a single device,
* and should not be re-used between multiple projects. */
//#define MY_VID 0xA0A0
//#define MY_PID 0x0005

/* Number of endpoint numbers besides endpoint zero. It's worth noting that
and endpoint NUMBER does not completely describe an endpoint, but the
along with the DIRECTION does (eg: EP 1 IN). The #define below turns on
Expand Down
26 changes: 24 additions & 2 deletions apps/msc_test/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@
#define ROMPTR
#endif

/* VID/PID Descriptor Definitions
*
* Utilize user-defined VID/PID values if provided in usb_config.h
* otherwise, defaults are provided by the stack. The defaults are
* only intended for testing purposes, and a unique VID/PID pair
* should be provided for an end-product release, otherwise driver
* issues may occur due to VID/PID conflicts.
*/
#ifdef MY_VID
#define DESC_VID MY_VID
#else
#define DESC_VID 0xA0A0
#warning "No user-defined VID, using the default instead. MY_VID should be set in usb_config.h"
#endif

#ifdef MY_PID
#define DESC_PID MY_PID
#else
#define DESC_PID 0x0005
#warning "No user-defined PID, using the default instead. MY_PID should be set in usb_config.h"
#endif

/* Configuration Packet
*
* This packet contains a configuration descriptor, one or more interface
Expand Down Expand Up @@ -79,8 +101,8 @@ const ROMPTR struct device_descriptor this_device_descriptor =
0x00, // Device Subclass
0x00, // Protocol.
EP_0_LEN, // bMaxPacketSize0
0xA0A0, // Vendor
0x0005, // Product
DESC_VID, // Vendor ID: Defined in usb_config.h
DESC_PID, // Product ID: Defined in usb_config.h
0x0001, // device release (1.0)
1, // Manufacturer
2, // Product
Expand Down