From 6e05f18d2b1183598179d2fcb6b76a7026a074d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Tue, 30 Mar 2021 17:37:57 +0200 Subject: [PATCH] usb: don't include date in serial, so we can have a constant by id path --- lib/usb_cdcacm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/usb_cdcacm.c b/lib/usb_cdcacm.c index 78ef94a..0444568 100644 --- a/lib/usb_cdcacm.c +++ b/lib/usb_cdcacm.c @@ -223,7 +223,7 @@ static const struct usb_config_descriptor usb_cdcacm_configuration_descriptor = }; /** device ID used as serial number */ -static char usb_serial[] = "H_YYYY-MM-DD_AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD"; +static char usb_serial[] = "H_AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD"; /** USB string table * @note starting with index 1 @@ -432,7 +432,8 @@ static void usb_cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) void usb_cdcacm_setup(void) { - snprintf(usb_serial, LENGTH(usb_serial), "%08x%08x%04x%04x", DESIG_UNIQUE_ID2, DESIG_UNIQUE_ID1, DESIG_UNIQUE_ID0 & 0xffff, DESIG_UNIQUE_ID0 >> 16); // set actual device ID as serial + // set serial + snprintf(usb_serial, sizeof(usb_serial), "%c_%08x%08x%08x", busvoodoo_version, DESIG_UNIQUE_ID0, DESIG_UNIQUE_ID1, DESIG_UNIQUE_ID2); // initialize USB rcc_periph_reset_pulse(RST_USB); // reset USB peripheral