Compare commits

...
Sign in to create a new pull request.

69 commits

Author SHA1 Message Date
Fedora Release Engineering
fde01fd9fb Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 17:35:56 +00:00
Zbigniew Jędrzejewski-Szmek
42c0cc778a Add sysusers.d config file to allow rpm to create users/groups automatically
See https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers.
2025-02-11 15:35:20 +01:00
Fedora Release Engineering
8525e49f0d Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 07:01:55 +00:00
Miroslav Suchý
f8d5981bb1 convert license to SPDX
This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4
2024-09-02 08:52:11 +02:00
Fedora Release Engineering
418bfab765 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 10:15:39 +00:00
Software Management Team
b1d6f9ca28 Eliminate use of obsolete %patchN syntax (#2283636) 2024-05-30 12:46:47 +02:00
Fedora Release Engineering
9445d7f940 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-24 22:37:39 +00:00
Fedora Release Engineering
12ed678953 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-20 22:59:25 +00:00
Fedora Release Engineering
75cea58244 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 07:18:28 +00:00
Fedora Release Engineering
df93d3e47b Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 13:03:18 +00:00
Richard Shaw
20cc2ba899 Add conditional for libusb-devel as it is retired as of f37. 2022-07-25 21:51:50 -05:00
Fedora Release Engineering
2912c5eaf5 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 14:33:50 +00:00
Fedora Release Engineering
fbb5c22a8b - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 13:12:19 +00:00
Fedora Release Engineering
16cc3fdb07 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 08:28:38 +00:00
Zbigniew Jędrzejewski-Szmek
78edd1d424 Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
2021-03-02 16:13:38 +01:00
Fedora Release Engineering
fd723a7de6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 14:15:42 +00:00
Tom Stellard
1690fe5582 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-19 00:46:08 +00:00
Fedora Release Engineering
267ea60e58 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 01:42:22 +00:00
Fedora Release Engineering
6e19728d4c - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 05:20:03 +00:00
Alec Leamas
68737d2c21 2:1.1.0-28: Again: missing sources. 2019-08-22 20:18:13 +02:00
Alec Leamas
777102e450 2:1.1.0-28: More missing sources. 2019-08-22 20:14:00 +02:00
Alec Leamas
9e7e4c4294 2:1.1.0-28: Add updated sources. 2019-08-22 20:08:26 +02:00
Alec Leamas
fabe805ab6 2:1.1.0-28 2019-08-22 20:02:41 +02:00
Fedora Release Engineering
29e3fb635b - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 09:24:32 +00:00
Fedora Release Engineering
f1e9e3b68c - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-01 03:15:01 +00:00
Igor Gnatenko
b61c330e9c Remove obsolete Group tag
References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag
2019-01-28 20:24:08 +01:00
Fedora Release Engineering
bb744fb0d8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 05:38:14 +00:00
Richard Shaw
2819c8baf1 Update build requirements for gcc/gcc-c++ per https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B#BuildRequires_and_Requires 2018-02-19 09:18:39 -06:00
Fedora Release Engineering
ce40c91989 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 17:20:31 +00:00
Richard Shaw
30cdb8e345 Update to current packaging guidelines for systemd. 2018-01-29 13:30:48 -06:00
Fedora Release Engineering
ad85f4bfd7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-02 23:43:20 +00:00
Fedora Release Engineering
51cc74b60a - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 13:27:40 +00:00
Fedora Release Engineering
a08c25013a - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 16:20:19 +00:00
Alec Leamas
ab7a0e55e0 1.1.0-2: bugfix. 2017-01-27 17:02:24 +01:00
Alec Leamas
26c0476b98 1.1.0-2: Fix lirc-drv-iguanair linkage. 2017-01-27 16:49:20 +01:00
Alec Leamas
a10607fe43 Fix possibly bad sources file. 2017-01-25 18:07:32 +01:00
Alec Leamas
50f9b62ede Re-add failing source, re-packed as .gz. 2017-01-25 17:59:06 +01:00
Alec Leamas
cc23db1e07 Add missing source 2017-01-25 17:51:13 +01:00
Alec Leamas
281f010873 Release 1.1.0-19 2017-01-25 17:45:02 +01:00
Alec Leamas
5abea51dd5 More missing sources. 2017-01-25 11:14:09 +01:00
Alec Leamas
82ebf58b4d Add missing plugin source. 2017-01-25 11:03:48 +01:00
Alec Leamas
574affc95e Release 1.1.0-19 2017-01-25 10:58:59 +01:00
Fedora Release Engineering
c678c30890 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages 2016-07-19 07:27:39 +00:00
Dennis Gilmore
fc2c12da98 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-04 00:27:02 +00:00
Dennis Gilmore
c2ef7268a9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-17 11:17:40 +00:00
Alec Leamas
5d1063cccf Fix upstream logrotate issue #1176627. 2014-12-23 00:31:52 +01:00
Alec Leamas
e59b432934 Filter bogus, patched libiguanaIR.so.0.3 so-name from Requires. 2014-12-11 01:24:00 +01:00
Alec Leamas
e483b3e8d9 Fixes #1159618, re-install logrotate file. 2014-12-10 16:35:52 +01:00
Alec Leamas
cc5faa9e0b Fixed 64-bit provides tweak. 2014-09-10 12:46:47 +02:00
Alec Leamas
1d205c697b Added 64-bit provides tweak. 2014-09-09 19:18:49 +02:00
Alec Leamas
10f970a6f5 Remove needless and circular dependency on lirc. 2014-09-03 16:38:35 +02:00
Alec Leamas
a14910cce0 patch soname + add virtual compatibility Provides: 2014-09-03 14:50:31 +02:00
Alec Leamas
f38e16792d Patch soname on rawhide to avoid unintended bump + new source. 2014-09-03 10:45:16 +02:00
Alec Leamas
25647416c6 Patch soname on rawhide to avoid unintended bump. 2014-09-03 10:35:39 +02:00
Alec Leamas
c88f15bdf6 Make a new try to sort out deps for 1.1.0 2014-09-02 11:32:26 +02:00
Alec Leamas
8cb2bd2c45 Have to re-add sources as well. 2014-08-27 20:54:24 +02:00
Alec Leamas
6b9729613f Backing out 1.1.0 again, broken dependencies problem 2014-08-27 20:40:05 +02:00
Alec Leamas
d38a7d5bd1 Fixing typo, bad %{epoch} requires: 2014-08-21 14:11:16 +02:00
Alec Leamas
34b77cbd7f Fixing typo, bad %{epoch} requires: 2014-08-21 14:08:16 +02:00
Alec Leamas
031ca5f63b New attempt to introduce 1.1.0 (ABI bump) 2014-08-21 01:58:33 +02:00
Alec Leamas
38f9aadde2 New attempt to introduce 1.1.0 (ABI bump) 2014-08-21 01:47:45 +02:00
Alec Leamas
aae93b298a Updating dependencies with epoch (sigh...). 2014-08-20 14:27:23 +02:00
Alec Leamas
986cf02410 - Backing out 1.1.0 due to ABI problems.
- Purged old changelog dating to 2006, partly outside Fedora.
2014-08-19 22:45:26 +02:00
Alec Leamas
3bdd72c534 Add missing patch (how did this ever build?). 2014-08-18 13:31:49 +02:00
Peter Robinson
337587118f - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-16 21:21:14 +00:00
Alec Leamas
b898e37d8e Updating to latest version
- Old patches now upstreamed, new patches for cmake required. LIBDIR handling
  needs cleanup (not required part in rpath.patch).
2014-08-11 17:25:03 +02:00
Dennis Gilmore
aabb8eb308 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-07 17:07:07 -05:00
Dennis Gilmore
bbf3721578 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-03 14:26:55 -05:00
Alec Leamas
a818866274 Updating to 1.0.5 2013-06-21 05:20:41 +02:00
27 changed files with 2749 additions and 779 deletions

7
.gitignore vendored
View file

@ -1 +1,8 @@
/iguanaIR-1.0.3.tar.bz2
/iguanaIR-1.1.0.tar.bz2
clog
/iguanaIR-1.0.5.tar.bz2
/iguanaIR-1.1.0-5.fc22.src.rpm
bak
/iguanair-lirc-e23b9d3.tar.gz
/iguanaIR-1.1.0.tar.gz

View file

@ -1,275 +0,0 @@
From 93d9206499bab837dccb5d864a875829c3dc057c Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 11:44:48 +0100
Subject: [PATCH 1/8] Remove trailing whitespace.
It makes the patches harder to read.
---
Makefile.in | 2 +-
client-interface.c | 2 +-
client.c | 8 ++++----
dataPackets.c | 2 +-
device-interface.c | 10 +++++-----
drivers/libusb.c | 6 +++---
drivers/libusbpre1.c | 6 +++---
iguanaIR.h | 2 +-
osx/daemonosx.c | 4 ++--
server.h | 4 ++--
udev/iguanaIR.rules | 2 +-
11 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 71f59cf..e62b6fa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -187,7 +187,7 @@ endif
.PHONY: dist devel-cleaner
dist: configure
devel-clean: distclean
- rm -rf autoconf/autom4te.cache autoconf/aclocal.m4
+ rm -rf autoconf/autom4te.cache autoconf/aclocal.m4
# rules to rebuild the configure script
M4S=$(filter-out $(srcdir)/autoconf/aclocal.m4, $(wildcard $(srcdir)/autoconf/*.m4))
diff --git a/client-interface.c b/client-interface.c
index 6c45e0d..6052206 100644
--- a/client-interface.c
+++ b/client-interface.c
@@ -80,7 +80,7 @@ static int pulsesToIguanaSend(int carrier,
fprintf(stderr, "%5d ", sendCode[x] & IG_PULSE_MASK);
#endif
- cycles = (uint32_t)((sendCode[x] & IG_PULSE_MASK) /
+ cycles = (uint32_t)((sendCode[x] & IG_PULSE_MASK) /
1000000.0 * carrier + 0.5);
numBytes = (cycles / MAX_DATA_BYTE) + 1;
cycles %= MAX_DATA_BYTE;
diff --git a/client.c b/client.c
index 13d0053..af0b30e 100644
--- a/client.c
+++ b/client.c
@@ -162,7 +162,7 @@ bool parseNumber(const char *text, unsigned int *value)
retval = false;
break;
}
- else
+ else
*value = (*value << 1) + text[x] - '0';
}
else
@@ -432,7 +432,7 @@ static bool handleInternalTask(igtask *cmd, PIPE_PTR conn)
else if ((cmd->spec->code & INTERNAL_SETCONFIG) == INTERNAL_SETCONFIG)
{
setSetting(cmd->spec->bit, cmd->arg, pinState);
- message(LOG_NORMAL, "%s: success\n", cmd->command);
+ message(LOG_NORMAL, "%s: success\n", cmd->command);
retval = true;
}
else
@@ -451,7 +451,7 @@ static bool performTask(PIPE_PTR conn, igtask *cmd)
{
int result = 0;
void *data = NULL;
-
+
switch(cmd->spec->code)
{
case IG_DEV_RECVON:
@@ -593,7 +593,7 @@ static bool performTask(PIPE_PTR conn, igtask *cmd)
b[3] = (c & 0x0F) << 4 | 0x0C;
}
((unsigned char*)data)[0] = (unsigned char)(x * 4);
-
+
break;
}
}
diff --git a/dataPackets.c b/dataPackets.c
index f7900e2..a57574d 100644
--- a/dataPackets.c
+++ b/dataPackets.c
@@ -75,7 +75,7 @@ bool readDataPacket(dataPacket *packet, PIPE_PTR fd, unsigned int timeout)
if (result == 0)
errno = ETIMEDOUT;
-
+
return retval;
}
diff --git a/device-interface.c b/device-interface.c
index afb1d96..29c104b 100644
--- a/device-interface.c
+++ b/device-interface.c
@@ -139,7 +139,7 @@ static void queueDataPacket(iguanaDev *idev, dataPacket *current, bool fromDev)
{
insertItem(&idev->recvList, NULL, (itemHeader*)current);
if (! notify(idev->readerPipe[WRITE]))
- message(LOG_ERROR, "Failed to signal primary thread.\n");
+ message(LOG_ERROR, "Failed to signal primary thread.\n");
}
else
{
@@ -543,7 +543,7 @@ bool oldPinConfig(iguanaDev *idev, /* required */
}
}
}
-
+
if (code == IG_DEV_SETPINCONFIG)
request->data = data;
if (x == 2)
@@ -561,7 +561,7 @@ bool deviceTransaction(iguanaDev *idev, /* required */
/* For old devices setting pin configs actually becomes 2
requests, awkward, but the way it has to be to support old
firmware. */
- if (idev->version <= 3 &&
+ if (idev->version <= 3 &&
(request->code == IG_DEV_SETPINCONFIG ||
request->code == IG_DEV_GETPINCONFIG))
return oldPinConfig(idev, request, response);
@@ -583,7 +583,7 @@ bool deviceTransaction(iguanaDev *idev, /* required */
case IG_DEV_GETID:
msg[CODE_OFFSET] = IG_DEV_EXECUTE;
break;
-
+
case IG_DEV_SETID:
{
unsigned char *block;
@@ -911,7 +911,7 @@ void handleIncomingPackets(iguanaDev *idev)
/* NOTE: last byte is the fill level */
current->dataLen = length - 1;
dataStart = buffer;
-
+
message(LOG_DEBUG2,
"Data without ctl header assuming IG_DEV_RECV.\n");
/* TODO: DEBUG: sleep here to test overflow on the device
diff --git a/drivers/libusb.c b/drivers/libusb.c
index 4993fef..ff2e667 100644
--- a/drivers/libusb.c
+++ b/drivers/libusb.c
@@ -2,7 +2,7 @@
** libusb.c ****************************************************************
****************************************************************************
*
- * Lowest level interface to the USB devices.
+ * Lowest level interface to the USB devices.
*
* Copyright (C) 2007, IguanaWorks Incorporated (http://iguanaworks.net)
* Author: Joseph Dunn <jdunn@iguanaworks.net>
@@ -519,11 +519,11 @@ static int clearHalt(deviceInfo *info, unsigned int ep)
switch (ep)
{
case EP_IN:
- return libusb_clear_halt(handle->device,
+ return libusb_clear_halt(handle->device,
handle->epIn->bEndpointAddress);
case EP_OUT:
- return libusb_clear_halt(handle->device,
+ return libusb_clear_halt(handle->device,
handle->epOut->bEndpointAddress);
}
return -1;
diff --git a/drivers/libusbpre1.c b/drivers/libusbpre1.c
index a0fe8d7..0303aa4 100644
--- a/drivers/libusbpre1.c
+++ b/drivers/libusbpre1.c
@@ -2,7 +2,7 @@
** usbclient.c *************************************************************
****************************************************************************
*
- * Lowest level interface to the USB devices.
+ * Lowest level interface to the USB devices.
*
* Copyright (C) 2007, IguanaWorks Incorporated (http://iguanaworks.net)
* Author: Joseph Dunn <jdunn@iguanaworks.net>
@@ -435,11 +435,11 @@ static int clearHalt(deviceInfo *info, unsigned int ep)
switch (ep)
{
case EP_IN:
- return usb_clear_halt(handle->device,
+ return usb_clear_halt(handle->device,
handle->epIn->bEndpointAddress);
case EP_OUT:
- return usb_clear_halt(handle->device,
+ return usb_clear_halt(handle->device,
handle->epOut->bEndpointAddress);
}
return -1;
diff --git a/iguanaIR.h b/iguanaIR.h
index 0d0236d..bbc27ae 100644
--- a/iguanaIR.h
+++ b/iguanaIR.h
@@ -170,7 +170,7 @@ IGUANAIR_API unsigned char iguanaDataToPinSpec(const void *data,
* below (all default to 0):
*
* bit: name: notes
- * 0 output enable
+ * 0 output enable
* 1 pullup enable
* 2 open drain
* 3 high sink only pins 0 and 1, ignored elsewhere
diff --git a/osx/daemonosx.c b/osx/daemonosx.c
index e425f2b..2397ac8 100644
--- a/osx/daemonosx.c
+++ b/osx/daemonosx.c
@@ -6,7 +6,7 @@
Mac OS X. It spawns a thread and waits for notification that an
iguanaIR device has been plugged in at which point it raises a SIGHUP
so that the standard igdaemon hot plug in processing will take place.
-
+
@note
Without this support the reflasher will not work as the reset operation
during programming results in a disconnect and a reconnect on Mac OS X.
@@ -66,7 +66,7 @@ int daemon_osx_support(const usbId *ids)
static void arm_notification(io_iterator_t iterator)
{
io_object_t object;
-
+
while ((object = IOIteratorNext(iterator)) != 0) {
IOObjectRelease(object);
}
diff --git a/server.h b/server.h
index 3d1d0ce..c127d5b 100644
--- a/server.h
+++ b/server.h
@@ -14,7 +14,7 @@
#ifndef _DAEMON_BASE_H_
#define _DAEMON_BASE_H_
-typedef struct
+typedef struct
{
/* driver location and prefered driver information */
bool onlyPreferred;
@@ -31,7 +31,7 @@ typedef struct
/* whether the server should ask devices for their labels */
bool readLabels;
- /* should the server rescan the usb bus after a disconnect */
+ /* should the server rescan the usb bus after a disconnect */
bool autoRescan;
/* a method for children to communicate back to the list owner */
diff --git a/udev/iguanaIR.rules b/udev/iguanaIR.rules
index 5e49ebf..e43aa91 100644
--- a/udev/iguanaIR.rules
+++ b/udev/iguanaIR.rules
@@ -6,7 +6,7 @@
#
# So if someone is using an old version of udev they may need to use a
# different first line like:
-# SYSFS{manufacturer} == "IguanaWorks",
+# SYSFS{manufacturer} == "IguanaWorks",
ATTR{manufacturer} == "IguanaWorks", ATTR{product} == "USB IR Transceiver", \
OWNER = "iguanair", MODE = "0664", \
--
1.7.11.7

View file

@ -1,27 +0,0 @@
From b428df7fbbc6bbf492f40431bc488b24637e142b Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 11:45:48 +0100
Subject: [PATCH 2/8] Don't hardcode iguanair UID.
Using a hardcoded UID will cause all sorts of problems when
already used or not obeying distro conventions.
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index e62b6fa..9a9cdfa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -85,7 +85,7 @@ ifeq ($(RPM_OS)$(DARWIN),)
install: adduser
.PHONY: adduser
adduser:
- /usr/sbin/useradd -u 213 -c "Iguanaworks IR Daemon" -d / -s /sbin/nologin iguanair 2>/dev/null || true
+ /usr/sbin/useradd -c "Iguanaworks IR Daemon" -d / -s /sbin/nologin iguanair 2>/dev/null || true
uninstall: deluser
.PHONY: deluser
--
1.7.11.7

View file

@ -1,27 +0,0 @@
From d6a24ca3d0a0f583d21926d4d9d3890f5958ba67 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 11:54:55 +0100
Subject: [PATCH 3/8] Use platform specific python extension dir
Although this is just an issue for (multi-arch) Fedora, it should
always be correct to use get_python_lib(1,0) instead of (0,0).
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index f901211..1a51327 100755
--- a/configure
+++ b/configure
@@ -5167,7 +5167,7 @@ $as_echo "$PYTHON_LDFLAGS" >&6; }
$as_echo_n "checking for Python site-packages path... " >&6; }
if test -z "$PYTHON_SITE_PKG"; then
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
- print distutils.sysconfig.get_python_lib(0,0);"`
+ print distutils.sysconfig.get_python_lib(1,0);"`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5
$as_echo "$PYTHON_SITE_PKG" >&6; }
--
1.7.11.7

View file

@ -1,64 +0,0 @@
From 15f72105f52e1a4ecaf47e2951af6a2536a6f913 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 13:45:32 +0100
Subject: [PATCH 4/9] Don't exit(3) in library calls
Basically, it's a bad idea to call exit(3) in a daemon for
whatever reason.
Signed-off-by: Alec Leamas <leamas.alec@gmail.com>
---
support.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/support.c b/support.c
index 35724e6..a458bd9 100644
--- a/support.c
+++ b/support.c
@@ -96,12 +96,12 @@ int message(int level, char *format, ...)
va_list list;
int retval = 0;
FILE *out;
+ char *buffer = NULL;
va_start(list, format);
out = pickStream(level);
if (out != NULL)
{
- char *buffer;
if (level != LOG_ALWAYS && level != LOG_NORMAL)
{
char when[22];
@@ -120,12 +120,15 @@ int message(int level, char *format, ...)
if (buffer == NULL)
{
perror("FATAL: message format malloc failedx");
- exit(2);
+ return -ENOMEM;
}
sprintf(buffer, "%s%s%s", when, msgPrefixes[level], format);
}
else
+ {
buffer = format;
+ perror("Can't select output log stream (configuration error?)");
+ }
retval = vfprintf(out, buffer, list);
/* flushing the log file after each write */
@@ -136,11 +139,7 @@ int message(int level, char *format, ...)
free(buffer);
}
va_end(list);
-
- if (level <= LOG_FATAL)
- exit(1);
-
- return retval;
+ return buffer == format ? -EINVAL : retval;
}
void appendHex(int level, void *location, unsigned int length)
--
1.7.11.4

