How to use the IR Receiver on Libre Computer Boards

The IR receivers on Libre Computer boards are supported through the standard Linux Infrared Remote Control (LIRC) stack.

Below are some resources on setting up LIRC.

To get raw signals to quickly test the IR, run evtest.

Hello, I’ve been trying to get the IR receiver to work. Does it need to be enabled, like on the raspberry pi? I couldn’t find any documentation on what I would need to enable. evtest runs, but it doesn’t seem to pick up my remote.

Which board are you using?

The Le Potato AML-S905X-CC

This works out of the box. You need to select the right device with evtest.

I’m running evtest on a fresh install of Raspbian. It says that it’s testing and waiting for input, but pointing an IR remote at the receiver and pushing buttons yields no results.

You have to select the right device with evtest. Make sure your remote is IR and not some other protocol like BT.

/dev/input/event6, which is meson-ir.

The remote is the remote from an older television. It is definitely IR and not Bluetooth

It has to be a supported carrier frequency and remote code. Make and model?

CurtisMathes Tronics

  1. Do you know the remote works?
  2. How do you know it’s IR remote and not RF?
  3. Take your cell phone and check if you see anything when you press on the remote to check if it is IR. CMOS sensors are somewhat IR sensitive so you should see flickering if there’s a working IR LED in the remote.

The remote works to turn on the television it came with.

I know it’s IR because it’s an older remote and television from being IR was used in remotes, and also it has a bulb on the front and checking the bulb with my phone camera and pressing a button I can see it flashing in my phone’s camera app.

Test the voltage on the GPIO line from the IR. It should change with IR signal. Make sure you have all the keytables for IR enabled so it can detect as many protocols as possible.

How do I enable all the keytables for IR?

I would like to connect TSOPxx IR receiver to GPIO header pin to receive IR signals due to Le Potato onboard IR is not suitable for my enclosure. Do I need to create a custom device overlay for that purpose? Couldn’t find information for this.

Target: Enable IR receiver on Le Potato (AML-S905X-CC) using Pin 35 (GPIOX_7) of the 40-pin header (referred to as 7J1). Overlay Name: gpio-ir-7j1-35

Prerequisites:

  • git installed (sudo apt install git or equivalent).
  • make installed (often part of build-essential: sudo apt install build-essential or equivalent).
  • Device Tree Compiler installed (sudo apt install device-tree-compiler or equivalent).

Steps:

  1. Clone the Repository: Obtain the source code for libretech-wiring-tool:
git clone https://github.com/libre-computer-project/libretech-wiring-tool.git
cd libretech-wiring-tool
  1. Create the .dts File: Create the device tree source file for the overlay within the repository structure.
  • Path: libre-computer/aml-s905x-cc/dt/gpio-ir-7j1-35.dts
  • Command (from repo root):
mkdir -p libre-computer/aml-s905x-cc/dt
nano libre-computer/aml-s905x-cc/dt/gpio-ir-7j1-35.dts
  • Paste the following content into the nano editor:
/dts-v1/;
/plugin/;

/*
 * Device Tree Overlay for Le Potato (AML-S905X-CC)
 * Enables GPIO IR Receiver on Header 7J1 Pin 35 (GPIOX_7)
 * Pinctrl: bias-pull-up inside mux, input-enable removed per feedback.
 *
 * Uses the standard Linux 'gpio-ir-receiver' kernel driver/module.
 * Connect the IR receiver's DATA pin to Header 7J1 Pin 35 (GPIOX_7).
 * Connect VCC to 3.3V (Pin 1 or 17) and GND to GND (e.g. Pin 6, 9, 14...).
 *
 * Based on Libre Computer mapping: GPIOX_7 = Pin 35 on 40P Header (7J1)
 * Filename: gpio-ir-7j1-35.dts (for libretech-wiring-tool)
 */

/ {
	// Compatible with the base device tree for Le Potato
	compatible = "amlogic,s905x", "amlogic,meson-gxl";

	// Fragment 1: Define the IR receiver device node
	fragment@0 {
		target-path = "/"; // Add node to the root
		__overlay__ {
			// Unique node name incorporating header and pin
			ir_recv_7j1p35: ir-receiver@7j1p35 {
				compatible = "gpio-ir-receiver";

				// Reference the GPIO pin: Controller (&gpio), Pin (GPIOX_7), Flags (1 = Active Low)
				// GPIOX_7 -> Kernel Pin 87. Active low (1) for typical IR receivers.
				gpios = <&gpio 87 1>; // GPIOX_7 (mapped to Pin 35), Active Low (1)

				// Reference the pin control configuration defined below
				pinctrl-names = "default";
				pinctrl-0 = <&ir_recv_7j1p35_pins>; // Link to the pinctrl state

				status = "okay"; // Enable this device
			};
		};
	};

	// Fragment 2: Configure the pin control state for the GPIO
	fragment@1 {
		// Target the peripheral pin controller node. '&pinctrl_periphs' is typical for S905X.
		target = <&pinctrl_periphs>;
		__overlay__ {
			// Define the pin control state for the IR receiver pin 7J1 Pin 35 (GPIOX_7)
			ir_recv_7j1p35_pins: ir-recv-7j1p35-pins { // Unique pinctrl node name

				// Define the pin multiplexing and configuration within mux block
				mux {
					pins = "GPIOX_7";         // Specify pin for muxing
					bias-pull-up;             // Apply pull-up (placed here per user request)
				};
			};
		};
	};
};
  • Save the file and exit nano (Ctrl+O, Enter, Ctrl+X).
  1. Build the Device Tree Overlays: From the root directory of the cloned libretech-wiring-tool repository, run make. This compiles the .dts files into binary .dtbo overlays using dtc.
# Ensure you are in the libretech-wiring-tool directory
make
  1. Verify Overlay Availability (using the local ldto): Use the ldto shell script located in the repository’s root directory to check if the newly compiled overlay is recognized.
# Run with sudo from the libretech-wiring-tool directory
sudo ./ldto list
# Confirm that `gpio-ir-7j1-35` appears in the list for `aml-s905x-cc`
  1. Test Activation (enable): Use the enable command with the ldto script. This applies the overlay temporarily until the system reboots. Please note that if used with busses, the bus numbers might not match up with the merge command of ldto script.
# Run with sudo from the libretech-wiring-tool directory
sudo ./ldto enable gpio-ir-7j1-35
  1. Verify Functionality:
  • Wiring: Confirm the IR receiver DATA is connected to Pin 35 (header 7J1).
  • Kernel Log: dmesg | grep -i ir
  • Input Device: ls /dev/input/by-path/*-ir-receiver-*
  • Test Tool: Use ir-keytable:
sudo apt update && sudo apt install ir-keytable # If needed
sudo ir-keytable # Status
sudo ir-keytable -t # Test receiving`Confirm you see scan codes when pressing remote buttons.
  1. Merge Overlay Permanently (merge):
  • Only after confirming the overlay works correctly via steps 5-6, use the merge command.
  • This command makes the combined device tree (base + overlay) the new default, effectively replacing or redirecting U-Boot to use the merged version permanently, rather than relying on the temporary override path used by enable.
# Run with sudo from the libretech-wiring-tool directory
# *** Ensure the overlay was tested successfully first! ***
sudo ./ldto merge gpio-ir-7j1-35
  1. Reboot for Testing: Reboot your Le Potato. U-Boot should now find and pass the combined device tree (base + overlay) created in the previous step to the Linux kernel. sudo reboot