Logo Search packages:      
Sourcecode: nut version File versions  Download package

void debug_message ( const char *  msg,
int  len 

Send an unknown command to the UPS, and store response in a variable.

msg Command string (usually a character and a null)
len Length of command plus null
The variables are of the form "ups.debug.X" where "X" is the command character.

Definition at line 717 of file tripplite_usb.c.

References hexascdump(), send_cmd(), and usb_comm_fail().

      int ret;
      unsigned char tmp_value[9];
      char var_name[20], err_msg[80];

      snprintf(var_name, sizeof(var_name), "ups.debug.%c", *msg);

      ret = send_cmd((unsigned char *)msg, len, tmp_value, sizeof(tmp_value));
      if(ret <= 0) {
            sprintf(err_msg, "Error reading '%c' value", *msg);
            usb_comm_fail(ret, err_msg);
      dstate_setinfo(var_name, "%s", hexascdump(tmp_value+1, 7));

Generated by  Doxygen 1.6.0   Back to index