summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usb-dfu-experiment/sam3u_chipid_usbserial.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usb-dfu-experiment/sam3u_chipid_usbserial.c b/usb-dfu-experiment/sam3u_chipid_usbserial.c
index c8d0e70..c62561e 100644
--- a/usb-dfu-experiment/sam3u_chipid_usbserial.c
+++ b/usb-dfu-experiment/sam3u_chipid_usbserial.c
@@ -16,12 +16,12 @@
static uint8_t usb_serial_string[USBStringDescriptor_LENGTH(32)];
/* convert from 7-bit ASCII to USB string */
-static int to_usb_string(char *out, int out_len, const char *in)
+static int to_usb_string(unsigned char *out, int out_len, const char *in)
{
int in_len = strlen(in);
int num_out = USBStringDescriptor_LENGTH(in_len);
int i;
- char *cur = out;
+ unsigned char *cur = out;
if (num_out > out_len || num_out >= 255 || num_out < 0)
return -EINVAL;
@@ -43,7 +43,7 @@ static int chip_uid_to_usbstring(void)
int rc;
FLASHD_Initialize(0);
- rc = FLASHD_ReadUniqueID(&uniqueID);
+ rc = FLASHD_ReadUniqueID(uniqueID);
if (rc != 0)
return -EIO;
@@ -59,6 +59,13 @@ static int chip_uid_to_usbstring(void)
int chipid_to_usbserial(void)
{
- chip_uid_to_usbstring();
+ int rc;
+
+ rc = chip_uid_to_usbstring();
+ if (rc < 0)
+ return rc;
+
set_usb_serial_str(usb_serial_string);
+
+ return 0;
}
personal git repositories of Harald Welte. Your mileage may vary