Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_vibration lock after 16 uses giving "no space left on device" #109

Open
Krayfighter opened this issue Sep 8, 2022 · 1 comment
Open

Comments

@Krayfighter
Copy link

the following code works

import inputs
from time import sleep
controller = inputs.devices.gamepads[0]
for i in range(16):
    controller.set_vibration(0, 1, 100)
    sleep(.1)

so long as the range is less than 17

otherwise, is will give the following stack trace

Traceback (most recent call last):
File "", line 1, in
File "/home/aidenk/.local/lib/python3.10/site-packages/inputs.py", line 2983, in set_vibration
self._set_vibration_nix(left_motor, right_motor, duration)
File "/home/aidenk/.local/lib/python3.10/site-packages/inputs.py", line 2969, in _set_vibration_nix
code = self.__get_vibration_code(left_motor, right_motor, duration)
File "/home/aidenk/.local/lib/python3.10/site-packages/inputs.py", line 2963, in __get_vibration_code
buf_conts = ioctl(self._write_device, 1076905344, inner_event)
OSError: [Errno 28] No space left on device

this work inside and outside of a loop, and for the duration of the process' lifetime, limiting the number of calls to this function to 16 for the entire program runtime

I also noticed that if I had 2 python instances open, I could use all the the 16 function calls in the first, and the second would be unable to call the function, giving the same stack trace.

my system:

Operating System: Fedora Linux 35
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.2
Kernel Version: 5.19.6-100.fc35.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® Xe Graphics
Manufacturer: Framework
Product Name: Laptop
System Version: A3

Python 3.10.6
inputs 0.5

@justin-sliprobotics
Copy link

The reason why this is happening is because the set_vibration method actually writes the effect to the gamepad when called. Your gamepad probably has 16 slots for effects. After calling it 16 times, there is no more space to store another effect. This library is unmaintained, but you can address it for yourself by splitting out the writing of the effect into its own method that is called only once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants