How to disable HDMI-CEC on a Raspberry Pi running Raspberry Pi OS?

How to disable HDMI-CEC on a Raspberry Pi running Raspberry Pi OS?

To disable HDMI-CEC (Consumer Electronics Control) on a Raspberry Pi running Raspberry Pi OS, you can follow these steps. HDMI-CEC allows devices connected through HDMI to control each other; however, in some scenarios, you might want to disable this feature to prevent automatic input switching or other remote control issues.

Method 1: Disabling CEC through Boot Configuration

  1. Open the Terminal: You can access the terminal directly if you are using the desktop environment or connect via SSH if you are accessing your Raspberry Pi remotely.

  2. Edit the Config File:

  • Open the config.txt file located in the /boot directory. You can use nano or any other text editor you prefer: bash sudo nano /boot/config.txt
  1. Add/Modify the HDMI-CEC Disable Line:
  • Add the following line to the file to disable HDMI-CEC: hdmi_ignore_cec=1
  • This line tells the Raspberry Pi to ignore CEC commands coming from HDMI.
  1. Save and Exit:
  • Press Ctrl+X to exit, then Y to save changes, and Enter to confirm the filename.
  1. Reboot the Raspberry Pi:
  • Reboot your Raspberry Pi to apply the changes: bash sudo reboot

Method 2: Using raspi-config Tool

If you prefer using a menu-driven approach, you can use the raspi-config tool to disable certain features:

  1. Open raspi-config:
  • Enter the following command in the terminal: bash sudo raspi-config
  1. Navigate the Menu:
  • Use the arrow keys to navigate to Advanced Options.
  • Press Enter to select it.
  1. HDMI Options:
  • Look for an option related to HDMI, such as HDMI Boost or similar. Note that as of certain versions, there might not be a direct option to disable CEC through raspi-config. If no relevant option exists, use Method 1.
  1. Exit and Save:
  • After making changes, navigate to <Finish> and reboot if prompted.

Method 3: Check for Software-Specific Settings

If you are using specific media software like Kodi, Plex, or others, they might have their own CEC control settings within their configuration menus. It’s worth checking these settings if you only need to control CEC behavior in specific applications.

Verification

To verify that CEC has been disabled, you can observe the behavior of your devices (e.g., your TV no longer switches automatically to the Raspberry Pi HDMI input). For a more technical verification, tools like cec-client can be used to probe CEC messages, but typically, observation of device behavior should suffice.

By following these steps, you should be able to disable HDMI-CEC on your Raspberry Pi running Raspberry Pi OS.