View file

@ -1,49 +0,0 @@
From 2c05db3a37f916a2637745cd603cb8e63c8a6ab7 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Wed, 26 Dec 2012 08:13:56 +0100
Subject: [PATCH 5/8] Improve driver dir detection.
Add a rpath to the private directory so the dynamic loader finds it;
also add a trace output for detected dir.
Although using rpaths is frowned upon in the general case, using it
for a private library directory like this is perfectly OK.
---
Makefile.in | 1 +
server.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 9a9cdfa..89433f2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -6,6 +6,7 @@ BINDIR=@bindir@
CFLAGS += -I. -fvisibility=hidden -DIGUANAIR_EXPORTS
+CFLAGS += -Wl,-rpath,$(LIBDIR)/iguanaIR
ifdef DARWIN
LINKARGS = -Wl,-dylib_current_version,1.0.0,-dylib_compatibility_version,1.0.0 -install_name $(DESTDIR)/$(LIBDIR)/$(LIBNAME)
diff --git a/server.c b/server.c
index 141ee54..3493100 100644
--- a/server.c
+++ b/server.c
@@ -93,8 +93,13 @@ deviceList* initServer()
#ifdef _WIN32
srvSettings.driverDir = ".";
#else
- srvSettings.driverDir = "/usr/lib/iguanaIR";
+ if (access("/usr/lib64", F_OK))
+ srvSettings.driverDir = "/usr/lib64/iguanaIR";
+ else
+ srvSettings.driverDir = "/usr/lib/iguanaIR";
#endif
+ message(LOG_DEBUG, " driverDir: %s\n", srvSettings.driverDir);
+
}
/* initialize the commPipe, driver, and device list */
--
1.7.11.7

View file

@ -1,61 +0,0 @@
From ea8f3436c24f579b8fdea4aac0fea5ab1d6b5b42 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 16:57:07 +0100
Subject: [PATCH 6/8] make options file work w systemd
Systemd uses an option file format which is almost identical
to the standard sh format used by sysV. However, it requires
the values to be quoted. This patch quots all values making
it work for systemd without breaking anything for the sysV
initscript.
---
iguanaIR.options | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/iguanaIR.options b/iguanaIR.options
index 4dc6e8f..2263787 100644
--- a/iguanaIR.options
+++ b/iguanaIR.options
@@ -7,7 +7,7 @@
## 2 = log debug1
## 3 = log debug2 (excessive)
## 4 = log debug3 (excessively excessive)
-LOGLEVEL=0
+LOGLEVEL="0"
## Because of a bug in libusb, using threads when communicating with
## our device can cause the device to hang. As a work around, we have
@@ -26,26 +26,26 @@ LOGLEVEL=0
## how quickly you can quit the daemon. With threads enabled, we set
## this timeout to 1000ms. With threads disabled, we put the timeout
## at 50ms. You can use a larger value if you want to save a little
-## amount of cpu time, but it may cause problems with sends,
+## amount of cpu time, but it may cause problems with sends,
## particularly long send.
## With the --no-threads option used
#RECEIVETIMEOUT=50
## When threads are used (and not --no-threads)
-RECEIVETIMEOUT=1000
+RECEIVETIMEOUT="1000"
## the igdaemon can use different backend USB drivers and should be
## told which to try first since we prefer the libusb driver to the
## libusbpre1.0
-DRIVERS=--driver=libusb
+DRIVERS="--driver=libusb"
## You can set the timeout value for sendings IR signals. This set how
## long to wait for send to successfully complete before assuming that
## the send failed and returning an error. Time is measured in ms and
## the default is 1000. Do not change this unless you have good
## reason.
-SENDTIMEOUT=1000
+SENDTIMEOUT="1000"
## The init.d script for igdaemon auto detects what distro you are
## using (fedora, debian, ubuntu, gentoo). You can overwrite this
--
1.7.11.7

View file

@ -1,82 +0,0 @@
From fa0085b8773ed9f69d70ce617ac824d52a4f8dff Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 13:26:05 +0100
Subject: [PATCH 7/8] Use fedora-specific default socket directory.
Fedora conventions requires the use of /var/run (or, after 17, just /run)
for the temporary socket directory. Fixed in this patch.
Using this means that docs need an update, fix: sed -i
's|/dev/iguanaIR|/var/run/iguanaIR|g' docs/TroubleShooting docs/driver docs/lirc
Note that the reasoning behind this probably is valid for all Linux
distributions: it's simply that Filesystem Hierarchy Standard (FHS)
assumes that these kind of directories goes into /run. A more complete
but also untested patch is in https://bugzilla.redhat.com/show_bug.cgi?id=642773,
fixes.patch bundled in the source rpm.
For the time being /var/run is used for historical reasons. On recent
platforms it's a symlink to /run. Over time, using just /run should be
better.
Signed-off-by: Alec Leamas <leamas.alec@gmail.com>
---
iguanaIR.h | 2 ++
reflasher/looper | 5 ++++-
udev/iguanaIR.rules | 4 ++--
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/iguanaIR.h b/iguanaIR.h
index bbc27ae..e3301b0 100644
--- a/iguanaIR.h
+++ b/iguanaIR.h
@@ -53,6 +53,8 @@
#ifdef __APPLE__
#define IGSOCK_NAME "/tmp/iguanaIR/"
+ #elif FEDORA
+ #define IGSOCK_NAME "/var/run/iguanaIR/"
#else
#define IGSOCK_NAME "/dev/iguanaIR/"
#endif
diff --git a/reflasher/looper b/reflasher/looper
index 15c3e20..c0db224 100755
--- a/reflasher/looper
+++ b/reflasher/looper
@@ -7,6 +7,7 @@ import stat
import sys
import os
import errno
+import platform
#versions = [3, 4, 0x0101, 0x0102]
versions = [4]
@@ -16,7 +17,9 @@ import iguanaIR
if sys.platform == 'darwin':
deviceDir = '/tmp/iguanaIR'
-else:
+elif sys.platform == 'linux2' and platform.linux_distribution()[0] == 'Fedora':
+ deviceDir = '/var/run/iguanaIR'
+else
deviceDir = '/dev/iguanaIR'
def listDevices(path = deviceDir):
diff --git a/udev/iguanaIR.rules b/udev/iguanaIR.rules
index e43aa91..79d6573 100644
--- a/udev/iguanaIR.rules
+++ b/udev/iguanaIR.rules
@@ -10,8 +10,8 @@
ATTR{manufacturer} == "IguanaWorks", ATTR{product} == "USB IR Transceiver", \
OWNER = "iguanair", MODE = "0664", \
- RUN = "/bin/mkdir -p /dev/iguanaIR", \
- RUN += "/bin/chown iguanair /dev/iguanaIR", \
+ RUN = "/bin/mkdir -p /var/run/iguanaIR", \
+ RUN += "/bin/chown iguanair /var/run/iguanaIR", \
RUN += "/etc/init.d/iguanaIR rescan"
# FOR DEBUGGING TRY ADDING TO THE RUN LINES:
--
1.7.11.4

View file

@ -1,28 +0,0 @@
From 4d74cf146fb53514f6b3b71684d6b8232d522e44 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Tue, 25 Dec 2012 14:04:40 +0100
Subject: [PATCH 8/8] udev: invoke systemd support, not sysV init file.
Signed-off-by: Alec Leamas <leamas.alec@gmail.com>
---
udev/iguanaIR.rules | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/udev/iguanaIR.rules b/udev/iguanaIR.rules
index 79d6573..7f72f1c 100644
--- a/udev/iguanaIR.rules
+++ b/udev/iguanaIR.rules
@@ -10,9 +10,7 @@
ATTR{manufacturer} == "IguanaWorks", ATTR{product} == "USB IR Transceiver", \
OWNER = "iguanair", MODE = "0664", \
- RUN = "/bin/mkdir -p /var/run/iguanaIR", \
- RUN += "/bin/chown iguanair /var/run/iguanaIR", \
- RUN += "/etc/init.d/iguanaIR rescan"
+ RUN = "/usr/share/iguanaIR/rescan"
# FOR DEBUGGING TRY ADDING TO THE RUN LINES:
#RUN += "/bin/bash -c 'echo $major $minor r=$result i=$id n=$number k=$kernel p=$parent r=$root >> /tmp/udev.txt'"
--
1.7.11.7

View file

