CEC Control From VIZIO TV - Change Device Type to Playback (4)

  • TL;DR Summary

    • Running the latest version of LibreELEC (9.2.2) on x86 machine with Pulse Eight USB-CEC adapter.
    • CEC remote control worked great. Then upgraded VIZIO TV to P55-F1. CEC control stopped working.
    • Found forum posts about VIZIO TVs having the same problem with Kodi. Solution was to change CEC device type to Playback (4).
    • Need to change config line <setting id="device_type" value="1" /> (Recording) to <setting id="device_type" value="4" /> (Playback.)
    • Attempted to implement by editing .kodi/userdata/peripheral_data/usb_2548_1002_CEC_Adapter.xml, but change revert on reboot.
    • Attempted to implement by editing /usr/share/kodi/system/peripherals.xml but location is read only.
    • How do I make changes to .kodi/userdata/peripheral_data/usb_2548_1002_CEC_Adapter.xml persist across reboots? or
    • How do I make changes to /usr/share/kodi/system/peripherals.xml or
    • Is there another way to force libCEC to register as a Playback device?



    First time poster, long time user, so be gentle. I've done my best to use the forum and documentation resources to find a solution on my own but haven't found one yet, so I'm hazarding a forum post.


    I have a compatibility issue with a VIZIO TV (P55-F1.) My LibreELEC based HTPC is an Intel based machine using a Pulse Eight USB-CEC Adapter. I've enjoyed CEC control of this HTPC for years with a previous VIZIO TV, but upgraded at the end of 2018 to a new TV (the VIZIO model above) and sound bar (also a VIZIO model SB3651.) That's when I lost CEC control of the HTPC from the TV remote.


    At startup, I get a "Connected: TV - VISIO SB3651" message, but no remote button presses result in any changes to Kodi. I've twiddled with the settings for the CEC adapter in Settings -> System -> Input -> Peripherals -> CEC Adapter without any change.


    I did find it a little odd that the "Connected" message above lists TV and the model of my sound bar together (SB3651.) I suspected that there may be some confusion by the adapter about exactly what device on the bus was the TV, but after reviewing the logs carefully below, I think I am mistaken. Maybe it's just saying it found two CEC compatible devices on the bus? A TV and sound bar.


    Through my own research, I stumbled upon the following two posts (not on this forum.)

    CEC remote on VIZIO P Series Quantum

    CEC Control not working - VIZIO E50-E1 - After TV OS Upgrade (4.0.32.2)


    These both seem to be dancing around the same issue. Namely that the default "device_type" for the CEC adapter to declare itself as is a Recording Device. VIZIO TVs seem to choke on this and prefer Playback Device (device_type = 4.) No such setting exists in the GUI, so it must be made in a config file.


    So, I've been attempting to make this change ever since. These other forum posts point me change the adapter XML config file located at .kodi/userdata/peripheral_data/<adapter name>.xml and/or /usr/share/kodi/system/peripherals.xml. Of course, "peripherals.xml" is in the read-only portion of the file system, so I've focused on the userdata based XML file. In my case that's "usb_2548_1002_CEC_Adapter.xml." I can edit this file via the terminal, make the device type change, and save the edits without issue, but they do not persist across a reboot. Maybe that's because my adapter is a USB device and it gets enumerated on every reboot? I'm not sure, but no matter what I do, I can't make this edit persist. So that's my first real question. How do I edit the adapter config file in .kodi/userdata/peripheral_data/ and have it persist across reboots?


    Note that I have done some additional debugging. I disabled the CEC Adapter through the GUI interface, rebooted, and then operated the adapter via the terminal using cec-client. Using the cec-client command, I was able to force a playback device, which seemed to make a big difference in the log entries. As you'll see from the log link attached, remote button press commands seem to be received on the CEC bus (or at least change the bus polling behavior,) but their source may be inaccurate. Changing to a playback device type shows button release events without duplicates. So this information coupled with the above forum posts makes me think this is the right approach. I don't have a log file to back this up, but if necessary, can probably figure out how to get one via some cec-client command output piping (I'm no linux terminal expert, but I bet I could figure it out.)


    If there is no good way to make changes to the peripheral_data based XML config file persist across reboots, then perhaps the solution is to change the peripherals.xml file located at /usr/share/kodi/system/peripherals.xml? If so, how do I edit the read-only peripherals.xml file? Or is there some other place I should be making edits to ensure things persist across reboots.


    Here's a link to my log file. I enabled debug logging and additionally I enabled component specific logging for libCEC (and the Video component by accident, somehow.) This log represents a normal boot with the CEC adapter configured normally and enabled. The notifications and behavior are consistent with my description above. I'm running the latest LibreELEC (official) 9.2.2 release.


    LibreELEC Log File


    I appreciate any help you can give me, or even some direction to go research. I'll be happy to provide any other info needed. This question may be a better fit over at the Kodi forum, but given that my assumed solution is modifying the device_type setting in these XML files, I thought it best to start here.

    Edited 7 times, last by FirbyKirby: Adding detail and model numbers associated with the existing CEC bus connections. Added a summary section at the top since the post got a bit long and probably boring. Tried to format filepaths and settings correctly so that they don't drown in paragraph text. ().

  • How do I make changes to /usr/share/kodi/system/peripherals.xml or

    Mount overlayfs:

    Code
    1. mkdir -p /storage/.cache/overlayfs/ov_syst /storage/.cache/overlayfs/ov_work_syst
    2. mount -t overlay overlay -o lowerdir=/usr/share/kodi/system,upperdir=/storage/.cache/overlayfs/ov_syst,workdir=/storage/.cache/overlayfs/ov_work_syst /usr/share/kodi/system

    After testing successfully put the lines into http://Autostart.sh [LibreELEC.wiki]

  • mglae , thank you very much. Your instructions were flawless. I was indeed able to edit peripherals.xml with your suggestions.


    Note (for anyone else reading this thread who may be as novice as I am) that I implemented your two code suggestions to mount the overlayfs, copied the peripherals.xml file over to the /storage/.cache/overlayfs/ov_syst directory, edited it with nano and made the changes I wanted (namely I changed the device type from 1 to 4.) I then created /storage/.config/autostart.sh and dropped the mount command you provided into that file and rebooted. Sure enough, reviewing /user/share/kodi/system/peripherals.xml after reboot showed the updated settings properly. :)


    The bad news is that it did precisely nothing to solve my problem. I was hoping (or had made the assumption) that peripherals.xml influenced the creation of the .kodi/userdata/peripheral_data/usb_2548_1002_CEC_Adapter.xml file. It does not. The usb_2548_1002_CEC_Adapter.xml config file still shows device_type = 1 (Recording device.) And my latest log still shows the CEC Adapter registering as a recording device. :(


    OK, so scratch the idea of editing peripherals.xml as a solution to this problem. Anyone else have any ideas how to force the CEC adapter to register as a playback device? Or, how to edit this usb_2548_1002_CEC_Adapter.xml file such that the changes persist across reboots? Or maybe more fundamental then all that, how does this usb_2548_1002_CEC_Adapter.xml file get generated in the first place?


    My latest log file gathered after the change to peripherals.xml is located here, in case I missed something. But from my review, it still shows the CEC adapter registering as a recording device.


    LibreELEC Log File

  • copied the peripherals.xml file over to the /storage/.cache/overlayfs/ov_syst directory, edited it with nano and made the changes I wanted

    Unfortunately this is wrong. After mounting overlayfs simply copy/edit/delete the files in /usr/share/kodi/system.

  • OK, adjusted my implementation, simply editing the /user/share/kodi/system/peripherals.xml file directly, making the change I wanted. As you said, I was able to edit it without any issue and with the mount command in autostart.sh, it was persistent. This is much simpler and cleaner. Thank you very much mglae, you rock.


    Unfortunately, this change still isn't propagated to the .kodi/userdata/peripheral_data/usb_2548_1002_CEC_Adapter.xml file nor do the log files show that the CEC adapter is attempting to register as a playback device (continuing to register as a recording device.) So I'm still looking for any ideas anyone might have on either editing the file in peripheral_data, or otherwise forcing the CEC adapter to register as a playback device using some other method I don't understand.

    Edited 2 times, last by FirbyKirby ().

  • IIRC it's possible to "cp /user/share/kodi/system/peripherals.xml /storage/.kodi/userdata/peripherals.xml" .. make changes to the version on /storage and reboot, and the userdata version overrides the embedded one?

  • Thanks for the recommendation. I gave it a shot tonight. Just to confirm I followed you advice, I copied the peripherals.xml file from /usr/share/kodi/system into the ~/.kodi/userdata/ directory, and then edited the new file, changing the device_type configuration line, saved changes and rebooted.


    Upon reboot, I can confirm that the peripherals.xml file retained the change (the new one in userdata,) but the generated ~/.kodi/userdata/peripheral_data/usb_2548_1002_CEC_Adapter.xml file retained it's default device type setting of 1 (recording device.) So, either the peripherals.xml file placed in the userdata folder is not being used as the primary configuration file, or my assumption that peripherals.xml has anything to do with the CEC adapter configuration is erroneous.


    Maybe it's something about being a USB-CEC adapter? I've noticed that the other forum posts that suggest this solution (changing the device type,) are all in reference to an RPI systems where the CEC adapter is "built-in." Or, it at least gets generated in the peripherals_data folder under a different name then mine (specifically, rpi_2708_1001.xml.) I'm not sure if those adapters are handled by the USB bus like my Pulse Eight USB-CEC adapter must be. But assuming they aren't, myabe they persist across reboots because of that? Further conjecture on this idea. I've noticed that the modified timestamp for the usb_2548_1002_CEC_Adapter.xml file is always the last reboot (whether I edited it or not,) which suggests to me that it doesn't matter what I put there as it'll always get overwritten. It's why I've been referring to that file as "generated." So I've got to figure out where these defaults are coming from.


    For full disclosure, I went ahead and cross posted this question at the Kodi forum. I figure, the more smart minds viewing this question, the better (for me at least.) Here's a link, for documentation purposes.


    CEC Control From VIZIO TV - Change Device Type to Playback (4)

  • Yes, that certainly seems to be the case. But I'm unclear then why the changes I'm making to peripherals.xml, with the overlay fs mounted, are not seeming to propagate to the CEC Adapter during operation? At least, the changes are not reflected in /storage/.kodi/userdata/peripherals_data/usb_2548_1002_CEC_Adapter.xml, nor in the logs. Does anyone know what linkage I may be missing between software components? Certainly, the GUI has a configuration panel, but this specific setting is not there (device type.) Does anyone know where those settings (changed in the GUI) are committed to? I assumed it was one of the above mentioned XML files, but apparently that's not the case. Maybe that's where I need to be looking?

  • Well, that was it. I'm embarrassed the solution was something so trivial. But then again, I've never claimed to be anything but a novice. And I honestly had no idea how to properly stop Kodi from the terminal. So all my changes previously were made to the XML file while Kodi was running.


    To fully document the solution for anyone arriving here, the procedure to enable at least some VISIO TVs to work with LibreELEC/Kodi is as follows.

    1. Stop Kodi via the GUI or terminal with systemctl stop kodi.
    2. Edit the CEC Adapter config file in /storage/.kodi/userdata/peripheral_data/ via the terminal. This configuration file name varies based on the adapter. For example, for RPI, it seems to be rpi_2708_1001.xml, and for a Pulse Eight CEC-Adapter, it seems to be usb_2548_1002_CEC_Adapter.xml.
    3. Change <setting id="device_type" value="1" /> line to <setting id="device_type" value="4" />. To force the adapter to register as a Playback device rather than a Recording device.
    4. Restart Kodi by restarting the machine or running systemctl start kodi in the terminal.

    Note: You may need to restart the TV, or disable/enable CEC in the TV settings for the change to take effect.

  • Well, that was it. I'm embarrassed the solution was something so trivial.

    I'm afraid that stopping kodi before any changes was too automated for us to be mentioned. :-) Fine that it's working now!