Added new USE_INTERNAL_SERIAL define for using the unique serial numbers in some AVR models as the USB device's serial number, added NO_INTERNAL_SERIAL compile time option to turn off new serial number reading code. Updated Mass Storage and CDC based demos to use the new device serial number if the device it is compiled for supports it.
This commit is contained in:
parent
9d506553aa
commit
730624f745
9 changed files with 34 additions and 46 deletions
|
@ -74,6 +74,21 @@
|
|||
* descriptor does not exist.
|
||||
*/
|
||||
#define NO_DESCRIPTOR 0
|
||||
|
||||
#if (!defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))) || defined(__DOXYGEN__)
|
||||
/** String descriptor index for the device's unique serial number string descriptor within the device.
|
||||
* This unique serial number is used by the host to associate resources to the device (such as drivers or COM port
|
||||
* number allocations) to a device regardless of the port it is plugged in to on the host. Some USB AVRs contain
|
||||
* a unique serial number internally, and setting the device descriptors serial number string index to this value
|
||||
* will cause it to use the internal serial number.
|
||||
*
|
||||
* On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseduo-serial
|
||||
* number for the device.
|
||||
*/
|
||||
#define USE_INTERNAL_SERIAL 0xDC
|
||||
#else
|
||||
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
|
||||
#endif
|
||||
|
||||
/** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */
|
||||
#define USB_CONFIG_POWER_MA(mA) (mA >> 1)
|
||||
|
@ -244,13 +259,14 @@
|
|||
*/
|
||||
uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal
|
||||
* serial number, in uppercase Unicode ASCII.
|
||||
*
|
||||
* \note On some AVR models, there is an embedded serial number
|
||||
* in the chip which can be used for the device serial number.
|
||||
* To use this serial number, define USE_INTERNAL_SERIAL to a
|
||||
* unique string index number in the project makefile and set
|
||||
* this value to USE_INTERNAL_SERIAL.
|
||||
*
|
||||
*
|
||||
* \note On some AVR models, there is an embedded serial number
|
||||
* in the chip which can be used for the device serial number.
|
||||
* To use this serial number, set this to USE_INTERNAL_SERIAL.
|
||||
* On unsupported devices, this will evaluate to 0 and will cause
|
||||
* the host to generate a pseudo-unique value for the device upon
|
||||
* insertion.
|
||||
*
|
||||
* \see ManufacturerStrIndex structure entry.
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue