Need help with a Serial port arcade encoder (Pandora Clone)

Hi,

I was given this Pandora Box clone and I would like to move away from the crummy software package it came with and build up my own EmuElec system. The problem is the Arcade controls encoder board is connected via serial rather than USB and I could not find any info on how to make it work.

The internals of this pandora box consist of a gutted out cheap Android TV box with a S905L SOC and more specifically, an obscure arcade controls encoder board that also acts as a small speaker amplifier.

The weird thing about this is the encoder board sends its inputs through a serial connection via the TV Box’ uart bound to ttyS0. It’s hand soldered to the uart header underneath the TV Box’ mainboard.

As it came, the pandora clone system is running a custom build of EmuElec 3.9 redubbed TigerleapElec. I could not find any info on it online, it’s just what I found while datamining on the SD card. It’s not using EmulationStation frontend. It has its own frontend, program name is PandoraDX. Seems to be a QT-based app.

There are no open network ports, there is seemingly no way to break out of the frontend to get a shell. There is a watchdog program ran early during the boot phase that seems to kill sshd, smbd and any other means of accessing remotely the device. debug-shell is also switch to tty9 via a systemd job early on.

The thing is, while datamining, I could not find anything relevant to how they interface the Arcade controls serial encoder board, other than a command line to chmod ttyS0. My guess is the “PandoraDX” frontend contains the necessary functions to bind ttyS0 to a /dev/input/js interface which I guess after that makes it a trivial matter to make with work with frontends and emus. The custom programs do not contain any debugging symbols so trying to disassemble those would not be a fun time! I think my best bet is to try and make the encoder board work with ready-made utilities rather than trying to reverse-engineer what’s on that SD card.

I tried tinkering with this encoder board using inputattach utility in --dump mode as there is seemingly no ready-made line discipline (driver) that would successfully interface it. In any way, I could not find one that would work with it.
In dump mode, I can clearly see the encoder board will stream a player’s input on a 2 byte array with a player number identifier 2-bits sub-array followed by every individual controls mapped onto a single bit across this 2 bytes array. This 2 bytes stream per player is streamed constantly for as long as the buttons are pressed and/or the joystick is not at idle. When no controls are touched, a single 2 bytes message is sent with all bits set to 0 (aside from the player ID bits) and stays silent until a button is pressed or a joystick is moved.
So fairly comprehensible and simple.

I’m a bit puzzled as to why would these clone makers would design a device so custom there is no ready-made driver for it in Linux… Serial based joysticks and gamepads were a thing at some point in time, why not try to re-use what was already made. Anyways…

As anybody ever come across this type of device?
I’m not really experienced with serial input devices but I figure the way to go would be to find a way to create a js interface bound to ttyS0 with the proper driver to interpret its inputs. The solution probably involves using inputattach with a specific line discipline (driver) to interface this weird encoder board.

I just cannot figure out how what I need to do here. I hope somebody ever came across this thing and could point me on how to make it work!

Thanks

I forgot to mention I would prefer to use this encoder board rather than replacing it for a USB one mainly for 2 reasons.

1- It would keep a cleaner look on the back panel.
2- The serial encoder board also acts as a USB interface to use the arcade deck as a 2-players arcade controller on PC. I’d like to keep this functionality.