batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
2k stars 514 forks source link

can't pair moonlinght from 40c-dev-fd77300a58 on Rpi5 with latest sunshine v0.23.1 #11684

Closed rcampbel3 closed 4 months ago

rcampbel3 commented 5 months ago

Batocera build version

40c-dev-fd77300a58

Your architecture

Raspberry Pi5

Your Graphic Processor Unit(s) (GPU)

rpi5 integrated graphics

Issue description

Pairing with moonlight on Windows running Sunshine 0.23.1 fails when I enter the PIN. I have moonlight streaming set up on many other clients with this same server with no issue.

Detailed reproduction steps

batocera-moonlight list

Searching for server... Connecting to 192.168.1.74... You must pair with the PC first

batocera-moonlight pair 192.168.1.74

Searching for server... Connecting to 192.168.1.74... Please enter the following PIN on the target PC: 7355 Failed to pair to server: Error

]# batocera-moonlight pair 192.168.1.74 Searching for server... Connecting to 192.168.1.74... Please enter the following PIN on the target PC: 9174 Failed to pair to server: Pairing failed

Details of any attempts to fix this yourself

I can't see any logs to debug further.

Details of any modifications you have made to Batocera.

it's the beta version. batocera-support-20240508204648.tar.gz

Logs and data

No response

luzfcb commented 5 months ago

@rcampbel3 I have a similar issue on another distro based on batocera upstream.

Would it be possible for you to capture the moonlight debug information?

Unfortunately batocera-moonlight script does not have a way to activate debugging info of moonlight, so the only solution is to create a copy of the script (named batocera-moonlight2) and include it.

batocera_exc="$(command -v batocera-moonlight)"
new_batocera_exc_copy="$(dirname "${batocera_exc}")/batocera-moonlight2"
cp "${batocera_exc}" "${new_batocera_exc_copy}"
chmod +x "${new_batocera_exc_copy}"
sed -i 's/cmd="moonlight/cmd="moonlight -debug/g' "${new_batocera_exc_copy}"
sed -i -E 's|^\$cmd|echo "Executing: \$cmd"\n\$cmd|' "${new_batocera_exc_copy}"

after that I got something like:

# batocera-moonlight2 pair 192.168.3.150
Moonlight Embedded 2.7.0 (CEC;SDL;ALSA)
Connecting to 192.168.3.150...
Request http://192.168.3.150:47989/serverinfo?uniqueid=0123456789ABCDEF&uuid=0f7b81c3-f4c6-4dbe-a9a3-41e1174b0fa9
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="200"><hostname>SteamHeadless</hostname><appversion>7.1.431.-1</appversion><GfeVersion>3.23.0.74</GfeVersion><uniqueid>417067A6-059F-672A-6614-EB5FD05600E6</uniqueid><HttpsPort>47984</HttpsPort><ExternalPort>47989</ExternalPort><MaxLumaPixelsHEVC>1869449984</MaxLumaPixelsHEVC><mac>00:00:00:00:00:00</mac><LocalIP>192.168.3.150</LocalIP><ServerCodecModeSupport>257</ServerCodecModeSupport><SupportedDisplayMode/><PairStatus>0</PairStatus><currentgame>0</currentgame><state>SUNSHINE_SERVER_FREE</state></root>

Request https://192.168.3.150:47984/serverinfo?uniqueid=0123456789ABCDEF&uuid=52fb8476-6e0e-43ad-ab51-d73a8e5f0430
Request http://192.168.3.150:47989/serverinfo?uniqueid=0123456789ABCDEF&uuid=dded7ec9-b609-497f-8ce2-26633f8b25cd
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="200"><hostname>SteamHeadless</hostname><appversion>7.1.431.-1</appversion><GfeVersion>3.23.0.74</GfeVersion><uniqueid>417067A6-059F-672A-6614-EB5FD05600E6</uniqueid><HttpsPort>47984</HttpsPort><ExternalPort>47989</ExternalPort><MaxLumaPixelsHEVC>1869449984</MaxLumaPixelsHEVC><mac>00:00:00:00:00:00</mac><LocalIP>192.168.3.150</LocalIP><ServerCodecModeSupport>257</ServerCodecModeSupport><SupportedDisplayMode/><PairStatus>0</PairStatus><currentgame>0</currentgame><state>SUNSHINE_SERVER_FREE</state></root>

