RaspberryPi3: does not register all keypresses with IRW

USB infrared remote control receiver/transmitter. Get one for $20, including worldwide shipping.

RaspberryPi3: does not register all keypresses with IRW

Postby MisterE » Fri Aug 05, 2016 4:20 pm

Spend more time as expected with this "toy". Hope someone can help.
The device did not work on my raspberry pi 3 with the Rasbian verion of LIRC. (0.9.0).
According to the wiki you should be able to use the "irman" driver.

After some hours i tried Fedora. It has version 0.9.5 of LIRC. And i found out that the device is only supported by version 0.9.2
It works fine with Fedora.

So i tried to manually compile the latest LIRC sources (stable and unstable). After many struggles it compiled. It works but if i start "irw" it registers two keypresses and it seems to "hang". Some keypresses afterwards are registered.

Then i found this helpful guide: https://gist.github.com/bullshit/918d74db9473355d7181
Installed using this steps, but with version pre1-2 instead of pre1-1.
The same problem.

Hope someone can help. I am at the point to give up.

Firmware is updated to v22 (story on its own).
MisterE
Newbie
Newbie
 
Posts: 8
Joined: Fri Aug 05, 2016 4:05 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby Barf » Sat Aug 06, 2016 2:49 am

Lirc officially natively supports IrToy since something like two years. It is the Kooiman driver, that is integrated, and has been further improved. Documentation. The irman emulation is obsolete.

Please do not use any ancient instructions not taking this into account.

Unfortunately, most Linux distros ship a Linux that is many, many years old. So, unless you are using a Linux that has a current Lirc (Fedora + ???) you should get the current version and compile it.

You may like to install IrScrutinizer to check that the IrToy and the drivers are working. It is easier than Lirc.

After that, if you do not get Lirc to work, there is the Lirc mailing list. Observe normal practice for reporting problems: the exact version (Lirc, operating system, firmware) you are using, the commands you are issuing etc.
Barf
Jr. Member
Jr. Member
 
Posts: 64
Joined: Mon Jul 07, 2014 3:12 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby MisterE » Sat Aug 06, 2016 11:22 am

Thanks for your reply

Barf wrote:Unfortunately, most Linux distros ship a Linux that is many, many years old. So, unless you are using a Linux that has a current Lirc (Fedora + ???) you should get the current version and compile it.


No, i am using Raspbian. It has a really old (0.9.0) version of LIRC. If i compile the newer versions myself i get the "lock" problem i mentioned.
If i use the device with my Fedora laptop (lird 0.9.4) it works fine.

I want it to work with Raspbian though.
MisterE
Newbie
Newbie
 
Posts: 8
Joined: Fri Aug 05, 2016 4:05 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby MisterE » Mon Sep 05, 2016 3:22 pm

A little progress. But i am at the point to destroy this thing. Partly to blame to Debian, they have a ancient Lirc version.

I have installed the latest "unofficial" debian version using the README
$ sudo apt-get install devscripts
$ tar xf lirc-debian-src-0.9.4-1.tar.gz
$ cd /lirc-debian-src-0.9.4b
$ dpkg-source -x *dsc
$ cd lirc-0.9.4
$ mk-build-deps
$ sudo dpkg -i lirc-build-deps*.deb
$ sudo apt-get install -f --fix-missing
$ sudo dpkg -i lirc-build-deps*.deb
$ rm lirc-build-deps*.deb
$ debuild -us -uc
$ cd ..
$ sudo dpkg -i $(ls *.deb ) => this should fail?
$ sudo apt-get install -f --fix-missing
$ sudo dpkg -i $(ls *.deb )

cp /etc/lirc/lircd.conf.dist /etc/lirc/lircd.conf
mv /etc/lirc/lircd.conf.d/devinput.lircd.conf /etc/lirc/lircd.conf.d/devinput.lircd.conf.org
wget -O /etc/lirc/lircd.conf.d/CD720.conf http://lirc.sourceforge.net/remotes/philips/CD720


I am faking a Philips CD player. I am using a Harmony 525 remote.

Now i start LIRC

root@raspberrypi:/etc/lirc/lircd.conf.d# lircd --nodaemon --dev /dev/irtoy --driver irtoy --loglevel=9
lircd-0.9.4b[12539]: Trace1: lircd: Opening log, level: Trace1
lircd-0.9.4b[12539]: Warning: Running as root
lircd-0.9.4b[12539]: Trace: started server socket
lircd-0.9.4b[12539]: Trace1: parsing '/etc/lirc/lircd.conf'
lircd-0.9.4b[12539]: Trace1: parsing '/etc/lirc/lircd.conf.d/CD720.conf'
lircd-0.9.4b[12539]: Trace: parsing remote
lircd-0.9.4b[12539]: Trace1: creating first remote
lircd-0.9.4b[12539]: Info: Using remote: Philips_CD720.
lircd-0.9.4b[12539]: Trace1: flags value: 16386
lircd-0.9.4b[12539]: Trace1: begin codes
lircd-0.9.4b[12539]: Trace1: end codes
lircd-0.9.4b[12539]: Trace1: end remote
lircd-0.9.4b[12539]: Trace: lengths: 113266 113266 89283 90186
lircd-0.9.4b[12539]: Trace: lengths: 113266 113266 89283 90186
lircd-0.9.4b[12539]: Trace: config file read
lircd-0.9.4b[12539]: Notice: lircd(irtoy) ready, using /var/run/lirc/lircd



I open another shell with "irw"

lircd-0.9.4b[12539]: Trace: registering local client
lircd-0.9.4b[12539]: Notice: accepted new client on /var/run/lirc/lircd
lircd-0.9.4b[12539]: Trace: irtoy: init
lircd-0.9.4b[12539]: Trace: irtoy_getversion: Got version V222
lircd-0.9.4b[12539]: Trace: irtoy_reset: Got protocol S01
lircd-0.9.4b[12539]: Trace: Version hw 2, sw 22, protocol 1


Then i press "play"

lircd-0.9.4b[12539]: Trace: irtoy_raw_rec
lircd-0.9.4b[12539]: Trace: new signal after large space
lircd-0.9.4b[12539]: Trace: readdata 0 1000000
lircd-0.9.4b[12539]: Trace: trying "Philips_CD720" remote
lircd-0.9.4b[12539]: Trace: decode: enter
lircd-0.9.4b[12539]: Trace: sync
lircd-0.9.4b[12539]: Trace: readdata 1 810
lircd-0.9.4b[12539]: Trace: readdata 0 959
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 810
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace: readdata 0 895
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1834
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1834
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 810
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1791
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1813
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: code: 1d35
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace1: sum: 23730
lircd-0.9.4b[12539]: Trace: readdata 0 92010
lircd-0.9.4b[12539]: Trace: decode: 1
lircd-0.9.4b[12539]: Trace: found: KEY_PLAY
lircd-0.9.4b[12539]: Trace: 55abd948 0 0 0 0 0 0 0 0 0
lircd-0.9.4b[12539]: Trace: release_gap: 273311
lircd-0.9.4b[12539]: Trace: writing to client 0: 0000000000001535 00 KEY_PLAY Philips_CD720
lircd-0.9.4b[12539]: Trace: irtoy_raw_rec
lircd-0.9.4b[12539]: Trace: trying "Philips_CD720" remote
lircd-0.9.4b[12539]: Trace: decode: enter
lircd-0.9.4b[12539]: Trace: sync
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace: readdata 0 895
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1706
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1834
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 895
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1791
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1834
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1834
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: code: 1d35
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace1: sum: 23795
lircd-0.9.4b[12539]: Trace: readdata 0 92010
lircd-0.9.4b[12539]: Trace: decode: 1
lircd-0.9.4b[12539]: Trace: found: KEY_PLAY
lircd-0.9.4b[12539]: Trace: 55abd948 55abd948 55abd948 1 1 0 0 1 1 1
lircd-0.9.4b[12539]: Trace: release_gap: 273311
lircd-0.9.4b[12539]: Trace: writing to client 0: 0000000000001535 01 KEY_PLAY Philips_CD720
lircd-0.9.4b[12539]: Trace: irtoy_raw_rec
lircd-0.9.4b[12539]: Trace: trying "Philips_CD720" remote
lircd-0.9.4b[12539]: Trace: decode: enter
lircd-0.9.4b[12539]: Trace: sync
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace: readdata 0 917
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace: readdata 0 938
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace: readdata 0 938
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1791
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 938
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1834
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 831
lircd-0.9.4b[12539]: Trace: readdata 0 938
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1813
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: readdata 1 1727
lircd-0.9.4b[12539]: Trace1: 0
lircd-0.9.4b[12539]: Trace: readdata 0 1791
lircd-0.9.4b[12539]: Trace1: 1
lircd-0.9.4b[12539]: Trace: code: 1d35
lircd-0.9.4b[12539]: Trace: readdata 1 853
lircd-0.9.4b[12539]: Trace1: sum: 23836
lircd-0.9.4b[12539]: Trace: decode: 1
lircd-0.9.4b[12539]: Trace: found: KEY_PLAY
lircd-0.9.4b[12539]: Trace: 55abd948 55abd948 55abd948 1 1 0 0 1 1 1
lircd-0.9.4b[12539]: Trace: release_gap: 273311
lircd-0.9.4b[12539]: Trace: writing to client 0: 0000000000001535 02 KEY_PLAY Philips_CD720
...little delay
...little delay
lircd-0.9.4b[12539]: Trace: irtoy_raw_rec
lircd-0.9.4b[12539]: Trace: readdata 0 1000000
lircd-0.9.4b[12539]: Trace: trying "Philips_CD720" remote
lircd-0.9.4b[12539]: Trace: decode: enter
lircd-0.9.4b[12539]: Trace: sync
lircd-0.9.4b[12539]: Trace1: pulse expected
lircd-0.9.4b[12539]: Trace: failed on bit 1
lircd-0.9.4b[12539]: Trace: failed on code
lircd-0.9.4b[12539]: Trace: decode: 0
lircd-0.9.4b[12539]: Trace: decoding failed for all remotes


Everytime i see those " failed" messages after a while.
I get a response in IRW tho.
Is this normal?


pi@raspberrypi:/etc/lirc/lircd.conf.d $ irw
0000000000001535 00 KEY_PLAY Philips_CD720
0000000000001535 01 KEY_PLAY Philips_CD720
0000000000001535 02 KEY_PLAY Philips_CD720
MisterE
Newbie
Newbie
 
Posts: 8
Joined: Fri Aug 05, 2016 4:05 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby Barf » Tue Sep 06, 2016 2:26 am

Congratulations to the move to a non-ancient version of Lirc!

You should now open a ticket at https://sourceforge.net/p/lirc/tickets/ since it is an issue with Lirc and/or the driver.

It appears to be a glitch in the driver that is sends its IRTOY_LONGSPACE:

Code: Select all
lircd-0.9.4b[12539]: Trace: readdata 0 1000000

when Lird does not expect it
Code: Select all
lircd-0.9.4b[12539]: Trace1: pulse expected


(you should show the lines immediately before, now "censored" ("...little delay); it may carry important information.
Barf
Jr. Member
Jr. Member
 
Posts: 64
Joined: Mon Jul 07, 2014 3:12 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby MisterE » Tue Sep 06, 2016 2:52 pm

I do not understand the bug. So i find it kinda hard to file it.
Furthermore, am i the only one with problems? I did not suspect problems with the latest version of Lirc.
I did another test, now on verbose level 10. I pressed the button a couple of times until irw stopped detecting presses. After a pause it will work again.
See attachment


I noticed the debian deb builder is using a extra patch.

Code: Select all
pi@raspberrypi:~/lirc-debian-src-0.9.4b/lirc-0.9.4b/debian/patches $ cat 0003-irtoy-improve-error-handling-220.patch
From 62b9172bf52584e0c621d0163052ccca9a240846 Mon Sep 17 00:00:00 2001
From: Helen Foster <helen-foster@users.sourceforge.net>
Date: Sun, 14 Aug 2016 14:00:30 +0100
Subject: [PATCH 03/10] irtoy: improve error handling (#220).

Avoid double init. Avoid calling setPin or trying to send if irtoy
is not initialized (segfault).
---
plugins/irtoy.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/plugins/irtoy.c b/plugins/irtoy.c
index f6e81d7..f7a6feb 100644
--- a/plugins/irtoy.c
+++ b/plugins/irtoy.c
@@ -467,6 +467,9 @@ static int init_device(void)
                          IRTOY_MINFWVERSION,
                          dev->swVersion);
                free(dev);
+               dev = NULL;
+               close(drv.fd);
+               tty_delete_lock();
                return 0;
        }
        rec_buffer_init();
@@ -490,10 +493,15 @@ static int init(void)
                "Additional irtoy device found: %s (ignored)";
        const char* const MSG_FOUND = "irtoy device found on %s";

+       log_trace("irtoy: init");
        if (drv.device == NULL) {
                log_error("irtoy: NULL device.");
                return 0;
        }
+       if (dev != NULL) {
+               log_debug("irtoy: init: irtoy already initialized");
+               return 1;
+       }
        if (strcmp(drv.device, "auto") != 0)
                return init_device();
        for (found = 0, i = 0; i <= 9; i++) {
@@ -516,6 +524,8 @@ static int init(void)

static int deinit(void)
{
+       log_trace("irtoy: deinit");
+
        // IMPORTANT do not remove this reset. it is vital to return the
        // irtoy to IRMAN mode.
        // If we leave the irtoy in sample mode while no-one has the
@@ -527,14 +537,14 @@ static int deinit(void)
        // sending the next one, while sample mode will keep streaming
        // (and under fluorescent light it WILL stream..)
        // triggering the problem
-       setPin(openPin, 0);
-       setPin(sendingPin, 0);
-       setPin(receivePin, 0);
        if (dev != NULL) {
+               setPin(openPin, 0);
+               setPin(sendingPin, 0);
+               setPin(receivePin, 0);
                irtoy_reset(dev);
                free(dev);
+               dev = NULL;
        }
-       dev = NULL;

        close(drv.fd);
        drv.fd = -1;
@@ -562,10 +572,6 @@ static int irtoy_send_double_buffered(unsigned char* signals, int length)
        unsigned char reply[16];
        int irtoyXmit;

-       if (dev == NULL) {
-               log_error("irtoy_send: irtoy not initialized");
-               return 0;
-       }
        res = write(dev->fd, IRTOY_COMMAND_TXSTART, sizeof(IRTOY_COMMAND_TXSTART));

        if (res != sizeof(IRTOY_COMMAND_TXSTART)) {
@@ -647,6 +653,12 @@ static int send(struct ir_remote* remote, struct ir_ncode* code)
        lirc_t val;
        int res;

+       log_trace("irtoy: send");
+
+       if (dev == NULL) {
+               log_error("irtoy: send: irtoy not initialized");
+               return 0;
+       }

        if (!send_buffer_put(remote, code))
                return 0;
--
2.5.5

Attachments
lirc.log
very verbose
(1.18 MiB) Downloaded 75 times
MisterE
Newbie
Newbie
 
Posts: 8
Joined: Fri Aug 05, 2016 4:05 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby MisterE » Sat Sep 10, 2016 8:44 am

MisterE
Newbie
Newbie
 
Posts: 8
Joined: Fri Aug 05, 2016 4:05 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby djacks » Thu Dec 01, 2016 3:38 pm

Hello,

I have exactly the same problem. Any process on bug and ticket ? the V23 or V24 can change something ? or is it a LIRC 0.9.4 bug ?
I use ubuntu deskstop 16.10

regards,
djacks
Newbie
Newbie
 
Posts: 1
Joined: Thu Dec 01, 2016 3:28 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby Barf » Sun Dec 04, 2016 8:49 am

I did some update on the ticket.
Barf
Jr. Member
Jr. Member
 
Posts: 64
Joined: Mon Jul 07, 2014 3:12 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby MisterE » Mon Dec 05, 2016 2:54 pm

sourceforge bug report updated.
MisterE
Newbie
Newbie
 
Posts: 8
Joined: Fri Aug 05, 2016 4:05 pm

Re: RaspberryPi3: does not register all keypresses with IRW

Postby Barf » Sat May 27, 2017 3:26 am

I managed to reproduce the problem on an RPi3. Then I flashed the "firmware 2.4", which appeared to solve the problem. Reported to the Lirc bug ticket. The ticket has now been closed.
Barf
Jr. Member
Jr. Member
 
Posts: 64
Joined: Mon Jul 07, 2014 3:12 pm


Return to USB Infrared Toy