[Nut-upsuser] Old APC SmartUPS 1250, Nut 2.2.2 Fedora 9

Arjen de Korte nut+users at de-korte.org
Fri Jul 4 13:35:50 UTC 2008


> Arjen: looks like you added some identifiers to this list previously.
> Would you have any objection to moving the upsdebugx() line up so that
> the firmware version gets printed before firmware_table_lookup()
> exits?

No objections here. It probably is worthwhile to check the value of 'ret'
before doing that though, so that if we don't get anything useful, we
don't proceed to test what we've got. So something like

524	while ((ret < 1) || (!strcmp(buf, "NA"))) {
525		upsdebugx(1, "Attempting to contact older Smart-UPS version");
526		ret = ser_send_char(upsfd, 'V');
527
528		if (ret != 1) {
529			upslog_with_errno(LOG_ERR, "getbaseinfo: ser_send_char failed");
530			return 0;
531		}
532
533		ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, IGNCHARS,
534			SER_WAIT_SEC, SER_WAIT_USEC);

 		if (ret < 1) {
			upslog_with_errno(LOG_ERR, "getbaseinfo: ser_get_line failed");
			return 0;
		}
535
536		/* found one, force the model information */
537		if (!strcmp(buf, "6QD")) break; /* (APC600.) */
538		if (!strcmp(buf, "8QD")) break; /* (SmartUPS 1250, vintage 07/94.) */
539		if (!strcmp(buf, "6TI")) break; /* (APC600.) */
540		if (!strcmp(buf, "6QI")) break; /* (APC600.) */
541		/* if (!strcmp(buf, "???")) break; (APC1250.) */
542
543		upslogx(1, "Smart-UPS firmware [%s] not recognized", buf);
544		return 0;
545	}

	dstate_setinfo("ups.model", "Smart-UPS");

Best regards, Arjen





More information about the Nut-upsuser mailing list