[iguanaIR] Initial import(#891339)
leamas
leamas at fedoraproject.org
Thu Jan 17 15:37:41 UTC 2013
commit 53cfcb9a91a1b6452a235eaa2003c90ac3f4b634
Author: Alec Leamas <alec at tests.notat.diaspora.com>
Date: Thu Jan 17 16:35:04 2013 +0100
Initial import(#891339)
.gitignore | 1 +
0001-Remove-trailing-whitespace.patch | 275 ++++++++++++++++++++
0002-Don-t-hardcode-iguanair-UID.patch | 27 ++
...se-platform-specific-python-extension-dir.patch | 27 ++
0004-Don-t-exit-3-in-library-calls.patch | 64 +++++
0005-Improve-driver-dir-detection.patch | 49 ++++
0006-make-options-file-work-w-systemd.patch | 61 +++++
...-fedora-specific-default-socket-directory.patch | 82 ++++++
...invoke-systemd-support-not-sysV-init-file.patch | 28 ++
iguanaIR-rescan | 12 +
iguanaIR.logrotate | 7 +
iguanaIR.service | 17 ++
iguanaIR.spec | 236 +++++++++++++++++
sources | 1 +
14 files changed, 887 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..146d9d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/iguanaIR-1.0.3.tar.bz2
diff --git a/0001-Remove-trailing-whitespace.patch b/0001-Remove-trailing-whitespace.patch
new file mode 100644
index 0000000..09fd357
--- /dev/null
+++ b/0001-Remove-trailing-whitespace.patch
@@ -0,0 +1,275 @@
+From 93d9206499bab837dccb5d864a875829c3dc057c Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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 at 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 at 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
+
diff --git a/0002-Don-t-hardcode-iguanair-UID.patch b/0002-Don-t-hardcode-iguanair-UID.patch
new file mode 100644
index 0000000..969407d
--- /dev/null
+++ b/0002-Don-t-hardcode-iguanair-UID.patch
@@ -0,0 +1,27 @@
+From b428df7fbbc6bbf492f40431bc488b24637e142b Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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
+
diff --git a/0003-Use-platform-specific-python-extension-dir.patch b/0003-Use-platform-specific-python-extension-dir.patch
new file mode 100644
index 0000000..0ca7949
--- /dev/null
+++ b/0003-Use-platform-specific-python-extension-dir.patch
@@ -0,0 +1,27 @@
+From d6a24ca3d0a0f583d21926d4d9d3890f5958ba67 Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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
+
diff --git a/0004-Don-t-exit-3-in-library-calls.patch b/0004-Don-t-exit-3-in-library-calls.patch
new file mode 100644
index 0000000..87afa35
--- /dev/null
+++ b/0004-Don-t-exit-3-in-library-calls.patch
@@ -0,0 +1,64 @@
+From 15f72105f52e1a4ecaf47e2951af6a2536a6f913 Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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 at 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
+
diff --git a/0005-Improve-driver-dir-detection.patch b/0005-Improve-driver-dir-detection.patch
new file mode 100644
index 0000000..b01f147
--- /dev/null
+++ b/0005-Improve-driver-dir-detection.patch
@@ -0,0 +1,49 @@
+From 2c05db3a37f916a2637745cd603cb8e63c8a6ab7 Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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
+
diff --git a/0006-make-options-file-work-w-systemd.patch b/0006-make-options-file-work-w-systemd.patch
new file mode 100644
index 0000000..4f13fdb
--- /dev/null
+++ b/0006-make-options-file-work-w-systemd.patch
@@ -0,0 +1,61 @@
+From ea8f3436c24f579b8fdea4aac0fea5ab1d6b5b42 Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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
+
diff --git a/0007-Use-fedora-specific-default-socket-directory.patch b/0007-Use-fedora-specific-default-socket-directory.patch
new file mode 100644
index 0000000..8225383
--- /dev/null
+++ b/0007-Use-fedora-specific-default-socket-directory.patch
@@ -0,0 +1,82 @@
+From fa0085b8773ed9f69d70ce617ac824d52a4f8dff Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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 at 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
+
diff --git a/0008-udev-invoke-systemd-support-not-sysV-init-file.patch b/0008-udev-invoke-systemd-support-not-sysV-init-file.patch
new file mode 100644
index 0000000..c1357b7
--- /dev/null
+++ b/0008-udev-invoke-systemd-support-not-sysV-init-file.patch
@@ -0,0 +1,28 @@
+From 4d74cf146fb53514f6b3b71684d6b8232d522e44 Mon Sep 17 00:00:00 2001
+From: Alec Leamas <leamas.alec at 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 at 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
+
diff --git a/iguanaIR-rescan b/iguanaIR-rescan
new file mode 100755
index 0000000..6565144
--- /dev/null
+++ b/iguanaIR-rescan
@@ -0,0 +1,12 @@
+#!/bin/bash
+#
+# If iguanaIR runs, signal HUP to start a rescan. If not started, or
+# signal fails, try-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
+fi
+systemctl try-restart iguanaIR.service
diff --git a/iguanaIR.logrotate b/iguanaIR.logrotate
new file mode 100644
index 0000000..ce609ad
--- /dev/null
+++ b/iguanaIR.logrotate
@@ -0,0 +1,7 @@
+/var/log/iguanaIR {
+ missingok
+ notifempty
+ postrotate
+ systemctl try-restart iguanaIR.service
+ endscript
+}
diff --git a/iguanaIR.service b/iguanaIR.service
new file mode 100644
index 0000000..c5c44f1
--- /dev/null
+++ b/iguanaIR.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Iguanaworks USB IR transceiver
+
+[Service]
+Type=forking
+User=iguanair
+Group=iguanair
+EnvironmentFile=/etc/sysconfig/iguanaIR
+ExecStart=/usr/bin/igdaemon $DRIVERS $OPTIONS \
+ --log-level=${LOGLEVEL} \
+ --send-timeout=${SENDTIMEOUT} \
+ --receive-timeout=${RECEIVETIMEOUT} \
+ -l /var/log/iguanaIR/iguanaIR.log
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/iguanaIR.spec b/iguanaIR.spec
new file mode 100644
index 0000000..0cf9575
--- /dev/null
+++ b/iguanaIR.spec
@@ -0,0 +1,236 @@
+Name: iguanaIR
+Version: 1.0.3
+Release: 1%{?dist}
+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
+URL: http://iguanaworks.net/ir
+Source0: http://iguanaworks.net/downloads/iguanaIR-%{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
+
+Requires: lirc
+Requires: logrotate
+Requires: udev
+
+BuildRequires: libusb1-devel
+BuildRequires: libusb-devel
+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
+
+
+# some features can be disabled during the rpm build
+%{?_without_clock_gettime: %global _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
+
+
+%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}
+
+%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}
+BuildArch: noarch
+
+%description firmware
+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.
+
+%prep
+%setup -q -n iguanaIR-%{version}
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+
+# 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
+
+# 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}
+
+
+%install
+make install PREFIX=$RPM_BUILD_ROOT/usr DESTDIR=$RPM_BUILD_ROOT INLIBDIR=$RPM_BUILD_ROOT%{_libdir}
+
+# Use /etc/sysconfig instead of /etc/default
+mkdir $RPM_BUILD_ROOT/etc/sysconfig
+mv $RPM_BUILD_ROOT/etc/default/iguanaIR \
+ $RPM_BUILD_ROOT/etc/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/*
+
+# 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
+
+# Install private log dir.
+install -m755 -pd $RPM_BUILD_ROOT/var/log/iguanaIR
+install -m644 -pD %SOURCE3 $RPM_BUILD_ROOT/etc/logrotate.d/%name
+
+# 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
+EOF
+
+# 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
+
+
+%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
+
+%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
+
+%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
+
+
+%files
+%doc AUTHORS LICENSE LICENSE-LGPL WHY protocols.txt README.txt notes.txt ChangeLog
+%doc docs
+%{_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
+
+%files devel
+%doc examples
+%{_includedir}/iguanaIR.h
+%{_libdir}/libiguanaIR.so
+
+%files -n python-iguanaIR
+%{python_sitearch}/*
+
+%files firmware
+%{_bindir}/iguanaIR-reflasher
+%{_datadir}/iguanaIR-reflasher/
+
+
+%changelog
+* Tue Jan 15 2013 Alec Leamas <leamas.alec at gmail.com> - 1.0.3-1
+- Handle review remarks:
+- Revert license to GPLv2 + LGPLv2,
+- Preserve timestamps, unowned dirs, missing Requires.
+
+* Wed Jan 2 2013 Alec Leamas <leamas.alec at 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.
diff --git a/sources b/sources
index e69de29..7c21b4a 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+172b897083f014c9b5ade296ccc48298 iguanaIR-1.0.3.tar.bz2
More information about the scm-commits
mailing list