提交 e03370f6 编写于 作者: M mucor

fix:telnet not work

add open in console dev init process

Change-Id: Ibf9801462d6de231001f094d4e75f01cad50da1f
上级 58e56327
......@@ -1005,6 +1005,7 @@ STATIC INT32 OsConsoleDevInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
INT32 ret;
struct file *filep = NULL;
struct Vnode *vnode = NULL;
struct file_operations_vfs *devOps = NULL;
/* allocate memory for filep,in order to unchange the value of filep */
filep = (struct file *)LOS_MemAlloc(m_aucSysMem0, sizeof(struct file));
......@@ -1040,6 +1041,13 @@ STATIC INT32 OsConsoleDevInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
* Use filep to connect console and uart, we can find uart driver function throught filep.
* now we can operate /dev/console to operate /dev/ttyS0 through filep.
*/
devOps = (struct file_operations_vfs *)((struct drv_data*)vnode->data)->ops;
if (devOps != NULL && devOps->open != NULL) {
(VOID)devOps->open(filep);
} else {
ret = ENOSYS;
goto ERROUT;
}
ret = register_driver(consoleCB->name, &g_consoleDevOps, DEFFILEMODE, filep);
if (ret != LOS_OK) {
......@@ -1204,7 +1212,7 @@ STATIC CONSOLE_CB *OsConsoleCreate(UINT32 consoleID, const CHAR *deviceName)
ret = OsConsoleDevInit(consoleCB, deviceName);
if (ret != LOS_OK) {
PRINT_ERR("console OsConsoleDevInitlloc error. %d\n", ret);
PRINT_ERR("console OsConsoleDevInit error. %d\n", ret);
goto ERR_WITH_SEM;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册