summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
Diffstat (limited to 'usb')
-rw-r--r--usb/device/dfu/dfu.h1
-rw-r--r--usb/device/dfu/dfu_desc.c15
2 files changed, 15 insertions, 1 deletions
diff --git a/usb/device/dfu/dfu.h b/usb/device/dfu/dfu.h
index 5ca1baf..3cbcac5 100644
--- a/usb/device/dfu/dfu.h
+++ b/usb/device/dfu/dfu.h
@@ -120,6 +120,7 @@ struct dfu {
};
extern struct dfu dfu;
+void set_usb_serial_str(const uint8_t *serial_usbstr);
/* call-backs by the board/SOC */
extern int USBDFU_handle_dnload(uint8_t altif, unsigned int offset,
diff --git a/usb/device/dfu/dfu_desc.c b/usb/device/dfu/dfu_desc.c
index 6c27c2e..c428e3a 100644
--- a/usb/device/dfu/dfu_desc.c
+++ b/usb/device/dfu/dfu_desc.c
@@ -1,4 +1,6 @@
+#include <unistd.h>
+
#include <usb/common/core/USBGenericDescriptor.h>
#include <usb/common/core/USBDeviceDescriptor.h>
#include <usb/common/core/USBConfigurationDescriptor.h>
@@ -32,7 +34,11 @@ static const USBDeviceDescriptor fsDevice = {
.bcdDevice = BOARD_USB_RELEASE,
.iManufacturer = STR_MANUF,
.iProduct = STR_PROD,
+#ifdef BOARD_USB_SERIAL
.iSerialNumber = STR_SERIAL,
+#else
+ .iSerialNumber = 0,
+#endif
.bNumConfigurations = 1,
};
@@ -84,9 +90,16 @@ const struct dfu_desc dfu_cfg_descriptor = {
static const unsigned char *usb_strings[] = {
USB_STRINGS_GENERATED
- (const unsigned char *) &string1
+#ifdef BOARD_USB_SERIAL
+ NULL
+#endif
};
+void set_usb_serial_str(const uint8_t *serial_usbstr)
+{
+ usb_strings[STR_SERIAL] = serial_usbstr;
+}
+
const USBDDriverDescriptors dfu_descriptors = {
.pFsDevice = &fsDevice,
.pFsConfiguration = &dfu_cfg_descriptor.ucfg,
personal git repositories of Harald Welte. Your mileage may vary