Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion multi/grlib-multi/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <libtty.h>
#include <stdlib.h>
#include <stdatomic.h>
#include <libklog.h>

#include <sys/debug.h>
#include <sys/file.h>
Expand Down Expand Up @@ -335,7 +336,22 @@ static void uart_ioctl(msg_t *msg, int dev)
inData = ioctl_unpack(msg, &req, NULL);
pid = ioctl_getSenderPid(msg);

err = libtty_ioctl(&uart_common.uart[dev].tty, pid, req, inData, &outData);
if (req == KIOEN) {
#ifdef UART_CONSOLE_USER
if (dev == UART_CONSOLE_USER) {
libklog_enable((int)(intptr_t)inData);
err = EOK;
}
else {
err = -EINVAL;
}
#else
err = -EINVAL;
#endif
}
else {
err = libtty_ioctl(&uart_common.uart[dev].tty, pid, req, inData, &outData);
}

ioctl_setResponse(msg, req, err, outData);
}
Expand Down
15 changes: 14 additions & 1 deletion multi/mcxn94x-multi/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,20 @@ static void uart_handleMsg(msg_t *msg, msg_rid_t rid, unsigned int major, unsign
case mtDevCtl:
in_data = ioctl_unpack(msg, &request, NULL);
pid = ioctl_getSenderPid(msg);
err = libtty_ioctl(&uart->tty_common, pid, request, in_data, &out_data);

if (request == KIOEN) {
if (uartPos[minor] == uart_common.ttyminor) {
libklog_enable((int)(intptr_t)in_data);
err = EOK;
}
else {
err = -EINVAL;
}
}
else {
err = libtty_ioctl(&uart->tty_common, pid, request, in_data, &out_data);
}

ioctl_setResponse(msg, request, err, out_data);
break;

Expand Down
8 changes: 7 additions & 1 deletion tty/grlib-uart/grlib-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,13 @@ static void uart_ioctl(unsigned port, msg_t *msg)
inData = ioctl_unpack(msg, &req, NULL);
pid = ioctl_getSenderPid(msg);

err = libtty_ioctl(&uart_common.uart.tty, pid, req, inData, &outData);
if (req == KIOEN) {
libklog_enable((int)(intptr_t)inData);
err = EOK;
}
else {
err = libtty_ioctl(&uart_common.uart.tty, pid, req, inData, &outData);
}

ioctl_setResponse(msg, req, err, outData);
}
Expand Down
Loading