Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Member
    Join Date
    Dec 2018
    Location
    The Netherlands
    Posts
    73

    [piCorePlayer] Customization of RF remote control keys?

    Dear Squeezebox community,

    I have a few question about the possibility to customize RF remote control keys in piCorePlayer. But let me start with describing my pCP setup.

    I built a Squeezebox player using a Raspberry Pi ZeroW board in combination with piCorePlayer. I can control pCP with a smartphone control app (I am using Squeeze Ctrl on an Android phone), but also wanted to be able to control pCP using an RF remote control. To accomplish this I installed the Jivelite extension in pCP, and bought an RF remote control to control Jivelite. The Jivelite screen is displayed on my TV via the HDMI output of the RPi ZeroW.

    The RF remote control that I bought is a "model T3" device that is described here: https://forum.kodi.tv/showthread.php?tid=278842 . This remote is sold on Aliexpress for circa 10 US dollar, for example here: https://www.aliexpress.com/item/4000671247122.html . It is actually a multi-function remote control that can be switched between RF mode (in this mode it can also work as a mouse) and IR mode. I am using the RF mode for remote control of piCorePlayer via Jivelite, and the IR mode for remote control of my Stereo set. The remote comes with an RF receiver in the form of an USB dongle, that is connected to the USB port of my RPi ZeroW using an USB to micro-USB adapter cable.

    After connecting the RF receiver to the USB port of the RPi ZeroW, RF remote control was working immediately (i.e. without installing LIRC or IR tools for Jivelite), and most keys at the front side of the remote have the function that I would expect. So RF remote control is actually working quite well, but if possible I would like to change the function of a few keys. For example, with the existing key mapping, somehow I unintentially changed internet radio station presets a few times. I think I can avoid this by removing c.q. changing the function of the 4 coloured buttons at the front side of the remote. Also I would like to change the behavior of the pause/play button, i.e. give it the same function as the space bar at the bottom side of the remote.

    Finally here are my questions:
    1) Where in piCorePlayer is the mapping of RF remote control keys defined? Is it in piCore Linux or in Jivelite?
    2) Does anybody know if it is possible to customize the key mapping? If so, how?
    3) Is there a linux tool to detect the key code of RF remote control keys? I suppose that I first need to know the key code of a specific key before I can map the key on another action.

    Thanks in advance for your help.


    PS: A picture of the RF+IR remote that I use is shown below. The USB dongle is the (2.4GHz) RF receiver. See https://forum.kodi.tv/showthread.php?tid=278842 for more info.
    Name:  T3-RF-IR-remote-control.jpg
Views: 291
Size:  79.2 KB
    Last edited by CJS; 2020-08-06 at 02:27. Reason: Added picture
    | LMS 8.0 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |

  2. #2
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    2,569
    This post documents how to find the keycode generated for the keys you want to change and this one outlines how to modify the jivelite key mapping in picoreplayer.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

  3. #3
    Member
    Join Date
    Dec 2018
    Location
    The Netherlands
    Posts
    73
    Quote Originally Posted by ralphy View Post
    This post documents how to find the keycode generated for the keys you want to change and this one outlines how to modify the jivelite key mapping in picoreplayer.
    Thanks raplhy for providing links to essential informaton on this subject!
    I will give it a try and report back in this thread. This may take a few days though due to other activities.

    PS: Response on dmesg | grep input is as follows:
    Code:
    dmesg | grep input
    [    2.367267] input: FREEWAY TECHNOLOGY RFIC-MOUSE Keyboard as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/0003:25A7:2402.0001/input/input0
    [    2.433422] input: FREEWAY TECHNOLOGY RFIC-MOUSE Consumer Control as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/0003:25A7:2402.0001/input/input1
    [    2.433625] input: FREEWAY TECHNOLOGY RFIC-MOUSE System Control as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/0003:25A7:2402.0001/input/input2
    [    2.433842] input: FREEWAY TECHNOLOGY RFIC-MOUSE as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/0003:25A7:2402.0001/input/input3
    [    2.434489] hid-generic 0003:25A7:2402.0001: input,hiddev96,hidraw0: USB HID v1.01 Keyboard [FREEWAY TECHNOLOGY RFIC-MOUSE] on usb-20980000.usb-1/input0
    [    2.439211] input: FREEWAY TECHNOLOGY RFIC-MOUSE as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.1/0003:25A7:2402.0002/input/input5
    [    2.441095] hid-generic 0003:25A7:2402.0002: input,hidraw1: USB HID v1.01 Mouse [FREEWAY TECHNOLOGY RFIC-MOUSE] on usb-20980000.usb-1/input1
    When running sudo evtest I get following response:
    Code:
    sudo evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:      FREEWAY TECHNOLOGY RFIC-MOUSE Keyboard
    /dev/input/event1:      FREEWAY TECHNOLOGY RFIC-MOUSE Consumer Control
    /dev/input/event2:      FREEWAY TECHNOLOGY RFIC-MOUSE System Control
    /dev/input/event3:      FREEWAY TECHNOLOGY RFIC-MOUSE
    /dev/input/event4:      FREEWAY TECHNOLOGY RFIC-MOUSE
    Select the device event number [0-4]:
    Further I noticed that most buttons on the front of the remote generate a response on event0, and the remaining ones on event1.
    So far so good. Thanks again!
    Last edited by CJS; 2020-08-06 at 14:39.
    | LMS 8.0 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |

  4. #4
    Member
    Join Date
    Dec 2018
    Location
    The Netherlands
    Posts
    73
    Hi Ralphy,

    Quote Originally Posted by ralphy View Post
    This post documents how to find the keycode generated for the keys you want to change ...
    With the help of your instructions and the evtest program I could detect the keycodes of all buttons that are located at the front of the T3 RF remote control. The picture below shows the keycode for each button, as well as the input / event (event0, event1, event2) on which the keycode is received.

    Name:  T3_RF_RC_keycodes_front_buttons.png
