braille.c 948 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  2. #include <linux/kernel.h>
  3. #include <linux/console.h>
  4. #include <linux/string.h>
  5. #include "console_cmdline.h"
  6. #include "braille.h"
  7. char *_braille_console_setup(char **str, char **brl_options)
  8. {
  9. if (!strncmp(*str, "brl,", 4)) {
  10. *brl_options = "";
  11. *str += 4;
  12. } else if (!strncmp(*str, "brl=", 4)) {
  13. *brl_options = *str + 4;
  14. *str = strchr(*brl_options, ',');
  15. if (!*str)
  16. pr_err("need port name after brl=\n");
  17. else
  18. *((*str)++) = 0;
  19. } else
  20. return NULL;
  21. return *str;
  22. }
  23. int
  24. _braille_register_console(struct console *console, struct console_cmdline *c)
  25. {
  26. int rtn = 0;
  27. if (c->brl_options) {
  28. console->flags |= CON_BRL;
  29. rtn = braille_register_console(console, c->index, c->options,
  30. c->brl_options);
  31. }
  32. return rtn;
  33. }
  34. int
  35. _braille_unregister_console(struct console *console)
  36. {
  37. if (console->flags & CON_BRL)
  38. return braille_unregister_console(console);
  39. return 0;
  40. }