Esempio n. 1
0
        RawDevice(ref DeviceParser parser)
        {
            bus            = parser.bus.Value;
            vendor         = parser.vendor;
            product        = parser.product;
            revision       = parser.revision;
            name           = parser.name;
            eventInterface = parser.eventIface;
            otherHandlers  = parser.otherHandlers.ToArray();
            eventTypesBits = parser.eventTypes;

            keysBits       = parser.bits.lookup(eEventType.Key);
            ledBits        = parser.getSingleBits(eEventType.LED);
            relBits        = parser.getSingleBits(eEventType.Relative);
            absBits        = parser.bits.lookup(eEventType.Absolute);
            switchBits     = parser.getSingleBits(eEventType.Switch);
            miscEventsBits = parser.getSingleBits(eEventType.Miscellaneous);
        }
Esempio n. 2
0
        /// <summary>Enumerate currently attached input devices</summary>
        public static IEnumerable <RawDevice> list()
        {
            DeviceParser parser = new DeviceParser();

            parser.reset();

            foreach (string line in MiscUtils.readLines(source))
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    if (parser.isGoodEnough())
                    {
                        yield return(new RawDevice(ref parser));
                    }
                    parser.reset();
                }
                parser.parse(line);
            }
        }