question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does inputs support the rumble functionality in most gamepads? I realize that’s output rather than input but it still seems appropriate.

Thank you for the library! I’m using it to write a scratch 2.0 extension so our CoderDojo can have kids use the full functionality of the gamepads; currently we’re limited to mapping buttons to keyboard keys and one of the sticks to the mouse with third party software. All I’m missing is rumble functionality.

One question though, is there a list of what all the ev_types and codes mean? For example, I currently completely ignore SYN_DROPPED and others, only use events with types Key and Absolute actually. I’m not sure how robust this 🙈 approach is.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
zethcommented, Aug 25, 2018

Ok will do. I just managed to make rumble work on Linux so will tidy up that and add it to inputs soon.

1reaction
dlernstromcommented, Jun 16, 2019

Hey @zeth: So I’ve been looking at integrating a Logitech Wireless Gamepad F710 for a Raspberry Pi project I’m working on. I didn’t want to implement the interface to the gamepad if I could avoid it, and was pleasantly surprised to find this project. I was able to test the gamepad and have very precise data coming in as I test all of the buttons and such. GREAT WORK!

Though I don’t need it, I also attempted to test rumble support – it didn’t work. Here is my traceback:

>>> pads[0].set_vibration(1, 1, 1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.virtualenvs/myproj/lib/python3.5/site-packages/inputs.py", line 2983, in set_vibration
    self._set_vibration_nix(left_motor, right_motor, duration)
  File "/home/pi/.virtualenvs/myproj/lib/python3.5/site-packages/inputs.py", line 2969, in _set_vibration_nix
    code = self.__get_vibration_code(left_motor, right_motor, duration)
  File "/home/pi/.virtualenvs/myproj/lib/python3.5/site-packages/inputs.py", line 2963, in __get_vibration_code
    buf_conts = ioctl(self._write_device, 1076905344, inner_event)
OSError: [Errno 14] Bad address

As I have studied the voodoo that is going on there, it appears that you had implemented the ff_rumble_effect, however, when calculating the _IOW Linux macro, you came up with 1076905344. When I did a similar exercise (based upon Linux C code here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input.h), I came up with 1076643200. Simply changing the constant to my calculated value allowed the rumble feature to work for me quite nicely.

HOWEVER, the magic number in the code doesn’t really contribute to solid software maintainability. Additionally, as I studied what is occurring in this code, it appears that a new rumble object is defined and sent to the gamepad every time you call set_vibration. On my device, it starts to fail with a memory error after about 4-5 repeated calls.

>>> pads[0].set_vibration(1, 1, 500)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/myproj/inputs.py", line 3223, in set_vibration
    self._set_vibration_nix(left_motor, right_motor, duration)
  File "/home/pi/myproj/inputs.py", line 3191, in _set_vibration_nix
    code = self.__get_vibration_code(left_motor, right_motor, duration)
  File "/home/pi/myproj/inputs.py", line 3185, in __get_vibration_code
    buf_conts = ioctl(self._write_device, 1076643200, inner_event)
OSError: [Errno 28] No space left on device

Now, I definitely understand that voodoo and am willing to help, however, don’t want to stick my nose where it doesn’t belong. I can certainly cobble together a PR, but from what I can tell (studying this code: https://github.com/flosse/linuxconsole/blob/master/utils/fftest.c), it appears that there are varying rumble mechanisms supported by various gamepads. Coming up with a universal rumble pattern may be tricky and so a more dynamic definition based upon connected devices might make more sense. This is probably why the rumble PR you submitted worked for you but not for me (though from what I can read on the struct definition, I still think you would have calculated the same magic number as I did, so I am not sure why mine is different).

Anyway - how would you like to proceed? How can I help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Play RUMBLE SUPPORT Like a CHALLENGER
Kellin is one of the best support players in Korean solo queue and he just recently started picking up Rumble support! There is...
Read more >
Rumble Support Is OP?! - YouTube
Download Mobalytics, the all-in-one companion for League of Legends -https://mobalytics.gg/imls/yt∙Join my discord for coaches, ...
Read more >
Contact us - Questions? - RumbleTalk
We are here to help! Feel free to contact us regarding anything related to general use of your chat widget, minisite pages, your...
Read more >
Rumble Support Build Guide, Runes, Items 12.23, LoL
Statistical Rumble Support build guide with best runes, item build, skill order, counters, summoner spells, trinkets, and mythic items, 12.23. Latest data.
Read more >
SUPPORT - RUMBLEVERSE
If you're having technical issues with Rumbleverse, you can review our knowledgebase articles and contact the Epic Games Player Support team from our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found