dpad + dialog or antimicro without X = antimicro-nonX

Third party OS images and hardware mods
Post Reply
mad_ady
Posts: 8458
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 577 times
Been thanked: 461 times
Contact:

dpad + dialog or antimicro without X = antimicro-nonX

Post by mad_ady »

Hello,
I've put together a simple python script that can map the keys on the Go Advance (or other systems) and can execute commands on key press, or inject keys/key combinations (like CTRL+C) or key sequences (strings, key combinations). You can find more about the project here:

https://github.com/mad-ady/antimicro-nonX

I'm using it to control a ncurses app (ncmpc) and it feels pretty snappy.


Original post below:

I'm building a mpd player out of a go advance for my son and I'm trying to find a suitable frontend. I've compiled ymuse which is gtk based and I can operate it with antimicro, but it feels sluggish. So I want to try ncmpc which is a ncurses client.
But I want to allow the user to select which mpd server to connect to - through dialog. The question is - is there an antimicro equivalent that listens to input events and generates specific keypresses?
Last edited by mad_ady on Fri Sep 04, 2020 6:13 pm, edited 1 time in total.

crashoverride
Posts: 5101
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 365 times
Contact:

Re: dpad + dialog or antimicro without X?

Post by crashoverride »

While I do not know of an existing program, I can point you in the direction to write your own. The Linux EVDEV subsystem allows creating virtual devices from user-space. You can can create a keyboard device and send it key presses based on input from the gamepad device. If you know Python, example use of EVDEV can be found here:
https://python-evdev.readthedocs.io/en/ ... ce-options

mad_ady
Posts: 8458
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 577 times
Been thanked: 461 times
Contact:

Re: dpad + dialog or antimicro without X?

Post by mad_ady »

Yeah, I already wrote something similar a while ago (in perl because I'm old skool), but I thought there might be something better that would suppress the original events and that would be faster. Oh, well, I'll give it a try: https://github.com/mad-ady/multibutton

escalade
Posts: 247
Joined: Thu Mar 14, 2019 8:34 pm
languages_spoken: english and norwegian
Has thanked: 12 times
Been thanked: 107 times
Contact:

Re: dpad + dialog or antimicro without X?

Post by escalade »

You can run AntimicroX with the environment variable QT_QPA_PLATFORM=offscreen to run it without any GUI, I'm using it heavily in my image.
Maintainer of RetroELEC (XU4 / OGA / x86_64)

mad_ady
Posts: 8458
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 577 times
Been thanked: 461 times
Contact:

Re: dpad + dialog or antimicro without X?

Post by mad_ady »

Sorry for the delay - been busy IRL.
So - it seems that my multibutton code was good enough to handle input events (had a bug and didn't see some of the keys, but that's sorted out). With this sample config file it can listen to Go Advance key codes and run an external (python this time) program that uses uinput to inject the keys that I wanted: https://github.com/mad-ady/multibutton/ ... -dpad.yaml, https://github.com/mad-ady/multibutton/ ... /uinput.py

Now, this works, but it's terribly inefficient (like the rest of my code). The reasons for this are:
* keys are read via polling
* on key press, a new process is started for uinput (and a new instance of python interpreter, etc)
* on key press a new uinput device is created to inject the key and then destroyed.

It's usable for my use case (MPD gui), but has a lag of ~0.5s between key press and action. In order to be faster and more efficient I'll need to rewrite it in a single language, avoid spawning new processes, and setting up only one /dev/input device.

Luckly the oga dpad driver seems to be debouncing keys, so I don't think I have to worry about it... Will let you know when it's ready :)

mad_ady
Posts: 8458
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 577 times
Been thanked: 461 times
Contact:

Re: dpad + dialog or antimicro without X = antimicro-nonX

Post by mad_ady »

Updated the first post with a link to the new project: https://github.com/mad-ady/antimicro-nonX. It's much more responsive than my previous attempt!
These users thanked the author mad_ady for the post:
odroid (Fri Sep 04, 2020 6:49 pm)

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest