Package: nut
Version: 2.4.1-3
Severity: normal
Tags: patch

Attached patch makes phoenix subdriver of blazer_usb useable for Ippon BCP800

I also sent the patch directly to upstream mailing list: 
http://lists.alioth.debian.org/pipermail/nut-upsdev/2009-August/003976.html

Cheers,
-- Danya

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages nut depends on:
ii  adduser                      3.110       add and remove users and groups
ii  debconf                      1.5.27      Debian configuration management sy
ii  libc6                        2.9-12      GNU C Library: Shared libraries
ii  libupsclient1                2.4.1-3     network UPS tools - client library
ii  libusb-0.1-4                 2:0.1.12-13 userspace USB programming library
ii  libwrap0                     7.6.q-18    Wietse Venema's TCP wrappers libra
ii  lsb-base                     3.2-22      Linux Standard Base 3.2 init scrip
ii  udev                         0.141-1     /dev/ and hotplug management daemo

Versions of packages nut recommends:
ii  bash-completion               1:1.0-3    programmable completion for the ba

Versions of packages nut suggests:
pn  nut-cgi                       <none>     (no description available)
pn  nut-dev                       <none>     (no description available)
pn  nut-snmp                      <none>     (no description available)
pn  nut-xml                       <none>     (no description available)

-- debconf information:
  nut/major_upstream_changes:
--- nut-2.4.1.orig/drivers/blazer_usb.c	2009-02-17 12:20:48.000000000 +0300
+++ nut-2.4.1/drivers/blazer_usb.c	2009-08-01 20:39:46.128727718 +0400
@@ -47,6 +47,23 @@
 static int (*subdriver_command)(const char *cmd, char *buf, size_t buflen) = NULL;
 
 
+static int phoenix_flush_io()
+{
+	static 
+	char buf[SMALLBUF+1];
+	int i, ret;
+	upsdebugx(3, "phoenix_flush_io");
+	for(i = 0; i < 10; i++) {
+		memset(buf, 0, sizeof(buf));
+		/* ret = usb->get_interrupt(udev, (unsigned char *)buf, 8, 1000); */
+		ret = usb_interrupt_read(udev, 0x81, buf, SMALLBUF, 1000);
+		upsdebugx(4, "flush(%d,%d) <- '%s'", ret, strlen(buf), buf);
+		if (ret < 1)
+			break;
+	}
+	return 0;
+}
+
 static int phoenix_command(const char *cmd, char *buf, size_t buflen)
 {
 	char	tmp[SMALLBUF];
@@ -56,6 +73,7 @@
 	memset(tmp, 0, sizeof(tmp));
 	snprintf(tmp, sizeof(tmp), "%s", cmd);
 
+	phoenix_flush_io();
 	for (i = 0; i < strlen(tmp); i += ret) {
 
 		/* Write data in 8-byte chunks */

Reply via email to