Add trailing zero in version field
This commit is contained in:
parent
39ac0fb6d0
commit
fcbcbcb9af
6
mpm.c
6
mpm.c
@ -682,14 +682,16 @@ static int mpm_open(struct multiboot *mboot)
|
|||||||
/* wait for watchdog and startup time */
|
/* wait for watchdog and startup time */
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
char version[16];
|
char version[16 +1];
|
||||||
if (mpm_read_version(mpm, (uint8_t *)version, sizeof(version)))
|
if (mpm_read_version(mpm, (uint8_t *)version, sizeof(version) -1))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "failed to get bootloader version\n");
|
fprintf(stderr, "failed to get bootloader version\n");
|
||||||
mpm_close(mboot);
|
mpm_close(mboot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version[16] = '\0';
|
||||||
|
|
||||||
uint8_t chipinfo[8];
|
uint8_t chipinfo[8];
|
||||||
if (mpm_read_chipinfo(mpm, chipinfo, sizeof(chipinfo)))
|
if (mpm_read_chipinfo(mpm, chipinfo, sizeof(chipinfo)))
|
||||||
{
|
{
|
||||||
|
6
twi.c
6
twi.c
@ -310,8 +310,8 @@ static int twi_open(struct multiboot *mboot)
|
|||||||
/* wait for watchdog and startup time */
|
/* wait for watchdog and startup time */
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
char version[16];
|
char version[16 +1];
|
||||||
if (twi_read_version(twi, version, sizeof(version)))
|
if (twi_read_version(twi, version, sizeof(version) -1))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "failed to get bootloader version: %s\n",
|
fprintf(stderr, "failed to get bootloader version: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
@ -320,6 +320,8 @@ static int twi_open(struct multiboot *mboot)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version[16] = '\0';
|
||||||
|
|
||||||
uint8_t chipinfo[8];
|
uint8_t chipinfo[8];
|
||||||
if (twi_read_memory(twi, chipinfo, sizeof(chipinfo), MEMTYPE_CHIPINFO, 0x0000))
|
if (twi_read_memory(twi, chipinfo, sizeof(chipinfo), MEMTYPE_CHIPINFO, 0x0000))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user