+ [29-June2016]
+
+ lirc-0.9.4a released.
+--
+2.5.5
+
diff --git a/0003-irtoy-improve-error-handling-220.patch b/0003-irtoy-improve-error-handling-220.patch
new file mode 100644
index 0000000..359595e
--- /dev/null
+++ b/0003-irtoy-improve-error-handling-220.patch
@@ -0,0 +1,96 @@
+From 62b9172bf52584e0c621d0163052ccca9a240846 Mon Sep 17 00:00:00 2001
+From: Helen Foster
+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
+
diff --git a/0003-lib-use-proper-linking-method-to-avoid-parallel-buil.patch b/0003-lib-use-proper-linking-method-to-avoid-parallel-buil.patch
deleted file mode 100644
index a3347b6..0000000
--- a/0003-lib-use-proper-linking-method-to-avoid-parallel-buil.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 8e0e7b65dea3b9f71e8658f0e417fac6409b4c2c Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni
-Date: Wed, 25 May 2016 16:34:55 +0200
-Subject: [PATCH] lib: use proper linking method to avoid parallel build issue
-
-Using _LDFLAGS = -l is correct when is an
-external library. However, when it is built by the same package, and
-especially in the same directory, this is wrong and can cause parallel
-build issues. In lib/Makefile.am, there was:
-
-libirrecord_la_LDFLAGS = -llirc
-
-But the liblirc library is built in the same directory. Or, due to the
-using of _LDFLAGS, make is not aware of the build dependency
-between libirrecord and liblirc.
-
-To solve this, _LIBADD should be used instead, as follows:
-
-libirrecord_la_LIBADD = liblirc.la
-
-This fixes parallel build issues seen by automated build tests
-conducted by the Buildroot project, such as:
-
- http://autobuild.buildroot.org/results/eb4/eb47d57de8182d25b1dacbf0ac3726ed20063d04/build-end.log
-
-Signed-off-by: Thomas Petazzoni
----
- lib/Makefile.am | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/lib/Makefile.am b/lib/Makefile.am
-index ce5c94c..fc77a60 100644
---- a/lib/Makefile.am
-+++ b/lib/Makefile.am
-@@ -29,7 +29,7 @@ liblirc_la_SOURCES = config_file.c \
- transmit.c \
- util.c
-
--libirrecord_la_LDFLAGS = -llirc
-+libirrecord_la_LIBADD = -llirc
- libirrecord_la_SOURCES = irrecord.c
-
- liblirc_client_la_LDFLAGS = -version-info 4:0:4
-@@ -98,10 +98,16 @@ input_map.lo: lirc/input_map.inc
-
- input_map.inc: lirc/input_map.inc
-
-+if BSD
-+lirc/input_map.inc:
-+ touch $@
-+ touch touch input_map.inc
-+else
- lirc/input_map.inc:
- ln -s . lirc || :
- $(top_srcdir)/tools/lirc-make-devinput -i > input_map.inc
- $(top_srcdir)/tools/lirc-make-devinput -i > $@
-+endif
-
- checkfiles:
- ../git-tools/checkfiles $(SOURCES) $(HEADERS)
---
-2.5.5
-
diff --git a/0004-plugins-audio_alsa-Fix-byte-truncating-in-16-bit-dat.patch b/0004-plugins-audio_alsa-Fix-byte-truncating-in-16-bit-dat.patch
index ef63323..b4a4e00 100644
--- a/0004-plugins-audio_alsa-Fix-byte-truncating-in-16-bit-dat.patch
+++ b/0004-plugins-audio_alsa-Fix-byte-truncating-in-16-bit-dat.patch
@@ -1,7 +1,7 @@
-From 5d933bee5c100e119c26476e45b69e019b392323 Mon Sep 17 00:00:00 2001
+From 4e931d11585e1baeddeea9a753007d835f8a3334 Mon Sep 17 00:00:00 2001
From: Alec Leamas
Date: Wed, 17 Aug 2016 21:28:00 +0200
-Subject: [PATCH] plugins: audio_alsa: Fix byte truncating in 16-bit data
+Subject: [PATCH 04/10] plugins: audio_alsa: Fix byte truncating in 16-bit data
(#218):
This fixes a bug introduced in 82305c72 which basically was
diff --git a/0005-contrib-disable-udev-dev-uinput-rule.patch b/0005-contrib-disable-udev-dev-uinput-rule.patch
new file mode 100644
index 0000000..338b956
--- /dev/null
+++ b/0005-contrib-disable-udev-dev-uinput-rule.patch
@@ -0,0 +1,22 @@
+From 8cb5fd91935603536dcb0377ff91eb0ae477d19a Mon Sep 17 00:00:00 2001
+From: Alec Leamas
+Date: Thu, 18 Aug 2016 16:19:17 +0200
+Subject: [PATCH 05/10] contrib: disable udev /dev/uinput rule.
+
+---
+ contrib/97-lircd-uinput.rules | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/contrib/97-lircd-uinput.rules b/contrib/97-lircd-uinput.rules
+index 12228a7..a554299 100644
+--- a/contrib/97-lircd-uinput.rules
++++ b/contrib/97-lircd-uinput.rules
+@@ -7,4 +7,4 @@ SUBSYSTEMS=="input",ATTRS{name}=="lircmd",SYMLINK+="lircmd"
+ # Make /dev/uinput accessible for the lirc group. A setfacl RUN would be
+ # better here, but seemingly does not work (?)
+ # An alternative is to use lircd-setup(8) to sun setfacl(1).
+-KERNEL=="uinput",GROUP:="lirc",MODE:="0660"
++## KERNEL=="uinput",GROUP:="lirc",MODE:="0660"
+--
+2.5.5
+
diff --git a/0008-lirc-setup-Fix-crasher-bugfix.patch b/0006-lirc-setup-Fix-crasher-bugfix.patch
similarity index 95%
rename from 0008-lirc-setup-Fix-crasher-bugfix.patch
rename to 0006-lirc-setup-Fix-crasher-bugfix.patch
index 8eb91b3..d0791a6 100644
--- a/0008-lirc-setup-Fix-crasher-bugfix.patch
+++ b/0006-lirc-setup-Fix-crasher-bugfix.patch
@@ -1,7 +1,7 @@
From 33c188c38f5f89e704e4c775205e1d90ca55bc0d Mon Sep 17 00:00:00 2001
From: Alec Leamas
Date: Sun, 21 Aug 2016 17:33:19 +0200
-Subject: [PATCH] lirc-setup: Fix crasher bugfix.
+Subject: [PATCH 06/10] lirc-setup: Fix crasher bugfix.
Fixes https://retrace.fedoraproject.org/faf/reports/1166394/
---
diff --git a/0005-contrib-Fix-usb-devices-acl-permissions-rhbz-1364744.patch b/0007-contrib-Fix-usb-devices-acl-permissions-rhbz-1364744.patch
similarity index 94%
rename from 0005-contrib-Fix-usb-devices-acl-permissions-rhbz-1364744.patch
rename to 0007-contrib-Fix-usb-devices-acl-permissions-rhbz-1364744.patch
index 0a55960..338bd51 100644
--- a/0005-contrib-Fix-usb-devices-acl-permissions-rhbz-1364744.patch
+++ b/0007-contrib-Fix-usb-devices-acl-permissions-rhbz-1364744.patch
@@ -1,7 +1,8 @@
From aa087cb999b7303d6f14d0928a84909d5bf29529 Mon Sep 17 00:00:00 2001
From: Alec Leamas
Date: Thu, 18 Aug 2016 21:04:07 +0200
-Subject: [PATCH] contrib: Fix usb devices' acl permissions (rhbz #1364744).
+Subject: [PATCH 07/10] contrib: Fix usb devices' acl permissions (rhbz
+ #1364744).
---
contrib/60-lirc.rules | 13 +++++++------
diff --git a/0008-lircd-Retry-temporary-unavailable-write-sockets-221.patch b/0008-lircd-Retry-temporary-unavailable-write-sockets-221.patch
new file mode 100644
index 0000000..afa2b79
--- /dev/null
+++ b/0008-lircd-Retry-temporary-unavailable-write-sockets-221.patch
@@ -0,0 +1,55 @@
+From f561c4b9e1ea8a225ae4431348529cd5b6b477d9 Mon Sep 17 00:00:00 2001
+From: Alec Leamas
+Date: Tue, 23 Aug 2016 13:16:56 +0200
+Subject: [PATCH 08/10] lircd: Retry temporary unavailable write sockets
+ (#221).
+
+---
+ daemons/lircd.cpp | 21 +++++++++++++++++++--
+ 1 file changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/daemons/lircd.cpp b/daemons/lircd.cpp
+index de2c341..2dc9029 100644
+--- a/daemons/lircd.cpp
++++ b/daemons/lircd.cpp
+@@ -115,6 +115,12 @@ int clock_gettime(int clk_id, struct timespec *t){
+
+ static const logchannel_t logchannel = LOG_APP;
+
++/** How long we sleep while waiting for busy write sockets. */
++static const int WRITE_SLEEP_US = 20000;
++
++/** How many times we retry busy write sockets. */
++static const int WRITE_RETRIES = 50;
++
+ struct peer_connection {
+ char* host;
+ unsigned short port;
+@@ -338,11 +344,22 @@ static int oatoi(const char* s)
+ int write_socket(int fd, const char* buf, int len)
+ {
+ int done, todo = len;
++ int retries = WRITE_RETRIES;
+
+ while (todo) {
+ done = write(fd, buf, todo);
+- if (done <= 0)
+- return done;
++ if (done <= 0) {
++ log_perror_debug("Error in write_socket");
++ if (errno == EAGAIN || errno == EWOULDBLOCK) {
++ retries -= 1;
++ if (retries <= 0)
++ return done;
++ usleep(WRITE_SLEEP_US);
++ continue;
++ } else {
++ return done;
++ }
++ }
+ buf += done;
+ todo -= done;
+ }
+--
+2.5.5
+
diff --git a/0009-lircd-Warn-for-duplicate-remote-definitions-222.patch b/0009-lircd-Warn-for-duplicate-remote-definitions-222.patch
new file mode 100644
index 0000000..46ff2f1
--- /dev/null
+++ b/0009-lircd-Warn-for-duplicate-remote-definitions-222.patch
@@ -0,0 +1,57 @@
+From 9ad5f93a07be0bf4f645f16dbbf29e2e8cd3b871 Mon Sep 17 00:00:00 2001
+From: Alec Leamas
+Date: Tue, 23 Aug 2016 13:50:48 +0200
+Subject: [PATCH 09/10] lircd: Warn for duplicate remote definitions (#222).
+
+---
+ daemons/lircd.cpp | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/daemons/lircd.cpp b/daemons/lircd.cpp
+index 2dc9029..8fd8336 100644
+--- a/daemons/lircd.cpp
++++ b/daemons/lircd.cpp
+@@ -70,6 +70,9 @@
+ #include
+ #endif
+
++#include
++#include
++
+ #include "lirc_private.h"
+
+ #ifdef HAVE_INT_GETGROUPLIST_GROUPS
+@@ -540,6 +543,22 @@ static int setup_hardware(void)
+ return ret;
+ }
+
++static void check_config_duplicates(const struct ir_remote* head)
++{
++ std::set names;
++ const struct ir_remote* ir;
++ const char* const errmsg =
++ "Duplicate remotes \"%s\" found, problems ahead";
++
++ for (ir = head; ir != NULL; ir = ir->next) {
++ std::string name(ir->name);
++ if (names.count(name) == 1)
++ log_warn(errmsg, name.c_str())
++ else
++ names.insert(name);
++ }
++}
++
+
+ void config(void)
+ {
+@@ -572,6 +591,7 @@ void config(void)
+ }
+ configfile = filename;
+ config_remotes = read_config(fd, configfile);
++ check_config_duplicates(config_remotes);
+ fclose(fd);
+ if (config_remotes == (void*)-1) {
+ log_error("reading of config file failed");
+--
+2.5.5
+
diff --git a/0010-lirc-make-devinput-Fix-that-two-remotes-has-the-same.patch b/0010-lirc-make-devinput-Fix-that-two-remotes-has-the-same.patch
new file mode 100644
index 0000000..7e90e9a
--- /dev/null
+++ b/0010-lirc-make-devinput-Fix-that-two-remotes-has-the-same.patch
@@ -0,0 +1,35 @@
+From b853e3d1bcc756206ffa1bc612996cd1597d53ea Mon Sep 17 00:00:00 2001
+From: Alec Leamas
+Date: Tue, 23 Aug 2016 13:24:32 +0200
+Subject: [PATCH 10/10] lirc-make-devinput: Fix that two remotes has the same
+ name (#222).
+
+---
+ tools/lirc-make-devinput | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/lirc-make-devinput b/tools/lirc-make-devinput
+index 3ae63ea..0598970 100755
+--- a/tools/lirc-make-devinput
++++ b/tools/lirc-make-devinput
+@@ -63,7 +63,7 @@ echo "# Date: $(date)"
+ cat < 24
%patch3 -p1
%patch4 -p1
%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+
+%if 0%fedora > 24
+%patch11 -p1
+%patch12 -p1
cp lib/driver.h lib/lirc/driver.h
%endif
sed -i -e 's|/usr/local/etc/|/etc/|' contrib/irman2lirc
-sed -i -e 's/#effective-user/effective-user /' lirc_options.conf
-sed -i -e '/^effective-user/s/=$/= lirc/' lirc_options.conf
%build
@@ -350,6 +364,12 @@ systemd-tmpfiles --create %{_tmpfilesdir}/lirc.conf
%{_udevrulesdir}/99-remote-control-lirc.rules
%changelog
+* Tue Aug 23 2016 Alec Leamas - 0.9.4b-4
+- Add fixes for #221 and #222
+- Update patches, include everything from upstream
+- Add some minor fixes for lircd.org
+- Obsoletes 0.9.4b-3 which is unpushed.
+
* Mon Aug 22 2016 Alec Leamas - 0.9.4b-3
- Add yet another ABRT crasher fix.
- Update fix for #1364744.