Skip to content
Advertisement

cannot get data from IR sensor on embedded linux using official driver

I run a linux image (made with buildroot and the 4.11.2 kernel provided by the manufacturer) on a nanopi NEO air board with an IR sensor plugged directly on the IR pin. I want to use the sensor to get data from an IR remote control.

I followed the procedure found here, with the same driver, and got the same results, but I cannot get any data from /dev/input/eventX, nor can I get my remote to appear in /proc/bus/input/devices (I tried sending data with the remote control when inserting the driver, or at boot when the driver is builtin, but it obviously didn’t work and I didn’t find much information on that).

I also tried with lirc and evtest / irrecord, but I still can’t get any data and I believe the problem is elsewhere.

I tested the sensor and the remote with an oscilloscope, so I know that the sensor is getting frames from the remote. I’m also fairly sure it’s not a protocol mismatch on the driver’s side.

So I have two questions :

  • Where is the problem here and why can’t I get anything when I run cat /dev/input/eventX ?
  • Is my remote supposed to show in /proc/bus/input/devices and is there a pairing procedure that I should be aware of ?

Please excuse me if those are trivial questions (I never worked on IR before) and thank you in advance.

EDIT

I’ve managed to get my remote to work with one of the old images provided by the manufacturer (kernel 3.4.39-h3) and I’ve noticed that :

  • The driver I’m using doesn’t work (it never goes into the interrupt function that reads the FIFO and the physical addresses associated to the FIFO are always at 0)
  • The driver for the old image registers the following input device in its init function (hardcoded), which I then use to get data from the remote (using cat /dev/input/event1) :
    pi@NanoPi-NEO-Air:~$ cat /proc/bus/input/devices
    ...    
    I: Bus=0019 Vendor=0001 Product=0001 Version=0100
    N: Name="sunxi-ir"
    P: Phys=RemoteIR/input1
    S: Sysfs=/devices/virtual/input/input1
    U: Uniq=
    H: Handlers=sysrq kbd event1 cpufreq_interactive 
    B: PROP=0
    B: EV=100003
    B: KEY=ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe

So now I’m wondering if I should also register that device in the driver I’m using and if so, how should I do it ?

Advertisement

Answer

One of my workmate solved it, the problem was in the dts.
In sun8i-h3-nanopi-neo-air.dts, just activating the IR like this :

&ir {
    status = "okay";
};

isn’t enough, the pins for the IR must be redefined too :

​&ir {
​    pinctrl-names = "default";
​    pinctrl-0 = <&ir_pins_a>;
​    status = "okay";
​};

Hope this will help somebody.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement