int main(int argc, char **argv) { SaHpiSessionIdT sid = 0; SaErrorT rc = SA_OK; rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL); if (rc != SA_OK) { dbg("Failed to open session"); return -1; } rc = saHpiDiscover(sid); if (rc != SA_OK) { dbg("Failed to run discover"); return -1; } /* get the resource id of the chassis */ SaHpiResourceIdT resid = get_resid(sid, SAHPI_ENT_SYSTEM_CHASSIS); if (resid == 0) { dbg("Couldn't find the resource id of the chassis"); return -1; } rc = saHpiAnnunciatorAcknowledge(sid, resid, 1, SAHPI_ENTRY_UNSPECIFIED, SAHPI_MINOR); if (rc != SA_OK) { dbg("Couldn't ack annunciator"); dbg("Error %s",oh_lookup_error(rc)); return -1; } return 0; }
int runTest(SaHpiSessionIdT sessionId, SaHpiResourceIdT resourceId, SaHpiAnnunciatorNumT a_num, SaHpiSeverityT bad_severity) { SaErrorT status; int retval = SAF_TEST_NOTSUPPORT; status = saHpiAnnunciatorAcknowledge(sessionId, resourceId, a_num, SAHPI_ENTRY_UNSPECIFIED, bad_severity); if (status == SA_ERR_HPI_INVALID_PARAMS) { retval = SAF_TEST_PASS; } else { retval = SAF_TEST_FAIL; e_print(saHpiAnnunciatorAcknowledge, SA_ERR_HPI_INVALID_PARAMS, status); m_print("Severity = %s", get_severity_str(bad_severity)); } return retval; }
int processAnnunRdr(SaHpiSessionIdT sessionId, SaHpiResourceIdT resourceId, SaHpiRdrT * rdr, SaHpiAnnunciatorRecT * annunRec) { SaErrorT status; int retval; status = saHpiAnnunciatorAcknowledge(sessionId, INVALID_RESOURCE_ID, annunRec->AnnunciatorNum, SAHPI_ENTRY_UNSPECIFIED, SAHPI_INFORMATIONAL); if (status == SA_ERR_HPI_INVALID_RESOURCE) { retval = SAF_TEST_PASS; } else { retval = SAF_TEST_FAIL; e_print(saHpiAnnunciatorAcknowledge, SA_ERR_HPI_INVALID_RESOURCE, status); } return retval; }
static ret_code_t set_acknowledge(SaHpiResourceIdT rptid, SaHpiInstrumentIdT rdrnum) { SaErrorT rv; char str[32]; int i, all = 0; SaHpiSeverityT sev = SAHPI_OK; SaHpiEntryIdT entryId = 0; i = get_string_param("EntryId(<Id> | all): ", str, 32); if (i != 0) return(HPI_SHELL_PARM_ERROR); if (strcmp(str, "all") == 0) all = 1; else entryId = atoi(str); if (all) { i = get_string_param("Severity(crit|maj|min|info|ok): ", str, 10); if (i != 0) return(HPI_SHELL_PARM_ERROR); if (strcmp(str, "crit") == 0) sev = SAHPI_CRITICAL; else if (strcmp(str, "maj") == 0) sev = SAHPI_MAJOR; else if (strcmp(str, "min") == 0) sev = SAHPI_MINOR; else if (strcmp(str, "info") == 0) sev = SAHPI_INFORMATIONAL; else if (strcmp(str, "ok") == 0) sev = SAHPI_OK; else { printf("Invalid severity %s\n", str); return(HPI_SHELL_PARM_ERROR); }; entryId = SAHPI_ENTRY_UNSPECIFIED; }; rv = saHpiAnnunciatorAcknowledge(Domain->sessionId, rptid, rdrnum, entryId, sev); if (rv != SA_OK) { printf("saHpiAnnunciatorAcknowledge error %s\n", oh_lookup_error(rv)); return(HPI_SHELL_CMD_ERROR); }; return HPI_SHELL_OK; }