Skip to content

Commit 44cc232

Browse files
Update tutorial.rst
The "Injecting an FF-event into first FF-capable device found" example was slightly broken, with a missing import and a typo on what is now line 450 (previously 449) - should be ecodes.EV_FF and not e.EV_FF. Finally, added a duration_ms of time.sleep(), as otherwise the effect immediately gets erased and doesn't seem to do anything.
1 parent 5adc2ab commit 44cc232

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

docs/tutorial.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,11 @@ Injecting an FF-event into first FF-capable device found
425425

426426
::
427427

428-
from evdev import ecodes, InputDevice, ff
428+
from evdev import ecodes, InputDevice, ff, list_devices
429+
import time
429430

430431
# Find first EV_FF capable event device (that we have permissions to use).
431-
for name in evdev.list_devices():
432+
for name in list_devices():
432433
dev = InputDevice(name)
433434
if ecodes.EV_FF in dev.capabilities():
434435
break
@@ -446,5 +447,6 @@ Injecting an FF-event into first FF-capable device found
446447

447448
repeat_count = 1
448449
effect_id = dev.upload_effect(effect)
449-
dev.write(e.EV_FF, effect_id, repeat_count)
450+
dev.write(ecodes.EV_FF, effect_id, repeat_count)
451+
time.sleep(duration_ms)
450452
dev.erase_effect(effect_id)

0 commit comments

Comments
 (0)