diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-03-18 16:43:24 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-03-18 16:43:24 +0100 |
commit | f928edff467b9b493b95c511ffa443a71943e54f (patch) | |
tree | fea65aede4f56fe6c84eb37d03b743b045dded53 | |
parent | aa314c85b727b86edffb30a34e06bfa9a501d7c3 (diff) |
uinput_mng: add the 'clear' control command
-rw-r--r-- | README | 2 | ||||
-rwxr-xr-x | uinput_mng | 6 |
2 files changed, 7 insertions, 1 deletions
@@ -51,6 +51,8 @@ The commands are: are disconnected. * list Lists all currently bound device paths. +* clear + Remove all currently bound devices. dev_add ------- @@ -53,6 +53,8 @@ class Controller: elif cmd == 'list': for d in self._in_devices: sys.stderr.write(d + '\n') + elif cmd == 'clear': + self._in_devices.clear() else: self._logger.error('Unknown command: %s', line) @@ -177,9 +179,11 @@ class PhysDevices(dict): def __exit__(self, exc_type, exc_value, traceback): self.close() - def close(self): + def clear(self): for path in list(self.keys()): self.remove(path) + def close(self): + self.clear() def add(self, path): if path in self: |