GPU: , GFE: 3.23.0.74 (, 7.1.431.-1)
Server codec flags: 0x101
Please enter the following PIN on the target PC: 4933
Request http://192.168.3.150:47989/pair?uniqueid=0123456789ABCDEF&uuid=2dc1c871-dc67-44ae-9999-210830179565&devicename=roth&updateState=1&phrase=getservercert&salt=a1dab143f9b8d45c7982587714adddb0&clientcert=2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d494943767a43434161656741774942416749424144414e42676b71686b694739773042415173464144416a4d53457748775944565151444442684f566b6c450a53554567523246745a564e30636d56686253424462476c6c626e51774868634e4d6a51774e5449774d5463304f4445345768634e4d7a51774e5445344d5463300a4f444534576a416a4d53457748775944565151444442684f566b6c4553554567523246745a564e30636d56686253424462476c6c626e5177676745694d4130470a4353714753496233445145424151554141344942447741776767454b416f4942415143394a6d6d6d7336506c4c3575522b473548317a324e6e526d73676750380a566246445074314c4d4f614e344e3076494f742f397466574276574853754e7a5a73387061394f64715373355551393759556433312b7834384364694f3670500a344e6e31455a306177387172422b4664745458626e43487036567a7a6f58774a543876385766643853636e58364163362f744e2f696632326e4e3669784a2f480a777a67395935496946782b6f6b6e374d38667045515176556442386f6866522f73476f572b337363584a4d63693267624f4436797171494676396239646836560a6a354474427869644d38474631552f505047746964453572366e33352b316d77716337635834697751493071743370344f4e335a3550674c493944444675456d0a434376452b4d336a6a544231772b5041714a63344f5a566c4f63315276495832614d70355763765751725a71532f6942314873576c4e523141674d42414145770a4451594a4b6f5a496876634e4151454c4251414467674542414b483668306c4b3865736646666967397656706458337049702f63444c355a677447452f674d310a716f34437359524b4f74416b696945426965613157734b466e4875777765664b6938417850657a4357786e4e52786a6e723568774c7347373650614a5a30574e0a6948594556504c5632784f737730714d79797a4a39536241553657495467306b6753315067696c2f4f527836315a763544684b57616b562b7269414f574f6d340a4f705636554b77334279517365727a584555564c7a396774474e433557465435455936675950546d2b4a726e6b646b7838344c322f7737794f69546f6c47477a0a766f4545637356486f7a7978744e55575957345759715542365a7077594d6f485475376450334b6c566b733268676c4d473979467868734731726849616c70670a4a345238494a49733871655a336a2f6b617165692b6f4a2f6869464b686a37366e3747712f6c4643352b333345354d3d0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="200"><paired>1</paired><plaincert>2D2D2D2D2D424547494E2043455254494649434154452D2D2D2D2D0A4D494943306A434341627167417749424167495546516C6D7A38577A33466A56323430354B456647334E52724C3141774451594A4B6F5A496876634E4151454C0A42514177497A45684D42384741315545417777595533567563326870626D5567523246745A584E30636D56686253424962334E304D423458445449304D4455790A4D54457A4D5467314E6C6F58445451304D4455784E6A457A4D5467314E6C6F77497A45684D42384741315545417777595533567563326870626D5567523246740A5A584E30636D56686253424962334E304D494942496A414E42676B71686B6947397730424151454641414F43415138414D49494243674B43415145416E61446D0A354C4C564C38787348726C6D4C52485174673469336C4E64552F7539317A574E755A41503351523062667236723636564343376E5242555651562B66625332640A376E433944746D566F53692F67484D564E7755596C6B4B79366773452F635635554A4C7A2F674536466E4B6B6F547855683851666F435638766C56612B4D51500A6E6770304F536949786A64785533784A444C54784E4149585641544673665270397332385976517872625A656A6966645045416138706A3864615673496D7A370A57714D2F72756D575730664235675379517633714347553150396454417851357947644244514B72594D5256722B6F75566875666D343167327A2B49304361330A7A78714745526D396D5A6C3043766C2F45716E546B6C4E6843684C74745A323930356B4F6E31754E5551397671546A654C2B715278414F76313442585044784F0A614E476877345868423136356D4B5A5958514944415141424D41304743537147534962334451454243775541413449424151414768484A6C5A592F4F597337510A446745654B784D385357576655755331326C31597A712F4A306F6863445A2F327059525574584834757A4545323144694A65596A4B642B6B2B706776397733480A31354554762F57705249565455563471584C51343677614E794735697972424C4246444F34783663483962464F4C30763777304E4751343254613447347963770A7465676E48767065574D6C64324542756B33584D6E31577A356E6B4C772F6C716151784D6C5A792F46592B706C645831647750363639374564414656753031470A4C4C5555516B4C462B5938384F70422B44424D316E467A545A7964623633392F61532F694651784D4F624943722F427A544346686C595850366C4B4A6254676F0A5175706934566A2B47544B3271376A4A6D3536436B4A62744F71546D6B365976684E5A584432386D673455612B4D4E43397070713534484339564231716130500A73446C377833676E0A2D2D2D2D2D454E442043455254494649434154452D2D2D2D2D0A0A</plaincert></root>

Request http://192.168.3.150:47989/pair?uniqueid=0123456789ABCDEF&uuid=6e6e82e0-f629-4a0d-9ac4-4c3ff82434d7&devicename=roth&updateState=1&clientchallenge=4782265b96721561774c04a4d5391605
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="200"><paired>1</paired><challengeresponse>0D278DE9299A78448FDE781333FD54208ED3682CF50CEC786FB5B2DB8389046395CD2B3DA5C36D615B54D4057938B6B8</challengeresponse></root>

