Refine console safety validation

This commit is contained in:
copilot-swe-agent[bot]
2026-06-09 06:56:08 +00:00
committed by GitHub
parent 35c34338f0
commit 546190e0c4
2 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -94,9 +94,13 @@ static int console(int argc, char **argv)
rt_kprintf("console: can not use device as console: %s\n", argv[2]);
return -RT_ERROR;
}
}
rt_kprintf("console change to %s\n", argv[2]);
rt_kprintf("console change to %s\n", argv[2]);
}
else
{
rt_kprintf("console already set to %s\n", argv[2]);
}
#ifdef RT_USING_POSIX
console_set_iodev(dev);
+2 -2
View File
@@ -179,7 +179,7 @@ static rt_err_t _console_get_open_flags(rt_device_t device, rt_uint16_t *oflag)
{
if (device->flag & (RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_DMA_TX))
{
console_oflag = (device->flag & RT_DEVICE_OFLAG_RDWR) |
console_oflag = (device->flag & RT_DEVICE_FLAG_RDWR) |
(device->flag & (RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_DMA_TX)) |
RT_DEVICE_FLAG_STREAM;
}
@@ -187,7 +187,7 @@ static rt_err_t _console_get_open_flags(rt_device_t device, rt_uint16_t *oflag)
{
LOG_W("refuse to set device %.*s as console: missing console-safe output support",
RT_NAME_MAX, device->parent.name);
return result;
return -RT_EINVAL;
}
}