netbird: board: make shield messages more useful

This commit is contained in:
Stefan Eichenberger 2017-08-21 17:48:32 +02:00
parent a6f157c6db
commit 4c75617528
1 changed files with 62 additions and 55 deletions

View File

@ -525,6 +525,7 @@ static void set_fdtshieldcmd(const char *fdt_cmd)
struct shield_command {
int shield_id;
const char *name;
const char *default_shieldcmd;
const char *fdtshieldcmd;
};
@ -535,12 +536,14 @@ struct shield_command {
static struct shield_command known_shield_commands[] = {
{
SHIELD_COM_IO,
"comio",
"shield comio mode rs232",
"fdt get value serial0 /aliases serial0;" \
"fdt set $serial0 status okay"
},
{
SHIELD_DUALCAN,
"dualcan",
"shield dualcan termination off off",
"fdt get value can0 /aliases d_can0;" \
"fdt get value can1 /aliases d_can1;" \
@ -582,16 +585,20 @@ static void shield_config(void)
return;
}
printf("Shield found: %s\n", cmd->name);
shieldcmd = cmd->default_shieldcmd;
/* If a shield configuration set by linux take it without bd check, we asume that Linux knows
* what to do. */
len = read_file("/root/boot/shieldcmd", shieldcmd_linux, MAX_SHIELD_CMD_LEN);
if (len > 0) {
puts("Shield command found in file, using it\n");
debug("Shield command found in file, using it\n");
shieldcmd = shieldcmd_linux;
}
printf("Shield command: %s\n", shieldcmd);
setenv("shieldcmd", shieldcmd);
set_fdtshieldcmd(cmd->fdtshieldcmd);