File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,14 @@ Changelog
55Unreleased
66====================
77
8- - Support path protocol in ``InputDevice ``.
8+ - ``InputDevice `` now accepts objects that support the path protocol. For
9+ example::
10+
11+ pth = pathlib.Path('/dev/input/event0')
12+ dev = evdev.InputDevice(pth)
13+
14+ - Support path protocol in ``InputDevice ``. This means that ``InputDevice ``
15+ instances can be passed to callers that expect a ``os.PathLike `` object.
916
1017- Exceptions raised during ``InputDevice.async_read() `` (and similar) are now
1118 handled properly (i.e. an exception is set on the returned future instead of
Original file line number Diff line number Diff line change @@ -114,12 +114,12 @@ def __init__(self, dev):
114114 '''
115115 Arguments
116116 ---------
117- dev : str
117+ dev : str|bytes|PathLike
118118 Path to input device
119119 '''
120120
121121 #: Path to input device.
122- self .fn = dev
122+ self .fn = dev if not hasattr ( dev , '__fspath__' ) else dev . __fspath__ ()
123123
124124 # Certain operations are possible only when the device is opened in
125125 # read-write mode.
You can’t perform that action at this time.
0 commit comments