@ -0,0 +1,853 @@
From 7e0aca378b95b8618c1adc936e7988be165fcc13 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Thu, 1 Sep 2016 02:51:03 +0200
Subject: [PATCH 10/13] Change iguanaIR.* -> iguanair.* to match other
plugins.
The mixed casing is only used by iguanair, causing some problems
when handling plugin. Also, using lowercase creates a visible
difference to the mixed-case driver file.
---
iguanaIR.c | 364 ----------------------------------------------------------
iguanaIR.conf | 13 ---
iguanaIR.html | 18 ---
iguanair.c | 364 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
iguanair.conf | 13 +++
iguanair.html | 18 +++
6 files changed, 395 insertions(+), 395 deletions(-)
delete mode 100755 iguanaIR.c
delete mode 100755 iguanaIR.conf
delete mode 100755 iguanaIR.html
create mode 100755 iguanair.c
create mode 100755 iguanair.conf
create mode 100755 iguanair.html
diff --git a/iguanaIR.c b/iguanaIR.c
deleted file mode 100755
index f2e5794..0000000
--- a/iguanaIR.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/****************************************************************************
-** hw_iguanaIR.c ***********************************************************
-****************************************************************************
-*
-* routines for interfacing with Iguanaworks USB IR devices
-*
-* Copyright (C) 2006, Joseph Dunn <jdunn@iguanaworks.net>
-*
-* Distribute under GPL version 2.
-*
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <errno.h>
-#include <arpa/inet.h>
-#if defined __APPLE__
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#else
-#include <wait.h>
-#endif
-#include <arpa/inet.h>
-
-#include "lirc_driver.h"
-
-#include "iguanaIR.h"
-static const logchannel_t logchannel = LOG_DRIVER;
-
-static int sendConn = -1;
-static pid_t child = 0;
-static int recvDone = 0;
-static int currentCarrier = -1;
-
-static void quitHandler(int sig)
-{
- recvDone = 1;
-}
-
-static void recv_loop(int fd, int notify)
-{
- int conn;
-
- alarm(0);
- signal(SIGTERM, quitHandler);
- /* signal(SIGPIPE, SIG_DFL); */
- signal(SIGINT, quitHandler);
- signal(SIGHUP, SIG_IGN);
- signal(SIGALRM, SIG_IGN);
-
- /* notify parent by closing notify */
- close(notify);
-
- conn = iguanaConnect(drv.device);
- if (conn != -1) {
- iguanaPacket request, response;
- lirc_t prevCode = -1;
-
- request = iguanaCreateRequest(IG_DEV_RECVON, 0, NULL);
- if (iguanaWriteRequest(request, conn)) {
- while (!recvDone) {
- /* read from device */
- do
- response = iguanaReadResponse(conn, 1000);
- while (!recvDone && ((response == NULL && errno == ETIMEDOUT)
- || (iguanaResponseIsError(response) && errno == ETIMEDOUT)));
-
- if (iguanaResponseIsError(response)) {
- /* be quiet during exit */
- if (!recvDone)
- log_error("error response: %s\n", strerror(errno));
- break;
- } else if (iguanaCode(response) == IG_DEV_RECV) {
- uint32_t* code;
- unsigned int length, x, y = 0;
- lirc_t buffer[8]; /* we read 8 bytes max at a time
- * from the device, i.e. packet
- * can only contain 8
- * signals. */
-
- /* pull the data off the packet */
- code = (uint32_t*)iguanaRemoveData(response, &length);
- length /= sizeof(uint32_t);
-
- /* translate the code into lirc_t pulses (and make
- * sure they don't split across iguana packets. */
- for (x = 0; x < length; x++) {
- if (prevCode == -1) {
- prevCode = (code[x] & IG_PULSE_MASK);
- if (prevCode > PULSE_MASK)
- prevCode = PULSE_MASK;
- if (code[x] & IG_PULSE_BIT)
- prevCode |= PULSE_BIT;
- } else if (((prevCode & PULSE_BIT) && (code[x] & IG_PULSE_BIT))
- || (!(prevCode & PULSE_BIT) && !(code[x] & IG_PULSE_BIT))) {
- /* can overflow pulse mask, so just set to
- * largest possible */
- if ((prevCode & PULSE_MASK) + (code[x] & IG_PULSE_MASK) >
- PULSE_MASK)
- prevCode = (prevCode & PULSE_BIT) | PULSE_MASK;
- else
- prevCode += code[x] & IG_PULSE_MASK;
- } else {
- buffer[y] = prevCode;
- y++;
-
- prevCode = (code[x] & IG_PULSE_MASK);
- if (prevCode > PULSE_MASK)
- prevCode = PULSE_MASK;
- if (code[x] & IG_PULSE_BIT)
- prevCode |= PULSE_BIT;
- }
- }
-
- /* write the data and free it */
- if (y > 0) {
- chk_write(fd,
- buffer,
- sizeof(lirc_t) * y);
- }
- free(code);
- }
-
- iguanaFreePacket(response);
- }
- }
-
- iguanaFreePacket(request);
- }
-
- iguanaClose(conn);
- close(fd);
-}
-
-static int iguana_init(void)
-{
- int recv_pipe[2], retval = 0;
-
- rec_buffer_init();
-
- if (pipe(recv_pipe) != 0) {
- log_error("couldn't open pipe: %s", strerror(errno));
- } else {
- int notify[2];
-
- if (pipe(notify) != 0) {
- log_error("couldn't open pipe: %s", strerror(errno));
- close(recv_pipe[0]);
- close(recv_pipe[1]);
- } else {
- drv.fd = recv_pipe[0];
-
- child = fork();
- if (child == -1) {
- log_error("couldn't fork child process: %s", strerror(errno));
- } else if (child == 0) {
- close(recv_pipe[0]);
- close(notify[0]);
- recv_loop(recv_pipe[1], notify[1]);
- _exit(0);
- } else {
- int dummy;
-
- close(recv_pipe[1]);
- close(notify[1]);
- /* make sure child has set its signal handler to avoid race with iguana_deinit() */
- chk_read(notify[0], &dummy, 1);
- close(notify[0]);
- sendConn = iguanaConnect(drv.device);
- if (sendConn == -1) {
- log_error("couldn't open connection to iguanaIR daemon: %s",
- strerror(errno));
- } else {
- retval = 1;
- }
- }
- }
- }
-
- return retval;
-}
-
-static pid_t dowaitpid(pid_t pid, int* stat_loc, int options)
-{
- pid_t retval;
-
- do
- retval = waitpid(pid, stat_loc, options);
- while (retval == (pid_t)-1 && errno == EINTR);
-
- return retval;
-}
-
-static int iguana_deinit(void)
-{
- /* close the connection to the iguana daemon */
- if (sendConn != -1) {
- iguanaClose(sendConn);
- sendConn = -1;
- }
-
- /* signal the child process to exit */
- if (child > 0 && (kill(child, SIGTERM) == -1 || dowaitpid(child, NULL, 0) != (pid_t)-1))
- child = 0;
-
- /* close drv.fd since otherwise we leak open files */
- close(drv.fd);
- drv.fd = -1;
-
- return child == 0;
-}
-
-static char* iguana_rec(struct ir_remote* remotes)
-{
- char* retval = NULL;
-
- if (rec_buffer_clear())
- retval = decode_all(remotes);
- return retval;
-}
-
-static bool daemonTransaction(unsigned char code, void* value, size_t size)
-{
- uint8_t* data;
- bool retval = false;
-
- data = (uint8_t*)malloc(size);
- if (data != NULL) {
- iguanaPacket request, response = NULL;
-
- memcpy(data, value, size);
- request = iguanaCreateRequest(code, size, data);
- if (request) {
- if (iguanaWriteRequest(request, sendConn))
- response = iguanaReadResponse(sendConn, 10000);
- iguanaFreePacket(request);
- } else {
- free(data);
- }
-
- /* handle success */
- if (!iguanaResponseIsError(response))
- retval = true;
- iguanaFreePacket(response);
- }
- return retval;
-}
-
-static int iguana_send(struct ir_remote* remote, struct ir_ncode* code)
-{
- int retval = 0;
- uint32_t freq;
-
- /* set the carrier frequency if necessary */
- freq = htonl(remote->freq);
- if (remote->freq != currentCarrier && remote->freq >= 25000 && remote->freq <= 100000
- && daemonTransaction(IG_DEV_SETCARRIER, &freq, sizeof(freq)))
- currentCarrier = remote->freq;
-
- if (send_buffer_put(remote, code)) {
- int length, x;
- const lirc_t* signals;
- uint32_t* igsignals;
-
- length = send_buffer_length();
- signals = send_buffer_data();
-
- igsignals = (uint32_t*)malloc(sizeof(uint32_t) * length);
- if (igsignals != NULL) {
- iguanaPacket request, response = NULL;
-
- /* must pack the data into a unit32_t array */
- for (x = 0; x < length; x++) {
- igsignals[x] = signals[x] & PULSE_MASK;
- if (signals[x] & PULSE_BIT)
- igsignals[x] |= IG_PULSE_BIT;
- }
-
- /* construct a request and send it to the daemon
- * TRICKY: IguanaFreePacket free()'s both the
- * igsignals chunk and the request packet, but
- * iguanaCreateRequest does not malloc that chunk.
- */
- request = iguanaCreateRequest(IG_DEV_SEND, sizeof(uint32_t) * length, igsignals);
- if (iguanaWriteRequest(request, sendConn)) {
- /* response will only come back after the device has
- * transmitted */
- response = iguanaReadResponse(sendConn, 10000);
- if (!iguanaResponseIsError(response))
- retval = 1;
-
- iguanaFreePacket(response);
- }
-
- /* free the packet and the data */
- iguanaFreePacket(request);
- }
- }
-
- return retval;
-}
-
-static int iguana_ioctl(unsigned int code, void* arg)
-{
- int retcode = -1;
- uint8_t channels = *(uint8_t*)arg;
-
- /* set the transmit channels: return 0 on success, 4 if
- * out-of-range (see ioctl) */
- if (code == LIRC_SET_TRANSMITTER_MASK) {
- if (channels > 0x0F)
- retcode = 4;
- else if (daemonTransaction(IG_DEV_SETCHANNELS, &channels, sizeof(channels)))
- retcode = 0;
- }
-
- return retcode;
-}
-
-static lirc_t readdata(lirc_t timeout)
-{
- lirc_t code = 0;
- struct pollfd pfd = {.fd = drv.fd, .events = POLLIN, .revents = 0};
- /* attempt a read with a timeout using select */
- if (poll(&pfd, 1, timeout / 1000) > 0) {
- /* if we failed to get data return 0 */
- if (read(drv.fd, &code, sizeof(lirc_t)) <= 0)
- iguana_deinit();
- }
- return code;
-}
-
-const struct driver hw_iguanaIR = {
- .name = "iguanaIR",
- .device = "0",
- .features = LIRC_CAN_REC_MODE2 | \
- LIRC_CAN_SEND_PULSE | \
- LIRC_CAN_SET_SEND_CARRIER | \
- LIRC_CAN_SET_TRANSMITTER_MASK,
- .send_mode = LIRC_MODE_PULSE,
- .rec_mode = LIRC_MODE_MODE2,
- .code_length = sizeof(int),
- .init_func = iguana_init,
- .deinit_func = iguana_deinit,
- .open_func = default_open,
- .close_func = default_close,
- .send_func = iguana_send,
- .rec_func = iguana_rec,
- .decode_func = receive_decode,
- .drvctl_func = iguana_ioctl,
- .readdata = readdata,
- .api_version = 3,
- .driver_version = "0.9.3",
- .info = "See file://" PLUGINDOCS "/iguanair.html",
- .device_hint = "/var/run/iguanaIR/*",
-};
-
-const struct driver* hardwares[] = { &hw_iguanaIR, (const struct driver*)NULL };
diff --git a/iguanaIR.conf b/iguanaIR.conf
deleted file mode 100755
index 12e9523..0000000
--- a/iguanaIR.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# This is a lirc configuration for a capture device.
-# See README for more.
-
-config:
- driver: iguanaIR
- id: iguanaIR
- label: Iguanaworks USB IR Transceiver
- menu: usb
- note: This is the user-space driver from Iguanaworks, Inc.
- There is also a built-in kernel driver. Both can be used
- but not concurrently.
- product_driver: 1781:0938
- modprobe: [blacklist iguanair]
diff --git a/iguanaIR.html b/iguanaIR.html
deleted file mode 100755
index 99609c3..0000000
--- a/iguanaIR.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<P>
- This driver supports both receiving and sending (blasting) using
- the IguanaIR devices from
- <a href="http://iguanaworks.net/ir">http://iguanaworks.net/ir.</a></p>
-<p>
- The LIRC driver works on top of the IguanaIR low-level userspace
- driver which provides a socket interface. It is available from
- the same source, and also packaged for many distributions
- including Debian, Fedora and Arch Linux.
-<p>
- The --device argument to the driver is a socket designator created
- by the low-level driveri. It defaults to '0' which implies
- <em>/run/iguanair/0</em>.
-<p>
- The kernel has built-in support for these devices in the
- iguanair module. This can be used instead of this driver in
- many cases. If the userspace driver should be used, the
- kernel driver must be blacklisted.</p>
diff --git a/iguanair.c b/iguanair.c
new file mode 100755
index 0000000..f2e5794
--- /dev/null
+++ b/iguanair.c
@@ -0,0 +1,364 @@
+/****************************************************************************
+** hw_iguanaIR.c ***********************************************************
+****************************************************************************
+*
+* routines for interfacing with Iguanaworks USB IR devices
+*
+* Copyright (C) 2006, Joseph Dunn <jdunn@iguanaworks.net>
+*
+* Distribute under GPL version 2.
+*
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <poll.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <errno.h>
+#include <arpa/inet.h>
+#if defined __APPLE__
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#else
+#include <wait.h>
+#endif
+#include <arpa/inet.h>
+
+#include "lirc_driver.h"
+
+#include "iguanaIR.h"
+static const logchannel_t logchannel = LOG_DRIVER;
+
+static int sendConn = -1;
+static pid_t child = 0;
+static int recvDone = 0;
+static int currentCarrier = -1;
+
+static void quitHandler(int sig)
+{
+ recvDone = 1;
+}
+
+static void recv_loop(int fd, int notify)
+{
+ int conn;
+
+ alarm(0);
+ signal(SIGTERM, quitHandler);
+ /* signal(SIGPIPE, SIG_DFL); */
+ signal(SIGINT, quitHandler);
+ signal(SIGHUP, SIG_IGN);
+ signal(SIGALRM, SIG_IGN);
+
+ /* notify parent by closing notify */
+ close(notify);
+
+ conn = iguanaConnect(drv.device);
+ if (conn != -1) {
+ iguanaPacket request, response;
+ lirc_t prevCode = -1;
+
+ request = iguanaCreateRequest(IG_DEV_RECVON, 0, NULL);
+ if (iguanaWriteRequest(request, conn)) {
+ while (!recvDone) {
+ /* read from device */
+ do
+ response = iguanaReadResponse(conn, 1000);
+ while (!recvDone && ((response == NULL && errno == ETIMEDOUT)
+ || (iguanaResponseIsError(response) && errno == ETIMEDOUT)));
+
+ if (iguanaResponseIsError(response)) {
+ /* be quiet during exit */
+ if (!recvDone)
+ log_error("error response: %s\n", strerror(errno));
+ break;
+ } else if (iguanaCode(response) == IG_DEV_RECV) {
+ uint32_t* code;
+ unsigned int length, x, y = 0;
+ lirc_t buffer[8]; /* we read 8 bytes max at a time
+ * from the device, i.e. packet
+ * can only contain 8
+ * signals. */
+
+ /* pull the data off the packet */
+ code = (uint32_t*)iguanaRemoveData(response, &length);
+ length /= sizeof(uint32_t);
+
+ /* translate the code into lirc_t pulses (and make
+ * sure they don't split across iguana packets. */
+ for (x = 0; x < length; x++) {
+ if (prevCode == -1) {
+ prevCode = (code[x] & IG_PULSE_MASK);
+ if (prevCode > PULSE_MASK)
+ prevCode = PULSE_MASK;
+ if (code[x] & IG_PULSE_BIT)
+ prevCode |= PULSE_BIT;
+ } else if (((prevCode & PULSE_BIT) && (code[x] & IG_PULSE_BIT))
+ || (!(prevCode & PULSE_BIT) && !(code[x] & IG_PULSE_BIT))) {
+ /* can overflow pulse mask, so just set to
+ * largest possible */
+ if ((prevCode & PULSE_MASK) + (code[x] & IG_PULSE_MASK) >
+ PULSE_MASK)
+ prevCode = (prevCode & PULSE_BIT) | PULSE_MASK;
+ else
+ prevCode += code[x] & IG_PULSE_MASK;
+ } else {
+ buffer[y] = prevCode;
+ y++;
+
+ prevCode = (code[x] & IG_PULSE_MASK);
+ if (prevCode > PULSE_MASK)
+ prevCode = PULSE_MASK;
+ if (code[x] & IG_PULSE_BIT)
+ prevCode |= PULSE_BIT;
+ }
+ }
+
+ /* write the data and free it */
+ if (y > 0) {
+ chk_write(fd,
+ buffer,
+ sizeof(lirc_t) * y);
+ }
+ free(code);
+ }
+
+ iguanaFreePacket(response);
+ }
+ }
+
+ iguanaFreePacket(request);
+ }
+
+ iguanaClose(conn);
+ close(fd);
+}
+
+static int iguana_init(void)
+{
+ int recv_pipe[2], retval = 0;
+
+ rec_buffer_init();
+
+ if (pipe(recv_pipe) != 0) {
+ log_error("couldn't open pipe: %s", strerror(errno));
+ } else {
+ int notify[2];
+
+ if (pipe(notify) != 0) {
+ log_error("couldn't open pipe: %s", strerror(errno));
+ close(recv_pipe[0]);
+ close(recv_pipe[1]);
+ } else {
+ drv.fd = recv_pipe[0];
+
+ child = fork();
+ if (child == -1) {
+ log_error("couldn't fork child process: %s", strerror(errno));
+ } else if (child == 0) {
+ close(recv_pipe[0]);
+ close(notify[0]);
+ recv_loop(recv_pipe[1], notify[1]);
+ _exit(0);
+ } else {
+ int dummy;
+
+ close(recv_pipe[1]);
+ close(notify[1]);
+ /* make sure child has set its signal handler to avoid race with iguana_deinit() */
+ chk_read(notify[0], &dummy, 1);
+ close(notify[0]);
+ sendConn = iguanaConnect(drv.device);
+ if (sendConn == -1) {
+ log_error("couldn't open connection to iguanaIR daemon: %s",
+ strerror(errno));
+ } else {
+ retval = 1;
+ }
+ }
+ }
+ }
+
+ return retval;
+}
+
+static pid_t dowaitpid(pid_t pid, int* stat_loc, int options)
+{
+ pid_t retval;
+
+ do
+ retval = waitpid(pid, stat_loc, options);
+ while (retval == (pid_t)-1 && errno == EINTR);
+
+ return retval;
+}
+
+static int iguana_deinit(void)
+{
+ /* close the connection to the iguana daemon */
+ if (sendConn != -1) {
+ iguanaClose(sendConn);
+ sendConn = -1;
+ }
+
+ /* signal the child process to exit */
+ if (child > 0 && (kill(child, SIGTERM) == -1 || dowaitpid(child, NULL, 0) != (pid_t)-1))
+ child = 0;
+
+ /* close drv.fd since otherwise we leak open files */
+ close(drv.fd);
+ drv.fd = -1;
+
+ return child == 0;
+}
+
+static char* iguana_rec(struct ir_remote* remotes)
+{
+ char* retval = NULL;
+
+ if (rec_buffer_clear())
+ retval = decode_all(remotes);
+ return retval;
+}
+
+static bool daemonTransaction(unsigned char code, void* value, size_t size)
+{
+ uint8_t* data;
+ bool retval = false;
+
+ data = (uint8_t*)malloc(size);
+ if (data != NULL) {
+ iguanaPacket request, response = NULL;
+
+ memcpy(data, value, size);
+ request = iguanaCreateRequest(code, size, data);
+ if (request) {
+ if (iguanaWriteRequest(request, sendConn))
+ response = iguanaReadResponse(sendConn, 10000);
+ iguanaFreePacket(request);
+ } else {
+ free(data);
+ }
+
+ /* handle success */
+ if (!iguanaResponseIsError(response))
+ retval = true;
+ iguanaFreePacket(response);
+ }
+ return retval;
+}
+
+static int iguana_send(struct ir_remote* remote, struct ir_ncode* code)
+{
+ int retval = 0;
+ uint32_t freq;
+
+ /* set the carrier frequency if necessary */
+ freq = htonl(remote->freq);
+ if (remote->freq != currentCarrier && remote->freq >= 25000 && remote->freq <= 100000
+ && daemonTransaction(IG_DEV_SETCARRIER, &freq, sizeof(freq)))
+ currentCarrier = remote->freq;
+
+ if (send_buffer_put(remote, code)) {
+ int length, x;
+ const lirc_t* signals;
+ uint32_t* igsignals;
+
+ length = send_buffer_length();
+ signals = send_buffer_data();
+
+ igsignals = (uint32_t*)malloc(sizeof(uint32_t) * length);
+ if (igsignals != NULL) {
+ iguanaPacket request, response = NULL;
+
+ /* must pack the data into a unit32_t array */
+ for (x = 0; x < length; x++) {
+ igsignals[x] = signals[x] & PULSE_MASK;
+ if (signals[x] & PULSE_BIT)
+ igsignals[x] |= IG_PULSE_BIT;
+ }
+
+ /* construct a request and send it to the daemon
+ * TRICKY: IguanaFreePacket free()'s both the
+ * igsignals chunk and the request packet, but
+ * iguanaCreateRequest does not malloc that chunk.
+ */
+ request = iguanaCreateRequest(IG_DEV_SEND, sizeof(uint32_t) * length, igsignals);
+ if (iguanaWriteRequest(request, sendConn)) {
+ /* response will only come back after the device has
+ * transmitted */
+ response = iguanaReadResponse(sendConn, 10000);
+ if (!iguanaResponseIsError(response))
+ retval = 1;
+
+ iguanaFreePacket(response);
+ }
+
+ /* free the packet and the data */
+ iguanaFreePacket(request);
+ }
+ }
+
+ return retval;
+}
+
+static int iguana_ioctl(unsigned int code, void* arg)
+{
+ int retcode = -1;
+ uint8_t channels = *(uint8_t*)arg;
+
+ /* set the transmit channels: return 0 on success, 4 if
+ * out-of-range (see ioctl) */
+ if (code == LIRC_SET_TRANSMITTER_MASK) {
+ if (channels > 0x0F)
+ retcode = 4;
+ else if (daemonTransaction(IG_DEV_SETCHANNELS, &channels, sizeof(channels)))
+ retcode = 0;
+ }
+
+ return retcode;
+}
+
+static lirc_t readdata(lirc_t timeout)
+{
+ lirc_t code = 0;
+ struct pollfd pfd = {.fd = drv.fd, .events = POLLIN, .revents = 0};
+ /* attempt a read with a timeout using select */
+ if (poll(&pfd, 1, timeout / 1000) > 0) {
+ /* if we failed to get data return 0 */
+ if (read(drv.fd, &code, sizeof(lirc_t)) <= 0)
+ iguana_deinit();
+ }
+ return code;
+}
+
+const struct driver hw_iguanaIR = {
+ .name = "iguanaIR",
+ .device = "0",
+ .features = LIRC_CAN_REC_MODE2 | \
+ LIRC_CAN_SEND_PULSE | \
+ LIRC_CAN_SET_SEND_CARRIER | \
+ LIRC_CAN_SET_TRANSMITTER_MASK,
+ .send_mode = LIRC_MODE_PULSE,
+ .rec_mode = LIRC_MODE_MODE2,
+ .code_length = sizeof(int),
+ .init_func = iguana_init,
+ .deinit_func = iguana_deinit,
+ .open_func = default_open,
+ .close_func = default_close,
+ .send_func = iguana_send,
+ .rec_func = iguana_rec,
+ .decode_func = receive_decode,
+ .drvctl_func = iguana_ioctl,
+ .readdata = readdata,
+ .api_version = 3,
+ .driver_version = "0.9.3",
+ .info = "See file://" PLUGINDOCS "/iguanair.html",
+ .device_hint = "/var/run/iguanaIR/*",
+};
+
+const struct driver* hardwares[] = { &hw_iguanaIR, (const struct driver*)NULL };
diff --git a/iguanair.conf b/iguanair.conf
new file mode 100755
index 0000000..12e9523
--- /dev/null
+++ b/iguanair.conf
@@ -0,0 +1,13 @@
+# This is a lirc configuration for a capture device.
+# See README for more.
+
+config:
+ driver: iguanaIR
+ id: iguanaIR
+ label: Iguanaworks USB IR Transceiver
+ menu: usb
+ note: This is the user-space driver from Iguanaworks, Inc.
+ There is also a built-in kernel driver. Both can be used
+ but not concurrently.
+ product_driver: 1781:0938
+ modprobe: [blacklist iguanair]
diff --git a/iguanair.html b/iguanair.html
new file mode 100755
index 0000000..99609c3
--- /dev/null
+++ b/iguanair.html
@@ -0,0 +1,18 @@
+<P>
+ This driver supports both receiving and sending (blasting) using
+ the IguanaIR devices from
+ <a href="http://iguanaworks.net/ir">http://iguanaworks.net/ir.</a></p>
+<p>
+ The LIRC driver works on top of the IguanaIR low-level userspace
+ driver which provides a socket interface. It is available from
+ the same source, and also packaged for many distributions
+ including Debian, Fedora and Arch Linux.
+<p>
+ The --device argument to the driver is a socket designator created
+ by the low-level driveri. It defaults to '0' which implies
+ <em>/run/iguanair/0</em>.
+<p>
+ The kernel has built-in support for these devices in the
+ iguanair module. This can be used instead of this driver in
+ many cases. If the userspace driver should be used, the
+ kernel driver must be blacklisted.</p>
--
2.5.5

