User avatar
timg11
Posts: 98
Joined: Sat May 31, 2014 11:14 pm

Installing lirc with GPIO-based interface - irsend won't work

Sat Feb 01, 2020 6:16 pm

Using Raspbian GNU/Linux 9 (stretch) on a Pi 3B.
$ uname -a
Linux Pi3B-TG2 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

I have this IR interface with the IR transmitter and receiver on GPIO 17 and 18 respectively.

The configuration instructions are linked from the page and here.

I've installed lirc (sudo apt-get install lirc),

I edited config.txt (sudo nano /boot/config.txt) to change like this:

Code: Select all

# Uncomment this to enable the lirc-rpi module
dtoverlay=lirc-rpi,gpio_in_pin=18,gpio_out_pin=17
I created /etc/lirc/hardware.conf to look like this:

Code: Select all

LIRCD_ARGS="--uinput --listen"
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
I changed /etc/lirc/lirc_options.conf to look like this:

Code: Select all

[lircd]
nodaemon        = False
driver          = default
device          = /dev/lirc0
I stopped and restarted lirc:

Code: Select all

pi@Pi3B-TG2:/etc/lirc $ sudo /etc/init.d/lircd stop
[ ok ] Stopping lircd (via systemctl): lircd.service.
pi@Pi3B-TG2:/etc/lirc $ sudo /etc/init.d/lircd start
[ ok ] Starting lircd (via systemctl): lircd.service.
Based on the guidance at lirc.org I should be able to get a response of installed drivers, etc from ir-keytable.

Expected response as shown in example from lirc.org:

Code: Select all

    $ ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event11) with:
        Driver em28xx, table rc-pinnacle-pctv-hd
        Supported protocols: NEC RC-5 RC-6
        Enabled protocols: RC-5

Actual response from my installation:

Code: Select all

pi@Pi3B-TG2:~ $ ir-keytable
Found /sys/class/rc/rc1/ (/dev/input/event3) with:
        Driver gpio_ir_recv, table rc-rc6-mce
        Supported protocols: other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
        Enabled protocols: lirc
        Name: gpio_ir_recv
        bus: 25, vendor/product: 0001:0001, version: 0x0100
        Repeat delay = 500 ms, repeat period = 125 ms
Couldn't find any node at /sys/class/rc/rc0/input*.



Cannot send with irsend:

Code: Select all

pi@Pi3B-TG2:~ $ sudo irsend SEND_ONCE  RD6831 KEY_OPEN

hardware does not support sending
Error running command: Input/output error
Trying other Test and debug tools from lirc.org:

Code: Select all

pi@Pi3B-TG2:~ $ mode2
Using driver default on device /dev/lirc0
Cannot initiate device /dev/lirc0

Code: Select all

pi@Pi3B-TG2:~ $ lirc-config-tool
Output dir:
    /home/pi/.config/lirc
Scanned /etc/lirc/lircd.conf
    Found 0 key symbols.
Created:
    mode_browser.lircrc
    mode_numeric.lircrc
    mplayer.lircrc
    mythtv.lircrc
    vlc.lircrc
    vlc_popupmenu_mode.lircrc
    volume_alsa.lircrc
    volume_mythtv.lircrc
    volume_pulse.lircrc


lirc-setup

Code: Select all

pi@Pi3B-TG2:~ $ lirc-setup
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
Traceback (most recent call last):
  File "/usr/bin/lirc-setup", line 10, in <module>
    import mvc_control
  File "/usr/lib/arm-linux-gnueabihf/python3/dist-packages/lirc/mvc_control.py", line 16, in <module>
    import mvc_view
  File "/usr/lib/arm-linux-gnueabihf/python3/dist-packages/lirc/mvc_view.py", line 12, in <module>
    gi.require_version('Vte', '2.91')
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 118, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Vte not available


From the lirc.org configuration guide:

Code: Select all

