Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Someone
Monday, April 14th, 2008 at 6:40:13pm UTC 

  1. diff -u nut-2.2.1/debian/changelog nut-2.2.1/debian/changelog
  2. --- nut-2.2.1/debian/changelog
  3. +++ nut-2.2.1/debian/changelog
  4. @@ -1,3 +1,10 @@
  5. +nut (2.2.1-2.1ubuntu7) hardy; urgency=low
  6. +
  7. +  * debian/patches/01_fix_megatec_regression.dpatch
  8. +    - Fix more megatec_usb driver regressions. (LP: #215389)
  9. +
  10. + -- Chuck Short <[email protected]>  Mon, 14 Apr 2008 14:25:48 -0400
  11. +
  12.  nut (2.2.1-2.1ubuntu6) hardy; urgency=low
  13.  
  14.    * debian/patches/01_fix_megatec_regression.dpatch
  15. diff -u nut-2.2.1/debian/patches/01_fix_megatec_regression.dpatch nut-2.2.1/debian/patches/01_fix_megatec_regression.dpatch
  16. --- nut-2.2.1/debian/patches/01_fix_megatec_regression.dpatch
  17. +++ nut-2.2.1/debian/patches/01_fix_megatec_regression.dpatch
  18. @@ -3,7 +3,7 @@
  19.  diff -Naur nut-2.2.1.orig/data/driver.list nut-2.2.1/data/driver.list
  20.  --- nut-2.2.1.orig/data/driver.list    2007-12-17 09:45:44.000000000 -0500
  21. -+++ nut-2.2.1/data/driver.list 2008-04-10 09:30:39.000000000 -0400
  22. ++++ nut-2.2.1/data/driver.list 2008-04-14 14:28:59.000000000 -0400
  23.  @@ -54,6 +54,7 @@
  24.  
  25.   "APC" "(various)"      "SNMP monitoring card"        "snmp-ups (experimental driver)"
  26. @@ -59,7 +59,7 @@
  27.   "Various"     "(various)"  "Generic RUPS model"      "genericups upstype=4"
  28.  diff -Naur nut-2.2.1.orig/drivers/megatec.c nut-2.2.1/drivers/megatec.c
  29.  --- nut-2.2.1.orig/drivers/megatec.c   2007-12-17 10:13:09.000000000 -0500
  30. -+++ nut-2.2.1/drivers/megatec.c        2008-04-10 09:25:10.000000000 -0400
  31. ++++ nut-2.2.1/drivers/megatec.c        2008-04-14 14:28:59.000000000 -0400
  32.  @@ -61,6 +61,8 @@
  33.   #define MAX_START_DELAY_LEN    4
  34.   #define MAX_SHUTDOWN_DELAY_LEN 2
  35. @@ -122,7 +122,7 @@
  36.         dstate_setinfo("output.voltage", "%.1f", query.ovolt);
  37.  diff -Naur nut-2.2.1.orig/drivers/megatec.h nut-2.2.1/drivers/megatec.h
  38.  --- nut-2.2.1.orig/drivers/megatec.h   2007-12-17 10:13:09.000000000 -0500
  39. -+++ nut-2.2.1/drivers/megatec.h        2008-04-10 09:25:54.000000000 -0400
  40. ++++ nut-2.2.1/drivers/megatec.h        2008-04-14 14:28:59.000000000 -0400
  41.  @@ -26,7 +26,7 @@
  42.   #define MEGATEC_H
  43.  
  44. @@ -134,7 +134,7 @@
  45.   #ifdef MEGATEC_SUBDRV
  46.  diff -Naur nut-2.2.1.orig/drivers/megatec_usb.c nut-2.2.1/drivers/megatec_usb.c
  47.  --- nut-2.2.1.orig/drivers/megatec_usb.c       2007-10-01 09:06:24.000000000 -0400
  48. -+++ nut-2.2.1/drivers/megatec_usb.c    2008-04-10 09:51:59.000000000 -0400
  49. ++++ nut-2.2.1/drivers/megatec_usb.c    2008-04-14 14:29:03.000000000 -0400
  50.  @@ -46,6 +46,8 @@
  51.   static usb_communication_subdriver_t *usb = &usb_subdriver;
  52.   static usb_dev_handle *udev = NULL;
  53. @@ -161,28 +161,42 @@
  54.   /* agiler subdriver definition */
  55.   static int get_data_agiler(char *buffer, int buffer_size);
  56.   static int set_data_agiler(const char *str);
  57. [email protected]@ -75,6 +87,7 @@
  58. [email protected]@ -63,6 +75,16 @@
  59. +       set_data_agiler
  60. + };
  61. +
  62. ++/* Phoenixtec Power Co subdriver definition */
  63. ++static int get_data_phoenix(char *buffer, int buffer_size);
  64. ++static int set_data_phoenix(const char *str);
  65. ++
  66. ++static subdriver_t phoenix_subdriver = {
  67. ++      "phoenix",
  68. ++      get_data_phoenix,
  69. ++      set_data_phoenix
  70. ++};
  71. ++
  72. + /* krauler (ablerex) subdriver definition */
  73. + static int get_data_krauler(char *buffer, int buffer_size);
  74. + static int set_data_krauler(const char *str);
  75. [email protected]@ -75,8 +97,10 @@
  76.  
  77.   /* list of subdrivers */
  78.   static subdriver_t *subdriver_list[] = {
  79.  +      &agiler_old_subdriver,
  80.         &agiler_subdriver,
  81.         &krauler_subdriver,
  82. ++      &phoenix_subdriver,
  83.         NULL  /* end of list */
  84. [email protected]@ -91,14 +104,16 @@
  85. + };
  86.  
  87. - /* list of all known devices */
  88. - static usb_ups_t KnownDevices[] = {
  89. --      {0x05b8, 0x0000, &agiler_subdriver},  /* Agiler UPS */
  90. --      {0x0001, 0x0000, &krauler_subdriver}, /* Krauler UP-M500VA */
  91. --      {0xffff, 0x0000, &krauler_subdriver}, /* Ablerex 625L USB */
  92. [email protected]@ -94,11 +118,13 @@
  93. +       {0x05b8, 0x0000, &agiler_subdriver},  /* Agiler UPS */
  94. +       {0x0001, 0x0000, &krauler_subdriver}, /* Krauler UP-M500VA */
  95. +       {0xffff, 0x0000, &krauler_subdriver}, /* Ablerex 625L USB */
  96.  -      {0x0665, 0x5161, &agiler_subdriver},  /* Belkin F6C1200-UNV */
  97. -+      {0x05b8, 0x0000, &agiler_old_subdriver},      /* Agiler UPS */
  98. -+      {0x0001, 0x0000, &krauler_subdriver},  /* Krauler UP-M500VA */
  99. -+      {0xffff, 0x0000, &krauler_subdriver},  /* Ablerex 625L USB */
  100. -+      {0x0665, 0x5161, &agiler_old_subdriver},      /* Belkin F6C1200-UNV */
  101. -+      {0x06da, 0x0003, &agiler_old_subdriver},      /* Mustek Powermust */
  102. -+      {0x0f03, 0x0001, &agiler_old_subdriver},      /* Unitek Alpha 1200Sx */
  103. ++      {0x0665, 0x5161, &phoenix_subdriver}, /* Belkin F6C1200-UNV */
  104. ++      {0x06da, 0x0003, &phoenix_subdriver}, /* Mustek Powermust */
  105. ++      {0x0f03, 0x0001, &phoenix_subdriver}, /* Unitek Alpha 1200Sx */
  106.         {-1, -1, NULL}                /* end of list */
  107.   };
  108.  
  109. @@ -191,7 +205,7 @@
  110.   {
  111.         usb_ups_t *p;
  112.  
  113. [email protected]@ -115,6 +130,12 @@
  114. [email protected]@ -115,6 +141,12 @@
  115.         return 0;
  116.   }
  117.  
  118. @@ -204,7 +218,7 @@
  119.   static void usb_open_error(const char *port)
  120.   {
  121.         fatalx(EXIT_FAILURE,
  122. [email protected]@ -148,13 +169,8 @@
  123. [email protected]@ -148,13 +180,8 @@
  124.  
  125.   int ser_open(const char *port)
  126.   {
  127. @@ -219,7 +233,7 @@
  128.  
  129.         char *subdrv = getval("subdriver");
  130.         char *vid = getval("vendorid");
  131. [email protected]@ -162,6 +178,7 @@
  132. [email protected]@ -162,6 +189,7 @@
  133.         char *vend = getval("vendor");
  134.         char *prod = getval("product");
  135.  
  136. @@ -227,7 +241,7 @@
  137.         if(subdrv)
  138.         {
  139.               subdriver_t **p;
  140. [email protected]@ -186,9 +203,6 @@
  141. [email protected]@ -186,9 +214,6 @@
  142.                     fatalx(EXIT_FAILURE, "No subdrivers named \"%s\" found!", subdrv);
  143.         }
  144.  
  145. @@ -237,7 +251,7 @@
  146.         /* FIXME: fix "serial" variable */
  147.           /* process the UPS selection options */
  148.         regex_array[0] = vid;
  149. [email protected]@ -198,11 +212,11 @@
  150. [email protected]@ -198,11 +223,11 @@
  151.         regex_array[4] = NULL; /* getval("serial"); */
  152.         regex_array[5] = getval("bus");
  153.  
  154. @@ -253,7 +267,7 @@
  155.         }
  156.         /* link the matchers */
  157.         regex_matcher->next = &subdriver_matcher;
  158. [email protected]@ -211,12 +225,28 @@
  159. [email protected]@ -211,12 +236,28 @@
  160.         if (ret < 0)
  161.               usb_open_error(port);
  162.  
  163. @@ -266,10 +280,10 @@
  164.  +      }
  165.  +      /* link the matchers */
  166.  +      reopen_matcher->next = regex_matcher;
  167. -
  168. ++
  169.  +      /* NOTE: This is here until ser_flush_io() is used in megatec.c */
  170.  +      ser_flush_io(0);
  171. -+
  172. +
  173.  +      return 0;
  174.  +}
  175.  +
  176. @@ -285,7 +299,7 @@
  177.                     break;
  178.         }
  179.  
  180. [email protected]@ -235,22 +265,90 @@
  181. [email protected]@ -235,22 +276,90 @@
  182.  
  183.   int ser_set_rts(int fd, int state)
  184.   {
  185. @@ -377,7 +391,7 @@
  186.               return -1;
  187.  
  188.         va_start(ap, fmt);
  189. [email protected]@ -264,7 +362,12 @@
  190. [email protected]@ -264,7 +373,12 @@
  191.               buf[sizeof(buf) - 1] = 0;
  192.         }
  193.  
  194. @@ -391,7 +405,7 @@
  195.   }
  196.  
  197.   int ser_get_line(int fd, char *buf, size_t buflen, char endchar, const char *ignset, long d_sec, long d_usec)
  198. [email protected]@ -272,16 +375,18 @@
  199. [email protected]@ -272,16 +386,18 @@
  200.         int len;
  201.         char *src, *dst, c;
  202.  
  203. @@ -415,7 +429,7 @@
  204.               c = *src;
  205.  
  206.               if (c == endchar)
  207. [email protected]@ -294,25 +399,77 @@
  208. [email protected]@ -294,25 +410,77 @@
  209.         }
  210.  
  211.         /* terminate string if we have space */
  212. @@ -499,7 +513,70 @@
  213.   static int set_data_agiler(const char *str)
  214.   {
  215.         return usb->set_report(udev, 0, (unsigned char *)str, strlen(str));
  216. [email protected]@ -337,87 +494,95 @@
  217. [email protected]@ -325,6 +493,62 @@
  218. +
  219. +
  220. + /*
  221. ++    Phoenixtec Power Co serial-to-usb device.
  222. ++*/
  223. ++static char   phoenix_buffer[32];
  224. ++
  225. ++static int set_data_phoenix(const char *str)
  226. ++{
  227. ++      unsigned int  count;
  228. ++
  229. ++      memset(phoenix_buffer, '\0', sizeof(phoenix_buffer));
  230. ++
  231. ++      snprintf(phoenix_buffer, sizeof(phoenix_buffer), "%s", str);
  232. ++
  233. ++      if (!strcmp(phoenix_buffer, "I\r") || !strcmp(phoenix_buffer, "C\r")) {
  234. ++            /* Ignore these, since they seem to lock up the connection */
  235. ++            return strlen(phoenix_buffer);
  236. ++      }
  237. ++
  238. ++      for (count = 0; count < strlen(phoenix_buffer); count += 8) {
  239. ++
  240. ++            if (usb->set_report(udev, 0, (unsigned char *)(phoenix_buffer + count), 8) < 1) {
  241. ++                  return -1;
  242. ++            }
  243. ++      }
  244. ++
  245. ++      return strlen(phoenix_buffer);
  246. ++}
  247. ++
  248. ++static int get_data_phoenix(char *buffer, int buffer_size)
  249. ++{
  250. ++      int   count;
  251. ++
  252. ++      memset(buffer, '\0', buffer_size);
  253. ++
  254. ++      if (!strcmp(phoenix_buffer, "I\r") || !strcmp(phoenix_buffer, "C\r")) {
  255. ++            /* Echo back unsupported commands */
  256. ++            snprintf(buffer, buffer_size, "%s", phoenix_buffer);
  257. ++            return strlen(buffer);
  258. ++      }
  259. ++
  260. ++      for (count = 8; count <= buffer_size; count += 8) {
  261. ++
  262. ++            /* Read data in 8-byte chunks, break on a timeout */
  263. ++            if (usb->get_interrupt(udev, (unsigned char *)&buffer[count-8], 8, 1000) < 0) {
  264. ++                  return count-8;
  265. ++            }
  266. ++
  267. ++            upsdebugx(3, "get_data_phoenix: got so far [%s]", buffer);
  268. ++            upsdebug_hex(4, "get_data_phoenix", (unsigned char *)buffer, count);
  269. ++      }
  270. ++
  271. ++      upsdebugx(3, "get_data_phoenix: buffer too small");
  272. ++      return -1;
  273. ++}
  274. ++
  275. ++
  276. ++/*
  277. +     Krauler serial-over-usb device.
  278. +
  279. +     Protocol was reverse-engineered using Windows driver.
  280. [email protected]@ -337,87 +561,95 @@
  281.   typedef struct {
  282.         char  *str;     /* Megatec command */
  283.         int   index;     /* Krauler string index for this command */
  284. @@ -577,10 +654,10 @@
  285.  +                        return res;
  286.                     }
  287.  -            }
  288. -
  289. +-
  290.  -            return strlen(str);
  291.  -      }
  292. --
  293. +
  294.  -      upsdebugx(4, "set_data_krauler: unknown command [%s]", str);
  295.  -      return 0;
  296.  -}
  297. @@ -651,7 +728,7 @@
  298.   }
  299.  diff -Naur nut-2.2.1.orig/scripts/hal/20-ups-nut-device.fdi nut-2.2.1/scripts/hal/20-ups-nut-device.fdi
  300.  --- nut-2.2.1.orig/scripts/hal/20-ups-nut-device.fdi   2007-10-01 08:59:22.000000000 -0400
  301. -+++ nut-2.2.1/scripts/hal/20-ups-nut-device.fdi        2008-04-10 09:31:09.000000000 -0400
  302. ++++ nut-2.2.1/scripts/hal/20-ups-nut-device.fdi        2008-04-14 14:28:59.000000000 -0400
  303.  @@ -162,6 +162,14 @@
  304.             <merge key="battery.type" type="string">ups</merge>
  305.           </match>
  306. @@ -692,7 +769,7 @@
  307.             <merge key="info.addons" type="strlist">hald-addon-megatec_usb</merge>
  308.  diff -Naur nut-2.2.1.orig/scripts/udev/nut-usbups.rules.in nut-2.2.1/scripts/udev/nut-usbups.rules.in
  309.  --- nut-2.2.1.orig/scripts/udev/nut-usbups.rules.in    2007-10-15 07:16:52.000000000 -0400
  310. -+++ nut-2.2.1/scripts/udev/nut-usbups.rules.in 2008-04-10 09:32:14.000000000 -0400
  311. ++++ nut-2.2.1/scripts/udev/nut-usbups.rules.in 2008-04-14 14:28:59.000000000 -0400
  312.  @@ -24,7 +24,7 @@
  313.   # LIEBERT/PowerSure Personal XT
  314.   SYSFS{idVendor}=="06da", SYSFS{idProduct}=="ffff", MODE="664", GROUP="@[email protected]"

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right