AnaviTechnology / anavi-docs

Documents for all ANAVI open source hardware products
http://anavi.technology/
64 stars 34 forks source link

Unable to send IR code #37

Open grosch opened 2 years ago

grosch commented 2 years ago

I'm trying to get started with the Anavi Infrared pHAT on my PI. I was able to learn the IR codes, but I can't send. When I try to send a code via irsend SEND_ONCE HunterDouglasBlinds KEY_UP it says:

hardware does not support sending Error running command: Input/output error

I have this in my config files:

pi@piir:~ $ grep -v ^\# /etc/modules
i2c-dev
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17 

pi@piir:~ $ grep -v ^\# /etc/lirc/hardware.conf 
LIRCD_ARGS="--uinput"
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
LIRCD_CONF=""
LIRCMD_CONF=""

pi@piir:~ $ grep -v ^\# /boot/config.txt
dtparam=audio=on
[pi4]
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17

pi@piir:~ $ grep -v ^\# /etc/lirc/lircd.conf.d/HunterDouglasBlinds.lircd.conf 

begin remote

  name  HunterDouglasBlinds
  driver devinput
  bits           56
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   8
  pre_data       0x0
  gap          29867
  toggle_bit_mask 0x0
  frequency    38000

      begin codes
          KEY_UP                   0xE501000000262D
          KEY_DOWN                 0xC2010000000646
      end codes

end remote
leon-anavi commented 2 years ago

Hi @grosch,

On which distributions and release are you using ANAVI Infrared pHAT on your Raspberry Pi? On Debian based distributions, including the Raspberry Pi OS, you can retrieve it with the command lsb_release -a.

There were some major changes in the way LIRC works with Raspbian Buster as explained in details here: https://blog.anavi.technology/?p=1

I see in some of your configuration lirc_rpi but lirc_rpi, the Linux kernel module provided with Raspbian before, was replaced with gpio-ir and gpio-ir-tx therefore the setup is as explained in the latest version of the user's manual: https://github.com/AnaviTechnology/anavi-docs/blob/master/anavi-infrared-phat/anavi-infrared-phat.md#chapter-3-software

Best regards, Leon

grosch commented 2 years ago

@leon-anavi I'm honestly struggling with the docs because this stuff is all new to me, and so I don't know what's out of date and what's not, nor what most of these config items do, so I'm just blindly doing copy/paste of the configurations :(

$ lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 10 (buster) Release: 10 Codename: buster

I do see in my config.txt that I have those newer names. Should I just delete the last two lines of /etc/modules?

I forgot to include this config file:

pi@piir:~ $ grep -v ^\# /etc/lirc/lirc_options.conf

[lircd]
nodaemon        = False
driver          = default
device          = /dev/lirc0
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
plugindir       = /usr/lib/arm-linux-gnueabihf/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600

[lircmd]
uinput          = False
nodaemon        = False
grosch commented 2 years ago

OK, I rebuilt from source as shown in your URL and I commented out the last two lines of /etc/modules. Now when I send I get this different error:

transmission failed Error running command: Input/output error

leon-anavi commented 2 years ago

Hi @grosch,

Should I just delete the last two lines of /etc/modules?

Yes, because you are using Raspbian GNU/Linux 10 (buster).

Have you applied lirc-gpio-ir-0.10.patch when building LIRC as explained in chapter Setting up LIRC?

Have you restarted the Raspberry Pi after changing /boot/config.txt and setting /dev/lirc0 at /etc/lirc/lirc_options.conf?

Thanks, Leon

grosch commented 2 years ago

Hi @leon-anavi,

Yes, I applied the patch and I've rebooted more then once since doing that.

leon-anavi commented 2 years ago

hm, could please share your whole current /boot/config.txt file?

Thanks, Leon

grosch commented 2 years ago
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

#dtoverlay=lirc-rpi,gpio_in_pin=18,gpio_out_pin=17
dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17
leon-anavi commented 2 years ago

hm, everything looks good in config.txt.

Is lircd --version outputting version 0.10.1 ?

I will try to reproduce the issue with a fresh Raspberry Pi OS on my side in the coming days.

Thanks, Leon

grosch commented 2 years ago

Yes sir:

pi@piir:~ $ lircd --version lircd 0.10.1

indieisaconcept commented 1 year ago

Was this ever resolved? Facing the same issue with a recently purchases phat.

leon-anavi commented 1 year ago

Hi @indieisaconcept,

Yes, this issue is outdated because there is a new LIRC version with recent Raspberry Pi OS release. In December the documentation was updated LIRC 0.10.1-6.3. With this LIRC version there is no need to apply any patches so the installation is now easier.

However, the configuration process is still required. As noted in the user's manual in /etc/lirc/lirc_options.conf device /dev/lirc1 is the receiver and device /dev/lirc0 is the transmitter. Initially /dev/lirc1 is used to scan a remote control. After that the configuration has to be updated to /dev/lirc0 and LIRC daemon must be restated with sudo systemctl restart lircd in order to send infrared commands.

Which Raspberry Pi OS and LIRC version are you using? Have you managed to successfully scan a remote control?

Best regards, Leon

indieisaconcept commented 1 year ago

Hi @leon-anavi,

I am running Bullseye with kernel 5.15.8 and LIRC 0.10.1-6.3. I have been able to successfully scan multiple remotes and execute commands in response to received codes using irexec. Unfortunately transmitted does not appear to be working at all.

Reviewing the logs for lircd.service I see

