braille.c 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 (!memcmp(*str, "brl,", 4)) {
  10. *brl_options = "";
  11. *str += 4;
  12. } else if (!memcmp(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. }
  20. return *str;
  21. }
  22. int
  23. _braille_register_console(struct console *console, struct console_cmdline *c)
  24. {
  25. int rtn = 0;
  26. if (c->brl_options) {
  27. console->flags |= CON_BRL;
  28. rtn = braille_register_console(console, c->index, c->options,
  29. c->brl_options);
  30. }
  31. return rtn;
  32. }
  33. int
  34. _braille_unregister_console(struct console *console)
  35. {
  36. if (console->flags & CON_BRL)
  37. return braille_unregister_console(console);
  38. return 0;
  39. }