Github messages for voidlinux
 help / color / mirror / Atom feed
From: Anachron <Anachron@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: LIRC on RPi 3 B+ does not work with IR receivers connected via GPIO
Date: Thu, 19 May 2022 11:05:31 +0200	[thread overview]
Message-ID: <20220519090531.JpEe5XO0TihE6v4wfqfumpwwSf4qq5i8CbYV9fx7qEI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-10905@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 4131 bytes --]

New comment by Anachron on void-packages repository

https://github.com/void-linux/void-packages/issues/10905#issuecomment-1131306568

Comment:
Turns out v4l is used nowadays for IR communication, the package should already be installed (`v4l-utils`).
Based on https://www.instructables.com/Setup-IR-Remote-Control-Using-LIRC-for-the-Raspber/
one needs to add the following options to /boot/config.txt:

```
dtoverlay=gpio-ir,gpio_pin=17
```

Where gpio_pin is the Pin used for communication with the IR. 

Example: https://miro.medium.com/max/1400/1*A2gpUDLyOx903dVUStHFTA.jpeg

I've connected mine to the GPIO number 17, so that's what I enabled.
Reboot, then you have /dev/lirc0 and can run `# rc-keytable` and receive:

```
# LC_ALL=C ir-keytable
Found /sys/class/rc/rc1/ with:
        Name: vc4
        Driver: cec
        Default keymap: rc-cec
        Input device: /dev/input/event1
        Supported kernel protocols: cec
        Enabled kernel protocols: cec
        bus: 30, vendor/product: 0000:0000, version: 0x0001
        Repeat delay = 0 ms, repeat period = 125 ms
Found /sys/class/rc/rc0/ with:
        Name: gpio_ir_recv
        Driver: gpio_ir_recv
        Default keymap: rc-rc6-mce
        Input device: /dev/input/event0
        LIRC device: /dev/lirc0
        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon
        Enabled kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon
        bus: 25, vendor/product: 0001:0001, version: 0x0100
        Repeat delay = 500 ms, repeat period = 125 ms
```

Now you can test your remote via `sudo ir-keytable -c -p all -t`.

```
LC_ALL=C ir-keytable -c -p all -t
Old keytable cleared
Protocols changed to unknown other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp cec imon rc-mm
Can't find xbox-dvd bpf protocol in /etc/rc_keymaps/protocols or /usr/lib/udev/rc_keymaps/protocols
Testing events. Please, press CTRL-C to abort.
623.497051: lirc protocol(necx): scancode = 0x404008 repeat
623.497098: event type EV_MSC(0x04): scancode = 0x404008
623.497098: event type EV_SYN(0x00).
624.302063: lirc protocol(necx): scancode = 0x404010
624.302096: event type EV_MSC(0x04): scancode = 0x404010
624.302096: event type EV_SYN(0x00).
624.361055: lirc protocol(necx): scancode = 0x404010 repeat
624.361088: event type EV_MSC(0x04): scancode = 0x404010
624.361088: event type EV_SYN(0x00).
624.867071: lirc protocol(necx): scancode = 0x40400b
624.867102: event type EV_MSC(0x04): scancode = 0x40400b
624.867102: event type EV_SYN(0x00).
624.926056: lirc protocol(necx): scancode = 0x40400b repeat
624.926090: event type EV_MSC(0x04): scancode = 0x40400b
624.926090: event type EV_SYN(0x00).
625.408074: lirc protocol(necx): scancode = 0x40400e
625.408103: event type EV_MSC(0x04): scancode = 0x40400e
625.408103: event type EV_SYN(0x00).
625.467074: lirc protocol(necx): scancode = 0x40400e repeat
625.467109: event type EV_MSC(0x04): scancode = 0x40400e
625.467109: event type EV_SYN(0x00).
```

(Part 2)

`/usr/share/lirc/contrib/60-lirc.rules` contains:

```
KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", GROUP="lirc", MODE="0660"
```

Adding lirc group: `groupadd lirc`

Reloading udev:

```sh
# udevadm control -R
# udevadm trigger
```

Checking permissions: 
```sh
# ls -lisah /dev/lirc0
164 0 crw-rw---- 1 root lirc 251, 0 19. Mai 10:26 /dev/lirc0
```

Adding group to user: `usermod -aG lirc <USER>`

(Logging out & in)
Checking groups:
```sh
$ groups
... lirc
```

Check features with normal user:
```
$ LC_ALL=C ir-ctl --features
Receive features /dev/lirc0:
 - Device can receive raw IR
 - Can report decoded scancodes and protocol
 - Receiving timeout 12664 microseconds
 - Can set receiving timeout min 1 microseconds, max 1250000 microseconds
Send features /dev/lirc0:
 - Device cannot send
```

(Part 3)
As per https://mauricius.dev/configure-an-infrared-remote-control-with-linux/ 
we now need to map the events to the correct keys manually.

(to be continued)

  parent reply	other threads:[~2022-05-19  9:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-10905@inbox.vuxu.org>
2022-04-15  0:51 ` github-actions
2022-04-29  2:13 ` [ISSUE] [CLOSED] " github-actions
2022-05-18 20:18 ` Anachron
2022-05-19  7:03 ` Anachron
2022-05-19  7:04 ` Anachron
2022-05-19  8:33 ` Anachron
2022-05-19  9:05 ` Anachron [this message]
2022-05-19  9:57 ` Anachron
2022-05-19  9:58 ` Anachron
2022-05-19 10:00 ` Anachron
2022-05-19 10:07 ` Anachron
2022-05-19 10:08 ` Anachron
2022-05-19 10:33 ` Anachron
2022-05-19 10:34 ` Anachron
2022-05-19 10:38 ` Anachron
2023-01-19 23:14 ` zdykstra
2023-01-20  7:44 ` Anachron
2023-01-20  7:45 ` Anachron
2023-01-20 14:03 ` zdykstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220519090531.JpEe5XO0TihE6v4wfqfumpwwSf4qq5i8CbYV9fx7qEI@z \
    --to=anachron@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).