braille.c 965 B

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