예제 #1
0
    def test_has_property(self):
        """
        Let's assume at least one between event0 and event10 is a device
        with at least one property set. May cause false negatives.
        """

        props_supported = 0
        for i in range(10):
            try:
                with open("/dev/input/event{}".format(i), "rb") as fd:
                    l = Libevdev(fd)

                    for p in range(6):
                        if l.has_property(p):
                            props_supported += 1
            except IOError:
                # Not all eventX nodes are guaranteed to exist
                pass
        self.assertGreater(props_supported, 0)
예제 #2
0
 def test_enable_property(self):
     l = Libevdev(self.fd)
     self.assertFalse(l.has_property("INPUT_PROP_ACCELEROMETER"))
     l.enable_property("INPUT_PROP_ACCELEROMETER")
     self.assertTrue(l.has_property("INPUT_PROP_ACCELEROMETER"))