vidset.c 911 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* vim: tabstop=4 shiftwidth=4 noexpandtab
  2. * This file is part of ToaruOS and is released under the terms
  3. * of the NCSA / University of Illinois License - see LICENSE.md
  4. * Copyright (C) 2016-2018 K. Lange
  5. *
  6. * Module to provide a debug shell command to set display mode.
  7. */
  8. #include <kernel/system.h>
  9. #include <kernel/module.h>
  10. #include <kernel/logging.h>
  11. #include <kernel/printf.h>
  12. #include <kernel/video.h>
  13. #include <kernel/mod/shell.h>
  14. DEFINE_SHELL_FUNCTION(set_mode, "Set display mode") {
  15. if (argc < 3) {
  16. fprintf(tty, "set_mode <x> <y>\n");
  17. return 1;
  18. }
  19. int x = atoi(argv[1]);
  20. int y = atoi(argv[2]);
  21. fprintf(tty, "Setting mode to %dx%d.\n", x, y);
  22. lfb_set_resolution(x,y);
  23. return 0;
  24. }
  25. static int hello(void) {
  26. BIND_SHELL_FUNCTION(set_mode);
  27. return 0;
  28. }
  29. static int goodbye(void) {
  30. return 0;
  31. }
  32. MODULE_DEF(vidset, hello, goodbye);
  33. MODULE_DEPENDS(debugshell);
  34. MODULE_DEPENDS(lfbvideo);