View file

@ -0,0 +1,39 @@
From ac541ea506a82ab699bff42829f697e46755eb12 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Mon, 30 Jan 2017 10:56:33 +0100
Subject: [PATCH 10/14] build: Remove cmake dist generation.
The cmake code is worse in at least two ways: It includes whatever
junk it finds in the source directory, and it isn't aware of the
lirc-driver-iguanair in the parent directory. The make-dist.sh
script just is better, so drop the cmake code.
---
software/usb_ir/CMakeLists.txt | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/software/usb_ir/CMakeLists.txt b/software/usb_ir/CMakeLists.txt
index e056483..8a55372 100644
--- a/software/usb_ir/CMakeLists.txt
+++ b/software/usb_ir/CMakeLists.txt
@@ -15,18 +15,6 @@ Set(SO_AGE 3)
Set(SOVERSION 0)
-# Source dist setup
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${FULLVER}")
-set(CPACK_SOURCE_IGNORE_FILES
- "/build/;/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}")
-set(CPACK_SOURCE_GENERATOR TGZ)
-include(CPack)
-
-add_custom_target(check_git ${CMAKE_COMMAND}
- -P ${CMAKE_SOURCE_DIR}/check_git_status.cmake)
-add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source
- DEPENDS check_git)
-
#Set(TARGET_ANDROID true)
If(TARGET_ANDROID)
--
2.9.3

View file

@ -0,0 +1,94 @@
From 889ff6716f40c5abca23bbfed9660e29903cc009 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Thu, 1 Sep 2016 02:52:51 +0200
Subject: [PATCH 11/13] Rename/link README files to match modified install
routines.
---
README | 28 ----------------------------
README.md | 1 +
iguanair.txt | 28 ++++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 28 deletions(-)
delete mode 100755 README
create mode 120000 README.md
create mode 100755 iguanair.txt
diff --git a/README b/README
deleted file mode 100755
index 843baf6..0000000
--- a/README
+++ /dev/null
@@ -1,28 +0,0 @@
-IguanaIR LIRC driver README
-===========================
-
-This driver used to be part of the LIRC sources. In order to improve
-the maintenance it has been moved to Iguanaworks, Inc which is the
-primary hardware and software vendor.
-
-From 0.9.4 the driver is available at: https://github.com/iguanaworks/iguanair-lirc
-
-As a transition step the same files are available here during the 0.9.4
-cycle. These files are a complete lirc driver for iguanair. Building requires
-lirc >= 0.9.4. If you are using a packaged version you probably need to
-have the -devel and -doc packages installed. Note that the downstream
-sources at https://github.com/iguanaworks/iguanair-lirc are preferred and
-will be the only option in next release.
-
-To build and install the driver together with the support files:
-
- $ make
- $ sudo make install
-
-Verifying the driver after make install:
-
- $ lirc-lsplugins -q iguanair
- --- /usr/lib64/lirc/plugins/iguanair.so
-
-You could also find the driver docs in the manual. The path varies, but
-in a packaged version typically /usr/share/doc/lirc/lirc.org/html/index.html.
diff --git a/README.md b/README.md
new file mode 120000
index 0000000..b471562
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+iguanair.txt
\ No newline at end of file
diff --git a/iguanair.txt b/iguanair.txt
new file mode 100755
index 0000000..843baf6
--- /dev/null
+++ b/iguanair.txt
@@ -0,0 +1,28 @@
+IguanaIR LIRC driver README
+===========================
+
+This driver used to be part of the LIRC sources. In order to improve
+the maintenance it has been moved to Iguanaworks, Inc which is the
+primary hardware and software vendor.
+
+From 0.9.4 the driver is available at: https://github.com/iguanaworks/iguanair-lirc
+
+As a transition step the same files are available here during the 0.9.4
+cycle. These files are a complete lirc driver for iguanair. Building requires
+lirc >= 0.9.4. If you are using a packaged version you probably need to
+have the -devel and -doc packages installed. Note that the downstream
+sources at https://github.com/iguanaworks/iguanair-lirc are preferred and
+will be the only option in next release.
+
+To build and install the driver together with the support files:
+
+ $ make
+ $ sudo make install
+
+Verifying the driver after make install:
+
+ $ lirc-lsplugins -q iguanair
+ --- /usr/lib64/lirc/plugins/iguanair.so
+
+You could also find the driver docs in the manual. The path varies, but
+in a packaged version typically /usr/share/doc/lirc/lirc.org/html/index.html.
--
2.5.5

View file

@ -0,0 +1,25 @@
From db05b2629b6b5a5972a51e2d2fbbf04e45e56cc8 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Fri, 3 Feb 2017 00:01:08 +0100
Subject: [PATCH 11/14] lirc-drv: Fix missing linker flag.
---
software/lirc-drv-iguanair/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/software/lirc-drv-iguanair/Makefile b/software/lirc-drv-iguanair/Makefile
index 3bae4e9..6aff458 100755
--- a/software/lirc-drv-iguanair/Makefile
+++ b/software/lirc-drv-iguanair/Makefile
@@ -17,7 +17,7 @@ driver = iguanair
all: $(driver).so
-LDFLAGS += -liguanaIR -L../usb_ir/build
+LDFLAGS += -lusb -liguanaIR -L../usb_ir/build
CFLAGS += -I../usb_ir
MODPROBE_CONF = 60-blacklist-kernel-iguanair.conf
--
2.9.3

View file

@ -0,0 +1,59 @@
From 4d692f097e5c556f47404c97a5ce2c0b2180ee3a Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Thu, 1 Sep 2016 03:17:27 +0200
Subject: [PATCH 12/13] Makefile: Add DESTDIR support
---
Makefile | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index c6a7f7a..4db147a 100755
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
#
-driver = iguanaIR
+driver = iguanair
all: $(driver).so
@@ -18,7 +18,13 @@ PLUGINDIR ?= $(shell pkg-config --variable=plugindir lirc-driver)
CONFIGDIR ?= $(shell pkg-config --variable=configdir lirc-driver)
PLUGINDOCS ?= $(shell pkg-config --variable=plugindocs lirc-driver)
-include $(PLUGINDOCS)/plugindocs.mk
+PLUGINDOCS_MK = $(PLUGINDOCS)/plugindocs.mk
+MODPROBE_CONF = 60-blacklist-kernel-iguanair.conf
+
+ifneq ($(wildcard $(PLUGINDOCS_MK)),)
+ include $(PLUGINDOCS_MK)
+endif
+
$(driver).o: $(driver).c
@@ -26,11 +32,14 @@ $(driver).so: $(driver).o
gcc --shared -fpic $(LDFLAGS) -o $@ $<
install: $(driver).so
- install $< $(PLUGINDIR)
- install $(driver).conf $(CONFIGDIR)
- install $(driver).html $(PLUGINDOCS)
- install -m 644 60-blacklist-kernel-iguanair.conf /etc/modprobe.d
+ install -pDm 755 $< $(DESTDIR)$(PLUGINDIR)/$<
+ install -pDm 644 $(driver).html $(DESTDIR)$(PLUGINDOCS)/$(driver).html
+ install -pDm 644 $(driver).conf $(DESTDIR)$(CONFIGDIR)/$(driver).conf
+ install -pDm 644 $(MODPROBE_CONF) \
+ $(DESTDIR)/etc/modprobe.d/$(MODPROBE_CONF)
+ifneq ($(wildcard $(PLUGINDOCS_MK)),)
$(MAKE) update
+endif
clean:
rm -f *.o *.so
--
2.5.5

View file

@ -0,0 +1,51 @@
From 4264b5d65c012fdbe4e2b676ef1987ab4a0778dd Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Sat, 4 Feb 2017 10:56:21 +0100
Subject: [PATCH 12/14] build: cmake: Use correct permissions when installing.
---
software/usb_ir/CMakeLists.txt | 2 ++
software/usb_ir/files/systemd/usr/bin/iguanaIR-rescan | 12 ++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/software/usb_ir/CMakeLists.txt b/software/usb_ir/CMakeLists.txt
index 8a55372..665ae82 100644
--- a/software/usb_ir/CMakeLists.txt
+++ b/software/usb_ir/CMakeLists.txt
@@ -245,9 +245,11 @@ install(FILES iguanaIR.h
DESTINATION /usr/include)
if (${SYSTEMD_FOUND} EQUAL 1)
install(DIRECTORY files/systemd/usr
+ USE_SOURCE_PERMISSIONS
DESTINATION /)
else()
install(DIRECTORY files/sysV/usr files/sysV/etc
+ USE_SOURCE_PERMISSIONS
DESTINATION /)
endif()
diff --git a/software/usb_ir/files/systemd/usr/bin/iguanaIR-rescan b/software/usb_ir/files/systemd/usr/bin/iguanaIR-rescan
index a41a59d..9d0a700 100755
--- a/software/usb_ir/files/systemd/usr/bin/iguanaIR-rescan
+++ b/software/usb_ir/files/systemd/usr/bin/iguanaIR-rescan
@@ -4,11 +4,11 @@
# signal fails, restart daemon.
if systemctl --quiet is-active iguanaIR.service; then
- pid=$( systemctl --property=MainPID show iguanaIR.service ) || \
- pid=''
- pid=${pid##*=}
- [ -n "$pid" ] && kill -HUP $pid &>/dev/null && exit 0
+ pid=$( systemctl --property=MainPID show iguanaIR.service ) || \
+ pid=''
+ pid=${pid##*=}
+ [ -n "$pid" ] && kill -HUP $pid &>/dev/null && exit 0
fi
systemctl show --property=UnitFileState iguanaIR.service |
- grep -q enabled && \
- systemctl restart iguanaIR.service
+ grep -q enabled && \
+ systemctl restart iguanaIR.service
--
2.9.3

View file

@ -0,0 +1,988 @@
From c75c2561ae65c711a80136e96fcba0f0fbb00294 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Thu, 1 Sep 2016 03:25:23 +0200
Subject: [PATCH 13/13] Convert all files to LF line endings (like main driver
files).
---
60-blacklist-kernel-iguanair.conf | 4 +-
Makefile | 90 ++---
iguanair.c | 728 +++++++++++++++++++-------------------
iguanair.conf | 26 +-
iguanair.html | 36 +-
iguanair.txt | 56 +--
6 files changed, 470 insertions(+), 470 deletions(-)
diff --git a/60-blacklist-kernel-iguanair.conf b/60-blacklist-kernel-iguanair.conf
index 1cf1cfa..1888c18 100755
--- a/60-blacklist-kernel-iguanair.conf
+++ b/60-blacklist-kernel-iguanair.conf
@@ -1,2 +1,2 @@
-# kernel iguanair module conflicts with userspace IguanaIR daemon
-blacklist iguanair
+# kernel iguanair module conflicts with userspace IguanaIR daemon
+blacklist iguanair
diff --git a/Makefile b/Makefile
index 4db147a..dd093eb 100755
--- a/Makefile
+++ b/Makefile
@@ -1,45 +1,45 @@
-#
-# Template for building a lirc userspace driver out of tree.
-# Requires that lirc is installed in system locations, in
-# particular that the /usr/lib[64]/pkgconfig/lirc-driver.pc
-# is in place (/usr/local/lib/pkgconfig/... is also OK).
-# The required file plugindocs.mk might live in a -doc
-# package which then is needed.
-#
-
-
-driver = iguanair
-
-all: $(driver).so
-
-CFLAGS += $(shell pkg-config --cflags lirc-driver)
-LDFLAGS += $(shell pkg-config --libs lirc-driver)
-PLUGINDIR ?= $(shell pkg-config --variable=plugindir lirc-driver)
-CONFIGDIR ?= $(shell pkg-config --variable=configdir lirc-driver)
-PLUGINDOCS ?= $(shell pkg-config --variable=plugindocs lirc-driver)
-
-PLUGINDOCS_MK = $(PLUGINDOCS)/plugindocs.mk
-MODPROBE_CONF = 60-blacklist-kernel-iguanair.conf
-
-ifneq ($(wildcard $(PLUGINDOCS_MK)),)
- include $(PLUGINDOCS_MK)
-endif
-
-
-$(driver).o: $(driver).c
-
-$(driver).so: $(driver).o
- gcc --shared -fpic $(LDFLAGS) -o $@ $<
-
-install: $(driver).so
- install -pDm 755 $< $(DESTDIR)$(PLUGINDIR)/$<
- install -pDm 644 $(driver).html $(DESTDIR)$(PLUGINDOCS)/$(driver).html
- install -pDm 644 $(driver).conf $(DESTDIR)$(CONFIGDIR)/$(driver).conf
- install -pDm 644 $(MODPROBE_CONF) \
- $(DESTDIR)/etc/modprobe.d/$(MODPROBE_CONF)
-ifneq ($(wildcard $(PLUGINDOCS_MK)),)
- $(MAKE) update
-endif
-
-clean:
- rm -f *.o *.so
+#
+# Template for building a lirc userspace driver out of tree.
+# Requires that lirc is installed in system locations, in
+# particular that the /usr/lib[64]/pkgconfig/lirc-driver.pc
+# is in place (/usr/local/lib/pkgconfig/... is also OK).
+# The required file plugindocs.mk might live in a -doc
+# package which then is needed.
+#
+
+
+driver = iguanair
+
+all: $(driver).so
+
+CFLAGS += $(shell pkg-config --cflags lirc-driver)
+LDFLAGS += $(shell pkg-config --libs lirc-driver)
+PLUGINDIR ?= $(shell pkg-config --variable=plugindir lirc-driver)
+CONFIGDIR ?= $(shell pkg-config --variable=configdir lirc-driver)
+PLUGINDOCS ?= $(shell pkg-config --variable=plugindocs lirc-driver)
+
+PLUGINDOCS_MK = $(PLUGINDOCS)/plugindocs.mk
+MODPROBE_CONF = 60-blacklist-kernel-iguanair.conf
+
+ifneq ($(wildcard $(PLUGINDOCS_MK)),)
+ include $(PLUGINDOCS_MK)
+endif
+
+
+$(driver).o: $(driver).c
+
+$(driver).so: $(driver).o
+ gcc --shared -fpic $(LDFLAGS) -o $@ $<
+
+install: $(driver).so
+ install -pDm 755 $< $(DESTDIR)$(PLUGINDIR)/$<
+ install -pDm 644 $(driver).html $(DESTDIR)$(PLUGINDOCS)/$(driver).html
+ install -pDm 644 $(driver).conf $(DESTDIR)$(CONFIGDIR)/$(driver).conf
+ install -pDm 644 $(MODPROBE_CONF) \
+ $(DESTDIR)/etc/modprobe.d/$(MODPROBE_CONF)
+ifneq ($(wildcard $(PLUGINDOCS_MK)),)
+ $(MAKE) update
+endif
+
+clean:
+ rm -f *.o *.so
diff --git a/iguanair.c b/iguanair.c
index f2e5794..a43665f 100755
--- a/iguanair.c
+++ b/iguanair.c
@@ -1,364 +1,364 @@
-/****************************************************************************
-** hw_iguanaIR.c ***********************************************************
-****************************************************************************
-*
-* routines for interfacing with Iguanaworks USB IR devices
-*
-* Copyright (C) 2006, Joseph Dunn <jdunn@iguanaworks.net>
-*
-* Distribute under GPL version 2.
-*
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <errno.h>
-#include <arpa/inet.h>
-#if defined __APPLE__
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#else
-#include <wait.h>
-#endif
-#include <arpa/inet.h>
-
-#include "lirc_driver.h"
-
-#include "iguanaIR.h"
-static const logchannel_t logchannel = LOG_DRIVER;
-
-static int sendConn = -1;
-static pid_t child = 0;
-static int recvDone = 0;
-static int currentCarrier = -1;
-
-static void quitHandler(int sig)
-{
- recvDone = 1;
-}
-
-static void recv_loop(int fd, int notify)
-{
- int conn;
-
- alarm(0);
- signal(SIGTERM, quitHandler);
- /* signal(SIGPIPE, SIG_DFL); */
- signal(SIGINT, quitHandler);
- signal(SIGHUP, SIG_IGN);
- signal(SIGALRM, SIG_IGN);
-
- /* notify parent by closing notify */
- close(notify);
-
- conn = iguanaConnect(drv.device);
- if (conn != -1) {
- iguanaPacket request, response;
- lirc_t prevCode = -1;
-
- request = iguanaCreateRequest(IG_DEV_RECVON, 0, NULL);
- if (iguanaWriteRequest(request, conn)) {
- while (!recvDone) {
- /* read from device */
- do
- response = iguanaReadResponse(conn, 1000);
- while (!recvDone && ((response == NULL && errno == ETIMEDOUT)
- || (iguanaResponseIsError(response) && errno == ETIMEDOUT)));
-
- if (iguanaResponseIsError(response)) {
- /* be quiet during exit */
- if (!recvDone)
- log_error("error response: %s\n", strerror(errno));
- break;
- } else if (iguanaCode(response) == IG_DEV_RECV) {
- uint32_t* code;
- unsigned int length, x, y = 0;
- lirc_t buffer[8]; /* we read 8 bytes max at a time
- * from the device, i.e. packet
- * can only contain 8
- * signals. */
-
- /* pull the data off the packet */
- code = (uint32_t*)iguanaRemoveData(response, &length);
- length /= sizeof(uint32_t);
-
- /* translate the code into lirc_t pulses (and make
- * sure they don't split across iguana packets. */
- for (x = 0; x < length; x++) {
- if (prevCode == -1) {
- prevCode = (code[x] & IG_PULSE_MASK);
- if (prevCode > PULSE_MASK)
- prevCode = PULSE_MASK;
- if (code[x] & IG_PULSE_BIT)
- prevCode |= PULSE_BIT;
- } else if (((prevCode & PULSE_BIT) && (code[x] & IG_PULSE_BIT))
- || (!(prevCode & PULSE_BIT) && !(code[x] & IG_PULSE_BIT))) {
- /* can overflow pulse mask, so just set to
- * largest possible */
- if ((prevCode & PULSE_MASK) + (code[x] & IG_PULSE_MASK) >
- PULSE_MASK)
- prevCode = (prevCode & PULSE_BIT) | PULSE_MASK;
- else
- prevCode += code[x] & IG_PULSE_MASK;
- } else {
- buffer[y] = prevCode;
- y++;
-
- prevCode = (code[x] & IG_PULSE_MASK);
- if (prevCode > PULSE_MASK)
- prevCode = PULSE_MASK;
- if (code[x] & IG_PULSE_BIT)
- prevCode |= PULSE_BIT;
- }
- }
-
- /* write the data and free it */
- if (y > 0) {
- chk_write(fd,
- buffer,
- sizeof(lirc_t) * y);
- }
- free(code);
- }
-
- iguanaFreePacket(response);
- }
- }
-
- iguanaFreePacket(request);
- }
-
- iguanaClose(conn);
- close(fd);
-}
-
-static int iguana_init(void)
-{
- int recv_pipe[2], retval = 0;
-
- rec_buffer_init();
-
- if (pipe(recv_pipe) != 0) {
- log_error("couldn't open pipe: %s", strerror(errno));
- } else {
- int notify[2];
-
- if (pipe(notify) != 0) {
- log_error("couldn't open pipe: %s", strerror(errno));
- close(recv_pipe[0]);
- close(recv_pipe[1]);
- } else {
- drv.fd = recv_pipe[0];
-
- child = fork();
- if (child == -1) {
- log_error("couldn't fork child process: %s", strerror(errno));
- } else if (child == 0) {
- close(recv_pipe[0]);
- close(notify[0]);
- recv_loop(recv_pipe[1], notify[1]);
- _exit(0);
- } else {
- int dummy;
-
- close(recv_pipe[1]);
- close(notify[1]);
- /* make sure child has set its signal handler to avoid race with iguana_deinit() */
- chk_read(notify[0], &dummy, 1);
- close(notify[0]);
- sendConn = iguanaConnect(drv.device);
- if (sendConn == -1) {
- log_error("couldn't open connection to iguanaIR daemon: %s",
- strerror(errno));
- } else {
- retval = 1;
- }
- }
- }
- }
-
- return retval;
-}
-
-static pid_t dowaitpid(pid_t pid, int* stat_loc, int options)
-{
- pid_t retval;
-
- do
- retval = waitpid(pid, stat_loc, options);
- while (retval == (pid_t)-1 && errno == EINTR);
-
- return retval;
-}
-
-static int iguana_deinit(void)
-{
- /* close the connection to the iguana daemon */
- if (sendConn != -1) {
- iguanaClose(sendConn);
- sendConn = -1;
- }
-
- /* signal the child process to exit */
- if (child > 0 && (kill(child, SIGTERM) == -1 || dowaitpid(child, NULL, 0) != (pid_t)-1))
- child = 0;
-
- /* close drv.fd since otherwise we leak open files */
- close(drv.fd);
- drv.fd = -1;
-
- return child == 0;
-}
-
-static char* iguana_rec(struct ir_remote* remotes)
-{
- char* retval = NULL;
-
- if (rec_buffer_clear())
- retval = decode_all(remotes);
- return retval;
-}
-
-static bool daemonTransaction(unsigned char code, void* value, size_t size)
-{
- uint8_t* data;
- bool retval = false;
-
- data = (uint8_t*)malloc(size);
- if (data != NULL) {
- iguanaPacket request, response = NULL;
-
- memcpy(data, value, size);
- request = iguanaCreateRequest(code, size, data);
- if (request) {
- if (iguanaWriteRequest(request, sendConn))
- response = iguanaReadResponse(sendConn, 10000);
- iguanaFreePacket(request);
- } else {
- free(data);
- }
-
- /* handle success */
- if (!iguanaResponseIsError(response))
- retval = true;
- iguanaFreePacket(response);
- }
- return retval;
-}
-
-static int iguana_send(struct ir_remote* remote, struct ir_ncode* code)
-{
- int retval = 0;
- uint32_t freq;
-
- /* set the carrier frequency if necessary */
- freq = htonl(remote->freq);
- if (remote->freq != currentCarrier && remote->freq >= 25000 && remote->freq <= 100000
- && daemonTransaction(IG_DEV_SETCARRIER, &freq, sizeof(freq)))
- currentCarrier = remote->freq;
-
- if (send_buffer_put(remote, code)) {
- int length, x;
- const lirc_t* signals;
- uint32_t* igsignals;
-
- length = send_buffer_length();
- signals = send_buffer_data();
-
- igsignals = (uint32_t*)malloc(sizeof(uint32_t) * length);
- if (igsignals != NULL) {
- iguanaPacket request, response = NULL;
-
- /* must pack the data into a unit32_t array */
- for (x = 0; x < length; x++) {
- igsignals[x] = signals[x] & PULSE_MASK;
- if (signals[x] & PULSE_BIT)
- igsignals[x] |= IG_PULSE_BIT;
- }
-
- /* construct a request and send it to the daemon
- * TRICKY: IguanaFreePacket free()'s both the
- * igsignals chunk and the request packet, but
- * iguanaCreateRequest does not malloc that chunk.
- */
- request = iguanaCreateRequest(IG_DEV_SEND, sizeof(uint32_t) * length, igsignals);
- if (iguanaWriteRequest(request, sendConn)) {
- /* response will only come back after the device has
- * transmitted */
- response = iguanaReadResponse(sendConn, 10000);
- if (!iguanaResponseIsError(response))
- retval = 1;
-
- iguanaFreePacket(response);
- }
-
- /* free the packet and the data */
- iguanaFreePacket(request);
- }
- }
-
- return retval;
-}
-
-static int iguana_ioctl(unsigned int code, void* arg)
-{
- int retcode = -1;
- uint8_t channels = *(uint8_t*)arg;
-
- /* set the transmit channels: return 0 on success, 4 if
- * out-of-range (see ioctl) */
- if (code == LIRC_SET_TRANSMITTER_MASK) {
- if (channels > 0x0F)
- retcode = 4;
- else if (daemonTransaction(IG_DEV_SETCHANNELS, &channels, sizeof(channels)))
- retcode = 0;
- }
-
- return retcode;
-}
-
-static lirc_t readdata(lirc_t timeout)
-{
- lirc_t code = 0;
- struct pollfd pfd = {.fd = drv.fd, .events = POLLIN, .revents = 0};
- /* attempt a read with a timeout using select */
- if (poll(&pfd, 1, timeout / 1000) > 0) {
- /* if we failed to get data return 0 */
- if (read(drv.fd, &code, sizeof(lirc_t)) <= 0)
- iguana_deinit();
- }
- return code;
-}
-
-const struct driver hw_iguanaIR = {
- .name = "iguanaIR",
- .device = "0",
- .features = LIRC_CAN_REC_MODE2 | \
- LIRC_CAN_SEND_PULSE | \
- LIRC_CAN_SET_SEND_CARRIER | \
- LIRC_CAN_SET_TRANSMITTER_MASK,
- .send_mode = LIRC_MODE_PULSE,
- .rec_mode = LIRC_MODE_MODE2,
- .code_length = sizeof(int),
- .init_func = iguana_init,
- .deinit_func = iguana_deinit,
- .open_func = default_open,
- .close_func = default_close,
- .send_func = iguana_send,
- .rec_func = iguana_rec,
- .decode_func = receive_decode,
- .drvctl_func = iguana_ioctl,
- .readdata = readdata,
- .api_version = 3,
- .driver_version = "0.9.3",
- .info = "See file://" PLUGINDOCS "/iguanair.html",
- .device_hint = "/var/run/iguanaIR/*",
-};
-
-const struct driver* hardwares[] = { &hw_iguanaIR, (const struct driver*)NULL };
+/****************************************************************************
+** hw_iguanaIR.c ***********************************************************
+****************************************************************************
+*
+* routines for interfacing with Iguanaworks USB IR devices
+*
+* Copyright (C) 2006, Joseph Dunn <jdunn@iguanaworks.net>
+*
+* Distribute under GPL version 2.
+*
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <poll.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <errno.h>
+#include <arpa/inet.h>
+#if defined __APPLE__
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#else
+#include <wait.h>
+#endif
+#include <arpa/inet.h>
+
+#include "lirc_driver.h"
+
+#include "iguanaIR.h"
+static const logchannel_t logchannel = LOG_DRIVER;
+
+static int sendConn = -1;
+static pid_t child = 0;
+static int recvDone = 0;
+static int currentCarrier = -1;
+
+static void quitHandler(int sig)
+{
+ recvDone = 1;
+}
+
+static void recv_loop(int fd, int notify)
+{
+ int conn;
+
+ alarm(0);
+ signal(SIGTERM, quitHandler);
+ /* signal(SIGPIPE, SIG_DFL); */
+ signal(SIGINT, quitHandler);
+ signal(SIGHUP, SIG_IGN);
+ signal(SIGALRM, SIG_IGN);
+
+ /* notify parent by closing notify */
+ close(notify);
+
+ conn = iguanaConnect(drv.device);
+ if (conn != -1) {
+ iguanaPacket request, response;
+ lirc_t prevCode = -1;
+
+ request = iguanaCreateRequest(IG_DEV_RECVON, 0, NULL);
+ if (iguanaWriteRequest(request, conn)) {
+ while (!recvDone) {
+ /* read from device */
+ do
+ response = iguanaReadResponse(conn, 1000);
+ while (!recvDone && ((response == NULL && errno == ETIMEDOUT)
+ || (iguanaResponseIsError(response) && errno == ETIMEDOUT)));
+
+ if (iguanaResponseIsError(response)) {
+ /* be quiet during exit */
+ if (!recvDone)
+ log_error("error response: %s\n", strerror(errno));
+ break;
+ } else if (iguanaCode(response) == IG_DEV_RECV) {
+ uint32_t* code;
+ unsigned int length, x, y = 0;
+ lirc_t buffer[8]; /* we read 8 bytes max at a time
+ * from the device, i.e. packet
+ * can only contain 8
+ * signals. */
+
+ /* pull the data off the packet */
+ code = (uint32_t*)iguanaRemoveData(response, &length);
+ length /= sizeof(uint32_t);
+
+ /* translate the code into lirc_t pulses (and make
+ * sure they don't split across iguana packets. */
+ for (x = 0; x < length; x++) {
+ if (prevCode == -1) {
+ prevCode = (code[x] & IG_PULSE_MASK);
+ if (prevCode > PULSE_MASK)
+ prevCode = PULSE_MASK;
+ if (code[x] & IG_PULSE_BIT)
+ prevCode |= PULSE_BIT;
+ } else if (((prevCode & PULSE_BIT) && (code[x] & IG_PULSE_BIT))
+ || (!(prevCode & PULSE_BIT) && !(code[x] & IG_PULSE_BIT))) {
+ /* can overflow pulse mask, so just set to
+ * largest possible */
+ if ((prevCode & PULSE_MASK) + (code[x] & IG_PULSE_MASK) >
+ PULSE_MASK)
+ prevCode = (prevCode & PULSE_BIT) | PULSE_MASK;
+ else
+ prevCode += code[x] & IG_PULSE_MASK;
+ } else {
+ buffer[y] = prevCode;
+ y++;
+
+ prevCode = (code[x] & IG_PULSE_MASK);
+ if (prevCode > PULSE_MASK)
+ prevCode = PULSE_MASK;
+ if (code[x] & IG_PULSE_BIT)
+ prevCode |= PULSE_BIT;
+ }
+ }
+
+ /* write the data and free it */
+ if (y > 0) {
+ chk_write(fd,
+ buffer,
+ sizeof(lirc_t) * y);
+ }
+ free(code);
+ }
+
+ iguanaFreePacket(response);
+ }
+ }
+
+ iguanaFreePacket(request);
+ }
+
+ iguanaClose(conn);
+ close(fd);
+}
+
+static int iguana_init(void)
+{
+ int recv_pipe[2], retval = 0;
+
+ rec_buffer_init();
+
+ if (pipe(recv_pipe) != 0) {
+ log_error("couldn't open pipe: %s", strerror(errno));
+ } else {
+ int notify[2];
+
+ if (pipe(notify) != 0) {
+ log_error("couldn't open pipe: %s", strerror(errno));
+ close(recv_pipe[0]);
+ close(recv_pipe[1]);
+ } else {
+ drv.fd = recv_pipe[0];
+
+ child = fork();
+ if (child == -1) {
+ log_error("couldn't fork child process: %s", strerror(errno));
+ } else if (child == 0) {
+ close(recv_pipe[0]);
+ close(notify[0]);
+ recv_loop(recv_pipe[1], notify[1]);
+ _exit(0);
+ } else {
+ int dummy;
+
+ close(recv_pipe[1]);
+ close(notify[1]);
+ /* make sure child has set its signal handler to avoid race with iguana_deinit() */
+ chk_read(notify[0], &dummy, 1);
+ close(notify[0]);
+ sendConn = iguanaConnect(drv.device);
+ if (sendConn == -1) {
+ log_error("couldn't open connection to iguanaIR daemon: %s",
+ strerror(errno));
+ } else {
+ retval = 1;
+ }
+ }
+ }
+ }
+
+ return retval;
+}
+
+static pid_t dowaitpid(pid_t pid, int* stat_loc, int options)
+{
+ pid_t retval;
+
+ do
+ retval = waitpid(pid, stat_loc, options);
+ while (retval == (pid_t)-1 && errno == EINTR);
+
+ return retval;
+}
+
+static int iguana_deinit(void)
+{
+ /* close the connection to the iguana daemon */
+ if (sendConn != -1) {
+ iguanaClose(sendConn);
+ sendConn = -1;
+ }
+
+ /* signal the child process to exit */
+ if (child > 0 && (kill(child, SIGTERM) == -1 || dowaitpid(child, NULL, 0) != (pid_t)-1))
+ child = 0;
+
+ /* close drv.fd since otherwise we leak open files */
+ close(drv.fd);
+ drv.fd = -1;
+
+ return child == 0;
+}
+
+static char* iguana_rec(struct ir_remote* remotes)
+{
+ char* retval = NULL;
+
+ if (rec_buffer_clear())
+ retval = decode_all(remotes);
+ return retval;
+}
+
+static bool daemonTransaction(unsigned char code, void* value, size_t size)
+{
+ uint8_t* data;
+ bool retval = false;
+
+ data = (uint8_t*)malloc(size);
+ if (data != NULL) {
+ iguanaPacket request, response = NULL;
+
+ memcpy(data, value, size);
+ request = iguanaCreateRequest(code, size, data);
+ if (request) {
+ if (iguanaWriteRequest(request, sendConn))
+ response = iguanaReadResponse(sendConn, 10000);
+ iguanaFreePacket(request);
+ } else {
+ free(data);
+ }
+
+ /* handle success */
+ if (!iguanaResponseIsError(response))
+ retval = true;
+ iguanaFreePacket(response);
+ }
+ return retval;
+}
+
+static int iguana_send(struct ir_remote* remote, struct ir_ncode* code)
+{
+ int retval = 0;
+ uint32_t freq;
+
+ /* set the carrier frequency if necessary */
+ freq = htonl(remote->freq);
+ if (remote->freq != currentCarrier && remote->freq >= 25000 && remote->freq <= 100000
+ && daemonTransaction(IG_DEV_SETCARRIER, &freq, sizeof(freq)))
+ currentCarrier = remote->freq;
+
+ if (send_buffer_put(remote, code)) {
+ int length, x;
+ const lirc_t* signals;
+ uint32_t* igsignals;
+
+ length = send_buffer_length();
+ signals = send_buffer_data();
+
+ igsignals = (uint32_t*)malloc(sizeof(uint32_t) * length);
+ if (igsignals != NULL) {
+ iguanaPacket request, response = NULL;
+
+ /* must pack the data into a unit32_t array */
+ for (x = 0; x < length; x++) {
+ igsignals[x] = signals[x] & PULSE_MASK;
+ if (signals[x] & PULSE_BIT)
+ igsignals[x] |= IG_PULSE_BIT;
+ }
+
+ /* construct a request and send it to the daemon
+ * TRICKY: IguanaFreePacket free()'s both the
+ * igsignals chunk and the request packet, but
+ * iguanaCreateRequest does not malloc that chunk.
+ */
+ request = iguanaCreateRequest(IG_DEV_SEND, sizeof(uint32_t) * length, igsignals);
+ if (iguanaWriteRequest(request, sendConn)) {
+ /* response will only come back after the device has
+ * transmitted */
+ response = iguanaReadResponse(sendConn, 10000);
+ if (!iguanaResponseIsError(response))
+ retval = 1;
+
+ iguanaFreePacket(response);
+ }
+
+ /* free the packet and the data */
+ iguanaFreePacket(request);
+ }
+ }
+
+ return retval;
+}
+
+static int iguana_ioctl(unsigned int code, void* arg)
+{
+ int retcode = -1;
+ uint8_t channels = *(uint8_t*)arg;
+
+ /* set the transmit channels: return 0 on success, 4 if
+ * out-of-range (see ioctl) */
+ if (code == LIRC_SET_TRANSMITTER_MASK) {
+ if (channels > 0x0F)
+ retcode = 4;
+ else if (daemonTransaction(IG_DEV_SETCHANNELS, &channels, sizeof(channels)))
+ retcode = 0;
+ }
+
+ return retcode;
+}
+
+static lirc_t readdata(lirc_t timeout)
+{
+ lirc_t code = 0;
+ struct pollfd pfd = {.fd = drv.fd, .events = POLLIN, .revents = 0};
+ /* attempt a read with a timeout using select */
+ if (poll(&pfd, 1, timeout / 1000) > 0) {
+ /* if we failed to get data return 0 */
+ if (read(drv.fd, &code, sizeof(lirc_t)) <= 0)
+ iguana_deinit();
+ }
+ return code;
+}
+
+const struct driver hw_iguanaIR = {
+ .name = "iguanaIR",
+ .device = "0",
+ .features = LIRC_CAN_REC_MODE2 | \
+ LIRC_CAN_SEND_PULSE | \
+ LIRC_CAN_SET_SEND_CARRIER | \
+ LIRC_CAN_SET_TRANSMITTER_MASK,
+ .send_mode = LIRC_MODE_PULSE,
+ .rec_mode = LIRC_MODE_MODE2,
+ .code_length = sizeof(int),
+ .init_func = iguana_init,
+ .deinit_func = iguana_deinit,
+ .open_func = default_open,
+ .close_func = default_close,
+ .send_func = iguana_send,
+ .rec_func = iguana_rec,
+ .decode_func = receive_decode,
+ .drvctl_func = iguana_ioctl,
+ .readdata = readdata,
+ .api_version = 3,
+ .driver_version = "0.9.3",
+ .info = "See file://" PLUGINDOCS "/iguanair.html",
+ .device_hint = "/var/run/iguanaIR/*",
+};
+
+const struct driver* hardwares[] = { &hw_iguanaIR, (const struct driver*)NULL };
diff --git a/iguanair.conf b/iguanair.conf
index 12e9523..6d17d77 100755
--- a/iguanair.conf
+++ b/iguanair.conf
@@ -1,13 +1,13 @@
-# This is a lirc configuration for a capture device.
-# See README for more.
-
-config:
- driver: iguanaIR
- id: iguanaIR
- label: Iguanaworks USB IR Transceiver
- menu: usb
- note: This is the user-space driver from Iguanaworks, Inc.
- There is also a built-in kernel driver. Both can be used
- but not concurrently.
- product_driver: 1781:0938
- modprobe: [blacklist iguanair]
+# This is a lirc configuration for a capture device.
+# See README for more.
+
+config:
+ driver: iguanaIR
+ id: iguanaIR
+ label: Iguanaworks USB IR Transceiver
+ menu: usb
+ note: This is the user-space driver from Iguanaworks, Inc.
+ There is also a built-in kernel driver. Both can be used
+ but not concurrently.
+ product_driver: 1781:0938
+ modprobe: [blacklist iguanair]
diff --git a/iguanair.html b/iguanair.html
index 99609c3..a62cdb1 100755
--- a/iguanair.html
+++ b/iguanair.html
@@ -1,18 +1,18 @@
-<P>
- This driver supports both receiving and sending (blasting) using
- the IguanaIR devices from
- <a href="http://iguanaworks.net/ir">http://iguanaworks.net/ir.</a></p>
-<p>
- The LIRC driver works on top of the IguanaIR low-level userspace
- driver which provides a socket interface. It is available from
- the same source, and also packaged for many distributions
- including Debian, Fedora and Arch Linux.
-<p>
- The --device argument to the driver is a socket designator created
- by the low-level driveri. It defaults to '0' which implies
- <em>/run/iguanair/0</em>.
-<p>
- The kernel has built-in support for these devices in the
- iguanair module. This can be used instead of this driver in
- many cases. If the userspace driver should be used, the
- kernel driver must be blacklisted.</p>
+<P>
+ This driver supports both receiving and sending (blasting) using
+ the IguanaIR devices from
+ <a href="http://iguanaworks.net/ir">http://iguanaworks.net/ir.</a></p>
+<p>
+ The LIRC driver works on top of the IguanaIR low-level userspace
+ driver which provides a socket interface. It is available from
+ the same source, and also packaged for many distributions
+ including Debian, Fedora and Arch Linux.
+<p>
+ The --device argument to the driver is a socket designator created
+ by the low-level driveri. It defaults to '0' which implies
+ <em>/run/iguanair/0</em>.
+<p>
+ The kernel has built-in support for these devices in the
+ iguanair module. This can be used instead of this driver in
+ many cases. If the userspace driver should be used, the
+ kernel driver must be blacklisted.</p>
diff --git a/iguanair.txt b/iguanair.txt
index 843baf6..4494163 100755
--- a/iguanair.txt
+++ b/iguanair.txt
@@ -1,28 +1,28 @@
-IguanaIR LIRC driver README
-===========================
-
-This driver used to be part of the LIRC sources. In order to improve
-the maintenance it has been moved to Iguanaworks, Inc which is the
-primary hardware and software vendor.
-
-From 0.9.4 the driver is available at: https://github.com/iguanaworks/iguanair-lirc
-
-As a transition step the same files are available here during the 0.9.4
-cycle. These files are a complete lirc driver for iguanair. Building requires
-lirc >= 0.9.4. If you are using a packaged version you probably need to
-have the -devel and -doc packages installed. Note that the downstream
-sources at https://github.com/iguanaworks/iguanair-lirc are preferred and
-will be the only option in next release.
-
-To build and install the driver together with the support files:
-
- $ make
- $ sudo make install
-
-Verifying the driver after make install:
-
- $ lirc-lsplugins -q iguanair
- --- /usr/lib64/lirc/plugins/iguanair.so
-
-You could also find the driver docs in the manual. The path varies, but
-in a packaged version typically /usr/share/doc/lirc/lirc.org/html/index.html.
+IguanaIR LIRC driver README
+===========================
+
+This driver used to be part of the LIRC sources. In order to improve
+the maintenance it has been moved to Iguanaworks, Inc which is the
+primary hardware and software vendor.
+
+From 0.9.4 the driver is available at: https://github.com/iguanaworks/iguanair-lirc
+
+As a transition step the same files are available here during the 0.9.4
+cycle. These files are a complete lirc driver for iguanair. Building requires
+lirc >= 0.9.4. If you are using a packaged version you probably need to
+have the -devel and -doc packages installed. Note that the downstream
+sources at https://github.com/iguanaworks/iguanair-lirc are preferred and
+will be the only option in next release.
+
+To build and install the driver together with the support files:
+
+ $ make
+ $ sudo make install
+
+Verifying the driver after make install:
+
+ $ lirc-lsplugins -q iguanair
+ --- /usr/lib64/lirc/plugins/iguanair.so
+
+You could also find the driver docs in the manual. The path varies, but
+in a packaged version typically /usr/share/doc/lirc/lirc.org/html/index.html.
--
2.5.5

View file

@ -0,0 +1,106 @@
From ad3c951d613fd8926f2afc4ce219dee592418fad Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Thu, 22 Aug 2019 18:42:11 +0200
Subject: [PATCH] reflasher: Move to python3.
---
files/python/usr/bin/iguanaIR-reflasher | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/files/python/usr/share/iguanaIR-reflasher/iguanaIR-reflasher b/files/python/usr/bin/iguanaIR-reflasher/iguanaIR-reflasher
index 97cacc2..abfbc50 100755
--- a/files/python/usr/share/iguanaIR-reflasher/iguanaIR-reflasher
+++ b/files/python/usr/share/iguanaIR-reflasher/iguanaIR-reflasher
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.7 -tt
+#!/usr/bin/python3
#
# **************************************************************************
# ** upgrade-usb ***********************************************************
@@ -215,7 +215,7 @@ def listDevices(path = iguanaIR.IGSOCK_NAME):
if device != 'ctl' and \
not stat.S_ISLNK(os.lstat(os.path.join(path, device)).st_mode):
devices.append(device)
- except Exception, inst:
+ except Exception as inst:
devices = ['0']
if MessageCannotlistdevice == False:
message(LOG_WARN,"""Guessing device "0", failed to list devices:\n %s\n""" % inst)
@@ -466,7 +466,7 @@ def writePagesToDevice(pages):
count += 1
if count == rebootPage:
sys.stdout.write('\n Rebooting device')
- print deviceTransaction(iguanaIR.IG_DEV_RESET)
+ print(deviceTransaction(iguanaIR.IG_DEV_RESET))
if deviceVersion() != version:
message(LOG_WARN, "Mid-write reboot unsuccessful.\n")
@@ -506,7 +506,7 @@ def writeHexFile(filename, blank_pages = False, setFeatures = False):
pages = readPages(open(filename, 'r'))
if blank_pages:
- blanks = range(128)
+ blanks = list(range(128))
for page in pages:
blanks.remove(page['start'] / 64)
@@ -538,7 +538,7 @@ def writeHexFile(filename, blank_pages = False, setFeatures = False):
def checkFileExists(path):
try:
os.stat(path)
- except OSError, inst:
+ except OSError as inst:
if inst[0] != errno.ENOENT:
raise
return False
--
2.20.1
diff --git a/files/python/usr/bin/iguanaIR-reflasher b/files/python/usr/bin/iguanaIR-reflasher
index 97cacc2..abfbc50 100755
--- a/files/python/usr/bin/iguanaIR-reflasher
+++ b/files/python/usr/bin/iguanaIR-reflasher
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.7 -tt
+#!/usr/bin/python3
#
# **************************************************************************
# ** upgrade-usb ***********************************************************
@@ -215,7 +215,7 @@ def listDevices(path = iguanaIR.IGSOCK_NAME):
if device != 'ctl' and \
not stat.S_ISLNK(os.lstat(os.path.join(path, device)).st_mode):
devices.append(device)
- except Exception, inst:
+ except Exception as inst:
devices = ['0']
if MessageCannotlistdevice == False:
message(LOG_WARN,"""Guessing device "0", failed to list devices:\n %s\n""" % inst)
@@ -466,7 +466,7 @@ def writePagesToDevice(pages):
count += 1
if count == rebootPage:
sys.stdout.write('\n Rebooting device')
- print deviceTransaction(iguanaIR.IG_DEV_RESET)
+ print(deviceTransaction(iguanaIR.IG_DEV_RESET))
if deviceVersion() != version:
message(LOG_WARN, "Mid-write reboot unsuccessful.\n")
@@ -506,7 +506,7 @@ def writeHexFile(filename, blank_pages = False, setFeatures = False):
pages = readPages(open(filename, 'r'))
if blank_pages:
- blanks = range(128)
+ blanks = list(range(128))
for page in pages:
blanks.remove(page['start'] / 64)
@@ -538,7 +538,7 @@ def writeHexFile(filename, blank_pages = False, setFeatures = False):
def checkFileExists(path):
try:
os.stat(path)
- except OSError, inst:
+ except OSError as inst:
if inst[0] != errno.ENOENT:
raise
return False
--
2.20.1

