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.
For boards that have terminals in their shipped configurations it makes sense
to reuse those VID/PIDs when providing a terminal in RIOT as well.
That affects the builtin-peripherals IDs and not the custom specified ones.
Co-authored-by: chrysn <chrysn@fsfe.org>
As the whitelist define can be set per compilation unit in all
legitimate cases, the checks do not need to be run on every single usb.h
inclusion. This is done for two reaons:
* It is sufficient -- if any user C file includes usb.h, there's already
a good chance that the user is doing something USB related manualy.
(And conversely, the existing examples with boards that happen to pull
in CDC-ACM or CDC-ECM do not include usb.h from an example C file).
* Defining the USB_H_USER_IS_RIOT around legitimate uses of the header
by other headers would allow accidental sidestepping: If a user
includes a legitimate usb.h using header (say, board.h) and just
forgets to include usb.h on their own, their application that'd mess
with USB would still work as usb.h is transitively included, and the
check for custom includes does not trigger.
A new define, USB_H_USER_IS_RIOT_INTERNAL, is defined that may only be
set from within RIOT's own compilation units that deem themselves
standard RIOT peripherals. If all usb.h users in a program match that
requirement, a default VID/PID pair is set.
Due to the new composite check, the individual checks for VID/PID being
set become moot and are removed.