Views: 136
Size:  163.5 KB

    Quote Originally Posted by ralphy View Post
    ... and this one outlines how to modify the jivelite key mapping in picoreplayer.
    I am struggling with this step. After extracting the default InputToActionMap.lua file from /tce/optional/pcp-jivelite.tcz, I modified the content of this file. My plan was to change c.q. create following key mappings (keycode => wanted action):
    Code:
    [KEY_PLAYPAUSE] = "pause",
    [KEY_F3] = "go_search",
    [KEY_F4] = "disabled",
    [KEY_F5] = "disabled",
    [KEY_F6] = "disabled",
    [KEY_F7] = "disabled",
    As it happens to be, none of these 6 keycodes exist in the default InputToActionMap.lua file, even if jivelite does respond on pressing the F3 to F7 function keys by playing presets 3 to 7. It seems that (for example) key code [KEY_F3] is mapped on action "play_preset_3", even if code [KEY_F3] is not defined in InputToActionMap.lua. Since the 6 keycodes did not exist I added the code shown above to the end of section "keyActionMappings.press", and copied the modified InputToActionMap.lua to /home/tc/.jivelite/userpath/jive/InputToActionMap.lua, as instructed in the linked post (btw I first created folder jive since this folder did not exist under /home/tc/.jivelite/userpath) :

    Quote Originally Posted by ralphy View Post
    Just copy the modified InputToActionMap.lua to /home/tc/.jivelite/userpath/jive/InputToActionMap.lua and quit jivelite. When it automatically restarts jivelite will use your version instead of the one in the tcz package.
    => Can you (Ralphy or somebody else) tell me how to "quit jivelite"? Since I did not know how to do this, I rebooted pCP expecting that jivelite would pick up the modified InputToActionMap.lua. But the response of jivelite on the 6 added keycodes had not changed, and when I used WinSCP to check the contents of folder /home/tc/.jivelite/userpath it appeared that folder jive with the modified InputToActionMap.lua file had disappeared. It seems like folder /home/tc/.jivelite is recreated after reboot? In a second attempt, I again copied the modified InputToActionMap.lua to folder /home/tc/.jivelite/userpath/jive, but before rebooting pCP I stored settings to SD card via the Jivelite GUI (jivelite HOME => Settings => piCorePlayer=>Save Settings to SD Card). In this case after rebooting pCP, at the end of the boot process jivelite was started, but the jivelite GUI did not appear on the screen. Maybe this is because jivelite, when reading the modified InputToActionMap.lua, does not recognize the 6 added keycodes?

    I checked that in this case file /home/tc/.jivelite/userpath/jive/InputToActionMap.lua was there. After deleting folder /home/tc/.jivelite/userpath/jive with modified InputToActionMap.lua (sudo rm -r /home/tc/.jivelite/userpath/jive) the jivelite GUI appeared again on the screen.

    Can anybody tell me what I should do to create the 6 custom keymappings mentioned above?
    Last edited by CJS; 2020-08-08 at 14:42. Reason: Fixed few typos and added some extra details
    | LMS 8.0 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |

  5. #5
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    2,569
    There is a Quit menu item at the bottom of the main menu in jivelite. Alternatively, you can press the small letter o to quit immediately. Picoreplayer will restart jivelite automatically.

    Unfortunately, you can't add new key codes in InputToActionMap.lua as all keys must be registered in the jive framework C source first, which then requires recompiling jivelite and as you discovered if jivelite doesn't recognize the key code it won't start.

    The Fn (function) keys are reassigned in the framework to KEY_PRESET_n so you should be able to map

    Code:
    [KEY_PRESET_3] = "go_search",
    If the KEY_PLAYPAUSE doesn't respond as KEY_PLAY or KEY_PAUSE you won't likely be able to map it without modifying the SDL library and recompiling it and jivelite.
    Last edited by ralphy; 2020-08-09 at 07:18.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

  6. #6
    Member
    Join Date
    Dec 2018
    Location
    The Netherlands
    Posts
    73
    Quote Originally Posted by ralphy View Post
    There is a Quit menu item at the bottom of the main menu in jivelite. Alternatively, you can press the small letter o to quit immediately. Picoreplayer will restart jivelite automatically.
    Thanks Ralphy. I had earlier hidden Quit from the HOME menu, that is why I did not see it... Pressing letter o indeed works.

    Unfortunately, you can't add new key codes in InputToActionMap.lua as all keys must be registered in the jive framework C source first, which then requires recompiling jivelite and as you discovered if jivelite doesn't recognize the key code it won't start.

    The Fn (function) keys are reassigned in the framework to KEY_PRESET_n so you should be able to map

    Code:
    [KEY_PRESET_3] = "go_search",
    Following your suggestion I have modified the behavior of function keys F3 to F7 by means of following changes to sections keyActionMappings.press as well as keyActionMappings.hold in InputToActionMap.lua:
    Code:
    [KEY_PRESET_3] = "go_search",
    [KEY_PRESET_4] = "disabled",
    [KEY_PRESET_5] = "disabled",
    [KEY_PRESET_6] = "disabled",
    [KEY_PRESET_7] = "disabled",
    FYI, the reason for disabling the coloured function keys F4 to F7 is that these keys are programmed to function as "Source Select" keys for my Stereo set when the RC operates in IR mode. For selecting a different input source for my Stereo, I need to long-press one of these function keys in IR mode. It happened a few times that I long-pressed one of these keys for selecting a different input source for my Stereo, assuming that the RC was operating in IR mode, while in reality the RC was operating in RF mode. By disabling the function keys in RF mode it is avoided that presets are accidentally changed.

    Apart from changing the behavior of the function keys I also modified the mapping of the special characters for setting presets 1 to 9. I did this because the order of special characters on this T3 Remote Control is different from the order that is used on standard PC/Laptop keyboards, refer to picture below:

    Name:  T3_Air-Mouse_keyboard.jpg