Jan 30 22:43:29 indiepiir lircd-0.10.1[678]: Info: Using remote: ANI-PIP-41UHD.
Jan 30 22:43:29 indiepiir lircd-0.10.1[678]: Info: Using remote: SE-020401.
Jan 30 22:43:29 indiepiir lircd-0.10.1[678]: Info: Using remote: aktimate-mini.
Jan 30 22:43:29 indiepiir lircd-0.10.1[678]: Notice: lircd(default) ready, using /var/run/lirc/lircd
Jan 30 22:43:46 indiepiir lircd[678]: lircd-0.10.1[678]: Notice: accepted new client on /var/run/lirc/lircd
Jan 30 22:43:46 indiepiir lircd[678]: lircd-0.10.1[678]: Info: Cannot configure the rc device for /dev/lirc0
Jan 30 22:43:46 indiepiir lircd-0.10.1[678]: Notice: accepted new client on /var/run/lirc/lircd
Jan 30 22:43:46 indiepiir lircd-0.10.1[678]: Info: Cannot configure the rc device for /dev/lirc0
Jan 30 22:43:46 indiepiir lircd[678]: lircd-0.10.1[678]: Info: removed client
Jan 30 22:43:46 indiepiir lircd-0.10.1[678]: Info: removed client

Thanks

leon-anavi commented 1 year ago

Hi @indieisaconcept,

Thank you for sharing the logs. It looks like a software configuration issue, possibly due to not properly scanned code. Other people have experienced similar issue with bad lircd.conf, for example: https://raspberrypi.stackexchange.com/questions/140370/lirc-irsend-not-working

What remote controls are you using? Can you have a look and check if the scanned values in lircd.conf make sense?

Btw something that might be useful during scanning, LIRC documentation recommends if it fails to recognize the protocol of the remote control you should use the --force (or just -f) option to create a config file in raw mode. For example:

irrecord -f -d /dev/lirc1 ~/lircd.conf

Best regards, Leon

waltonbruce commented 9 months ago

Back to the Original Poster (tm): the issue was never resolved, and I'm able to reproduce.

The symptom: able to read a remote using irrecord, no problem. When I try to use irsend to transmit, the error is returned: "HARDWARE DOES NOT SUPPORT SENDING".

The issue appears only on the raspberry-pi 3B with 32-bit OS... I have tried ubuntu jammy as well as raspbian bullseye with the same results. I have a working ubuntu jammy 64bit raspberry-pi 4B with the same setup and it works fine!

We have the following log.

bruce@pithreeb:~$ grep lircd /var/log/syslog | tail Oct 8 14:03:25 pithreeb lircd[716]: lircd-0.10.1[716]: Error: hardware does not support sending Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Info: initializing '/dev/lirc0' Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Info: Using device: /dev/lirc0 Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Warning: can't get exclusive access to events coming from `/dev/lirc0' interface Oct 8 14:03:25 pithreeb lircd[716]: lircd-0.10.1[716]: Info: removed client Oct 8 14:03:25 pithreeb lircd[716]: lircd-0.10.1[716]: Info: closing '/dev/lirc0' Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Error: error processing command: send_once fujitsu_heat_ac min_heat Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Error: hardware does not support sending Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Info: removed client Oct 8 14:03:25 pithreeb lircd-0.10.1[716]: Info: closing '/dev/lirc0'

The config.txt has:

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

On boot we see the devices:

bruce@pithreeb:~$ sudo dmesg | grep -i gpio [ 13.548106] rc rc0: GPIO IR Bit Banging Transmitter as /devices/platform/gpio-ir-transmitter@11/rc/rc0 [ 13.553681] rc rc0: lirc_dev: driver gpio-ir-tx registered at minor = 0, no receiver, raw IR transmitter [ 13.706218] rc rc1: gpio_ir_recv as /devices/platform/ir-receiver@12/rc/rc1 [ 13.706530] rc rc1: lirc_dev: driver gpio_ir_recv registered at minor = 1, raw IR receiver, no transmitter [ 13.706846] input: gpio_ir_recv as /devices/platform/ir-receiver@12/rc/rc1/input11 [ 13.787209] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000

bruce@pithreeb:~$ ls -l /dev/lirc* crw-rw---- 1 root video 247, 0 Oct 7 14:49 /dev/lirc0 crw-rw---- 1 root video 247, 1 Oct 7 14:49 /dev/lirc1

My OS and kernel version etc:

bruce@pithreeb:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

bruce@pithreeb:~$ uname -a Linux pithreeb 5.15.0-1038-raspi #41-Ubuntu SMP PREEMPT Fri Sep 8 12:45:35 UTC 2023 armv7l armv7l armv7l GNU/Linux

Is there anyone who can help me figure this out? I had hoped to repurpose my 4B for another project and instead use the old 3B to control the minisplit...

thanks -bruce.

leon-anavi commented 9 months ago

@waltonbruce, what are the lirc versions on raspberry-pi 3B with 32-bit OS and on the ubuntu jammy 64bit raspberry-pi 4B?

You can retrieve the LIRC version by running the following command in a terminal:

lircd --version
waltonbruce commented 9 months ago

Hi Leon,

I don't have access to the pi's currently, I will follow up when I get to the site to have them both plugged and online.

They are both running ubuntu 22.04 and updated to current release distribution for each architechture. Unless I've done something horribly wrong each machine is running identical released code for lirc.

https://launchpad.net/ubuntu/jammy/arm64/lirc/0.10.1-6.3ubuntu1 https://launchpad.net/ubuntu/jammy/armhf/lirc/0.10.1-6.3ubuntu1

The reason for my posting was being mystified why 32 vs. 64 bit OS might behave differently with this gpio hardware. I'll get back to this thread in a few days.

thanks -bruce.

waltonbruce commented 8 months ago

Hi Leon,

Verified that both hosts are running same version of lircd.

bruce@pifourb:~$ lircd --version lircd 0.10.1

bruce@pithreeb:~$ lircd --version lircd 0.10.1

Still looking for more clues as these are back online for awhile now.

thx