aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth McMullin2012-05-26 15:20:23 +1200
committerGareth McMullin2012-05-26 15:20:23 +1200
commite533812c3281f2c073da40968461358a1c419016 (patch)
treec69c05b7d90186cbb157280b8bb5babc7303fe06
parent01bf5e6b44992740250d0d5467e8baf5d9953d09 (diff)
Use our new USB VID/PID. Thanks OpenMoko, Inc.
DFU now uses the same short serial number as application.
-rw-r--r--src/stm32/cdcacm.c6
-rw-r--r--src/stm32/usbdfu.c21
2 files changed, 15 insertions, 12 deletions
diff --git a/src/stm32/cdcacm.c b/src/stm32/cdcacm.c
index 232ce78..6a70acc 100644
--- a/src/stm32/cdcacm.c
+++ b/src/stm32/cdcacm.c
@@ -55,9 +55,9 @@ static const struct usb_device_descriptor dev = {
.bDeviceSubClass = 2, /* Common Class */
.bDeviceProtocol = 1, /* Interface Association */
.bMaxPacketSize0 = 64,
- .idVendor = 0x0483,
- .idProduct = 0x5740,
- .bcdDevice = 0x0200,
+ .idVendor = 0x1D50,
+ .idProduct = 0x6018,
+ .bcdDevice = 0x0100,
.iManufacturer = 1,
.iProduct = 2,
.iSerialNumber = 3,
diff --git a/src/stm32/usbdfu.c b/src/stm32/usbdfu.c
index 868a24d..9520c7a 100644
--- a/src/stm32/usbdfu.c
+++ b/src/stm32/usbdfu.c
@@ -59,9 +59,9 @@ const struct usb_device_descriptor dev = {
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.bMaxPacketSize0 = 64,
- .idVendor = 0x0483,
- .idProduct = 0xDF11,
- .bcdDevice = 0x0200,
+ .idVendor = 0x1D50,
+ .idProduct = 0x6017,
+ .bcdDevice = 0x0100,
.iManufacturer = 1,
.iProduct = 2,
.iSerialNumber = 3,
@@ -113,7 +113,7 @@ const struct usb_config_descriptor config = {
.interface = ifaces,
};
-static char serial_no[25];
+static char serial_no[9];
static const char *usb_strings[] = {
"x",
@@ -304,17 +304,20 @@ int main(void)
static char *get_dev_unique_id(char *s)
{
- volatile uint8_t *unique_id = (volatile uint8_t *)0x1FFFF7E8;
+ volatile uint32_t *unique_id_p = (volatile uint32_t *)0x1FFFF7E8;
+ uint32_t unique_id = *unique_id_p +
+ *(unique_id_p + 1) +
+ *(unique_id_p + 2);
int i;
/* Fetch serial number from chip's unique ID */
- for(i = 0; i < 24; i+=2) {
- s[i] = ((*unique_id >> 4) & 0xF) + '0';
- s[i+1] = (*unique_id++ & 0xF) + '0';
+ for(i = 0; i < 8; i++) {
+ s[7-i] = ((unique_id >> (4*i)) & 0xF) + '0';
}
- for(i = 0; i < 24; i++)
+ for(i = 0; i < 8; i++)
if(s[i] > '9')
s[i] += 'A' - '9' - 1;
+ s[8] = 0;
return s;
}