0001
0002 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0003
0004 #include <linux/kernel.h>
0005 #include <linux/console.h>
0006 #include <linux/errno.h>
0007 #include <linux/string.h>
0008
0009 #include "console_cmdline.h"
0010 #include "braille.h"
0011
0012 int _braille_console_setup(char **str, char **brl_options)
0013 {
0014 size_t len;
0015
0016 len = str_has_prefix(*str, "brl,");
0017 if (len) {
0018 *brl_options = "";
0019 *str += len;
0020 return 0;
0021 }
0022
0023 len = str_has_prefix(*str, "brl=");
0024 if (len) {
0025 *brl_options = *str + len;
0026 *str = strchr(*brl_options, ',');
0027 if (!*str) {
0028 pr_err("need port name after brl=\n");
0029 return -EINVAL;
0030 }
0031 *((*str)++) = 0;
0032 }
0033
0034 return 0;
0035 }
0036
0037 int
0038 _braille_register_console(struct console *console, struct console_cmdline *c)
0039 {
0040 int rtn = 0;
0041
0042 if (c->brl_options) {
0043 console->flags |= CON_BRL;
0044 rtn = braille_register_console(console, c->index, c->options,
0045 c->brl_options);
0046 }
0047
0048 return rtn;
0049 }
0050
0051 int
0052 _braille_unregister_console(struct console *console)
0053 {
0054 if (console->flags & CON_BRL)
0055 return braille_unregister_console(console);
0056
0057 return 0;
0058 }