mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 14:03:55 +01:00
usb: Add configuration options for USB peripheral serial
This adds compile-time options to configure the serial of an USB peripheral. The serial be autogenerated with a configured number of bytes. It is also possible to configure a fixed serial string for a device and disable the autogeneration of the serial.
This commit is contained in:
parent
4661948bd1
commit
185bf28c21
@ -96,6 +96,32 @@ extern "C" {
|
||||
#define CONFIG_USB_CONFIGURATION_STR "USB config"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral serial string
|
||||
*
|
||||
* Compile-time value to override the serial string with. An LUID-based hex
|
||||
* string is generated when this value is not used.
|
||||
*
|
||||
* This string does not have to be a number, but it must be unique between
|
||||
* devices with identical VID:PID combination.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
#define CONFIG_USB_SERIAL_STR "RIOT-12345"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral serial string length
|
||||
*
|
||||
* Maximum value is 63. Sensible values are between 8 to 32 depending on the
|
||||
* number of expected devices.
|
||||
*
|
||||
* The length here is in bytes. The generated hex string is twice as many chars
|
||||
* in length due to conversion from bytes to hex chars.
|
||||
*/
|
||||
#if !defined(CONFIG_USB_SERIAL_STR) && !defined(CONFIG_USB_SERIAL_BYTE_LENGTH)
|
||||
#define CONFIG_USB_SERIAL_BYTE_LENGTH 8
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral device version
|
||||
*
|
||||
|
||||
@ -81,6 +81,32 @@ config USB_DEFAULT_LANGID
|
||||
help
|
||||
The default value is EN-US (0x0409).
|
||||
|
||||
config USB_CUSTOM_SERIAL_STR
|
||||
bool "Configure a custom USB serial string"
|
||||
|
||||
config USB_SERIAL_STR
|
||||
string "Serial string"
|
||||
depends on USB_CUSTOM_SERIAL_STR
|
||||
help
|
||||
USB peripheral serial string
|
||||
|
||||
Compile-time value to override the serial string with. An LUID-based hex
|
||||
string is generated when this value is not used.
|
||||
|
||||
This string does not have to be a number, but it must be unique between
|
||||
devices with identical VID:PID combination.
|
||||
|
||||
config USB_SERIAL_BYTE_LENGTH
|
||||
int "USB peripheral serial string length"
|
||||
depends on !USB_CUSTOM_SERIAL_STR
|
||||
range 0 63
|
||||
default 8
|
||||
help
|
||||
The length here is in bytes. The generated hex string is twice as many chars
|
||||
in length due to conversion from bytes to hex chars.
|
||||
|
||||
comment "WARNING: The serial string is empty!"
|
||||
depends on USB_SERIAL_STR = "" && USB_CUSTOM_SERIAL_STR
|
||||
|
||||
rsource "usbus/Kconfig"
|
||||
endif # KCONFIG_USB
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user