fbinit.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. *
  3. * Copyright © 1999 Keith Packard
  4. *
  5. * Permission to use, copy, modify, distribute, and sell this software and its
  6. * documentation for any purpose is hereby granted without fee, provided that
  7. * the above copyright notice appear in all copies and that both that
  8. * copyright notice and this permission notice appear in supporting
  9. * documentation, and that the name of Keith Packard not be used in
  10. * advertising or publicity pertaining to distribution of the software without
  11. * specific, written prior permission. Keith Packard makes no
  12. * representations about the suitability of this software for any purpose. It
  13. * is provided "as is" without express or implied warranty.
  14. *
  15. * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  16. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  17. * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  18. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  19. * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  20. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  21. * PERFORMANCE OF THIS SOFTWARE.
  22. */
  23. #ifdef HAVE_CONFIG_H
  24. #include <kdrive-config.h>
  25. #endif
  26. #include <fbdev.h>
  27. static const KdCardFuncs fbdevFuncs = {
  28. fbdevCardInit, /* cardinit */
  29. fbdevScreenInit, /* scrinit */
  30. fbdevInitScreen, /* initScreen */
  31. fbdevFinishInitScreen, /* finishInitScreen */
  32. fbdevCreateResources, /* createRes */
  33. fbdevPreserve, /* preserve */
  34. fbdevEnable, /* enable */
  35. fbdevDPMS, /* dpms */
  36. fbdevDisable, /* disable */
  37. fbdevRestore, /* restore */
  38. fbdevScreenFini, /* scrfini */
  39. fbdevCardFini, /* cardfini */
  40. 0, /* initCursor */
  41. 0, /* enableCursor */
  42. 0, /* disableCursor */
  43. 0, /* finiCursor */
  44. 0, /* recolorCursor */
  45. 0, /* initAccel */
  46. 0, /* enableAccel */
  47. 0, /* disableAccel */
  48. 0, /* finiAccel */
  49. fbdevGetColors, /* getColors */
  50. fbdevPutColors, /* putColors */
  51. };
  52. void InitCard(char *name)
  53. {
  54. KdCardInfoAdd(&fbdevFuncs, 0);
  55. }
  56. void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
  57. {
  58. KdInitOutput(pScreenInfo, argc, argv);
  59. }
  60. void InitInput(int argc, char **argv)
  61. {
  62. KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
  63. }
  64. void ddxUseMsg(void)
  65. {
  66. KdUseMsg();
  67. ErrorF("\nXfbdev Device Usage:\n");
  68. ErrorF
  69. ("-fb path Framebuffer device to use. Defaults to /dev/fb0\n");
  70. ErrorF("\n");
  71. }
  72. int ddxProcessArgument(int argc, char **argv, int i)
  73. {
  74. if (!strcmp(argv[i], "-version")) {
  75. kdVersion("Xfbdev");
  76. exit(0);
  77. }
  78. if (!strcmp(argv[i], "-fb")) {
  79. if (i + 1 < argc) {
  80. fbdevDevicePath = argv[i + 1];
  81. return 2;
  82. }
  83. UseMsg();
  84. exit(1);
  85. }
  86. return KdProcessArgument(argc, argv, i);
  87. }