17 #include <linux/device.h>
18 #include <linux/serial.h>
19 #include <linux/tty.h>
20 #include <linux/export.h>
38 #define TPK_STR_SIZE 508
39 #define TPK_MAX_ROOM 4096
40 static const char *tpk_tag =
"[U] ";
43 static int tpk_printk(
const unsigned char *
buf,
int count)
52 tmp[tpk_curr + 0] =
'\n';
53 tmp[tpk_curr + 1] =
'\0';
60 for (i = 0; i <
count; i++) {
61 tmp[tpk_curr] = buf[
i];
66 tmp[tpk_curr + 0] =
'\n';
67 tmp[tpk_curr + 1] =
'\0';
70 if ((i + 1) < count && buf[i + 1] ==
'\n')
74 tmp[tpk_curr + 1] =
'\0';
83 tmp[tpk_curr + 1] =
'\\';
84 tmp[tpk_curr + 2] =
'\n';
85 tmp[tpk_curr + 3] =
'\0';
123 const unsigned char *
buf,
int count)
131 ret = tpk_printk(buf, count);
140 static int tpk_write_room(
struct tty_struct *tty)
149 unsigned int cmd,
unsigned long arg)
170 .write_room = tpk_write_room,
178 static int __init ttyprintk_init(
void)
190 if (IS_ERR(ttyprintk_driver))
191 return PTR_ERR(ttyprintk_driver);
194 ttyprintk_driver->
name =
"ttyprintk";
214 ttyprintk_driver =
NULL;