pi@Pi3B-TG2:~ $ sudo systemctl status lircd.socket lircd.service
● lircd.socket
   Loaded: loaded (/lib/systemd/system/lircd.socket; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-02-01 11:51:48 CST; 1h 36min ago
   Listen: /run/lirc/lircd (Stream)

Feb 01 11:51:48 Pi3B-TG2 systemd[1]: Listening on lircd.socket.

● lircd.service - Flexible IR remote input/output application support
   Loaded: loaded (/lib/systemd/system/lircd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-02-01 11:51:50 CST; 1h 36min ago
     Docs: man:lircd(8)
           http://lirc.org/html/configure.html
 Main PID: 481 (lircd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/lircd.service
           └─481 /usr/sbin/lircd --nodaemon

Feb 01 11:51:51 Pi3B-TG2 lircd[481]: lircd-0.9.4c[481]: Warning: Failed to initialize hardware
Feb 01 11:51:51 Pi3B-TG2 lircd[481]: lircd-0.9.4c[481]: Notice: accepted new client on /var/run/lirc/lircd
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Notice: lircd(default) ready, using /var/run/lirc/lircd
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Notice: accepted new client on /var/run/lirc/lircd
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Info: [b]Cannot configure the rc device for /dev/lirc0
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Error: could not get file information for /dev/lirc0
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: default_init(): No such file or directory[/b]
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Warning: Failed to initialize hardware
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Notice: accepted new client on /var/run/lirc/lircd
Feb 01 11:51:51 Pi3B-TG2 lircd-0.9.4c[481]: Notice: accepted new client on /var/run/lirc/lircd
pi@Pi3B-TG2:~ $
Last edited by timg11 on Sat Feb 01, 2020 10:01 pm, edited 2 times in total.

User avatar
timg11
Posts: 98
Joined: Sat May 31, 2014 11:14 pm

Re: Installing lirc with GPIO-based interface - ir-keytable not found

Sat Feb 01, 2020 8:01 pm

Maybe getting on the right track - this article says kernel 4.19 changes things:

Changes to config.txt

Code: Select all

dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17

I am able to get mode2 to work for receiving:

sudo mode2 -d /dev/lirc1
push button on remote…..

Code: Select all

pi@Pi3B-TG2:~ $ sudo mode2 -d /dev/lirc1
Using driver default on device /dev/lirc1
Trying device: /dev/lirc1
Using device: /dev/lirc1
Running as regular user pi
pulse 933
space 857
pulse 919
space 857
pulse 920
^C
I then edit lirc_options.conf to
device = lirc0

so I can use the output. I restart lirc. Then I try irsend:

Code: Select all

pi@Pi3B-TG2:~ $ sudo irsend SEND_ONCE  RD6831 KEY_OPEN

hardware does not support sending
Error running command: Input/output error
pi@Pi3B-TG2:~ $
I am looking for a fix to that problem now...

Modules are present:

Code: Select all

pi@Pi3B-TG2:~ $ find /lib/modules/4.19.66-v7+/ -name "gpio-ir*"
/lib/modules/4.19.66-v7+/kernel/drivers/media/rc/gpio-ir-recv.ko
/lib/modules/4.19.66-v7+/kernel/drivers/media/rc/gpio-ir-tx.ko


pi@Pi3B-TG2:~ $ lsmod | grep gpio
gpio_ir_recv           16384  0
gpio_ir_tx             16384  0
pi@Pi3B-TG2:~ $



pi@Pi3B-TG2:~ $ ls -al /dev/lirc*
crw-rw---- 1 root video 252, 0 Feb  1 14:01 /dev/lirc0
crw-rw---- 1 root video 252, 1 Feb  1 14:01 /dev/lirc1
pi@Pi3B-TG2:~ $

User avatar
timg11
Posts: 98
Joined: Sat May 31, 2014 11:14 pm

Re: Installing lirc with GPIO-based interface - irsend won't work

Sun Feb 02, 2020 7:23 pm

I did a clean flash from 2018-06-27-raspbian-stretch.img.
I now have

Code: Select all

 $ cat /etc/debian_version
9.4
$ uname -a
Linux Pi3-TG2 4.14.50-v7+ #1122 SMP Tue Jun 19 12:26:26 BST 2018 armv7l GNU/Linux
I am now able to use lirc successfully. Lots of time struggling with 4.19, finally had to abandon.

Another important discovery, that appears to be necessary even with 4.14 kernel. I was still getting "irsend: hardware does not support sending"

This article provides a different way to start the LIRC daemon in the last post.

"...run following command in console:

Code: Select all

sudo lircd --device /dev/lirc0 
to start LIRC daemon..."

If you get the error "lircd: there seems to already be a lircd process", then precede with

Code: Select all

sudo /etc/init.d/lircd stop

Return to “Troubleshooting”