Announcement

Collapse
No announcement yet.

Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Howto create a linux kernel IR remote keytable for Jivelite on piCorePlayer 5

    The 4.19 linux kernel has removed the original LIRC uinput drivers that piCorePlayer has used since 3.x for navigating Jivelite with an IR remote. IR remote control is still supported but you need to migrate your lircd.conf files to an IR keytables configuration. If you are using the FLIRC usb dongle, it works the same as in previous piCorePlayer releases.

    IR keytables requires an IR receiver connected to a GPIO of your raspberry pi. I'm using these 38 kHz TSOP4838 DIP-3 IR Receiver Modules. Check out this video for info on creating a solderless harness to connect an IR receiver directly to the rpi.

    LIRC is not needed for kernel IR keytables jivelite navigation and should not be installed.

    So let's get started.

    Switch to Beta mode at the bottom of the Main page of the piCorePlayer 5 webgui.

    Install Jivelite from the webgui Tweaks Tab->Jivelite Setup, reboot and configure jivelite.

    Navigate to the IR Page from the webgui Tweaks Tab->IR Remote Control section.

    Click image for larger version

Name:	ir.png
Views:	1
Size:	37.5 KB
ID:	1578194

    Click Install IR tools for use with jivelite and reboot.

    Set the GPIO number in Set LIRC GPIO in number (IR receiver) if you are not using the default 25, save and reboot.

    A keytable for the SlimDevices remotes is loaded by default when the IR tools are installed and should be operational now.

    We also provided keytable files for the JustBoom IR and Sony RMT-D11[67]A remotes. They are located at /usr/local/share/pcp-irtools/files and currently need to be installed via putty/ssh.
    Code:
    cd /usr/local/etc/keytables
    sudo cp /usr/local/share/pcp-irtools/files/justboomir jivelite
    sudo ir-keytable -c -w jivelite
    pcp bu
    The JustBoom IR remote should now work with jivelite without restarting.

    Alternately, you could copy the keytable file from piCorePlayer to your browser system and upload the configuration via the webgui. Instructions are provide below.

    To create a custom keytable connect to your piCorePlayer using ssh or putty and login as the tc user.

    Clear the default kernel keytable and load all IR protocol drivers.

    Code:
    sudo ir-keytable -p all -c
    Code:
    Old keytable cleared
    Protocols changed to lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon
    Note the list of IR Protocols loaded.

    Check that your remote is recognized

    To test this, we are going to run ir-keytable and press some buttons on our remote control.

    Code:
    sudo ir-keytable -t
    Code:
    Testing events. Please, press CTRL-C to abort.
    5740.570027: lirc protocol(sony12): scancode = 0xe001b
    5740.570043: event type EV_MSC(0x04): scancode = 0xe001b
    5740.570043: event type EV_SYN(0x00).
    5740.620027: lirc protocol(sony12): scancode = 0xe001b
    5740.620047: event type EV_MSC(0x04): scancode = 0xe001b
    5740.620047: event type EV_SYN(0x00).
    5740.680024: lirc protocol(sony12): scancode = 0xe001b
    5740.680044: event type EV_MSC(0x04): scancode = 0xe001b
    5740.680044: event type EV_SYN(0x00).
    If you do not see any output as you press your remote buttons, your remote may not be supported or you have the wrong GPIO configured for the IR receiver.

    From the Testing events we can determine that my remote uses the sony protocol

    If you have an lircd.conf for your remote from piCorePlayer 3 or 4, make a copy of it and load it into your favorite text editor.

    Delete everything except the key symbols and you should have a file similiar to this.

    Code:
    KEY_MINUS 0xD8E # Tape B Fast Rewind
    KEY_EQUAL 0x38E # Tape B Fast Forward
    KEY_UP 0xCC1 # Tape A Fast Rewind
    KEY_DOWN 0x2C1 # Tape A Fast Forward
    KEY_RIGHT 0xC41 # Tape A Forward
    KEY_LEFT 0x6C1 # Tape A Record
    KEY_ENTER 0x1C1 # Tape A Stop
    KEY_ESC 0x9C1 # Tape A Pause
    The format of the keytable file is rather simple:

    It's a plain text file, the first line contains a header with a descriptive name (you can choose that rather arbitrarily, but better avoid special characters, spaces and such) and the remote protocol to use (the type: - which is very important). After that each line contains a mapping of remote scancode to Linux keycode.

    If you made a comment with the remote key that corresponds to the scan code, creating the keytable file is quite simple.

    Press each key on the remote and put the scancode BEFORE the key symbol in the file we just created.

    The scancode in the earlier test was for the Tape B Fast Rewind key on my Sony RM-S70 remote.

    Once complete remove all text following the key symbol name.

    Next we need to add the header line to identify the remote the file is for and the protocol; used by the kernel keytable loader.

    The completed keytable file.

    Code:
    # table: rms70, type: sony
    0xe001b KEY_MINUS
    0xe001c KEY_EQUAL
    0x100033 KEY_UP
    0x100034 KEY_DOWN
    0x100032 KEY_RIGHT
    0x100036 KEY_LEFT
    0x100038 KEY_ENTER
    0x100039 KEY_ESC
    If you are creating a keytable file for a new remote, you can refer to my Jivelite action to key symbol spreadsheet to help identify the jive action to key symbol mapping needed.

    Save your new keytable file, I use the remote model for the name, but you it can be called whatever you like.

    Now we need to upload the file using the piCorePlayer webgui Upload custom jivelite keytables to pCP on the IR page.

    Click Browse and choose your new keytable file, select it and click upload.

    If successful you should be able to use the remote immediately, no jivelite restart or reboot is required.
    Last edited by ralphy; 2020-08-24, 14:33. Reason: lirc not needed.
    Ralphy

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

    #2
    .....
    Ralphy

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

    Comment


      #3
      Does 5.0 contain out-of-the-box support for using official Squeezebox IR remote (in my case with simple TSOP on GPIO) - or will people have to go through the keytable set-up steps?
      Paul Webster
      Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
      and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

      Comment


        #4
        hi Paul Webster,

        They should work with the default IR install. Through squeezelite or jivelite depending on configuration.

        I tested this many times on the pCP5.0.0 beta and rc. I haven't tested on the official pCP5.0.0 release yet.

        regards
        Greg

        Comment


          #5
          Originally posted by Paul Webster View Post
          Does 5.0 contain out-of-the-box support for using official Squeezebox IR remote (in my case with simple TSOP on GPIO) - or will people have to go through the keytable set-up steps?
          Thanks for asking this Paul. I sometimes forget the important details and have updated the howto.

          As Greg mentioned, we provide support for the slimdevices remote as the default when the IR tools are installed.
          We also provide keytables for the JustBoom IR and Sony RMT-D11[67]A remotes.
          Ralphy

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

          Comment


            #6
            Hi Guys

            I wondered if there was going to be any way to still support USB dongles with jivelite? I understand of course things move on, but I see that with the 5.x setup, I can get my dongle to work if I install lircd support for squeezelite - i.e. before installing jivelite. Once I've done this, I can see the /dev/lirc devices present, so it seems it's possible to get lircd on the new kernel. However, once I install jivelite, i don't see these devices at all.

            dmesg is

            Code:
            [email protected]:~$ dmesg
            [    0.000000] Booting Linux on physical CPU 0x0
            [    0.000000] Linux version 4.19.40-pcpCore ([email protected]) (gcc version 7.3.1 20180425 (crosstool-NG 1.23.0.418-d590)) #1 Sat May 11 13:40:46 EDT 2019
            [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
            [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
            [    0.000000] OF: fdt: Machine model: Raspberry Pi Model B Rev 1
            [    0.000000] Memory policy: Data cache writeback
            [    0.000000] cma: Reserved 8 MiB at 0x0e000000
            [    0.000000] On node 0 totalpages: 61440
            [    0.000000]   Normal zone: 540 pages used for memmap
            [    0.000000]   Normal zone: 0 pages reserved
            [    0.000000]   Normal zone: 61440 pages, LIFO batch:15
            [    0.000000] random: get_random_bytes called from start_kernel+0x90/0x4a0 with crng_init=0
            [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
            [    0.000000] pcpu-alloc: [0] 0
            
            .......
            
            [    1.461222] dwc_otg 20980000.usb: DWC OTG Controller
            [    1.461314] dwc_otg 20980000.usb: new USB bus registered, assigned bus number 1
            [    1.461389] dwc_otg 20980000.usb: irq 56, io mem 0x00000000
            [    1.461445] Init: Port Power? op_state=1
            [    1.461451] Init: Power Port (0)
            [    1.461858] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
            [    1.461876] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
            [    1.461888] usb usb1: Product: DWC OTG Controller
            [    1.461898] usb usb1: Manufacturer: Linux 4.19.40-pcpCore dwc_otg_hcd
            [    1.461908] usb usb1: SerialNumber: 20980000.usb
            [    1.462987] hub 1-0:1.0: USB hub found
            [    1.463085] hub 1-0:1.0: 1 port detected
            [    1.464292] dwc_otg: FIQ enabled
            [    1.464304] dwc_otg: NAK holdoff enabled
            [    1.464310] dwc_otg: FIQ split-transaction FSM enabled
            [    1.464329] Module dwc_common_port init
            [    1.464856] usbcore: registered new interface driver usb-storage
            [    1.465284] mousedev: PS/2 mouse device common for all mice
            [    1.466702] bcm2835-wdt 20100000.watchdog: Broadcom BCM2835 watchdog timer
            [    1.467277] bcm2835-cpufreq: min=700000 max=700000
            [    1.468010] sdhci: Secure Digital Host Controller Interface driver
            [    1.468021] sdhci: Copyright(c) Pierre Ossman
            [    1.468666] sdhost-bcm2835 20202000.mmc: could not get clk, deferring probe
            [    1.468883] sdhci-pltfm: SDHCI platform and OF driver helper
            [    1.469490] ledtrig-cpu: registered to indicate activity on CPUs
            [    1.469623] hidraw: raw HID events driver (C) Jiri Kosina
            [    1.469872] usbcore: registered new interface driver usbhid
            [    1.469881] usbhid: USB HID core driver
            [    1.470939] vchiq: vchiq_init_state: slot_zero = (ptrval), is_master = 0
            [    1.472785] [vc_sm_connected_init]: start
            [    1.476535] vc_vchi_sm_init: failed to open VCHI service (-1)
            [    1.476558] [vc_sm_connected_init]: failed to initialize shared memory service
            [    1.476573] [vc_sm_connected_init]: end - returning -1
            [    1.478369] Initializing XFRM netlink socket
            [    1.478440] NET: Registered protocol family 17
            [    1.478607] Key type dns_resolver registered
            [    1.480703] registered taskstats version 1
            [    1.480732] Loading compiled-in X.509 certificates
            [    1.491321] uart-pl011 20201000.serial: cts_event_workaround enabled
            [    1.491456] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
            [    1.494826] sdhost: log_buf @ (ptrval) (4e113000)
            [    1.542178] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
            [    1.544078] of_cfs_init
            [    1.544242] of_cfs_init: OK
            [    1.579013] Freeing unused kernel memory: 440K
            [    1.579027] This architecture does not have kernel memory protection.
            [    1.579033] Run /init as init process
            [    1.591251] random: fast init done
            [    1.622607] mmc0: host does not support reading read-only switch, assuming write-enable
            [    1.623478] mmc0: new SD card at address 9ffc
            [    1.635201] mmcblk0: mmc0:9ffc SU01G 969 MiB
            [    1.645059]  mmcblk0: p1 p2
            [    1.693769] Indeed it is in host mode hprt0 = 00021501
            [    2.003539] usb 1-1: new high-speed USB device number 2 using dwc_otg
            [    2.003796] Indeed it is in host mode hprt0 = 00001101
            [    2.324079] usb 1-1: New USB device found, idVendor=0424, idProduct=9512, bcdDevice= 2.00
            [    2.324122] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
            [    2.325417] hub 1-1:1.0: USB hub found
            [    2.325616] hub 1-1:1.0: 3 ports detected
            [    2.643553] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
            [    2.774135] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00, bcdDevice= 2.00
            [    2.774159] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
            [    2.777471] smsc95xx v1.0.6
            [    2.874130] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:d9:64:9b
            [    2.973569] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
            [    3.108221] usb 1-1.3: New USB device found, idVendor=0471, idProduct=0815, bcdDevice= 0.00
            [    3.108244] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
            [    3.108255] usb 1-1.3: Product: eHome Infrared Transceiver
            [    3.108266] usb 1-1.3: Manufacturer: Philips
            [    3.108276] usb 1-1.3: SerialNumber: PH00Z6r1
            [    5.846486] zram: Added device: zram0
            [    5.933963] zram0: detected capacity change from 0 to 51609600
            [    5.948554] random: mkswap: uninitialized urandom read (16 bytes read)
            [    5.967742] Adding 50396k swap on /dev/zram0.  Priority:-2 extents:1 across:50396k SSFS
            [    6.772223] squashfs: version 4.0 (2009/01/31) Phillip Lougher
            [    8.009348] EXT4-fs (mmcblk0p2): recovery complete
            [    8.082549] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
            [    8.294272] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
            [   15.864538] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
            [   16.053788] bcm2835_audio soc:audio: card created with 8 channels
            [   18.343975] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
            [   19.836486] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
            [   24.073381] random: sshd: uninitialized urandom read (32 bytes read)
            [   24.663337] random: squeezelite: uninitialized urandom read (32 bytes read)
            [   25.957587] Finished piCorePlayer v5.0.0 startup.
            and the usb device shows up as

            Code:
            [    3.108221] usb 1-1.3: New USB device found, idVendor=0471, idProduct=0815, bcdDevice= 0.00
            [    3.108244] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
            [    3.108255] usb 1-1.3: Product: eHome Infrared Transceiver
            [    3.108266] usb 1-1.3: Manufacturer: Philips
            [    3.108276] usb 1-1.3: SerialNumber: PH00Z6r1
            I use a pronto as remote, so the codes can be anything.

            Any chance?

            Comment


              #7
              The pcp 4.19.40 kernel includes the rc media driver for your dongle.

              Code:
              modinfo mceusb.ko | grep 815
              alias:          usb:v0471p0815d*dc*dsc*dp*ic*isc*ip*in*
              Try removing lirc and reboot.
              Confirm jivelite is installed then install IR-tools for jivelite and reboot.

              Run sudo ir-keytable to see if the device is found.
              If yes, then try the steps outlined in post #1.
              Ralphy

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

              Comment


                #8
                Originally posted by ralphy View Post
                The pcp 4.19.40 kernel includes the rc media driver for your dongle.

                Code:
                modinfo mceusb.ko | grep 815
                alias:          usb:v0471p0815d*dc*dsc*dp*ic*isc*ip*in*
                Try removing lirc and reboot.
                Confirm jivelite is installed then install IR-tools for jivelite and reboot.

                Run sudo ir-keytable to see if the device is found.
                If yes, then try the steps outlined in post #1.
                Hi ralphy

                Ok, yes, the kernel support seems to be there. sudo ir-keytable gives

                Code:
                Found /sys/class/rc/rc1/ (/dev/input/event1) with:
                        Name: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815)
                        Driver: mceusb, table: rc-rc6-mce
                        LIRC device: /dev/lirc1
                        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon
                        Enabled kernel protocols: lirc rc-6
                        bus: 3, vendor/product: 0471:0815, version: 0x0000
                        Repeat delay = 500 ms, repeat period = 125 ms
                .... which is a good start. However, sudo ir-keytable doesn't give any response - I assume because it's listening on GPIO 25. How do we tell it to listen on /dev/lirc1 instead?

                Comment


                  #9
                  Your device is using /dev/lirc1 according to the details from ir-keytable. But you can't use it with jivelite. Jivelite will read from /dev/input/event1 but you'll need to create a keytable file.

                  It appears you haven't followed the steps outlined in post #1 as not all the IR protocols have been loaded and that's likely why -t doesn't print any scancodes.

                  mce_kbd appears in the supported protocols but not in the enabled list.

                  sudo ir-keytable -p all -c

                  sudo ir-keytable -t

                  etc.
                  Ralphy

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

                  Comment


                    #10
                    Originally posted by Greg Erskine View Post
                    hi Paul Webster,

                    They should work with the default IR install. Through squeezelite or jivelite depending on configuration.

                    I tested this many times on the pCP5.0.0 beta and rc. I haven't tested on the official pCP5.0.0 release yet.

                    regards
                    Greg
                    Just to complete this one ... yes, JiveLite controlled by ir-remote worked fine after in-situ update.
                    My GPIO receiver working with Squeezebox remote without me having to go through any of the ir-keytable etc stuff myself.
                    Paul Webster
                    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
                    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

                    Comment


                      #11
                      XBox one remote keytables

                      Hi Guys

                      I made my own keytables for my Xbox remote, uploaded and it works. But after reboot the default keytables are loaded.
                      Can you tell me how to fix this problem?

                      Mirko

                      Comment


                        #12
                        Originally posted by Mirko View Post
                        Hi Guys

                        I made my own keytables for my Xbox remote, uploaded and it works. But after reboot the default keytables are loaded.
                        Can you tell me how to fix this problem?

                        Mirko
                        Did you backup your changes before you rebooted?
                        Ralphy

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

                        Comment


                          #13
                          Originally posted by ralphy View Post
                          Did you backup your changes before you rebooted?
                          Yes i did, at least i found a way to install.
                          Keytable must be saved to temp and install it the way you discribe it for justboomir in your first post. Everything works fine now.

                          Comment


                            #14
                            When you upload the file using the Web GUI there must be no spaces and no special characters in the filename, keep it simple like Xbox.conf

                            I had this problem as well

                            Jeff
                            sigpic
                            Want a webapp ? Get SqueezeLite-X ! https://forums.slimdevices.com/showt...l=1#post903953

                            Comment


                              #15
                              Apple Remote A1156, same Problem

                              Originally posted by Mirko View Post
                              Hi Guys

                              I made my own keytables for my Xbox remote, uploaded and it works. But after reboot the default keytables are loaded.
                              Can you tell me how to fix this problem?

                              Mirko
                              Good day,
                              I do have the same problem here with my picoreplayer installation. I've been trying everything so far...at least what came in my mind, but I still can't get my keytable to "survive" a reboot. I cleared the keytable using sudo ir-keytable -p all -c, then uploaded my custom keytable for the white apple remote, then everything works fine. But after a reboot the settings are gone. I already tried backing up my changes using "Main Page" --> "Advanced Mode Operations" --> "Backup". Also I was trying to figure out saving the keytable to "temp" as suggested by Mirko, but didn't really understand what he was exactly doing.

                              I hope someone could also help me out? What am I missing or doing wrong?

                              Thank you very much,
                              Michael

                              Comment

                              Working...
                              X