bendavid / aiopylgtv

Library to control webOS based LG Tv devices
MIT License
143 stars 47 forks source link

Added buttons to the list: NETFLIX, GUIDE, AMAZON #46

Closed heisenberg2980 closed 2 years ago

heisenberg2980 commented 2 years ago

While setting up a virtual remote control I realised these 3 buttons also work with my LG Magic Remote: NETFLIX, GUIDE, AMAZON

chros73 commented 2 years ago

Which model do you have? (These don't work on 2018 models.)

heisenberg2980 commented 2 years ago

The model is LG UN85 (I believe it is 2020) and it comes with the LG Magic Remote released in 2019: https://www.lg.com/us/tv-audio-video-accessories/lg-AN-MR19BA-magic-remote-control

I am also trying to figure out the commands to activate other buttons of the remote control (i.e. the source/input button and the quick access buttons) but no luck so far

chros73 commented 2 years ago

Yes, it's 2020 model, and CX has the same remote. It's hard to guess these keywords, I found these ones too, work on B8: STOP , REWIND , FASTFORWARD , MENU , MAGNIFIER_ZOOM , LIVE_ZOOM , POWER

Can you try these ones as well, maybe they work for you? DISNEY, DISNEYPLUS, APPLETV, APPLETVPLUS, ALEXA, INPUT, INPUTS, INPUTSOURCE

heisenberg2980 commented 2 years ago

I just tried them all, from the first list all of them work except MAGNIFIER_ZOOM and LIVE_ZOOM (unless they have to be used in a certain screen/source that I am not aware of, I tested them on a HDMI, Netflix and Youtube and they don´t seem to do anything).

Unfortunately from the second list none of them works (INPUTS/INPUTSOURCE is the one I am desperately trying to find the code for).

bendavid commented 2 years ago

You can grep for them from the LG firmware.

(download the firmware from lg and unpack with https://github.com/openlgtv/epk2extract )

chros73 commented 2 years ago

MAGNIFIER_ZOOM works here e.g. with HDMI2 input, a small setting window appear in the bottom left corner, and when you exit it, a "Focus zoom off" toast message. LIVE_ZOOM works with HDMI2 as well, "Live zoom is off" toast message appears upon exiting.

Not sure what's the name for INPUT, if there is any. Anyways, I added these new button to my fork.

You can grep for them from the LG firmware.

Yes, but since no definite list for this, you don't know what to grep for :) I have ideas from this file: /usr/share/X11/xkb/keycodes/lg

(I also removed unnecessary button methods, just didn't make any sense.)

heisenberg2980 commented 2 years ago

You can grep for them from the LG firmware.

(download the firmware from lg and unpack with https://github.com/openlgtv/epk2extract )

Thanks for the advise, I used epk2extract to unpack the firmware and after getting a bit of help from their discord channel I found all the buttons (using the command "strings rootfs.pak.unsquashfs/usr/sbin/lginput2 | grep -i '^KEY_'"). Unfortunately none of the buttons displayed the source menu, but one of the guys in discord mentioned the command com.webos.surfacemanager/showInputPicker and that worked, so now I just need to find out about the quick access buttons

chros73 commented 2 years ago

Cheers, then that's another place to check them :) But I don't know how this crap works, e.g. in that list we have LIVEZOOM that doesn't work but LIVE_ZOOM does :) And you can filter out duplicate entries from the list with:

strings rootfs.pak.unsquashfs/usr/sbin/lginput2 | grep -i '^KEY_' | sort | uniq

And I found couple of more buttons that work on B8.

chros73 commented 2 years ago

I found 4 more that work here, in this binary file (in 1 line): /usr/sbin/network-input-service And there are bunch of new ones in the CX firmware, try out one of these for the input list: INPUT_HUB , VIR_INPUTLIST , S_MENU , FUNCTIONMENU

heisenberg2980 commented 2 years ago

I just tried them, only the first one works (INPUT_HUB) but it opens the Home Dashboard instead of the input list (the other 3 don´t do anything). Anyway after the discussion with the epk2extract guys on discord the input list is done for me, the only pending buttons I have now are the Quick Access (the ones you execute by holding numbers 1-9 in the remote control)

chros73 commented 2 years ago

(INPUT_HUB) but it opens the Home Dashboard instead of the input list

That's weird I could swear that this is it :)

chros73 commented 2 years ago

the only pending buttons I have now are the Quick Access (the ones you execute by holding numbers 1-9 in the remote control)

Good question, I don't know how to send buttons with long press. But you can launch the registered apps by using launch_app or launch_app_with_params methods. E.g. you can launch the Quick Access app with: launch_app com.webos.app.magicnum You can use get_apps_all to see all the app ids (including hidden apps as well).

I added couple of more buttons (along with their description) and an input_button method (for triggering input hub).

heisenberg2980 commented 2 years ago

That´s a really good point, as long as I can execute the same commands I don´t really need to know how to execute the long press buttons, as I just need to assign the same command that the long press does. My virtual remote control is complete, thanks!!