1.描述符改为动态检查,移除获取路径等独立函数,仅保留验证描述符是否有效的独立接口。

2.修改ioctl操作成功后返回值为操作字节数。
3.新增获取sflags、oflags、path命令。
This commit is contained in:
MacRsh
2024-01-16 04:10:20 +08:00
parent d45995369e
commit a43d77c2e3

View File

@@ -98,7 +98,7 @@ MR_WEAK int mr_printf_output(const char *buf, size_t size)
{
static int desc = -1;
if (desc < 0)
if (mr_dev_is_valid(desc) == MR_FALSE)
{
#ifndef MR_CFG_PRINTF_DEV_NAME
#define MR_CFG_PRINTF_DEV_NAME "serial1"
@@ -108,7 +108,7 @@ MR_WEAK int mr_printf_output(const char *buf, size_t size)
#else
console = mr_dev_open(MR_CFG_PRINTF_DEV_NAME, MR_OFLAG_RDWR | MR_OFLAG_NONBLOCK);
#endif /* MR_USING_PRINTF_NONBLOCKING */
if (desc < 0)
if (mr_dev_is_valid(desc) == MR_FALSE)
{
return desc;
}