Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,11 @@ Injecting an FF-event into first FF-capable device found
========================================================

::

from evdev import ecodes, InputDevice, ff
from time import sleep
from evdev import ecodes, InputDevice, ff, util

# Find first EV_FF capable event device (that we have permissions to use).
for name in evdev.list_devices():
for name in util.list_devices():
dev = InputDevice(name)
if ecodes.EV_FF in dev.capabilities():
break
Expand All @@ -446,5 +446,8 @@ Injecting an FF-event into first FF-capable device found

repeat_count = 1
effect_id = dev.upload_effect(effect)
dev.write(e.EV_FF, effect_id, repeat_count)
dev.write(ecodes.EV_FF, effect_id, repeat_count)

# Erasing the effect too soon will prevent it from running
sleep(2)
dev.erase_effect(effect_id)