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