From 8a6859d295b9029847eb5075d536369c2f47b797 Mon Sep 17 00:00:00 2001 From: Christian Brickhouse Date: Fri, 16 Jul 2021 15:36:31 -0700 Subject: [PATCH] Fix final code example --- docs/tutorial.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 604d289..71e107e 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -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 @@ -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)