Views: 105
Size:  140.3 KB

    I changed the mapping by selecting the special character that is physically located directly below the corresponding numerical key.
    Following changes were made to section charActionMappings.press in InputToActionMap.lua:

    Code:
    --	[")"]  = "set_preset_0",
    	["!"]  = "set_preset_1",
    	["^"]  = "set_preset_2",
    	["#"]  = "set_preset_3",
    	["$"]  = "set_preset_4",
    	["%"]  = "set_preset_5",
    	["&"]  = "set_preset_6",
    	["*"]  = "set_preset_7",
    	["("]  = "set_preset_8",
    	[")"]  = "set_preset_9",
    The line for set_preset_0 is commented out, since character ")" is used for set_preset_9. With this mapping it is easy to set presets 1 to 9 by means of the Remote Control. Only limitation is that preset 0 (corresponding with preset 10 in LMS) cannot be set with the RC. If needed it is still possible to set preset 10 via the web interface of LMS, or by selecting piCorePlayer as player in SqueezePlay on a Windows PC.

    If the KEY_PLAYPAUSE doesn't respond as KEY_PLAY or KEY_PAUSE you won't likely be able to map it without modifying the SDL library and recompiling it and jivelite.
    Not being a programmer, at this moment in time I consider modification of source code and recompilation of Jivelite a step to far. It is a pity that I can't pause/play audio with the PLAYPAUSE key at the front side of the RC, but I can still do this by using the SPACE bar at the back side. This is a limitation that I can live with.

    Thanks again Ralphy for your help! For users that use a similar RF/USB remote control to control piCorePlayer and that also want to customize the function of remote control buttons I have provided installation instructions in the next post in this thread.
    Last edited by CJS; 2020-08-11 at 08:10.
    | LMS 8.0 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |

  7. #7
    Member
    Join Date
    Dec 2018
    Location
    The Netherlands
    Posts
    73
    For people that use a simular RF/USB remote control to control piCorePlayer via Jivelite I have attached a zip file with following content:
    • Original InputToActionMap.lua file that comes with Jivelite
    • Modified InputToActionMap.lua that changes the function of a few buttons on the Remote Control, as discussed in my previous post
    • Excel sheet that shows the keycodes that are generated by the model T3 remote control
    • README.txt file that explains how to install the modified InputToActionMap.lua in piCorePlayer. This text file also contains some extra information about how to use evtest for detection of keycodes that are generated by a RF/USB remote control.

    Attachment => T3_Jive_keymap.zip


    HOW TO INSTALL A CUSTOM InputToActionMap.lua FILE FOR JIVELITE IN PICOREPLAYER
    Instructions below make use of Win32DiskImager, Putty and WinSCP on a Windows PC. Also it is assumed that Jivelite is installed in piCorePlayer, and that the Joggler skin is used.
    Lines that start with $ are commands that are entered on the Putty commandline.

    1) First make a backup image of the piCorePlayer SD card using Win32DiskImager. To minimize the file size of the image select "Read Only Allocated Partitions" in Win32DiskImager.

    2) Boot piCorePlayer and SSH into piCorePlayer using Putty:
    login as: tc
    password: piCore

    3) Create folder temp in /home/tc
    $ mkdir temp

    4) Create folder jive in /home/tc/.jivelite/userpath
    $ cd /home/tc/.jivelite/userpath
    $ sudo mkdir jive

    5) Copy customized InputToActionMap.lua from Windows PC to piCoreplayer using WinSCP. Copy InputToActionMap.lua to folder /home/tc/temp that was created in step 3.

    6) Copy InputToActionMap.lua from folder temp to folder /home/tc/.jivelite/userpath/jive
    $ cd /home/tc/temp
    $ sudo cp InputToActionMap.lua ../.jivelite/userpath/jive

    7) Quit Jivelite, by pressing key o at the back side of the T3 Remote Control.
    Jivelite should restart automatically and pick up the custom InputToActionMap.lua file

    8) Check that the modified remote control keys work as expected.
    If the Jivelite GUI does not start, SSH into pCP and delete the custom InputToActionMap.lua from folder /home/tc/.jivelite/userpath/jive as follows
    $ sudo rm /home/tc/.jivelite/userpath/jive/InputToActionMap.lua

    9) This is an optional step to reduce data that is saved to SD card in the next step.
    If the modified keys work as expected, SSH into piCorePlayer again and remove InputToActionMap.lua from folder temp:
    $ cd temp
    $ rm InputToActionMap.lua

    10) Save the customized key map /home/tc/.jivelite/userpath/jive/InputToActionMap.lua to SD card using your Remote Control:
    Jivelite HOME => Settings => piCorePlayer => Save Settings to SD Card
    This saves piCorePlayer settings to SD card, including all files under /home/tc. These settings are restored when booting PiCorePlayer

    11) Reboot piCorePlayer by selecting "Reboot piCorePlayer" in the same piCorePlayer menu

    12) Double check that the modified keys work as expected.

    Regards,
    CJS
    | LMS 8.0 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |

  8. #8
    Member
    Join Date
    Dec 2018
    Location
    The Netherlands
    Posts
    73
    Hi Ralphy,

    I was thinking, when you make the next update of Jivelite for piCorePlayer (maybe for the next version of piCorePlayer?), can you consider to add "KEY_PLAYPAUSE" to the jive framework and to InputToActionMap.lua? This would help people that use an RF remote control like myself. Let me know if it would help when I create an issue at https://github.com/ralph-irving/tcz-jivelite/issues.

    Also, for setting presets 0 to 9, it would be convenient if this could be done by long-pressing numerical keys 0 to 9 at the front side of the remote control. This is how presets 1 to 6 can be set on the front panel of the Squeezebox Boom. Is this something that could be implemented in a next release of tcz-jivelite without breaking existing functionality?

    Kind regards, CJS.
    | LMS 8.0 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |

  9. #9
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    2,897
    Looks like a useful remote at a reasonable price.
    I'm interested to see how it works after you have used it for a while - i.e. build quality
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  10. #10
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    2,569
    Quote Originally Posted by CJS View Post
    I was thinking, when you make the next update of Jivelite for piCorePlayer (maybe for the next version of piCorePlayer?), can you consider to add "KEY_PLAYPAUSE" to the jive framework and to InputToActionMap.lua? This would help people that use an RF remote control like myself. Let me know if it would help when I create an issue at https://github.com/ralph-irving/tcz-jivelite/issues.
    Maybe I could remap KEY_PLAYPAUSE to KEY_PAUSE for the next picoreplayer release, but I don't have a remote that generates a KEY_PLAYPAUSE event.
    What are the scancodes reported by evtest for it?

    Quote Originally Posted by CJS View Post
    Also, for setting presets 0 to 9, it would be convenient if this could be done by long-pressing numerical keys 0 to 9 at the front side of the remote control. This is how presets 1 to 6 can be set on the front panel of the Squeezebox Boom. Is this something that could be implemented in a next release of tcz-jivelite without breaking existing functionality?
    Currently a long press of the Fn (function) key saves to the presets and pressing an Fn key selects it.
    Ralphy

    1-Touch, 5-Classics, 3-Booms, 1-UE Radio
    Squeezebox client builds donations always appreciated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •