Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935

    Getting HDMI CEC to work on pCP 7.0

    I thought I would start a new thread on this to document progress.

    The pCP kernel has HDMI CEC enabled.
    So next step is to get it to work so that a TV remote control can be used to control JiveLite (and potentially other things) through the TV itself rather then adding an infrared receiver to the RPi.

    I think that for this to work it need ps the /dev/cec0 to exist (a RPi4 with dual HDMI would also have /dev/cec1 for the 2nd HDMI port but that is for later study).

    Tests done on an old RPi with HDMI cable attached and TV switched on at time of boot and JiveLite running with display over the HDMI connection to the TV.

    sudo modprobe cec
    Does not give an error.
    However, it does not result in a /dev/cec0 being created.
    So this might be fatal but not sure if it is this that is supposed to create the device.

    In any case, tried to install v4l2-utils to get the cec command line tools.
    This is not in the pCP repo but is in TinyCore ... so switched to that repo to try to install.
    However, it fails on v4l-dvb-5.4.83-pcpCore.tcz - Presumably because the version in the repo is older.

    Code:
    Downloading: libxshmfence.tcz
    libxshmfence.tcz: OK
    Downloading: expat2.tcz
    expat2.tcz: OK
    Downloading: libXdmcp.tcz
    libXdmcp.tcz: OK
    Downloading: libXau.tcz
    libXau.tcz: OK
    Downloading: libxcb.tcz
    libxcb.tcz: OK
    Downloading: libX11.tcz
    libX11.tcz: OK
    Downloading: libXext.tcz
    libXext.tcz: OK
    Downloading: libXxf86vm.tcz
    libXxf86vm.tcz: OK
    Downloading: libXfixes.tcz
    libXfixes.tcz: OK
    Downloading: libXdamage.tcz
    libXdamage.tcz: OK
    Downloading: bzip2-lib.tcz
    bzip2-lib.tcz: OK
    Downloading: pcre.tcz
    pcre.tcz: OK
    Downloading: libelf.tcz
    libelf.tcz: OK
    Downloading: gamin.tcz
    gamin.tcz: OK
    Downloading: glib2.tcz
    glib2.tcz: OK
    Downloading: libudev.tcz
    libudev.tcz: OK
    Downloading: libpciaccess.tcz
    libpciaccess.tcz: OK
    Downloading: libdrm.tcz
    libdrm.tcz: OK
    Downloading: mesa.tcz
    mesa.tcz: OK
    Downloading: SDL2.tcz
    SDL2.tcz: OK
    Downloading: SDL2_image.tcz
    SDL2_image.tcz: OK
    Downloading: libjpeg-turbo.tcz
    libjpeg-turbo.tcz: OK
    Downloading: v4l-dvb-5.4.83-pcpCore.tcz
    Error on v4l-dvb-5.4.83-pcpCore.tcz
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    Update:
    Getting /dev/cec0 to appear requires using recent RPi kms

    dtoverlay=vc4-kms-v3d-pi4 on a pi4, or dtoverlay=vc4-kms-v3d on Pi2/3 (not recommended on Pi0/1) ... of course, I am trying to get this to work on an old Pi1 ...
    anyway ... adding into config.txt
    dtoverlay=vc4-kms-v3d
    and rebooting results in /dev/cec0 being created.

    As expected - this messes up the display of JiveLite but can research that later. Edit: just needed the Jivelite skin to be changed to one of the HD skins via Settings/Screen (and a keyboard to do the navigation because CEC not working yet)

    It also prevents Squeezelite starting up on HDMI because "b1" does not appear ... but changing it to use the new device allows it to start
    hw:CARD=vc4hdmi,DEV=0
    but no sound comes out .. however, sound does come out with
    iec958:CARD=vc4hdmi,DEV=0
    (perhaps it is related to the sample format)
    It would not start with
    sysdefault:CARD=vc4hdmi

    Now need the v4l2-utils to get the command line tools to try things out.

    Trying loading
    v4l-dvb-5.4.83-pcpCore.tcz
    from pCP repo ...
    Last edited by Paul Webster; 2021-01-27 at 10:55.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  3. #3
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    2,095
    Watching with interest.....

    I have a multi-device 'learning' IR remote controller, and I have an IR receiver attached to my RPi. So when I press the corresponding device key on the remote (to put it into Squeezebox mode), the commands that it sends are the same as those sent by an original Squeezebox remote. In theory, would this CEC setup allow the TV to send those same commands back to the RPi via HDMI (i.e. remote in Squeezebox mode), or is it translating commands coming from the TV device remote keys (i.e. remote in TV mode)?

  4. #4
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    after installing the pcp-dvb modules ... I was then able to install v4l2-utils.tcz

    Code:
    Downloading: libv4l2.tcz
    libv4l2.tcz: OK
    Downloading: v4l2-utils.tcz
    v4l2-utils.tcz: OK
    and I now have cec-ctl command line tool ... next to work out what it does.
    Code:
    tc@testrpi1:~$cec-ctl
    Failed to open /dev/cec0: Permission denied
    tc@testrpi1:~$ sudo cec-ctl
    Driver Info:
            Driver Name                : vc4_hdmi
            Adapter Name               : vc4
            Capabilities               : 0x0000000e
                    Logical Addresses
                    Transmit
                    Passthrough
            Driver version             : 5.4.83
            Available Logical Addresses: 1
            Connector Info             : None
            Physical Address           : 2.0.0.0
            Logical Address Mask       : 0x0000
            CEC Version                : 2.0
            OSD Name                   : ''
            Logical Addresses          : 0
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    Some progress ... at least able to send a command ...
    #First need to configure the device
    sudo cec-ctl --audio --osd-name pCP

    #then can turn on TV (from standby)
    sudo cec-ctl --image-view-on -t0

    Not yet been able to receive something from Tv remote ... but looks promising.

    Edited: see later about using "playback" rather than "audio" (probably would need to be configurable since perhaps not all TVs react in the same way)
    Last edited by Paul Webster; 2021-01-27 at 09:07.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  6. #6
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    I have not been able to get cec-ctl to see messages ... but I suspect this is me rather than it.
    So I decided to try a different route and use cec-client (from Pulse8) on top of the kernel CEC support.

    I probably need to build it on pCP but have not done that yet (not even sure if it is possible).
    I built in on a different RPi running Raspbian with the idea of copying it over to the pCP box ... and in doing so I went through a couple of iterations turning things off.
    But not successful yet.

    I followed the instructions at
    https://github.com/Pulse-Eight/libce...raspberrypi.md
    with one line changed
    from
    cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..
    to
    cmake -DHAVE_CURSES_API=0 -DHAVE_CURSES_TINFO=0 -DHAVE_LINUX_API=1 -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..

    I turned off the ncurses parts because pCP has ncursesw but cec-client looks for ncurses (the "w" is "wide" for Unicode) and I could not work out how to patch it.
    The HAVE_LINUX_API=1 is what turns on the ability in cec-client to use the Linux kernel API.

    Having copied over the cec-client and libcec modules I was still getting errors when trying to run on pCP - it wants libudev.so.1 rather than libudev.so.1 that is on pCP.
    I do not know if that is a result of me building under Raspbian.

    Maybe someone with more knowledge in the area of building things for pCP could give me some ideas.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  7. #7
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    Quote Originally Posted by chill View Post
    Watching with interest.....

    I have a multi-device 'learning' IR remote controller, and I have an IR receiver attached to my RPi. So when I press the corresponding device key on the remote (to put it into Squeezebox mode), the commands that it sends are the same as those sent by an original Squeezebox remote. In theory, would this CEC setup allow the TV to send those same commands back to the RPi via HDMI (i.e. remote in Squeezebox mode), or is it translating commands coming from the TV device remote keys (i.e. remote in TV mode)?
    If this works you would use the regular TV/Video remote which usually has a marked up pause/play/skip buttons.
    The TV receives those commands and translates them to CEC equivalent to relay to the correct device (in this case the RPi).
    That is the theory ... not even getting the commands in yet.
    The TV does not know how to interpret remote signals from a regular Squeezebox remote.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  8. #8
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    Aha ...
    Code:
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_PRESSED (0x44):
            ui-cmd: pause (0x46)
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_PRESSED (0x44):
            ui-cmd: pause (0x46)
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_RELEASED (0x45)
    Received from TV to Playback Device 2 (0 to 8): POLL
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_PRESSED (0x44):
            ui-cmd: electronic-program-guide (0x53)
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_PRESSED (0x44):
            ui-cmd: electronic-program-guide (0x53)
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_RELEASED (0x45)
    Received from TV to Playback Device 2 (0 to 8): POLL
    Received from TV to Playback Device 2 (0 to 8): POLL
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_PRESSED (0x44):
            ui-cmd: device-root-menu (0x09)
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_PRESSED (0x44):
            ui-cmd: device-root-menu (0x09)
    Received from TV to Playback Device 2 (0 to 8): USER_CONTROL_RELEASED (0x45)
    Received from TV to Playback Device 2 (0 to 8): POLL
    Received from TV to Playback Device 2 (0 to 8): POLL
    The "ui-cmd:" lines above correspond to pressing keys on the TV remote while the TV source is set to the RPi.

    I went back to cec-ctl and tried with a different profile ... instead of --audio I went for --playback
    Now I see remote control key presses ... this is very promising.

    Volume Up/Down did not come through but were actioned by the TV directly.
    I suspect that this is configurable ... not sure if in the TV or through a CEC configuration command.
    In the case where the volume being controlled is the local TV (or HDMI connected AMP) this is not a problem - but if JiveLite is being used to control a different LMS player then would need to see the vol up/down requests so that they can be passed to LMS.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  9. #9
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,935
    A bit more stream of consciousness stuff ...

    If someone can get libCEC from Pulse8 (see earlier stuff in this thread) to build and install on pCP ... then there is another tool that can sit on top of it that maps CEC commands to uinput (like keyboard input ... so I think it might work like ir-keytable with Jivelite)
    https://github.com/bramp/libcec-daemon
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  10. #10
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    3,993
    I'll take a look. And I'll pull in the v4l2-utils as well.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

Posting Permissions

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