mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Flight: Was only returning half of the serial number (thanks for catching that Pip)
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1476 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
260d436156
commit
b853c392f3
@ -138,7 +138,7 @@ int32_t PIOS_SYS_SerialNumberGet(char *str)
|
||||
int i;
|
||||
|
||||
/* Stored in the so called "electronic signature" */
|
||||
for(i=0; i<12; ++i) {
|
||||
for(i=0; i<24; ++i) {
|
||||
uint8_t b = MEM8(0x1ffff7e8 + (i/2));
|
||||
if( !(i & 1) )
|
||||
b >>= 4;
|
||||
@ -146,7 +146,7 @@ int32_t PIOS_SYS_SerialNumberGet(char *str)
|
||||
|
||||
str[i] = ((b > 9) ? ('A'-10) : '0') + b;
|
||||
}
|
||||
str[i] = 0;
|
||||
str[i] = '\0';
|
||||
|
||||
/* No error */
|
||||
return 0;
|
||||
|
@ -98,21 +98,10 @@ int32_t PIOS_USB_HID_Init(uint32_t mode)
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
|
||||
|
||||
/* Update the USB serial number from the chip */
|
||||
uint8_t sn[40];
|
||||
PIOS_SYS_SerialNumberGet((char *) sn);
|
||||
/* uint8_t len = 0;;
|
||||
for(uint8_t i = 0, len = 2; sn[i] != '\0' && len < PIOS_HID_StringSerial[0]; ++i)
|
||||
{
|
||||
PIOS_HID_StringSerial[len++] = sn[i];
|
||||
PIOS_HID_StringSerial[len++] = 0;
|
||||
}
|
||||
while(len < PIOS_HID_StringSerial[0])
|
||||
{
|
||||
PIOS_HID_StringSerial[len++] = 0;
|
||||
} */
|
||||
for(uint8_t i = 0; i < 12; i++)
|
||||
{
|
||||
PIOS_HID_StringSerial[2+i*2] = sn[i];
|
||||
uint8_t sn[25];
|
||||
PIOS_SYS_SerialNumberGet((char *) sn);
|
||||
for(uint8_t i = 0; sn[i] != '\0' && (2 * i) < PIOS_HID_StringSerial[0]; i ++) {
|
||||
PIOS_HID_StringSerial[2+2*i] = sn[i];
|
||||
}
|
||||
|
||||
USB_Init();
|
||||
|
@ -178,7 +178,11 @@ uint8_t PIOS_HID_StringSerial[PIOS_HID_SIZ_STRING_SERIAL] =
|
||||
{
|
||||
PIOS_HID_SIZ_STRING_SERIAL, /* bLength */
|
||||
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
||||
'S', 0, 'T', 0, 'M', 0,'3', 0,'2', 0, '1', 0, '\0', 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define PIOS_HID_SIZ_STRING_LANGID 4
|
||||
#define PIOS_HID_SIZ_STRING_VENDOR 28
|
||||
#define PIOS_HID_SIZ_STRING_PRODUCT 20
|
||||
#define PIOS_HID_SIZ_STRING_SERIAL 26
|
||||
#define PIOS_HID_SIZ_STRING_SERIAL 52 /* 96 bits, 12 bytes, 24 characters, 48 in unicode */
|
||||
|
||||
#define STANDARD_ENDPOINT_DESC_SIZE 0x09
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user