Skip to content

Commit 4473ae3

Browse files
committed
[DM][OFW] Find the console device when using "stdout-path"
"stdout-path" has path and option, we should find the console device by dts path. Signed-off-by: GuEe-GUI <[email protected]>
1 parent b0c556f commit 4473ae3

File tree

1 file changed

+20
-1
lines changed
  • components/drivers/ofw

1 file changed

+20
-1
lines changed

components/drivers/ofw/ofw.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,26 @@ rt_err_t rt_ofw_console_setup(void)
307307

308308
if (err == -RT_ENOSYS && !rt_ofw_prop_read_string(ofw_node_chosen, "stdout-path", &stdout_path))
309309
{
310-
struct rt_ofw_node *stdout_np = rt_ofw_find_node_by_path(stdout_path);
310+
struct rt_ofw_node *stdout_np;
311+
312+
if (*stdout_path != '/' && ofw_node_aliases)
313+
{
314+
int alias_len;
315+
struct rt_ofw_prop *prop;
316+
317+
alias_len = strchrnul(stdout_path, ':') - stdout_path;
318+
319+
rt_ofw_foreach_prop(ofw_node_aliases, prop)
320+
{
321+
if (!rt_strncmp(prop->name, stdout_path, alias_len))
322+
{
323+
stdout_path = prop->value;
324+
break;
325+
}
326+
}
327+
}
328+
329+
stdout_np = rt_ofw_find_node_by_path(stdout_path);
311330

312331
if (stdout_np && (ofw_name = ofw_console_serial_find(con_name, stdout_np)))
313332
{

0 commit comments

Comments
 (0)