Imported Upstream version 2.6.4

This commit is contained in:
Arnaud Quette 2012-06-01 15:55:19 +02:00
parent fad6ced6f6
commit fefe62b2bd
257 changed files with 6020 additions and 1394 deletions

View file

@ -12,7 +12,7 @@
#include <usb.h>
#define SUBDRIVER_NAME "USB communication subdriver"
#define SUBDRIVER_VERSION "0.19"
#define SUBDRIVER_VERSION "0.21"
/* communication driver description structure */
upsdrv_info_t comm_upsdrv_info = {
@ -104,6 +104,7 @@ void send_read_command(unsigned char command)
buf[1] = 0x01; /* data length */
buf[2] = command; /* command to send */
buf[3] = calc_checksum(buf); /* checksum */
upsdebug_hex (3, "send_read_command", buf, 4);
usb_set_descriptor(upsdev, USB_DT_STRING, 4, buf, 4); /* FIXME: Ignore error */
}
}
@ -122,6 +123,7 @@ void send_write_command(unsigned char *command, int command_length)
/* Add checksum */
sbuf[command_length] = calc_checksum(sbuf);
command_length += 1;
upsdebug_hex (3, "send_write_command", sbuf, command_length);
usb_set_descriptor(upsdev, USB_DT_STRING, 4, sbuf, command_length); /* FIXME: Ignore error */
}
}
@ -266,7 +268,8 @@ int get_answer(unsigned char *data, unsigned char command)
end_length += length;
my_buf += length + 5;
}
upsdebugx(4, "get_answer: exiting (len=%d)", end_length);
upsdebug_hex (5, "get_answer", data, end_length);
return end_length;
}
@ -299,6 +302,7 @@ int command_write_sequence(unsigned char *command, int command_length, unsigned
while ((bytes_read < 1) && (retry < 5)) {
send_write_command(command, command_length);
sleep(PW_SLEEP);
bytes_read = get_answer(answer, command[0]);
retry ++;
}
@ -388,7 +392,7 @@ usb_dev_handle *nutusb_open(const char *port)
usb_find_busses();
usb_find_devices();
for (retry = 0; retry <= MAX_TRY ; retry++)
for (retry = 0; retry < MAX_TRY ; retry++)
{
dev_h = open_powerware_usb();
if (!dev_h) {