// Get supported event bits public static int GetBit(int fd, EvdevType ev, int length, IntPtr data) { // EVIOCGBIT = _IOC(_IOC_READ, 'E', 0x20 + (ev), len) uint ioctl = IOCreate(DirectionFlags.Read, (int)ev + 0x20, length); int retval = Libc.ioctl(fd, ioctl, data); return(retval); }
public static int GetName(int fd, out string name) { unsafe { sbyte *pname = stackalloc sbyte[129]; int ret = Libc.ioctl(fd, EvdevIoctl.Name128, new IntPtr(pname)); name = new string(pname); return(ret); } }
public static int GetId(int fd, out EvdevInputId id) { id = default(EvdevInputId); unsafe { fixed(EvdevInputId *pid = &id) { return(Libc.ioctl(fd, EvdevIoctl.Id, new IntPtr(pid))); } } }
// Get absolute value / limits public static int GetAbs(int fd, EvdevAxis axis, out InputAbsInfo info) { info = default(InputAbsInfo); unsafe { fixed(InputAbsInfo *pinfo = &info) { // EVIOCGABS(abs) = _IOR('E', 0x40 + (abs), struct input_absinfo) uint ioctl = IOCreate(DirectionFlags.Read, (int)axis + 0x40, BlittableValueType <InputAbsInfo> .Stride); int retval = Libc.ioctl(fd, ioctl, new IntPtr(pinfo)); return(retval); } } }