Mycroft Community Forum

How to hack a data stream pipe?

Speaking of hitting a wall. This one is solid concrete to me.

I’m coding a skill for Moonlight embedded (OpenSource streaming C compiled client for Nvidias GameStream) and while the advancement is satisfying i’ve got a big problem i can’t wrap my head around.

The most crucial thing is to get the config / game lists / connection tests / pairing right if you want to solely rely on voice to have an appropriate experience. While these (game lists, connection tests, etc) are easily manageable with subprocesses popen and grabbing stdout to process the data in mycroft, pairing is giving me serious headaches (since i have to grab PIN to be voiced out mid-process).

It seems the pairing credentials are written to stdout ONLY at the end of the process (see strace log), eg you either cut off the pairing or enter a wrong PIN. There seems no way to catch the data as it is appearing on screen. I’ve gone several python routes (Threading, Threading+queue, select.select, and so on. The list would be too long, this would be one viable set of code)

The deeper problem is - like stated in the topic - that i have to hack a data stream pipe that is directed to a special file (hopefully that assessment is right :wink: ). I even can moonlight pair host > /dev/pts/0 and it will appear on the ssh-ing screen in real time, while moonlight pair host > out.txt ( and all redirections or script -c to file, …) will act like described above.

Why is that? And does anyone know a (hacky) way to get around that? I simply don’t want to drop pair (to be handled in terminal), that wouldn’t be the whole package.


If someone wants to reproduce it (needs a nVidia-Card-Host with Nvidia GeForce Experience installed AND Gamestream activated (GeForceExp>Settings>Shield))
sudo apt-get install moonlight-embedded
and simply running the python code linked above (it will print out what’s happening ; change hostname/IP in .py as fit; threading/queue has to be pip’ed in)
in comparison do a moonlight pair hostname/IP
(have an eye on host)