[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: qcontrol on kirkwood qnap on Debian Wheezy



On Sun, 2015-12-20 at 19:59 +0000, Ian Campbell wrote:
> Hrm, that seems like I very likely passed the wrong thing to sbuild's
> -d option :-/
> 
> I'm not sure what the correct fix is, uploading an epoch'd version to
> wheezy backports would then require an epoch everywhere else, but
> uploading a properly built 0.5.4-5 to wheezy-backports would be a
> violation of the rules for foo-backports I think.
> 
> I've copied d-backports@ and ftp-master@ for advise. TL;DR: I seem to
> have uploaded a package built (and intended) for jessie-backports
> into
> wheezy-backports by mistake, it is fortunately uninstallable in that
> context.
> 
> Is it possible to simply remove the incorrect package from wheezy
> -backports?

I'll assume not.

wheezy-backports was supposed to have v0.5.4-1_bpo70+1, a diff of
v0.5.4-1 with v0.5.4-5 (the accidental upload) is below. The major
changes are:

 * Handling of device tree based systems alongside board file based
   ones, essentially looking at /proc/device-tree/model in preference
   to /proc/cpuinfo if (and only if) the former exists and extending
   various lists of model names to include the DT names
 * Handling of ​/dev/input/by-path/platform-gpio_keys-event
   vs /dev/input/by-path/platform-gpio-keys-event name, which varies
   with kernel versions, by looking for both in turn.
 * Wait for udev to settle in initscript
 * Some docs fixes

The 3rd and 4th are utterly benign. The first two are potentially
problematic but were written with compatibility with older kernels in
mind and will behave as they always have on older kernels.

Therefore I think the least-bad way to fix my cockup would be to upload
0.5.4-5~bpo8+1~bpo7+1 to wheezy-backports (containing 0.5.4-5 properly
built for wheezy) and to upload 0.5.4-5~bpo8+2 to jessie-backports
(since making 0.5.4-5 available in Jessie is what I was originally
intending to do).

This is bending the rules for wheezy-backports, since really 0.5.4-5 is
only a candidate for wheezy-backports-sloppy, but as I say I think this
is the least bad way out of the hole I've dug.

Other options I considered:

 * an upload of 0.5.4-5~bpo8+1~really0.5.4-1~bpo70+2 to wheezy-
   backports, reverting to the expected wheezy-backports version. If
   the diff between -1 and -5 was at all scary then this would be my
   preferred option, but I think they are not so scary.
 * uploading epoch 1: versions of all the intended versions to all of
   wheezy-backports, jessie-backports, sid (=> stretch). This has
   issues with version ordering between the proposed 1:0.5.4-1~bpo70+2
   in wheezy-backports and the actual 0.5.4-1+deb8u1 in Jessie (not
   jessie-backports, which would get 1:0).

I'll give it a few days for objections before I move on this.

Ian.

diff --git a/debian/changelog b/debian/changelog
index 6b718ef..1607fff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,37 @@
+qcontrol (0.5.4-5) unstable; urgency=medium
+
+  * [udeb/qcommand] Drop check for gpio-keys driver, it is no longer required.
+    (Closes: #793179)
+
+ -- Ian Campbell <ijc@debian.org>  Sun, 26 Jul 2015 17:01:05 +0100
+
+qcontrol (0.5.4-4) unstable; urgency=medium
+
+  * Handle differently named GPIO keys device nodes, this has changed in the
+  * kernel.
+
+ -- Ian Campbell <ijc@debian.org>  Wed, 08 Jul 2015 19:54:06 +0100
+
+qcontrol (0.5.4-3) unstable; urgency=medium
+
+  * Apply patch from Martin Michlmayr to support device-tree only systems.
+    (Closes: #788885)
+  * Update description and README with new devices, patch from Martin Michlmayr.
+    (Closes: #788911)
+
+ -- Ian Campbell <ijc@debian.org>  Tue, 23 Jun 2015 08:59:53 +0100
+
+qcontrol (0.5.4-2) unstable; urgency=medium
+
+  * Update Vcs-* to point to anonscm.
+  * Wait for necessary devices to appear before starting.
+    (Closes: #781886). This works around an issue exposed by systemd LSB
+    compatibility mode. Proper systemd support will come later.
+  * Update path to examples in man page. (Closes: #749127)
+  * Update to standards version 0.9.6, no changes required.
+
+ -- Ian Campbell <ijc@debian.org>  Wed, 13 May 2015 20:02:02 +0100
+
 qcontrol (0.5.4-1) unstable; urgency=low
 
   * New upstream release 0.5.4.
diff --git a/debian/control b/debian/control
index 2711ab5..f6530eb 100644
--- a/debian/control
+++ b/debian/control
@@ -1,11 +1,11 @@
 Source: qcontrol
 Section: utils
 Priority: optional
-Maintainer: Ian Campbell <ijc@hellion.org.uk>
+Maintainer: Ian Campbell <ijc@debian.org>
 Build-Depends: debhelper (>= 9), liblua5.1-0-dev, pkg-config
-Standards-Version: 3.9.5
-Vcs-Git: git://git.debian.org/collab-maint/qcontrol.git
-Vcs-Browser: http://git.debian.org/?p=collab-maint/qcontrol.git
+Standards-Version: 3.9.6
+Vcs-Git: git://anonscm.debian.org/collab-maint/qcontrol.git
+Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/qcontrol.git
 Homepage: https://gitorious.org/qcontrol/pages/Home
 
 Package: qcontrol
@@ -19,10 +19,10 @@ Description: hardware control for QNAP Turbo Station devices
  presses or temperature, with events triggering actions defined in the
  configuration file.
  .
- Supported devices at this time are the QNAP TS-109, TS-110, TS-119,
- TS-209, TS-210, TS-219, TS-219P, TS-409, TS-409U, TS-410, TS-410U,
- TS-419P and TS-419U but the code is extensible so more devices may
- be added in future releases.
+ Currently supported devices are the QNAP TS-109, QNAP TS-11x,
+ QNAP TS-12x, QNAP TS-209, QNAP HS-210, QNAP TS-21x, QNAP TS-22x,
+ QNAP TS-409, QNAP TS-409U, QNAP TS-41x, QNAP TS-42x and Synology
+ Diskstation and Rackstation.
 
 Package: qcontrol-udeb
 Section: debian-installer
diff --git a/debian/initramfs/init-bottom b/debian/initramfs/init-bottom
index c517341..722fae3 100755
--- a/debian/initramfs/init-bottom
+++ b/debian/initramfs/init-bottom
@@ -18,11 +18,17 @@ esac
 # Begin real processing below this line
 
 # Only needed on TS-219P II and TS-419P II, safe to call on any TS-x19 though.
-device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-	 head -n1 | sed "s/^[^:]*: //")
+if [ -e /proc/device-tree/model ]; then
+	device=$(cat /proc/device-tree/model)
+else
+	device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
+		 head -n1 | sed "s/^[^:]*: //")
+fi
 case $device in
     "QNAP TS-119/TS-219") break ;;
+    "QNAP TS219 family")  break ;;
     "QNAP TS-41x")        break ;;
+    "QNAP TS419 family")  break ;;
     *)                    exit 0 ;;
 esac
 
diff --git a/debian/patches/Examples-Handle-varying-gpio-keys-node-name.patch b/debian/patches/Examples-Handle-varying-gpio-keys-node-name.patch
new file mode 100644
index 0000000..97d7b6c
--- /dev/null
+++ b/debian/patches/Examples-Handle-varying-gpio-keys-node-name.patch
@@ -0,0 +1,211 @@
+From e9725869e1f998697e9651054544e2fa840d6956 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ijc@hellion.org.uk>
+Date: Sun, 31 May 2015 12:03:19 +0100
+Subject: [PATCH 2/2] Examples: Handle varying gpio-keys node name
+
+---
+ examples/mv2120.lua | 28 +++++++++++++++++++++++++---
+ examples/ts209.lua  | 28 +++++++++++++++++++++++++---
+ examples/ts219.lua  | 28 +++++++++++++++++++++++++---
+ examples/ts409.lua  | 28 +++++++++++++++++++++++++---
+ examples/ts41x.lua  | 28 +++++++++++++++++++++++++---
+ 5 files changed, 125 insertions(+), 15 deletions(-)
+
+diff --git a/examples/mv2120.lua b/examples/mv2120.lua
+index aacbba5..4bcc911 100644
+--- a/examples/mv2120.lua
++++ b/examples/mv2120.lua
+@@ -18,9 +18,31 @@ end
+ 
+ -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and
+ -- the kernel module gpio_keys to be loaded.
+-register("evdev", "/dev/input/by-path/platform-gpio-keys-event",
+-	116, "power_button",
+-	408, "restart_button")
++
++-- Different kernel versions use platform-gpio_keys-event or
++-- platform-gpio-keys-event, find the right one.
++
++function find_device( options )
++	for index,option in ipairs(options) do
++		local f=io.open(option)
++		if f then
++			f:close()
++			return option
++		end
++	end
++	return nil
++end
++
++evdev = find_device ( { "/dev/input/by-path/platform-gpio_keys-event",
++			"/dev/input/by-path/platform-gpio-keys-event" } )
++if evdev then
++	logprint("Register evdev on "..evdev)
++	register("evdev", evdev,
++		 116, "power_button",
++		 408, "restart_button")
++else
++	logprint("No evdev device found")
++end
+ 
+ function power_button( time )
+ 	os.execute("poweroff")
+diff --git a/examples/ts209.lua b/examples/ts209.lua
+index 6cc9722..da301a5 100644
+--- a/examples/ts209.lua
++++ b/examples/ts209.lua
+@@ -7,9 +7,31 @@ register("ts209")
+ 
+ -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and
+ -- the kernel module gpio_keys to be loaded.
+-register("evdev", "/dev/input/by-path/platform-gpio-keys-event",
+-	408, "restart_button",
+-	133, "media_button")
++
++-- Different kernel versions use platform-gpio_keys-event or
++-- platform-gpio-keys-event, find the right one.
++
++function find_device( options )
++	for index,option in ipairs(options) do
++		local f=io.open(option)
++		if f then
++			f:close()
++			return option
++		end
++	end
++	return nil
++end
++
++evdev = find_device ( { "/dev/input/by-path/platform-gpio_keys-event",
++			"/dev/input/by-path/platform-gpio-keys-event" } )
++if evdev then
++	logprint("Register evdev on "..evdev)
++	register("evdev", evdev,
++		 408, "restart_button",
++		 133, "media_button")
++else
++	logprint("No evdev device found")
++end
+ 
+ register("system-status")
+ 
+diff --git a/examples/ts219.lua b/examples/ts219.lua
+index 78f96ce..ab28d93 100644
+--- a/examples/ts219.lua
++++ b/examples/ts219.lua
+@@ -7,9 +7,31 @@ register("ts219")
+ 
+ -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and
+ -- the kernel module gpio_keys to be loaded.
+-register("evdev", "/dev/input/by-path/platform-gpio-keys-event",
+-	408, "restart_button",
+-	133, "media_button")
++
++-- Different kernel versions use platform-gpio_keys-event or
++-- platform-gpio-keys-event, find the right one.
++
++function find_device( options )
++	for index,option in ipairs(options) do
++		local f=io.open(option)
++		if f then
++			f:close()
++			return option
++		end
++	end
++	return nil
++end
++
++evdev = find_device ( { "/dev/input/by-path/platform-gpio_keys-event",
++			"/dev/input/by-path/platform-gpio-keys-event" } )
++if evdev then
++	logprint("Register evdev on "..evdev)
++	register("evdev", evdev,
++		 408, "restart_button",
++		 133, "media_button")
++else
++	logprint("No evdev device found")
++end
+ 
+ register("system-status")
+ 
+diff --git a/examples/ts409.lua b/examples/ts409.lua
+index c60473d..fb4f4cb 100644
+--- a/examples/ts409.lua
++++ b/examples/ts409.lua
+@@ -7,9 +7,31 @@ register("ts409")
+ 
+ -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and
+ -- the kernel module gpio_keys to be loaded.
+-register("evdev", "/dev/input/by-path/platform-gpio-keys-event",
+-	408, "restart_button",
+-	133, "media_button")
++
++-- Different kernel versions use platform-gpio_keys-event or
++-- platform-gpio-keys-event, find the right one.
++
++function find_device( options )
++	for index,option in ipairs(options) do
++		local f=io.open(option)
++		if f then
++			f:close()
++			return option
++		end
++	end
++	return nil
++end
++
++evdev = find_device ( { "/dev/input/by-path/platform-gpio_keys-event",
++			"/dev/input/by-path/platform-gpio-keys-event" } )
++if evdev then
++	logprint("Register evdev on "..evdev)
++	register("evdev", evdev,
++		 408, "restart_button",
++		 133, "media_button")
++else
++	logprint("No evdev device found")
++end
+ 
+ register("system-status")
+ 
+diff --git a/examples/ts41x.lua b/examples/ts41x.lua
+index 7c9043d..2460385 100644
+--- a/examples/ts41x.lua
++++ b/examples/ts41x.lua
+@@ -7,9 +7,31 @@ register("ts41x")
+ 
+ -- Requires CONFIG_KEYBOARD_GPIO enabled in the kernel and
+ -- the kernel module gpio_keys to be loaded.
+-register("evdev", "/dev/input/by-path/platform-gpio-keys-event",
+-	408, "restart_button",
+-	133, "media_button")
++
++-- Different kernel versions use platform-gpio_keys-event or
++-- platform-gpio-keys-event, find the right one.
++
++function find_device( options )
++	for index,option in ipairs(options) do
++		local f=io.open(option)
++		if f then
++			f:close()
++			return option
++		end
++	end
++	return nil
++end
++
++evdev = find_device ( { "/dev/input/by-path/platform-gpio_keys-event",
++			"/dev/input/by-path/platform-gpio-keys-event" } )
++if evdev then
++	logprint("Register evdev on "..evdev)
++	register("evdev", evdev,
++		 408, "restart_button",
++		 133, "media_button")
++else
++	logprint("No evdev device found")
++end
+ 
+ register("system-status")
+ 
+-- 
+2.1.4
+
diff --git a/debian/patches/README-Update-list-of-supported-devices.patch b/debian/patches/README-Update-list-of-supported-devices.patch
new file mode 100644
index 0000000..3f36c2d
--- /dev/null
+++ b/debian/patches/README-Update-list-of-supported-devices.patch
@@ -0,0 +1,27 @@
+From 57de7382fda15ae09941354cb5c82917c6902811 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ijc@hellion.org.uk>
+Date: Tue, 23 Jun 2015 08:51:45 +0100
+Subject: [PATCH 1/2] README: Update list of supported devices.
+
+Patch from Martin Michlmayr via Debian bug #788911.
+---
+ README | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/README b/README
+index 0de0456..3c8dae2 100644
+--- a/README
++++ b/README
+@@ -3,7 +3,7 @@ see https://gitorious.org/qcontrol/
+ Supported devices:
+  - QNAP TS-109, TS-109 II, TS-209 and TS-209 II (ts209)
+  - QNAP TS-409 and TS-409U (ts409)
+- - QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P (ts219)
+- - QNAP TS-410, TS-410U, TS-419P and TS-419U (ts41x)
++ - QNAP TS-11x, TS-12x, HS-210, TS-21x and TS-22x (ts219)
++ - QNAP TS-41x and TS-42x (ts41x)
+  - Synology Diskstation and Rackstation (synology)
+ 
+-- 
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 75a113c..e1bebc9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
+README-Update-list-of-supported-devices.patch
+Examples-Handle-varying-gpio-keys-node-name.patch
 multiarch.patch
 debian-config.patch
diff --git a/debian/qcontrol.1 b/debian/qcontrol.1
index ca21bca..942523b 100644
--- a/debian/qcontrol.1
+++ b/debian/qcontrol.1
@@ -18,10 +18,10 @@ Note: the current version does not have a real daemon mode. Caution is
 therefore advised when using qcontrol as a real daemon to monitor and
 control a device.
 .PP
-Currently supported devices are the QNAP TS-109, QNAP TS-110, QNAP TS-119,
-QNAP TS-209, QNAP TS-210, QNAP TS-219, QNAP TS-219P, QNAP TS-409, QNAP
-TS-409U, QNAP TS-410, QNAP TS-410U, QNAP TS-419P and QNAP TS-419U but
-support for additional devices may be added in future releases.
+Currently supported devices are the QNAP TS-109, QNAP TS-11x, QNAP TS-12x,
+QNAP TS-209, QNAP HS-210, QNAP TS-21x, QNAP TS-22x, QNAP TS-409, QNAP
+TS-409U, QNAP TS-41x, QNAP TS-42x and Synology Diskstation and Rackstation.
+Support for additional devices may be added in future releases.
 
 .SH BASIC USAGE
 Normally a control process will be started when the system is booted.
@@ -120,8 +120,8 @@ Configuration file for qcontrol init script
 Socket file for communication between daemon precess and client
 
 .SH SEE ALSO
-.IP \fB/usr/share/doc/qcontrol/examples\fP
-Example LUA configuration file containing more advanced commands
+.IP \fB/etc/qcontrol/*.lua\fP
+Example LUA configuration files for a variety of platforms
 
 .SH AUTHOR
 qcontrol was written by Byron Bradley <byron.bbradley@gmail.com>.
diff --git a/debian/qcontrol.postinst b/debian/qcontrol.postinst
index eb3969d..f12c42a 100755
--- a/debian/qcontrol.postinst
+++ b/debian/qcontrol.postinst
@@ -2,16 +2,20 @@
 set -e
 
 if [ ! -e /etc/qcontrol.conf ]; then
-	device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-		 head -n1 | sed "s/^[^:]*: //")
+	if [ -e /proc/device-tree/model ]; then
+		device=$(cat /proc/device-tree/model)
+	else
+		device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
+			 head -n1 | sed "s/^[^:]*: //")
+	fi
 	case $device in
 	    "QNAP TS-109/TS-209")
 		ln -s qcontrol/ts209.lua /etc/qcontrol.conf ;;
-	    "QNAP TS-119/TS-219")
+	    "QNAP TS-119/TS-219" | "QNAP TS219 family")
 		ln -s qcontrol/ts219.lua /etc/qcontrol.conf ;;
 	    "QNAP TS-409")
 		ln -s qcontrol/ts409.lua /etc/qcontrol.conf ;;
-	    "QNAP TS-41x")
+	    "QNAP TS-41x" | "QNAP TS419 family")
 		ln -s qcontrol/ts41x.lua /etc/qcontrol.conf ;;
 	esac
 fi
diff --git a/debian/qcontrol.qcontrold.init b/debian/qcontrol.qcontrold.init
index ccbcb22..55bd5a1 100644
--- a/debian/qcontrol.qcontrold.init
+++ b/debian/qcontrol.qcontrold.init
@@ -38,6 +38,11 @@ set -e
 
 case "$1" in
     start)
+	# Ensure that /dev/input/by-path/platform-gpio-keys-event has
+	# arrived. Under systemd LSB compatibility mode it may not
+	# have yet.
+	udevadm settle
+
 	log_daemon_msg "Starting qcontrol daemon" "qcontrol"
 	if start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- -d; then
 		log_end_msg 0
diff --git a/debian/udeb/debian-installer-startup.d/S99qcontrol b/debian/udeb/debian-installer-startup.d/S99qcontrol
index 2afb2a8..06fa7d1 100644
--- a/debian/udeb/debian-installer-startup.d/S99qcontrol
+++ b/debian/udeb/debian-installer-startup.d/S99qcontrol
@@ -2,17 +2,21 @@
 
 if qcommand -t; then
 	watchdog="no"
-	device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-		 head -n1 | sed "s/^[^:]*: //")
+	if [ -e /proc/device-tree/model ]; then
+		device=$(cat /proc/device-tree/model)
+	else
+		device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
+			 head -n1 | sed "s/^[^:]*: //")
+	fi
 	case $device in
 	    "QNAP TS-109/TS-209")
 		mv /etc/qcontrol/ts209.lua /etc/qcontrol.conf ;;
-	    "QNAP TS-119/TS-219")
+	    "QNAP TS-119/TS-219" | "QNAP TS219 family")
 		watchdog="yes"
 		mv /etc/qcontrol/ts219.lua /etc/qcontrol.conf ;;
 	    "QNAP TS-409")
 		mv /etc/qcontrol/ts409.lua /etc/qcontrol.conf ;;
-	    "QNAP TS-41x")
+	    "QNAP TS-41x" | "QNAP TS419 family")
 		watchdog="yes"
 		mv /etc/qcontrol/ts41x.lua /etc/qcontrol.conf ;;
 	esac
diff --git a/debian/udeb/qcommand b/debian/udeb/qcommand
index 08b2944..83e60c6 100644
--- a/debian/udeb/qcommand
+++ b/debian/udeb/qcommand
@@ -4,10 +4,14 @@
 # If called with -t, it only tests if the device is supported
 
 # Test if device is supported
-device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-	 head -n1 | sed "s/^[^:]*: //")
+if [ -e /proc/device-tree/model ]; then
+	device=$(cat /proc/device-tree/model)
+else
+	device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
+		 head -n1 | sed "s/^[^:]*: //")
+fi
 case $device in
-    "QNAP TS-109/TS-209" | "QNAP TS-119/TS-219" | "QNAP TS-409" | "QNAP TS-41x")
+    "QNAP TS-109/TS-209" | "QNAP TS-119/TS-219" | "QNAP TS219 family" | "QNAP TS-409" | "QNAP TS-41x" | "QNAP TS419 family")
 	# Success or continue 
 	[ "$1" = "-t" ] && exit 0 || true ;;
     *)
@@ -15,21 +19,13 @@ case $device in
 	[ "$1" = "-t" ] && exit 1 || exit 0 ;;
 esac
 
-# The gpio_keys character device is required with the default
-# Debian configuration file.
-test_event_dev() {
-	[ -c /dev/input/by-path/platform-gpio-keys-event ] || return 1
-}
-
 case $device in
-    "QNAP TS-409" | "QNAP TS-41x")
+    "QNAP TS-409" | "QNAP TS-41x" | "QNAP TS419 family")
 	if [ "$1" = powerled ]; then
 		exit 0
 	fi ;;
 esac
 
-test_event_dev || exit 0
-
 # Returns 1 even on success (TODO: is that still true?)
 qcontrol --direct "$@" || true
 


Reply to: