IR Remote control on Jetson

Has anybody had any luck using a Windows Media Center compatible remote (and IR receiver) to control the launching of programs on Jetson?

I tried :
sudo apt-get install lirc

Selecting “Windows Media Center Transceivers/Remotes (all)” as the remote control, and “None” for the IR transmitter

The terminal shows :
Preconfiguring packages …
Selecting previously unselected package lirc.
(Reading database … 144987 files and directories currently installed.)
Preparing to unpack …/lirc_0.9.0-0ubuntu5_armhf.deb …
Unpacking lirc (0.9.0-0ubuntu5) …
Processing triggers for man-db (2.6.7.1-1) …
Processing triggers for doc-base (0.10.5) …
Processing 1 added doc-base file…
Processing triggers for ureadahead (0.100.0-16) …
Setting up lirc (0.9.0-0ubuntu5) …
ls: cannot access /lib/modules/3.10.40-g8c4516e/kernel/drivers/staging/media/lirc: No such file or directory

  • Loading LIRC modules [ OK ]
  • Unable to load LIRC kernel modules. Verify your
  • selected kernel modules in /etc/lirc/hardware.conf
    Processing triggers for ureadahead (0.100.0-16) …

Then I do :
sudo service lirc restart

But I get :

  • Stopping remote control daemon(s): LIRC [ OK ]
  • Loading LIRC modules [ OK ]
  • Unable to load LIRC kernel modules. Verify your
  • selected kernel modules in /etc/lirc/hardware.conf

cat /etc/lirc/hardware.conf
REMOTE=“Windows Media Center Transceivers/Remotes (all)”
REMOTE_MODULES=“lirc_dev mceusb”
REMOTE_DRIVER=“”
REMOTE_DEVICE=“/dev/lirc0”
REMOTE_SOCKET=“”
REMOTE_LIRCD_CONF=“mceusb/lircd.conf.mceusb”
REMOTE_LIRCD_ARGS=“”
TRANSMITTER=“None”
TRANSMITTER_MODULES=“”
TRANSMITTER_DRIVER=“”
TRANSMITTER_DEVICE=“”
TRANSMITTER_SOCKET=“”
TRANSMITTER_LIRCD_CONF=“”
TRANSMITTER_LIRCD_ARGS=“”
START_LIRCD=“true”
LOAD_MODULES=“true”
LIRCMD_CONF=“”
FORCE_NONINTERACTIVE_RECONFIGURATION=“false”
START_LIRCMD=“”

I’m not even sure that it is registering the IR receiver, because it doen not show up in the list of devices, and irw does not respond to any inputs from the remote.

cat /proc/bus/input/devices
I: Bus=0003 Vendor=045e Product=0095 Version=0111
N: Name=“Microsoft Microsoft IntelliMouse® Explorer”
P: Phys=usb-tegra-ehci.2-1.3/input0
S: Sysfs=/devices/platform/tegra-ehci.2/usb2/2-1/2-1.3/2-1.3:1.0/input/input0
U: Uniq=
E: Enabled=0
H: Handlers=event0 icfboost
B: PROP=0
B: EV=17
B: KEY=1f0000 0 0 0 0 0 0 0 0
B: REL=1c3
B: MSC=10

I: Bus=0003 Vendor=04f2 Product=0414 Version=0111
N: Name=“Chicony USB Keyboard”
P: Phys=usb-tegra-ehci.2-1.4/input0
S: Sysfs=/devices/platform/tegra-ehci.2/usb2/2-1/2-1.4/2-1.4:1.0/input/input1
U: Uniq=
E: Enabled=0
H: Handlers=sysrq kbd event1 icfboost
B: PROP=0
B: EV=120013
B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=04f2 Product=0414 Version=0111
N: Name=“Chicony USB Keyboard”
P: Phys=usb-tegra-ehci.2-1.4/input1
S: Sysfs=/devices/platform/tegra-ehci.2/usb2/2-1/2-1.4/2-1.4:1.1/input/input2
U: Uniq=
E: Enabled=0
H: Handlers=kbd event2 icfboost
B: PROP=0
B: EV=13
B: KEY=2000000 387a d801d001 1e0000 0 0 0
B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name=“tegra-rt5639 Headphone Jack”
P: Phys=ALSA
S: Sysfs=/devices/platform/tegra-snd-rt5639.0/sound/card1/input3
U: Uniq=
E: Enabled=0
H: Handlers=event3
B: PROP=0
B: EV=21
B: SW=4

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name=“gpio-keys.4”
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys.4/input/input4
U: Uniq=
E: Enabled=0
H: Handlers=kbd event4 icfboost
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0

I saw this in your terminal messages:

ls: cannot access /lib/modules/3.10.40-g8c4516e/kernel/drivers/staging/media/lirc: No such file or directory

This means you need to add the kernel module “lirc”. User space components won’t be enough without kernel support.

Please excuse my noobness, but how do I do that?

Kernel and kernel module compiling will be the same on Jetson/L4T as other systems, so bear in mind that if you find information on the web the information is probably correct for what you are doing.

That said, there are some preconditions to satisfy because you would be building something as a module to fit into an existing kernel. So here are the basic start requirements:

  • You need the kernel source, and it must match your running system. I'm not sure which version you are running, so what is the output of "head -n1 /etc/nv_tegra_release"?
  • Next, the kernel source must be configured exactly as your running system is. On your Jetson this would show up as /proc/config.gz, and when you have your kernel source, this can be copied to the base directory of kernel source, gunzip to decompress, and renamed ".config".
  • You might have to apt-get install package "ncurses-devel" (or maybe it is "libncurses5-dev") to run "make menuconfig", manually load ".config", and then hunt for and enable whichever modules are used for the "lirc"...some sort of infra-red remote control module. Possibly one module will require another...until what you need is all enabled as a module (one can build directly into a kernel but a module lets you keep your existing kernel and simply copy the module over to the right place).
  • With the kernel source configured as your running kernel then modified to add modules for your IR remote, you can build modules ("make modules"), test insmod of the module, and if it works, copy it to the right place. Details can be added as you progress.

Sorry for the delay; too much turkey :)

First off, I am using R21

R21 (release), REVISION: 1.0, GCID: 4584307, BOARD: ardbeg, EABI: hard, DATE: Wed Oct 8 02:31:33 UTC 2014

For those interested, the master index into L4T:
https://developer.nvidia.com/linux-tegra

For you, specifically Tegra K1, R21.1:
https://developer.nvidia.com/linux-tegra-rel-21

You need the kernel from the R21.1 page:
http://developer.download.nvidia.com/mobile/tegra/l4t/r21.1.0/sources/kernel_src.tbz2

I suggest you save this compressed archive on your host machine for future use. Also copy this to your Jetson (there will be times you need to use sudo…or “sudo -s” for a continuous root shell). If needed make this directory; if not place the file there on Jetson:

/usr/src/kernels/

For the copy on Jetson, unpack:

cd /usr/src/kernels
bunzip2 < kernel_src.tbz2 | tar xv

This will create a subdirectory named after the specific kernel with its checksum. You can remove the kernel_src.tbz2 now if you wish, but if space allows, it might be useful to keep a pristine copy. cd into this directory. This gives you an exact copy of the same kernel you are running.

To configure this kernel to the running kernel (assumes you are in this newly created kernel source top directory):

cp /proc/config.gz .
gunzip config.gz
mv config .config

A typical and easy to use menu for setting configuration is via “make menuconfig”. This does require the ncurses system for rendering fake graphics on text mode. The name of the package will be either “ncurses-devel” or “libncurses5-dev”. So, this should install what is needed…try each, I forget the exact name, one should work unless you need to uncomment repositories in /etc/apt/sources.list:

apt-get install ncurses-devel
<i>OR</i>
apt-get install libncurses5-dev

Having this will allow you to run “make menuconfig”. A menu will pop up. Just to be sure the .config file is loaded, cursor down to the bottom, tell it to load file “.config”.

If you were to save and exit the menuconfig, this kernel will be an exact match to your running kernel once you do one more thing. You will want to be sure that if you scroll down to general setup and go into this with the “enter” key that item “Local version” matches the suffix you get from the output of “uname -r”. My R19.3 ends with “-gf455cd4”. The suffix on R21.1 will be similar, you should make sure that “Local version” (second item down on the list) matches this suffix. If you had to add this hit “save” and save to “.config”. Your kernel source is ready. You can run “make menuconfig” at any time and explore driver options.

So here comes the fun part! You need to go through the menu and figure out the IR control features which provide this lirc module somewhere in “Device Drivers” and enable it as a module. The “M” key enables as a module, “Y” is integrated, “N” is “no feature”. If there is a dependency of one feature on another then enabling one feature might show features which were previously hidden. If you are satisfied you found the module feature, check as “M” for module, save to “.config”, and exit the menu. Run “make modules”. When you get there you can use “find . -name ‘modulewhatever.ko’” and do a recursive search for the driver file…cd there, and “insmod lirc.ko” (I used “modulewhatever.ko” because it might be more than one module). If it works, you can copy it to the right place and have your driver. Ask again when you get that far.

Wow, that is a lot of instruction (but I needed it).
I got that far, and can see some remote-control modules in the build dir :

Jetson:/usr/src/kernels/kernel/drivers/media/rc$ dir *.o
20 -rw-r–r-- 1 root root 17308 Dec 3 21:39 ir-lirc-codec.mod.o
112 -rw-r–r-- 1 root root 114600 Dec 3 21:35 ir-lirc-codec.o
20 -rw-r–r-- 1 root root 17268 Dec 3 21:39 lirc_dev.mod.o
144 -rw-r–r-- 1 root root 143736 Dec 3 21:35 lirc_dev.o
28 -rw-r–r-- 1 root root 24968 Dec 3 21:39 mceusb.mod.o
156 -rw-r–r-- 1 root root 157952 Dec 3 21:35 mceusb.o

I will work on integrating the new modules tomorrow.
Thanks again!

The actual module which you can test by direct “insmod” will have a file name ending in “.ko”, so something like “insmod lirc.ko”. The “.o” are just a side product while creating it.

In that case, it is probably one or more of :

./drivers/media/rc/ir-lirc-codec.ko
./drivers/media/rc/lirc_dev.ko
./drivers/media/rc/mceusb.ko

I’ll give it a try.

I get an error with insmod :

Jetson:/usr/src/kernels/kernel/drivers/media/rc$ sudo insmod lirc_dev.ko
insmod: ERROR: could not insert module lirc_dev.ko: Invalid module format

Interesting. If one module depended on another, you would probably get a message about missing symbols (since the other module would be prerequisite and insert order would fix the issue).

Module format seems like an odd error. Did you build everything on the Jetson itself? This is easiest, and cross-compile creates a lot of issues.

Also, since one module can depend on another, do all of these modules give that invalid format error?

The build took place on the Jetson, and the same error occurs for insmod for each of the three *.ko files.
What about modprobe instead of insmod?

I ran modinfo and noticed that vermagic was set to “3.10.40g8c4516e”; i.e. I had left out the “-” in front of the “g8c4516e”. So, I re-did everything from scratch.

When I issue the insmod command on lirc_dev.ko, it doesn’t complain.
However, I get an “Unknown symbol” error for mceusb.ko and ir-lirc-codec.ko :

insmod: ERROR: could not insert module ir-lirc-codec.ko: Unknown symbol in module

Unknown symbol just means a dependency from another module. This is where modprobe would help, but they’d need to be installed…if you are testing prior to install it would kind of defeat the purpose. If you insmod the “.ko” files for lirc in the proper order it should work…had it been a single module then it would have worked anyway. The missing symbol might be a hint as to which one it belongs to. If you were to run a diff command between the “/proc/config.gz” and the “.config” produced with lirc updates, you’d find the names (not necessarily file name) of what was enabled differently as a hint.

Order does not matter; only the lirc_dev.ko can be insmod’d; mceusb.ko and ir-lirc-codec.ko cannot.
The diff of the configs (below) shows the 3 new modules (as expected), and a list of decoders.
The decoders all correspond to ir--decoder.c and ir--decoder.o files.

dmesg is giving me the list of Unknown symbols.
they correspond to EXPORT_SYMBOL declarations in ir-raw.c, which is in the top-line of the Makefile
rc-core-objs := rc-main.o ir-raw.o

[ 3896.275547] ir_lirc_codec: Unknown symbol rc_core_debug (err 0)
[ 3896.275591] ir_lirc_codec: Unknown symbol ir_raw_handler_register (err 0)
[ 3896.275609] ir_lirc_codec: Unknown symbol ir_raw_handler_unregister (err 0)

cp /proc/.config.gz temp.gz
gunzip temp.gz
diff temp .config | grep -v “#”
35c35
< CONFIG_LOCALVERSION=“”

CONFIG_LOCALVERSION=“-g8c4516e”
2537c2537


CONFIG_MEDIA_RC_SUPPORT=y
2553a2554,2576
CONFIG_RC_CORE=y
CONFIG_RC_MAP=y
CONFIG_RC_DECODERS=y
CONFIG_LIRC=m
CONFIG_IR_LIRC_CODEC=m
CONFIG_IR_NEC_DECODER=y
CONFIG_IR_RC5_DECODER=y
CONFIG_IR_RC6_DECODER=y
CONFIG_IR_JVC_DECODER=y
CONFIG_IR_SONY_DECODER=y
CONFIG_IR_RC5_SZ_DECODER=y
CONFIG_IR_SANYO_DECODER=y
CONFIG_IR_MCE_KBD_DECODER=y
CONFIG_RC_DEVICES=y
CONFIG_IR_MCEUSB=m
2672a2696
CONFIG_VIDEO_IR_I2C=y
3124a3149

Has anybody tried this on their own Jetson?
The modules I enabled in menuconfig are as follows :

Device Drivers → Multimedia Support

# Remote Controller support -> Y
# Remote controller decoders
  # LIRC interface driver -> M
# Remote Controller devices -> Y
  # Windows Media Center -> M

I have not tried, but I also wonder if perhaps there is a user space package required. The kernel drivers give an app the ability to deal with the commands, but there must be such an app to start with.

I finally got this working, but I had to install the Grinch kernel.

There just seems to be no way (that I can find) to get the R21.1 Jetson kernel to recognize that an IR receiver is a valid input. It shows up in lsusb and in dmesg, but it does not show up in /proc/bus/input/devices, nor in /sys/class/rc, nor in /dev/input.

I also could not find a way around the “Unknown symbol” error when using insmod on the newly built modules : mseusb.ko, and ir-lirc-codec.ko.

Between that, and trying to get gst-streamer to work, I am finding these Jetsons to be very frustrating.

Just wanted to chime in on this old post and say mceusb is working just fine on Jetson its all about the modules order in which you insmod. They must go in this order:

insmod /system/lib/modules/lirc_dev.ko
insmod /system/lib/modules/ir-mce_kbd-decoder.ko
insmod /system/lib/modules/ir-rc6-decoder.ko
insmod /system/lib/modules/ir-lirc-codec.ko
insmod /system/lib/modules/mceusb.ko

And in ubuntu you can use irrecord and lirc to configure your remote as /dev/input either as a keyboard or in kodi aS a standard mce remote (configuration in dpkg reconfigure lirc use /dev/input and keyboard or windows mce remote for kodi)

I also have this working in Android with a custom Vendor_Product_.kl :)

I was looking for some insight on using Streamzap IR remote. I compiled the modules for lirc and streamzap and keymaps but I get unknown symbol errors when I try to insmod any of the modules besides lirc_dev.

[17871.326456] streamzap: Unknown symbol ir_raw_event_handle (err 0)
[17871.326481] streamzap: Unknown symbol ir_raw_event_store (err 0)
[17871.326513] streamzap: Unknown symbol rc_register_device (err 0)
[17871.326532] streamzap: Unknown symbol rc_free_device (err 0)
[17871.326545] streamzap: Unknown symbol rc_allocate_device (err 0)
[17871.326565] streamzap: Unknown symbol ir_raw_event_store_with_filter (err 0)
[17871.326573] streamzap: Unknown symbol rc_unregister_device (err 0)
[17888.041813] rc_streamzap: Unknown symbol rc_map_register (err 0)
[17888.041843] rc_streamzap: Unknown symbol rc_map_unregister (err 0)
[

I don’t seem to be able to find any of the symbols from rc_core. I can not compile this as a module. Is rc_core not compiled into Grinch 21.3.4-gc017b03? It indicated [Y] in the .config file.

Any help would be appreciated.