Imported Upstream version 2.7.2
This commit is contained in:
parent
0121794af9
commit
a356b56d11
263 changed files with 6039 additions and 8151 deletions
|
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define DRIVER_VERSION "0.01"
|
||||
#define DRIVER_VERSION "0.06"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
@ -66,17 +66,22 @@
|
|||
#include "nutdrv_qx_megatec.h"
|
||||
#include "nutdrv_qx_megatec-old.h"
|
||||
#include "nutdrv_qx_mustek.h"
|
||||
#include "nutdrv_qx_q1.h"
|
||||
#include "nutdrv_qx_voltronic.h"
|
||||
#include "nutdrv_qx_voltronic-qs.h"
|
||||
#include "nutdrv_qx_zinto.h"
|
||||
|
||||
/* Master list of avaiable subdrivers */
|
||||
static subdriver_t *subdriver_list[] = {
|
||||
&voltronic_subdriver,
|
||||
&voltronic_qs_subdriver,
|
||||
&mustek_subdriver,
|
||||
&megatec_old_subdriver,
|
||||
&megatec_subdriver,
|
||||
&mecer_subdriver,
|
||||
&megatec_subdriver,
|
||||
&zinto_subdriver,
|
||||
/* Fallback Q1 subdriver */
|
||||
&q1_subdriver,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -534,7 +539,7 @@ static int phoenix_command(const char *cmd, char *buf, size_t buflen)
|
|||
static int ippon_command(const char *cmd, char *buf, size_t buflen)
|
||||
{
|
||||
char tmp[64];
|
||||
int ret;
|
||||
int ret, len;
|
||||
size_t i;
|
||||
|
||||
/* Send command */
|
||||
|
|
@ -562,10 +567,19 @@ static int ippon_command(const char *cmd, char *buf, size_t buflen)
|
|||
return ret;
|
||||
}
|
||||
|
||||
snprintf(buf, buflen, "%.*s", ret, tmp);
|
||||
|
||||
upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf);
|
||||
return ret;
|
||||
/*
|
||||
* As Ippon will always return 64 bytes in response, we have to
|
||||
* calculate and return length of actual response data here.
|
||||
* Empty response will look like 0x00 0x0D, otherwise it will be
|
||||
* data string terminated by 0x0D.
|
||||
*/
|
||||
len = (int)strcspn(tmp, "\r");
|
||||
upsdebugx(3, "read: %.*s", len, tmp);
|
||||
if (len > 0) {
|
||||
len ++;
|
||||
}
|
||||
snprintf(buf, buflen, "%.*s", len, tmp);
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Krauler communication subdriver */
|
||||
|
|
@ -1759,7 +1773,9 @@ static int qx_command(const char *cmd, char *buf, size_t buflen)
|
|||
|
||||
case -ETIMEDOUT: /* Connection timed out */
|
||||
case -EOVERFLOW: /* Value too large for defined data type */
|
||||
#ifdef EPROTO
|
||||
case -EPROTO: /* Protocol error */
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue