-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: qcontrol
Version: 0.4.2+svn-r40-1
Serverity: wishlist
Tags: patch

Hello,

recently I bought a new Qnap device (TS-219p II, the one with the USB
3.0 ports) and tried to install Debian on it. (also see the thread [1]
on the debian-arm mailing list) The Debian installer couldn't
successfully finish it's job on the device because - as we found out -
the PIC on at least this hardware revision has a watchdog which resets
the device after 5 minutes if enabled.

The solution Qnap used to solve this is simply disabling the PIC
watchdog using their own drivers and a binary called "pic_raw". Since
qcontrol is the solution on Debian used to communicate with the PIC, I
added an option to disable the PIC watchdog.

I don't know if the watchdog also exists or is enabled by default in
other Qnap devices or hardware revisions but it would probably be a
good idea to disable it at boot time for at least this device. Please
find the patch for the added lines of code attached.

[1] http://lists.debian.org/debian-arm/2012/11/threads.html#00013

- --
Helmut Pozimski


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iJwEAQECAAYFAlCkCUoACgkQGPN+zM7FMNFiRgQAp7n+PDaHnh+zZupsTmcPwIyh
0DHlyJ1Uuc84ppFZs1DtbQmfFjRPWwLTbVr7OqM49vqgq8Icj+oEsIk7wPg7F3MU
zCD3yqEeOxTaPKfQD+qEeUNLnacz3ON25LLqF5j3E5MupdwHr3v60XkxBEjkTueA
L/mgjiqHN8TRroEqpIA=
=iPx8
-----END PGP SIGNATURE-----
diff --git a/ts219.c b/ts219.c
index b50d629..ec84925 100644
--- a/ts219.c
+++ b/ts219.c
@@ -315,6 +315,21 @@ static int ts219_autopower(int argc, const char **argv)
 	return 0;
 }
 
+static int ts219_wdt(int argc, const char **argv)
+{
+        char code = 0;
+
+        if (argc != 1)
+                return -1;
+        if (strcmp(argv[0], "off") == 0)
+                code = 0x67;
+        else
+                return -1;
+
+        return serial_write(&code, 1);
+        return 0;
+}
+
 static int ts219_init(int argc, const char **argv UNUSED)
 {
 	int err;
@@ -361,6 +376,12 @@ static int ts219_init(int argc, const char **argv UNUSED)
 	                       "Control the automatic power mechanism, options are:\n"
 	                       "\ton\n\toff\n",
 	                       ts219_autopower);
+        err = register_command("watchdog",
+                                "Disable the PIC watchdog",
+                                "Watchdog options are:\n"
+                                "\toff",
+                                ts219_wdt);
+
 
 	return pthread_create(&ts219_thread, NULL, serial_poll, NULL);
 }

Reply via email to