Skip to content

Commit 6812d25

Browse files
committed
list_devices() must also check for write access
1 parent 5d61fd9 commit 6812d25

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎evdev/util.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def list_devices(input_device_dir='/dev/input'):
1818

1919

2020
def is_device(fn):
21-
'''Check if ``fn`` exists, is readable and if it is a character device.'''
21+
'''Check if ``fn`` is a readable and writable character device.'''
2222

2323
if not os.path.exists(fn):
2424
return False
@@ -27,7 +27,7 @@ def is_device(fn):
2727
if not stat.S_ISCHR(m):
2828
return False
2929

30-
if not os.access(fn, os.R_OK):
30+
if not os.access(fn, os.R_OK | os.W_OK):
3131
return False
3232

3333
return True

0 commit comments

Comments
 (0)