Skip to content

Commit

Permalink
[usb_telemetry] Fixed fetching device serial number
Browse files Browse the repository at this point in the history
  • Loading branch information
podhrmic committed Dec 7, 2014
1 parent 5ca8ee5 commit 4a05209
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sw/airborne/arch/stm32/usb_ser_hw.c
Expand Up @@ -206,7 +206,7 @@ static const struct usb_config_descriptor config = {
.interface = ifaces,
};

static char serial_no[24];
static char serial_no[25];

/* Description of the device as it appears after enumeration */
static const char *usb_strings[] = {
Expand All @@ -216,7 +216,7 @@ static const char *usb_strings[] = {
};

/**
* Serial is 96bit so 12bytes so 12 hexa numbers, or 24 decimal
* Serial is 96bit so 12bytes so 12 hexa numbers, or 24 decimal + termination character
*/
inline char *get_dev_unique_id(char *s)
{
Expand All @@ -236,7 +236,8 @@ inline char *get_dev_unique_id(char *s)
if (s[i] > '9') {
s[i] += 'A' - '9' - 1;
}

// add termination character
s[24] = '\0';
return s;
}

Expand Down

0 comments on commit 4a05209

Please sign in to comment.