Request http://192.168.3.150:47989/pair?uniqueid=0123456789ABCDEF&uuid=a605fd9e-335d-468f-892a-2f097b311148&devicename=roth&updateState=1&serverchallengeresp=4fe1276cafceb1ff984be3444ba63a6caf852690e6247f9f5e00cc9b2297c600
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="200"><pairingsecret>314F17980E81AE8E8B756AA50E3E018E6BA6D3FB501E6CBD22C3F56B70F9C6BAE5A39CEE628BD85930D9347A036176184288B21B3B522957C56EA38CD42C4CBB0053486A2CA84ED1691D04B4B8727F3F10C98286A30F251ADAC4F5FBAE34FDD181839E77D79DA86ED7925BD0AEEF500DBC15FEAAD0337E0F8EC3207B4BC2E8DDAB64D9E7B536535FB7D67EFDC58AA6FA4C3C5F8D80DD931B0C094175649DD5AFF464E58EAAA6017F32ADAB9D6BFDAF004AE1B7FA1BDAAEEE55A692B5212D64E90D5CF900D4606305AFA4F9857773E4A57C4BF7BF988FB3D78F698F4B373A66054AD712BA8E0C7CD55EF1044A2737EB925823E220C455702532D8D4A193A4D5443A7FB52D633D5706B954273B5C9D5ED3</pairingsecret><paired>1</paired></root>

Request http://192.168.3.150:47989/pair?uniqueid=0123456789ABCDEF&uuid=d3d3fc81-fdd6-4cff-b959-8473ca442ebd&devicename=roth&updateState=1&clientpairingsecret=a99d3e6abb273dbcf3233cc4d35c5895443504589e4aac50676623c2d6fde5c4a5baa3dd3bb420d1e13520b985251ab8e1ed6588a0f5e1aea8102ef8a89a222ebedf40f0ae7fbf606d0660a3a71ea6cf497577b145f74fcb9a18955efd174e153947cf3922f6e254187dff94e3a6381515fddeac52cb3c40096642c0a64aa61af119545ebce14121a0d33913dc8a47ee8f78ba13f9ce83ba97f4a5b4eb73b20a572097e842e7fe5e39fee5ef1cdc841e6d52928c180204c499b522fde9753b6b00f8327db64a3696c1fe4122e6492757e32666ae92a861703a580dac5949fc5198b706bd5ce23793e5ba5794224a7a620d4604bd6a2aa76b1c47243ce9ee2106a4867961467cdb855be342f1a4685229
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="200"><paired>1</paired></root>

Request https://192.168.3.150:47984/pair?uniqueid=0123456789ABCDEF&uuid=69df2474-3444-4b4b-9b3a-ddd2748311c9&devicename=roth&updateState=1&phrase=pairchallenge
Request http://192.168.3.150:47989/unpair?uniqueid=0123456789ABCDEF&uuid=666aa3f3-72f0-44f0-921c-0ddf06fb005a
Response:
<?xml version="1.0" encoding="utf-8"?>
<root status_code="404"/>

Failed to pair to server: Error

I noticed that for some reason, moonlight is sending a request to unpair right after it manages to pair. I'm not sure if this is the expected behavior

dmanlfc commented 5 months ago

and if you downgrade Sunshine ? this seems like a handshake issue where moonlight-embedded is not negotiating with sunshine on it's new terms...

luzfcb commented 4 months ago

@dmanlfc I tested pairing Moonlight 2.7.0 with all Sunshine server versions from 19.4 up to v2024.601.193044, but could not pair with any of them.

I wanted to try downgrade Moonlight to 2.6.x to test it, but I don't know how to find a binary compatible with Batocera/Knulli and my Anbernic RG35xx-h.

I'm using The Knulli linux (a batocera fork) https://github.com/knulli-cfw/distribution because it is compatible with the Ambernic RG35xx-h (that uses the Allwinner H700 processor)

luzfcb commented 4 months ago

Interesting fact: moonlight-embedded 2.6.0 from the original RG35xx-h ROM works as expected, while the batocera/knulli version does not.

The only difference between the two that I could see is that moonlight-embedded 2.6.0 of the original RG35xx-h ROM uses very old versions of OpenSSL (1.x) and libcurl.

I have no idea if this is the cause (incompatibility with some change in OpenSSL 3.x or libcurl)

dmanlfc commented 4 months ago

fixed @luzfcb RPi5 confirmed working @rcampbel3

test RPi5 build here - https://drive.google.com/drive/folders/17xwxkBM1oCLdUczk81EQyXOBLSAhP5xJ?usp=drive_link

luzfcb commented 4 months ago

@dmanlfc Thank you 🙌🏽 , unfortunately I don't have an RPI5 to test, in my case I only have Anbernic RG35xx-h.

Were you able to reproduce the issue?

But could you give some explanation of what exactly the cause of the problem was? Is it something specific to batocera moonlight-embedded, or something should be fixed and/or documented directly in moonlight-embedded ?

An explanation would be useful to perhaps avoid unnecessary efforts in https://github.com/moonlight-stream/moonlight-embedded/issues/892