Esempio n. 1
0
int
MouseInit (void)
{
    int		i;
    int		fd;
    Kmouse	*km;
    KdMouseInfo	*mi, *next;
    KmouseProt	*mp;
    int		n = 0;
    char	*prot;

    if (!MouseInputType)
	MouseInputType = KdAllocInputType ();

    for (mi = kdMouseInfo; mi; mi = next)
    {
	next = mi->next;
	prot = mi->prot;
	if (!mi->name)
	{
	    for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
	    {
		fd = open (kdefaultMouse[i], 2);
		if (fd >= 0)
		{
		    mi->name = KdSaveString (kdefaultMouse[i]);
		    break;
		}
	    }
	}
	else
	    fd = open (mi->name, 2);
	    
	if (fd >= 0)
	{
	    km = (Kmouse *) xalloc (sizeof (Kmouse));
	    if (km)
	    {
		km->iob.fd = fd;
		km->iob.avail = km->iob.used = 0;
		km->prot = 0;
		km->i_prot = 0;
		km->tty = isatty (fd);
		mi->driver = km;
		MouseFirstProtocol (km, mi->prot);
		if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi))
		    n++;
	    }
	    else
		close (fd);
	}
	else
	    KdMouseInfoDispose (mi);
    }
}
Esempio n. 2
0
int
LinuxKeyboardInit (void)
{
    if (!LinuxKbdType)
	LinuxKbdType = KdAllocInputType ();

    KdRegisterFd (LinuxKbdType, LinuxConsoleFd, LinuxKeyboardRead, 0);
    LinuxKeyboardEnable (LinuxConsoleFd, 0);
    KdRegisterFdEnableDisable (LinuxConsoleFd, 
			       LinuxKeyboardEnable,
			       LinuxKeyboardDisable);
    return 1;
}
Esempio n. 3
0
File: ts.c Progetto: dikerex/theqvd
int
TsInit (void)
{
    int		i;
    int		fd;
    KdMouseInfo	*mi, *next;
    int		n = 0;

    if (!TsInputType)
	TsInputType = KdAllocInputType ();
    
    for (mi = kdMouseInfo; mi; mi = next)
    {
	next = mi->next;
	if (mi->inputType)
	    continue;
	if (!mi->name)
	{
	    for (i = 0; i < NUM_TS_NAMES; i++)    
	    {
		fd = open (TsNames[i], 0);
		if (fd >= 0) 
		{
		    mi->name = KdSaveString (TsNames[i]);
		    break;
		}
	    }
	}
	else
	    fd = open (mi->name, 0);
	if (fd >= 0)
	{
	    struct h3600_ts_calibration cal;
	    /*
	     * Check to see if this is a touch screen
	     */
	    if (ioctl (fd, TS_GET_CAL, &cal) != -1)
	    {
		mi->driver = (void *) fd;
		mi->inputType = TsInputType;
		if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
		    n++;
	    }
	    else
		close (fd);
	}
    }
}
Esempio n. 4
0
int
TslibInit (void)
{
    int		i;
    KdMouseInfo	*mi, *next;
    int		fd= 0;
    int		n = 0;

    if (!TsInputType)
	TsInputType = KdAllocInputType ();
    
    for (mi = kdMouseInfo; mi; mi = next)
    {
	next = mi->next;
	if (mi->inputType)
	    continue;

	if (!mi->name)
	{
	    for (i = 0; i < NUM_TS_NAMES; i++)    
	    {
		if(!(tsDev = ts_open(TsNames[i],0))) continue;
	        ts_config(tsDev); 
	        fd=ts_fd(tsDev);
		if (fd >= 0) 
		{
		    mi->name = KdSaveString (TsNames[i]);
		    break;
		}
	    }
	}

	if (fd > 0 && tsDev != 0) 
	  {
	    mi->driver = (void *) fd;
	    mi->inputType = TsInputType;
	    	if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
		    n++;
	  } 
	else 
	  if (fd > 0) close(fd);
	}
}
Esempio n. 5
0
int
BusInit (void)
{
    int	    i;
    int	    busPort;
    int	    n = 0;

    if (!BusInputType)
	BusInputType = KdAllocInputType ();
    
    for (i = 0; i < NUM_BUS_NAMES; i++)
    {
	busPort = open (BusNames[i], 0);
	{
	    KdRegisterFd (BusInputType, busPort, BusRead, 0);
	    n++;
	}
    }
    return n;
}
Esempio n. 6
0
File: ps2.c Progetto: dikerex/theqvd
int
Ps2Init (void)
{
    int	    i;
    int	    ps2Port;
    int	    n;

    if (!Ps2InputType)
	Ps2InputType = KdAllocInputType ();
    n = 0;
    for (i = 0; i < NUM_PS2_NAMES; i++)
    {
	ps2Port = open (Ps2Names[i], 0);
	if (ps2Port >= 0)
	{
	    if (KdRegisterFd (Ps2InputType, ps2Port, Ps2Read, (void *) i))
		n++;
	}
    }
    return n;
}
Esempio n. 7
0
static Bool
EvdevKbdInit (void)
{
    int         i;
    int         fd;
    int         n = 0;
    char        name[100];

    if (!EvdevInputType)
        EvdevInputType = KdAllocInputType ();

    for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
    {
        fd = open (kdefaultEvdev1[i], 2);
        if (fd >= 0)
        {
            ioctl(fd, EVIOCGRAB, 1);

            ioctl(fd, EVIOCGNAME(sizeof(name)), name);
            ErrorF("Name is %s\n", name);
            ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
            ErrorF("Phys Loc is %s\n", name);
            ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
            ErrorF("Unique is %s\n", name);

        }

        if (fd >= 0)
        {
            unsigned long   ev[NBITS(EV_MAX)];
            Kevdev          *ke;

            if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
            {
                perror ("EVIOCGBIT 0");
                close (fd);
                continue;
            }
            ke = xalloc (sizeof (Kevdev));
            if (!ke)
            {
                close (fd);
                continue;
            }
            memset (ke, '\0', sizeof (Kevdev));
            if (ISBITSET (ev, EV_KEY))
            {
                if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
                           ke->keybits) < 0)
                {
                    perror ("EVIOCGBIT EV_KEY");
                    xfree (ke);
                    close (fd);
                    continue;
                }
            }
            if (ISBITSET (ev, EV_REL))
            {
                if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
                           ke->relbits) < 0)
                {
                    perror ("EVIOCGBIT EV_REL");
                    xfree (ke);
                    close (fd);
                    continue;
                }
                for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
                    if (ISBITSET(ke->relbits, ke->max_rel))
                        break;
            }
            if (ISBITSET (ev, EV_ABS))
            {
                int i;

                if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
                           ke->absbits) < 0)
                {
                    perror ("EVIOCGBIT EV_ABS");
                    xfree (ke);
                    close (fd);
                    continue;
                }
                for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
                    if (ISBITSET(ke->absbits, ke->max_abs))
                        break;
                for (i = 0; i <= ke->max_abs; i++)
                {
                    if (ISBITSET (ke->absbits, i))
                        if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
                        {
                            perror ("EVIOCGABS");
                            break;
                        }
                    ke->prevabs[i] = ABS_UNSET;
                }
                if (i <= ke->max_abs)
                {
                    xfree (ke);
                    close (fd);
                    continue;
                }
            }
            if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL))
                n++;
        }
    }
    return TRUE;
}