View file

@ -0,0 +1,60 @@
From 89f10c5f0c4374fb8ac51f1878b8b79329123c5b Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Wed, 25 Jan 2017 16:35:50 +0100
Subject: [PATCH] fix
---
.../Makefile | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/iguanair-lirc-e23b9d3726b010c9e747786ffe72e38debc8cfef/Makefile b/iguanair-lirc-e23b9d3726b010c9e747786ffe72e38debc8cfef/Makefile
index dd093eb..be86c43 100755
--- a/iguanair-lirc-e23b9d3726b010c9e747786ffe72e38debc8cfef/Makefile
+++ b/iguanair-lirc-e23b9d3726b010c9e747786ffe72e38debc8cfef/Makefile
@@ -3,9 +3,6 @@
# Requires that lirc is installed in system locations, in
# particular that the /usr/lib[64]/pkgconfig/lirc-driver.pc
# is in place (/usr/local/lib/pkgconfig/... is also OK).
-# The required file plugindocs.mk might live in a -doc
-# package which then is needed.
-#
driver = iguanair
@@ -18,13 +15,7 @@ PLUGINDIR ?= $(shell pkg-config --variable=plugindir lirc-driver)
CONFIGDIR ?= $(shell pkg-config --variable=configdir lirc-driver)
PLUGINDOCS ?= $(shell pkg-config --variable=plugindocs lirc-driver)
-PLUGINDOCS_MK = $(PLUGINDOCS)/plugindocs.mk
-MODPROBE_CONF = 60-blacklist-kernel-iguanair.conf
-
-ifneq ($(wildcard $(PLUGINDOCS_MK)),)
- include $(PLUGINDOCS_MK)
-endif
-
+MODPROBE_CONF = 60-blacklist-kernel-iguanair.conf
$(driver).o: $(driver).c
@@ -32,14 +23,11 @@ $(driver).so: $(driver).o
gcc --shared -fpic $(LDFLAGS) -o $@ $<
install: $(driver).so
- install -pDm 755 $< $(DESTDIR)$(PLUGINDIR)/$<
- install -pDm 644 $(driver).html $(DESTDIR)$(PLUGINDOCS)/$(driver).html
- install -pDm 644 $(driver).conf $(DESTDIR)$(CONFIGDIR)/$(driver).conf
- install -pDm 644 $(MODPROBE_CONF) \
+ install -D $< $(DESTDIR)$(PLUGINDIR)/$<
+ install -D $(driver).conf $(DESTDIR)$(CONFIGDIR)/$(driver).conf
+ install -D $(driver).html $(DESTDIR)$(PLUGINDOCS)/$(driver).html
+ install -Dm 644 $(MODPROBE_CONF) \
$(DESTDIR)/etc/modprobe.d/$(MODPROBE_CONF)
-ifneq ($(wildcard $(PLUGINDOCS_MK)),)
- $(MAKE) update
-endif
clean:
rm -f *.o *.so
--
2.9.3

13
README.fedora Normal file
View file

@ -0,0 +1,13 @@
Fedora README
=============
On recent kernels (F17+) you will need to disable the kernel ir stuff
to make the iguanaIR driver work. Basically, blacklist all rc_*
modules using a file in /etc/modprobe.d. The list varies, my
own file is:
blacklist rc_medion_x10_or2x
blacklist rc_pinnacle_pctv_hd
blacklist ati_remote
blacklist rc_core

24
changeset_2710.patch Normal file
View file

@ -0,0 +1,24 @@
Index: /trunk/software/usb_ir/CMakeLists.txt
===================================================================
--- trunk/software/usb_ir/CMakeLists.txt (revision 2709)
+++ trunk/software/usb_ir/CMakeLists.txt (revision 2710)
@@ -1,4 +1,7 @@
cmake_minimum_required(VERSION 2.6)
project(IguanaIR C)
+
+Set(SOVERSION 0)
+Set(FULLVER 0.3)
#Set(TARGET_ANDROID true)
@@ -98,9 +101,10 @@
iguanaIR.c dataPackets.c ${PIPESRC}
${BASESRC})
+set_target_properties(iguanaIR PROPERTIES
+ VERSION ${SOVERSION} SOVERSION ${FULLVER})
set_property(TARGET iguanaIR
APPEND PROPERTY COMPILE_DEFINITIONS IGUANAIR_EXPORTS)
install(TARGETS iguanaIR
DESTINATION ${LIBDIR})
-
# build the service/server that controls hardware

11
cmake-args.patch Normal file
View file

@ -0,0 +1,11 @@
diff --git a/runCmake b/runCmake
index f37873c..6d19253 100755
--- a/runCmake
+++ b/runCmake
@@ -40,5 +40,5 @@ fi
# create the build path
mkdir -p $BUILDDIR
cd $BUILDDIR
-PATH=${QTPATH}:${PYPATH}:${PATH} ARCH=${ARCH} CSPATH=${CSPATH} ${CMAKE} ${CHAIN} ..
+PATH=${QTPATH}:${PYPATH}:${PATH} ARCH=${ARCH} CSPATH=${CSPATH} ${CMAKE} ${CHAIN} $@ ..
cd ..

View file

@ -1,7 +1,7 @@
#!/bin/bash
#
# If iguanaIR runs, signal HUP to start a rescan. If not started, or
# signal fails, try-restart daemon.
# signal fails, restart daemon.
if systemctl --quiet is-active iguanaIR.service; then
pid=$( systemctl --property=MainPID show iguanaIR.service ) || \
@ -9,4 +9,6 @@ if systemctl --quiet is-active iguanaIR.service; then
pid=${pid##*=}
[ -n "$pid" ] && kill -HUP $pid &>/dev/null && exit 0
fi
systemctl try-restart iguanaIR.service
systemctl show --property=UnitFileState iguanaIR.service |
grep -q enabled && \
systemctl restart iguanaIR.service

View file

@ -1,4 +1,5 @@
/var/log/iguanaIR {
/var/log/iguanaIR/*.log {
su iguanair iguanair
missingok
notifempty
postrotate

View file

@ -1,239 +1,427 @@
%global commit6 e23b9d3726b010c9e747786ffe72e38debc8cfef
%global shortcommit %(c=%{commit6}; echo ${c:0:7})
%global repo https://github.com/iguanaworks/iguanair-lirc/archive
%global __python %{__python3}
Name: iguanaIR
Version: 1.0.3
Release: 2%{?dist}
Version: 1.1.0
Release: 44%{?dist}
Epoch: 2
Summary: Driver for Iguanaworks USB IR transceiver
Group: System Environment/Daemons
# Following files are LGPL2.1, remaining GPLv2:
# ./support.h ./iguanaIR.h ./support.c ./pipes.c ./compat.h ./pipes.h
# ./iguanaIR.c ./dataPackets.h ./compat-unix.c ./dataPackets.c
License: GPLv2 and LGPLv2
# Automatically converted from old format: GPLv2 and LGPLv2 - review is highly recommended.
License: GPL-2.0-only AND LicenseRef-Callaway-LGPLv2
URL: http://iguanaworks.net/ir
Source0: http://iguanaworks.net/downloads/iguanaIR-%{version}.tar.bz2
Source0: http://iguanaworks.net/downloads/%{name}-%{version}.tar.bz2
Source1: iguanaIR.service
Source2: iguanaIR-rescan
Source3: iguanaIR.logrotate
Patch1: 0001-Remove-trailing-whitespace.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/279
Patch2: 0002-Don-t-hardcode-iguanair-UID.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/280
Patch3: 0003-Use-platform-specific-python-extension-dir.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/281
Patch4: 0004-Don-t-exit-3-in-library-calls.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/282
Patch5: 0005-Improve-driver-dir-detection.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/283
Patch6: 0006-make-options-file-work-w-systemd.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/284
Patch7: 0007-Use-fedora-specific-default-socket-directory.patch
# Fedora only, not acceptable upstream.
Patch8: 0008-udev-invoke-systemd-support-not-sysV-init-file.patch
Source3: README.fedora
Source4: patch-soname
Source5: iguanaIR.logrotate
Source6: %{repo}/%{commit6}/iguanair-lirc-%{shortcommit}.tar.gz
# https://iguanaworks.net/projects/IguanaIR/ticket/317
Patch1: changeset_2710.patch
Patch2: rpath.patch
Patch3: cmake-args.patch
# https://github.com/iguanaworks/iguanair-lirc/pull/1 (Patch10..Patch13)
Source10: 0010-Change-iguanaIR.-iguanair.-to-match-other-plugins.patch
Source11: 0011-Rename-link-README-files-to-match-modified-install-r.patch
Source12: 0012-Makefile-Add-DESTDIR-support.patch
Source13: 0013-Convert-all-files-to-LF-line-endings-like-main-drive.patch
Source20: 0020-build-Fix-DESTDIR-dont-update-docs.patch
Source21: 0016-reflasher-Move-to-python3.patch
Requires: lirc
Requires: logrotate
Requires: udev
BuildRequires: cmake gcc
BuildRequires: dos2unix
BuildRequires: git
BuildRequires: libusb1-devel
BuildRequires: libusb-devel
%if 0%{?fedora} < 37
libusb-devel
%endif
BuildRequires: popt-devel
BuildRequires: python2-devel
BuildRequires: systemd-units
Requires(pre): shadow-utils
Requires(post): systemd-units
Requires(post): systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units
BuildRequires: systemd
%{?systemd_requires}
Requires(post): systemd-sysv
# some features can be disabled during the rpm build
%{?_without_clock_gettime: %global _disable_clock_gettime --disable-clock_gettime}
%{?_without_clock_gettime: %define _disable_clock_gettime --disable-clock_gettime}
# Don't add provides for python .so and private lib so-files
%global __provides_exclude _iguanaIR.so
%global __provides_exclude_from %{_libdir}/iguanaIR/.*[.]so
# Don't require private libs in /usr/lib[64]/iguanaIR
%global __requires_exclude libusbpre1.so|libusb.so
# Filter away versioned plugin deps (they only depend on ABI):
%global __provides_exclude_from ^%{_libdir}/lirc/plugins/.*$
%description
This package provides igdaemon and igclient, the programs necessary to
control the Iguanaworks USB IR transceiver.
%package devel
Summary: Library and header files for iguanaIR
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description devel
The development files needed to interact with the iguanaIR igdaemon are
included in this package.
%package -n python-iguanaIR
Group: System Environment/Daemons
Summary: Python module for Iguanaworks USB IR transceiver
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python
BuildRequires: python2-devel swig
%description -n python-iguanaIR
This package provides the swig-generated Python module for interfacing
with the Iguanaworks USB IR transceiver.
%package firmware
Group: System Environment/Daemons
Summary: Firmware and reflasher for Iguanaworks USB IR transceiver
Requires: %{name} = %{version}-%{release}
%package reflasher
Summary: Reflasher for Iguanaworks USB IR transceiver
BuildArch: noarch
%description firmware
%description reflasher
This package provides the reflasher/testing script and assorted firmware
versions for the Iguanaworks USB IR transceiver. If you have no idea
what this means, you don't need it.
%if 0%{fedora} > 23
%package -n lirc-drv-iguanair
Summary: lirc plugin for iguanair user-space driver
Requires: lirc >= 0.9.4
BuildRequires: lirc-devel >= 0.9.4
BuildRequires: make
%description -n lirc-drv-iguanair
lirc plugin providing full support for the iguanaIR userspace driver,
the same as was built in into the lirc releases up to 0.9.3.
%endif
%prep
%setup -q -n iguanaIR-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%setup -q -n %{name}-%{version}
%setup -q -T -D -a 6
%patch -P1 -p3
%patch -P2 -p1
%patch -P3 -p1
cp %{SOURCE3} README.fedora
cd iguanair-lirc-%{commit6}
patch -p1 < %{SOURCE10}
patch -p1 < %{SOURCE11}
patch -p1 < %{SOURCE12}
git apply --whitespace=fix %{SOURCE13}
dos2unix Makefile
patch -l -p2 --fuzz 2 < %{SOURCE20}
cd ..
patch -p1 --fuzz 2 < %{SOURCE21}
# docs: bad EOL, remove script, fix /dev/iguanaIR -> /var/run/iguanaIR
sed -i 's/\r//' docs/*
rm docs/pullDocs
sed -i 's|/dev/iguanaIR|/var/run/iguanaIR|g' \
docs/TroubleShooting docs/driver docs/lirc
# Create a sysusers.d config file
cat >iguanair.sysusers.conf <<EOF
u iguanair - 'Iguanaworks IR Daemon' %{_localstatedir}/run/%{name} -
EOF
# Noarch data wrongly in libdir.
# http://iguanaworks.net/projects/IguanaIR/ticket/286
sed -i 's|$(LIBDIR)|%{_datadir}|g' reflasher/Makefile
# Force proper compile flags usage.
sed -i '/^CFLAGS/s|$| -DFEDORA=1 -fpic %{optflags}|' Makefile.in
# Remove foreign packaging
rm -rf osx packaging
%build
%configure %{?_disable_clock_gettime}
make %{?_smp_mflags}
./runCmake -DLIBDIR="%{_libdir}"
cd build
make CFLAGS="%{optflags} -fpic -DFEDORA=1 -DHAVE_KERNEL_LIRC_H=1 -I.." %{?_smp_mflags}
cp %{SOURCE4} .
%install
make install PREFIX=$RPM_BUILD_ROOT/usr DESTDIR=$RPM_BUILD_ROOT INLIBDIR=$RPM_BUILD_ROOT%{_libdir}
%if 0%{fedora} > 23
cd iguanair-lirc-%{commit6}
PLUGINDOCS=$(pkg-config --variable=plugindocs lirc-driver)
make LDFLAGS="-liguanaIR -L../build" CFLAGS="%{optflags} \
-fpic -I.. -DHAVE_KERNEL_LIRC_H=1 -DPLUGINDOCS=\\\"$PLUGINDOCS\\\"" \
DESTDIR=$RPM_BUILD_ROOT install
cd ..
%endif
mkdir -p $RPM_BUILD_ROOT/%{_datadir} || :
cp -ar files/python/usr/share/iguanaIR-reflasher $RPM_BUILD_ROOT/%{_datadir}
mkdir -p $RPM_BUILD_ROOT/%{_bindir} || :
cp -ar files/python/usr/bin/* $RPM_BUILD_ROOT/%{_bindir}
cd build
make install PREFIX=$RPM_BUILD_ROOT/usr DESTDIR=$RPM_BUILD_ROOT \
INLIBDIR=$RPM_BUILD_ROOT%{_libdir}
rm -rf $RPM_BUILD_ROOT/%{_libdir}/python%{python_version}/site-packages
install -m755 -d $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}
%if 0%{fedora} > 30
rm -rf $RPM_BUILD_ROOT/%{_libdir}/python2.7/site-packages
%endif
# fix missing links
pushd $RPM_BUILD_ROOT%{_libdir}
rm libiguanaIR.so.0.3
mv libiguanaIR.so.0 libiguanaIR.so.0.3
ln -sf libiguanaIR.so.0.3 libiguanaIR.so.0
# Use /etc/sysconfig instead of /etc/default
mkdir $RPM_BUILD_ROOT/etc/sysconfig
mkdir $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig || :
mv $RPM_BUILD_ROOT/etc/default/iguanaIR \
$RPM_BUILD_ROOT/etc/sysconfig
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
# Fix up some stray file permissions issues
chmod -x $RPM_BUILD_ROOT%{python_sitearch}/*.py \
$RPM_BUILD_ROOT%{_includedir}/iguanaIR.h \
$RPM_BUILD_ROOT%{_datadir}/iguanaIR-reflasher/hex/*
chmod a-x $RPM_BUILD_ROOT%{_includedir}/%{name}.h \
$RPM_BUILD_ROOT%{_datadir}/%{name}-reflasher/hex/*
# Remove the installed initfile and install the systemd support instead.
rm -rf $RPM_BUILD_ROOT/etc/init.d/
install -m644 -pD %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/iguanaIR.service
install -m755 -pD %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/iguanaIR/rescan
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
install -m644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
install -m755 -D %{SOURCE2} $RPM_BUILD_ROOT%{_libexecdir}/iguanaIR/rescan
# Install private log dir.
install -m755 -pd $RPM_BUILD_ROOT/var/log/iguanaIR
install -m644 -pD %SOURCE3 $RPM_BUILD_ROOT/etc/logrotate.d/%name
# Install private log dir, tmpfiles.d setup.
install -m755 -d $RPM_BUILD_ROOT%{_localstatedir}/log/iguanaIR
# Handle the tempfiles.d and /var/run stuff.
install -m755 -pd $RPM_BUILD_ROOT/run/iguanaIR
install -m755 -pd $RPM_BUILD_ROOT/etc/tmpfiles.d
cat > $RPM_BUILD_ROOT/etc/tmpfiles.d/iguanaIR.conf <<EOF
d /run/iguanaIR 0755 iguanair iguanair
install -m755 -d $RPM_BUILD_ROOT/%{_tmpfilesdir}
cat > $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf <<EOF
d /run/%{name} 0755 iguanair iguanair
EOF
install -m 755 -d $RPM_BUILD_ROOT/run/%{name}
install -m 644 -D %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
# Blacklist the kernel driver, just to be sure ATM.
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
cat > $RPM_BUILD_ROOT/etc/modprobe.d/blacklist-iguanair.conf << EOF
# iguanaIR user space driver blacklisting the kernel driver
blacklist iguanair
EOF
install -m0644 -D iguanair.sysusers.conf %{buildroot}%{_sysusersdir}/iguanair.conf
%pre
getent group iguanair >/dev/null || groupadd -r iguanair
getent passwd iguanair >/dev/null || \
useradd -r -g iguanair -d /var/run/iguanaIR -s /sbin/nologin \
-c "Iguanaworks IR Daemon" iguanair
exit 0
%post
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
/sbin/ldconfig
%systemd_post %{name}.service
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable iguanaIR.service > /dev/null 2>&1 || :
/bin/systemctl stop iguanaIR.service > /dev/null 2>&1 || :
fi
%systemd_preun %{name}.service
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart iguanaIR.service >/dev/null 2>&1 || :
fi
/sbin/ldconfig
%systemd_postun_with_restart %{name}.service
%files
%doc AUTHORS LICENSE LICENSE-LGPL WHY protocols.txt README.txt notes.txt ChangeLog
%doc docs
%license LICENSE LICENSE-LGPL
%doc README.txt WHY ChangeLog AUTHORS
%doc README.fedora
%{_bindir}/igdaemon
%{_bindir}/igclient
%{_libdir}/libiguanaIR.so.*
%{_libdir}/iguanaIR/
%{_datadir}/iguanaIR/
%{_unitdir}/iguanaIR.service
/lib/udev/rules.d/80-iguanaIR.rules
%config(noreplace) /etc/modprobe.d/blacklist-iguanair.conf
%config(noreplace) /etc/sysconfig/iguanaIR
%config(noreplace) /etc/tmpfiles.d/iguanaIR.conf
%config(noreplace) /etc/logrotate.d/iguanaIR
%attr(755, iguanair, iguanair) /lib/udev/devices/iguanaIR
%attr(755, iguanair, iguanair) /run/iguanaIR
%attr(755, iguanair, iguanair) /var/log/iguanaIR
%{_bindir}/iguanaIR-rescan
%{_libdir}/lib%{name}.so.*
%{_libdir}/%{name}/*.so
%{_libexecdir}/%{name}/
%{_unitdir}/%{name}.service
%config(noreplace) /etc/logrotate.d/%{name}
/lib/udev/rules.d/80-%{name}.rules
%config(noreplace) /etc/sysconfig/%{name}
%{_tmpfilesdir}/%{name}.conf
%ghost %attr(755, iguanair, iguanair) /run/%{name}
%attr(775, iguanair, iguanair) %{_localstatedir}/log/%{name}
%if 0%{fedora} < 30
%{_libdir}/python2.7/*
%endif
%{_sysusersdir}/iguanair.conf
%files devel
%doc examples
%{_includedir}/iguanaIR.h
%{_libdir}/libiguanaIR.so
%{_includedir}/%{name}.h
%{_libdir}/lib%{name}.so
%files -n python-iguanaIR
%{python_sitearch}/*
%files reflasher
%{_datadir}/%{name}-reflasher/
%{_bindir}/%{name}-reflasher
%files firmware
%{_bindir}/iguanaIR-reflasher
%{_datadir}/iguanaIR-reflasher/
%if 0%{fedora} > 23
%files -n lirc-drv-iguanair
%config /etc/modprobe.d/60-blacklist-kernel-iguanair.conf
%{_libdir}/lirc/plugins/iguanair.so
%{_docdir}/lirc/plugindocs/iguanair.html
%{_datadir}/lirc/configs/iguanair.conf
%endif
%changelog
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-44
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Tue Jan 15 2013 Alec Leamas <leamas.alec@gmail.com> - 1.0.3-1
- Handle review remarks:
- Revert license to GPLv2 + LGPLv2,
- Preserve timestamps, unowned dirs, missing Requires.
* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2:1.1.0-43
- Add sysusers.d config file to allow rpm to create users/groups automatically
* Wed Jan 2 2013 Alec Leamas <leamas.alec@gmail.com> - 1.0.3-1
- Initial release based on work by Joseph Dunn, Jarod Wilson and
Jason Tibbits in bug 642773
- Set license to GPLv2, can't find any LGPL files.
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Mon Sep 02 2024 Miroslav Suchý <msuchy@redhat.com> - 2:1.1.0-41
- convert license to SPDX
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-39
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-38
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-37
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-33
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2:1.1.0-32
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-31
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Aug 22 2019 Alec Leamas <leamas.alec@gmail.com> - 2:1.1.0-28
- Move to python3 (Closes: #1737981).
- Drop the SWIG-generated python bindings.
- Update ancient systemd scriptlets.
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Jan 27 2017 Alec Leamas <leamas.alec@gmail.com> - 2:1.1.0-20
- Fix bad linkage for dynamic lirc-drv-iguanair module.
* Wed Jan 25 2017 Alec Leamas <leamas.alec@gmail.com> - 2:1.1.0-19
- -18 was a COPR release only.
- Drop the python package which does not compile cleanly any more.
- Add lirc plugin generation.
- Fix %%license usage for license files - #1413263.
- Use %%tmpfilesdir as required - #1413263.
- Remove horrible hacks from -10 to break circular dep lirc <=> iguanaIR.
- Filter away plugin deps - they only depend on ABI.
- Fix so-file links - #1409065
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2:1.1.0-17
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.1.0-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2:1.1.0-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Dec 22 2014 Alec Leamas <leamas.alec@gmail.com> - 2:1.1.0-14
- Fixing #1176627: Update logrotate conf.
* Thu Dec 11 2014 Alec Leamas <leamas.alec@gmail.com> - 2:1.1.0-13
- Filter away bogus, patched so-name from Requires:
* Wed Dec 10 2014 Alec Leamas <leamas.alec@gmail.com> - 2:1.1.0-12
- Fixes #1159618.
- Re-install logrotate file, mysteriously dropped sometime.
* Wed Sep 10 2014 Alec Leamas <leamas.alec@nowhere.net> - 2:1.1.0-11
- Fixed 64-bit provides tweak.
* Tue Sep 09 2014 Alec Leamas <leamas.alec@nowhere.net> - 2:1.1.0-10
- Added 64-bit provides tweak.
* Wed Sep 03 2014 Alec Leamas <leamas.alec@nowhere.net> - 2:1.1.0-9
- Remove needless and circular dependency on lirc.
* Wed Sep 03 2014 Alec Leamas <leamas.alec@nowhere.net> - 2:1.1.0-8
- patch soname + add virtual compatibility Provides:
* Wed Sep 3 2014 Alec Leamas <leamas.alec@nowhere.net - 2:1.1.0-7
- Patch soname on rawhide to avoid unintended bump.
* Tue Sep 2 2014 Alec Leamas <leamas.alec@nowhere.net - 2:1.1.0-6
- Make a new try to sort out deps for 1.1.0
* Wed Aug 27 2014 Alec Leamas <leamas.alec@nowhere.net - 2:1.0.5-7
- Have to re-add sources as well.
* Wed Aug 27 2014 Alec Leamas <leamas.alec@nowhere.net - 2:1.0.5-6
- Backing out 1.1.0 again, broken dependencies problem
* Thu Aug 21 2014 Alec Leamas <leamas.alec@nowhere.net - 1:1.1.0-5
- Fixing typo, bad %%{epoch} requires:
* Thu Aug 21 2014 Alec Leamas <leamas.alec@nowhere.net> - 1:1.1.0-4
- New attempt to introduce 1.1.0 (ABI bump)
* Wed Aug 20 2014 Alec Leamas <leamas.alec@nowhere.net> - 1:1.0.5-5
- Updating dependencies with epoch (sigh...).
* Tue Aug 19 2014 Alec Leamas <leamas.alec@nowhere.net> - 1:1.0.5-4
- Backing out 1.1.0 due to ABI problems.
- Purged old changelog dating to 2006, partly outside Fedora.
* Mon Aug 18 2014 Alec Leamas <leamas.alec@gmail.com> - 1.1.0-3
- Add missing patch (how did this ever build?).
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Mon Aug 11 2014 Alec Leamas <leamas.alec@gmail.com> - 1.1.0-1
- Updating to latest version
- Old patches now upstreamed, new patches for cmake required. LIBDIR handling
needs cleanup (not required part in rpath.patch).
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Sun Apr 21 2013 Alec Leamas <leamas.alec@gmail.com> - 1.0.5-1
- Update to latest upstream 1.0.5
- Most patches merged upstream.
* Tue Dec 25 2012 Alec Leamas <leamas.alec@gmail.com> - 1.0.3-1
- Updated to 1.0.3
- Moved most of fixes.patch to spec file, split rest to smaller ones.
- Support sysconfig configuration file.
- Include documentation files
- Install udev rule in /lib/udev, not /etc/udev.
- Fixed udev issue invoking '/etc/init.d/iguanaIR rescan'.
* Wed Apr 18 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.0.1-3
- Some systemd and dependency filtering suggestions.
* Fri Jan 28 2011 Jarod Wilson <jarod@redhat.com> 1.0.1-2
- Address Fedora package review concerns (#642773)
* Thu Jan 20 2011 Jarod Wilson <jarod@redhat.com> 1.0.1-1
- Update to 1.0.1 release
* Wed Oct 13 2010 Jarod Wilson <jarod@redhat.com> 1.0-0.2.pre2.svn1419
- Update to 1.0pre2 snapshot plus svn rev 1419 additions
- Patch in additional changes to use more suitable locations for
plugins, socket directory and reflasher files
* Wed Jul 21 2010 Jarod Wilson <jarod@redhat.com> 1.0-0.1.pre2
- Update to 1.0pre2 snapshot
- Revamp spec to be more compliant with Fedora packaging guidelines

46
patch-soname Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
function patch_strings_in_file()
{
local FILE="$1"
local PATTERN="$2"
local REPLACEMENT="$3"
# Find all unique strings in FILE that contain the pattern
STRINGS=$(strings ${FILE} | grep ${PATTERN} | sort -u -r)
if [ "${STRINGS}" != "" ] ; then
echo "File '${FILE}' contain strings with '${PATTERN}' in them:"
for OLD_STRING in ${STRINGS} ; do
# Create the new string with a simple bash-replacement
NEW_STRING=${OLD_STRING//${PATTERN}/${REPLACEMENT}}
# Create null terminated ASCII HEX representations of the strings
OLD_STRING_HEX="$(echo -n ${OLD_STRING} | xxd -g 0 -u -ps -c 256)00"
NEW_STRING_HEX="$(echo -n ${NEW_STRING} | xxd -g 0 -u -ps -c 256)00"
if [ ${#NEW_STRING_HEX} -le ${#OLD_STRING_HEX} ] ; then
# Pad the replacement string with null terminations so the
# length matches the original string
while [ ${#NEW_STRING_HEX} -lt ${#OLD_STRING_HEX} ] ; do
NEW_STRING_HEX="${NEW_STRING_HEX}00"
done
# Now, replace every occurrence of OLD_STRING with NEW_STRING
echo -n "Replacing ${OLD_STRING} with ${NEW_STRING}... "
hexdump -ve '1/1 "%.2X"' ${FILE} | \
sed "s/${OLD_STRING_HEX}/${NEW_STRING_HEX}/g" | \
xxd -r -p > ${FILE}.tmp
chmod --reference ${FILE} ${FILE}.tmp
mv ${FILE}.tmp ${FILE}
echo "Done!"
else
echo "New string '${NEW_STRING}' is longer than old" \
"string '${OLD_STRING}'. Skipping."
fi
done
fi
}
patch_strings_in_file $@

15
rpath.patch Normal file
View file

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6bdf24d..7ca5c4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,6 +71,9 @@ ElseIf("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
Set(DAEMONLIBS pthread dl)
EndIf()
+ Set(CMAKE_SKIP_RPATH True)
+ Set(INSTALL_LIBDIR @libdir@)
+
Set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -pedantic")
# see if we have clock_gettime in time.h

View file

@ -1 +1,2 @@
172b897083f014c9b5ade296ccc48298 iguanaIR-1.0.3.tar.bz2
SHA512 (iguanaIR-1.1.0.tar.bz2) = 19d793598043c203192c7de0066794629ef64cefe901beca4e894e2090a3d0a91d813de1ae5440a8d51c1f94ad4a960278dbe625302564dcc39c38a668cf18f2
SHA512 (iguanair-lirc-e23b9d3.tar.gz) = ad116c16ea9f18259e2b915f1e1589d08e4ddc787459bc8595876ec0cc2ea36265a2dcb6b7792e3d1e9faab8e8ad680fdf9f0f59fac6d87148464aeb0aba86fb