[Unofficial] moonlight-embedded

The screen is showing the last frame of Kodi, it’s not black. I can see the Kodi interface etc but cannot control it with any input devices. This sounds promising!

Could you try running echo 1 > /sys/class/graphics/fb0/blank while running moonlight? If it doesn’t fix the issue, could you run it when in Kodi menu (and not playing any video!) and see if the screen goes black? If it doesn’t, send dmesg after doing it.

Morning @smg04, sorry I didn’t get to run any of the commands above.

Although this morning I have tried running once I initated the moonlight session:

echo 1 > /sys/class/graphics/fb0/blank

And the screen came back to life and all appears to work!

This is on 19.5-Matrix_rc1.

Cheers

Same here.

Edit: Tried adding that command to prescript.sh at the last line with and without sleep command but it doesn’t work this way for some reason.
I just decided to create another sd card for 19.3 and Luna 130, everything works great. Even played TR in HDR.

@Kaan, hopefully it’s something simple for @smg04 to fix. He’s done great work so for on this addon, especially getting surround sound functionality working. So I’m sure he can sort us out :slight_smile:

1 Like

@Kaan, just a heads up but my way around this at the moment is by making a shell script which runs the above command. I then just jump on with SSH from my phone and run it when using Moonlight.

Saves swapping SD cards etc.

I have no idea how to fix this right now. It shouldn’t happen and it doesn’t happen for me. Something is triggering the screen not to go blank (the command is run multiple times when launching moonlight). So for now, there’s no way to fix this, just run the command if your screen is black.

Cheers @smg04, I’ve also noticed that my Xbox Controller no longer allows control of Kodi when quiting Moonlight too, if i reboot then it comes back. Its as though the script isn’t running correctly or something?

Hi @smg04 and everyone who love smg04 projects,
I spent half day to read whole story of this project , so i’d summarize all test result from my devices
My devices: X96 Air P3 with 1Gbit LAN
With coreelec 19.3:
script.luna.130 :
+run good without black screen issue when compare to 144 , it have a bug when you make a fresh pair ( it will not show pin code in dialog box) ==> you need to pair to Host via ssh
+controller or (mouse and keyboard) will stay connected depend on script you using, so you need to combine script from coreelec_usb and coreelec_mouse_keyboard into 1 script, so all controller and keyboard will stay connected after disconnect to Host PC
with version 144:
+Blackscreen issue after connect to host , tried to “echo 1 > /sys/class/graphics/fb0/blank” but the issue still there

Version 19.4rc1 and 19.5rc :
This coreelec version make my device not stable in LAN network (only half of packets can be recieved)
script.luna.144 :Blackscreen issue after connect to host , but if i do “echo 1 > /sys/class/graphics/fb0/blank” screen came back to life, and work normally , i tried to insert this command to launch script , it can help you fix this issue

==> the issue came from moonlight binary , can you give us change log of this bin when you build from 130 to 144 ?
Moonlight tips : if you face with micro stuttering or screen tearing, you can try to turn off vsync from game or nvidia control pannel, let try to cap FPS from RTSS tool , it’s so effectively , reduce input lag a lot

@luizkun Since updating from coreelec 19.3 to 19.4 the kernel was updated to 4.9.269 which changed some parameters in initializing the codec.

You can check out the commits here:

It has been updated based on Kodi’s decode parameters. So you will not be able to use version 144 on 19.3 and you cannot use 130 on 19.4. This has introduced the blackscreen issue which I have yet to figure out what is causing it, as moonlight is supposed to run the blank command.

When it comes to input, this is still a problem because Kodi is running in the background and has full control of the input devices. If I were to kill Kodi then it would be a lot slower to return back to it, but it would fix all blackscreen, input, audio issues.

Hi @smg04 thanks for your change log , can you guide me how to build this moonlight-embedded for coreelec ? I can help you debug this issue

Build steps

  1. Set up a Linux environment (I use Ubuntu 18.04 on WSL)
  2. Download CoreELEC repo (or use git clone). You need to match your coreelec version (coreelec-19 for matrix or coreelec-20 for nexus)
  3. Use scripts/checkdeps to download all dependencies (if it doesn’t work, you have to sudo apt update).
  4. Build addon using scripts/create_addon script.luna. This will only build the addon, not the whole CoreELEC image.
  5. Folder target will contain the built zip file for installation.

The addon config is located in packages/addons/script/luna/package.mk and moonlight-embedded config is located in packages/addons/addon-depends/moonlight-embedded/package.mk.

1 Like

Thank you very muh smg04, i will try your guide after my business trip , i will let you know soon when i find something

script.luna.1.44_modded.zip (2.7 MB)
Hi @smg04 @Adam86 i create luizkun_script as a simple workaround script to fix black screen issue and controller issue .
Please try it

@luizkun will try it in the next hour!

What launch script do you recommend to use?

EDIT: just tried it with the luizkun launch script and now the stream starts absolutely fine which is fantastic. The only thing that is still an issue is my controller doesn’t work in Kodi still until I reboot.

Great work though :slight_smile:

Continuing the discussion from [Unofficial] moonlight-embedded:

Hi Adam, you should try different usb port , and i suggest using 2.0 USB port for controller , i see that USB 3.0 controller driver does not support gamepad well , my device X96Air P3 has usb 3.0 port also have that issue while USB 2.0 port work normally .

@luizkun, OK I checked and the Xbox Wireless USB Dongle was plugged into the side USB 2.0 port, so I swapped this to the rear one and tested Moonlight again and when ending the stream the controller continued to work this time :slight_smile:

So looking really good now I’d say, cheers for your efforts.

This is working great for me too!

Thanks a lot @luizkun and @smg04 for your work on this

@luizkun, been meaning to ask you, is there a way to stop Moonlight from prompting which launchscript it is using when you launch a stream?

It should ask you to select a launch script only when you are first time running the script or have upgraded to a new version… Once you select it, it should never ask you again (until you update again).