• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ saHpiRptEntryGet函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中saHpiRptEntryGet函数的典型用法代码示例。如果您正苦于以下问题:C++ saHpiRptEntryGet函数的具体用法?C++ saHpiRptEntryGet怎么用?C++ saHpiRptEntryGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了saHpiRptEntryGet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: list_rpt

static
void list_rpt(SaHpiSessionIdT sessionid)
{
        SaHpiRptEntryT rptentry;
	SaHpiEntryIdT rptentryid;
	SaHpiEntryIdT nextrptentryid;
        
        int rv;

	rptentryid = SAHPI_FIRST_ENTRY;

	rv = SA_OK;

	while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) {
                
		rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
				      &rptentry);
		if (rv != SA_OK) {
			printf("Error getting RPT entry: rv = %d\n", rv);
		}

		printf("Resource Id: %d\n", rptentry.ResourceId);
		printf("Resource Tag: %s\n", (char *)rptentry.ResourceTag.Data);

		rptentryid = nextrptentryid;
	}
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:27,代码来源:hpi_cmd.c


示例2: list_all

SaErrorT list_all(SaHpiSessionIdT sessionid)
{
	SaHpiRptEntryT rptentry;
	SaHpiEntryIdT rptentryid;
	SaHpiEntryIdT nextrptentryid;
	SaErrorT rv = SA_OK;

	rptentryid = SAHPI_FIRST_ENTRY;
	do {
		
		if (fdebug) printf("saHpiRptEntryGet\n");

		rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,&rptentry);
		if (rv != SA_OK) {
			printf("Error getting RPT entry: rv = %s\n", oh_lookup_error(rv));
			return (rv);
		} else {
			oh_print_rptentry(&rptentry, 2);
			list_rdr(sessionid, rptentry.ResourceId);
			list_inv(sessionid, rptentry.ResourceId);
			list_sens(sessionid, rptentry.ResourceId);
			list_ctrl(sessionid, rptentry.ResourceId);
			list_wdog(sessionid, rptentry.ResourceId);
		}

		rptentryid = nextrptentryid;
	} while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY));
	return(rv);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:29,代码来源:hpitree.c


示例3: list_rpt

SaErrorT list_rpt(SaHpiSessionIdT sessionid,SaHpiResourceIdT resourceid)
{
	SaHpiRptEntryT rptentry;
	SaHpiEntryIdT rptentryid;
	SaHpiEntryIdT nextrptentryid;
	SaErrorT rv = SA_OK;

	rptentryid = SAHPI_FIRST_ENTRY;
	do {
		
		if (fdebug) printf("saHpiRptEntryGet\n");

		rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,&rptentry);
		if (rv != SA_OK) {
			printf("Error getting RPT entry: rv = %s\n", oh_lookup_error(rv));
			return (rv);
		} else {
			if (resourceid == 255) 
				oh_print_rptentry(&rptentry, 2);
			else {
				if (resourceid == rptentry.ResourceId) {
					oh_print_rptentry(&rptentry, 2);
					nextrptentryid = SAHPI_LAST_ENTRY;
				}	 
			}
		}

		rptentryid = nextrptentryid;
	} while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY));
	return(rv);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:31,代码来源:hpitree.c


示例4: list_rdr

SaErrorT list_rdr(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid)
{
	SaErrorT rv       = SA_OK,
	         rvRdrGet = SA_OK,
 		 rvRptGet = SA_OK;

	SaHpiRptEntryT rptentry;
	SaHpiEntryIdT rptentryid;
	SaHpiEntryIdT nextrptentryid;
	SaHpiEntryIdT entryid;
	SaHpiEntryIdT nextentryid;
	SaHpiRdrT rdr;
	SaHpiResourceIdT l_resourceid;
	SaHpiTextBufferT working;
		
	oh_init_textbuffer(&working);																		
																
	/* walk the RPT list */
	rptentryid = SAHPI_FIRST_ENTRY;
	do {
		
		if (fdebug) printf("saHpiRptEntryGet\n");
		rvRptGet = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry);
		if ((rvRptGet != SA_OK) || fdebug) 
		       	printf("RptEntryGet returns %s\n",oh_lookup_error(rvRptGet));
			if (rvRptGet == SA_OK 
                   		&& (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_RDR) 
				&& ((resourceid == 0xFF) || (resourceid == rptentry.ResourceId)))
			{
				l_resourceid = rptentry.ResourceId;
				if (resourceid != 0xFF) 
					 nextrptentryid = SAHPI_LAST_ENTRY;

				/* walk the RDR list for this RPT entry */
				entryid = SAHPI_FIRST_ENTRY;			

				if (fdebug) printf("rptentry[%d] resourceid=%d\n", entryid,resourceid);

				do {
					rvRdrGet = saHpiRdrGet(sessionid,l_resourceid, entryid,&nextentryid, &rdr);
					if (fdebug) printf("saHpiRdrGet[%d] rv = %s\n",entryid,oh_lookup_error(rvRdrGet));

					if (rvRdrGet == SA_OK)
					{
						snprintf(working.Data, SAHPI_MAX_TEXT_BUFFER_LENGTH,
							 "\nRdr for %s, ResourceId: %d\n",
							 rptentry.ResourceTag.Data,l_resourceid);
						oh_print_text(&working);

						oh_print_rdr(&rdr, 4);
					}
					entryid = nextentryid;
				} while ((rvRdrGet == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ;
			}
			rptentryid = nextrptentryid;
		} while ((rvRptGet == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY));

	return(rv);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:59,代码来源:hpitree.c


示例5: main

int main(int argc, char **argv)
{
	SaHpiSessionIdT sid = 0;
	SaHpiRptEntryT res;
	SaHpiRdrT rdr;
	SaHpiEntryIdT id = SAHPI_FIRST_ENTRY;
	SaHpiResourceIdT resid;
	int failcount = 0;
	int testnum = 0;
	SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if(rc != SA_OK) {
		failed("Failed to open session");
	}

	rc = saHpiDiscover(sid);
	if(rc != SA_OK) {
		failed("Failed to run discover");
	}
						
        rc = saHpiRptEntryGet(sid, id, &id, &res);
        runtest();
        if(rc != SA_OK) {
		dbg("Error %s",oh_lookup_error(rc));
		failed("Couldn't get the first rpt entry");
		/* we're toast, bail */
		goto end;
	}
	else{
		id = SAHPI_FIRST_ENTRY;
		resid = res.ResourceId;
		rc = saHpiRdrGet(sid, resid, id, &id, &rdr);
		if (oh_cmp_ep(&rdr.Entity,&res.ResourceEntity) != SAHPI_TRUE){
			dbg("Error %s", oh_lookup_error(rc));
			failed("Entity path of rdr did not match entity path of resource");
		}
		runtest();
		if(rc != SA_OK){
			dbg("Error %s", oh_lookup_error(rc));
			failed("Couldn't get the first rdr entry");
			goto end;
		}
	}
	
	dbg("Ran %d tests", testnum);
	/* if there is any failures, the test fails */
	end:
		if(failcount) {
			return -1;
		}

	return(0);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:54,代码来源:sim_sanity_005.c


示例6: get_event

static void* get_event(void *unused)
{
	SaHpiEventT	event;
	SaErrorT	rv;        
        SaHpiRptEntryT rptentry;
        SaHpiRdrT rdr;
        SaHpiEntryIdT rptentryid;
        SaHpiEntryIdT nextrptentryid;

	rv = saHpiSubscribe(Domain->sessionId);
	if (rv != SA_OK) {
		printf("OpenHPI>Fail to Subscribe event\n");
		return (void *)0;
	}	
	
	while(1) {
		for(;;) {
                        rdr.RdrType = SAHPI_NO_RECORD;
                        rptentry.ResourceId = 0;
			memset(&event, 0xF, sizeof(event));
			rv = saHpiEventGet(Domain->sessionId,
				SAHPI_TIMEOUT_BLOCK, &event,
				NULL, NULL, NULL);		
			if (rv != SA_OK ) {
				printf("saHpiEventGet failed with error <%d>", rv);
				break;
			}
			if (prt_flag == 1) {
				if (show_event_short)
					show_short_event(&event, ui_print);
                                else if (rdr.RdrType != SAHPI_NO_RECORD)
                                        oh_print_event(&event, &rdr.Entity, 4);
                                else if (rptentry.ResourceId != 0)
                                        oh_print_event(&event, &rptentry.ResourceEntity, 4);
                                else {
                                        rptentryid = event.Source;
                                        rv = saHpiRptEntryGet(Domain->sessionId,
                                                              rptentryid,
                                                              &nextrptentryid, &rptentry);
                                        if(rv == SA_OK)
                                                oh_print_event(&event, &rptentry.ResourceEntity, 4);
                                        else {
                                                printf("saHpiRptEntryGet failed for resource Id <%d> with error <%d>",
                                                        event.Source, rv);
                                                printf("Wrong resource Id <%d> detected", event.Source);
                                                oh_print_event(&event, NULL, 4);
                                        }
                                }
			}
		}/*the loop for retrieving event*/
		sleep(1);
	}
	return (void *)1;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:54,代码来源:session.c


示例7: get_resid

static SaHpiResourceIdT get_resid(SaHpiSessionIdT sid,
                           SaHpiEntryIdT srchid) {
        SaHpiRptEntryT res;
        SaHpiEntryIdT rptid = SAHPI_FIRST_ENTRY;

        while(saHpiRptEntryGet(sid, rptid, &rptid, &res) == SA_OK) {
                if (srchid == res.ResourceEntity.Entry[0].EntityType) {
                        return res.ResourceId;
                }
        }
        return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:12,代码来源:sim_sanity_011.c


示例8: sa_list_sensor

static int sa_list_sensor(void)
{
        SaErrorT rv = SA_OK;
        SaHpiEntryIdT rptentryid;
        SaHpiRptEntryT rptentry;
        SaHpiEntryIdT nextrptentryid;
        SaHpiEntryIdT entryid;
        SaHpiEntryIdT nextentryid;
        SaHpiResourceIdT resourceid;
        SaHpiRdrT rdr;
        SaHpiEntityPathT ep_target;
        char *ep_string = NULL;

        /* walk the RPT list */
        rptentryid = SAHPI_FIRST_ENTRY;
        while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY))
        {
                rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry);
                if (rv == SA_OK) {
                        /* Walk the RDR list for this RPT entry */

                        /* Filter by entity path if specified */
                        if (ep_string && !oh_cmp_ep(&ep_target,&(rptentry.ResourceEntity))) {
                                rptentryid = nextrptentryid;
                                continue;
                        }

                        entryid = SAHPI_FIRST_ENTRY;
                        resourceid = rptentry.ResourceId;
                        rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0;
                        while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY))
                        {
                                rv = saHpiRdrGet(sessionid,resourceid,
                                                 entryid,&nextentryid, &rdr);
                                if (rv == SA_OK) {
                                        if (rdr.RdrType == SAHPI_SENSOR_RDR &&
                                                rdr.RdrTypeUnion.SensorRec.Ignore != TRUE) {
						printf("Resource Id: %d, Sensor Id: %d\n",
							resourceid, rdr.RdrTypeUnion.SensorRec.Num);
                                        } 

                                        entryid = nextentryid;
                                } else {
                                        rv = SA_OK;
                                        entryid = SAHPI_LAST_ENTRY;
                                }
                        }
                        rptentryid = nextrptentryid;
                }
        }
	return rv;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:52,代码来源:commands.c


示例9: discover_resources

/*
 * This function opens the HPI session, discovers the resources which matches
 * the requested capability and sends the list of resource ids and resource
 * names.
 *
 * If the none of the resources matches to requested capability,
 * then SA_ERR_HPI_NOT_PRESENT error will be return.
 * On sucess SA_OK will be return.
 */
SaErrorT discover_resources(SaHpiSessionIdT sessionid,
                            SaHpiCapabilitiesT capability,
                            SaHpiResourceIdT *resourceid_list,
                            int *number_resources)
{
        int count=0;
        SaErrorT rv;
        SaHpiRptEntryT rptentry;
        SaHpiEntryIdT rptentryid;
        SaHpiEntryIdT nextrptentryid;

        rv = saHpiDiscover(sessionid);
        if (rv != SA_OK) {
                printf("saHpiDiscover failed with error: %s\n",
                       oh_lookup_error(rv));
                return rv;
        }

        rptentryid = SAHPI_FIRST_ENTRY;
        while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY))
        {
                rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
                                      &rptentry);
                if (rv != SA_OK) {
                        printf("RptEntryGet failed with error: %s\n",
                               oh_lookup_error(rv));
                        return rv;
                }

                if (rptentry.ResourceCapabilities & capability) {
                        resourceid_list[count] = rptentry.ResourceId;
                        printf("\tResource-id = %d, Resource Name = %s\n",
                               rptentry.ResourceId, rptentry.ResourceTag.Data);
                        if (strcmp(rptentry.ResourceTag.Data,
                                   "Power Subsystem") == 0)
                          powerSubsystemResId = rptentry.ResourceId;
                        count++;
                }
                rptentryid = nextrptentryid;
        }

        if (count == 0)
                return SA_ERR_HPI_NOT_PRESENT;

        *number_resources = count;
        return SA_OK;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:56,代码来源:hpi_common.c


示例10: main

int main(int argc, char **argv)
{
        SaHpiSessionIdT sid = 0;
        SaHpiRptEntryT res;
        SaHpiEntryIdT id = SAHPI_FIRST_ENTRY;
        int failcount = 0;
        int testnum = 0;
        SaErrorT rc = SA_OK;

        rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if(rc != SA_OK) {
		failed("Failed to open session");
	}

	rc = saHpiDiscover(sid);
	if(rc != SA_OK) {
		failed("Failed to run discover");
	}
						
	
        /* loop over all resources, ensure that ResourceTag and
	 *            ManufacturerId have been set */
        while(saHpiRptEntryGet(sid,id,&id,&res) == SA_OK) {
		runtest();
		if(!res.ResourceTag.DataLength) {
			failed("Resource Tag has zero length");
		}
		runtest();
		if(!res.ResourceInfo.ManufacturerId) {
			failed("Resource has no Manufacturer Id");
		}

		/* there should be an inner loop here for Rdrs */
	}
 
 	printf("I hit here\n");	
	dbg("Ran %d tests", testnum);
        
	/* if there is any failures, the test fails */
	
        if(failcount) {
	                return -1;
		        }
        return(0);
}	
开发者ID:openhpi1,项目名称:testrepo,代码行数:45,代码来源:sim_sanity_003.c


示例11: get_rpts

static void get_rpts(void)
{
	SaHpiEntryIdT	rptentryid, nextrptentryid;
	SaErrorT	rv;
	SaHpiRptEntryT	rptentry;
	int		n;

	rptentryid = SAHPI_FIRST_ENTRY;
	while (rptentryid != SAHPI_LAST_ENTRY) {
		rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid, &rptentry);
		if (rv != SA_OK)
			break;
		n = nrpts;
		Rpts = (Rpt_t *)resize_array(Rpts, sizeof(Rpt_t), &nrpts, 1);
		rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0;
		Rpts[n].Rpt =  rptentry;
		rptentryid = nextrptentryid;
	}
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:19,代码来源:hpithres.c


示例12: sensor_list

SaErrorT sensor_list(SaHpiSessionIdT sessionid, hpi_ui_print_cb_t proc)
{
	SaErrorT		rv = SA_OK;
	SaHpiRptEntryT		rptentry;
	SaHpiEntryIdT		rptentryid;
	SaHpiEntryIdT		nextrptentryid;

	/* walk the RPT list */
	rptentryid = SAHPI_FIRST_ENTRY;
	while (rptentryid != SAHPI_LAST_ENTRY) {
		rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid, &rptentry);
		if (rv != SA_OK)
			break;
		rv = show_sensor_list(sessionid, rptentry.ResourceId, proc);
		if (rv == -1)
			return(-1);
		rptentryid = nextrptentryid;
	};
	return(rv);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:20,代码来源:show.c


示例13: Test_Resource

int Test_Resource(SaHpiSessionIdT session)
{
	SaErrorT status;
	int retval = SAF_TEST_UNKNOWN;
	SaHpiEntryIdT RptNextEntry;
	SaHpiRptEntryT Report;

	//
	// Obtain a ResourceId
	//
	status = saHpiRptEntryGet(session,
				  SAHPI_FIRST_ENTRY, &RptNextEntry, &Report);

	if (status != SA_OK) {
		if (status == SA_ERR_HPI_NOT_PRESENT) {
			retval = SAF_TEST_NOTSUPPORT;
		} else {
			e_print(saHpiRptEntryGet, SA_OK, status);
			retval = SAF_TEST_UNRESOLVED;
		}
	} else {
		//
		//  Call saHpiResourceSeveritySet while passing in an invalid 
		//    session id
		//
		status = saHpiResourceSeveritySet(INVALID_SESSION_ID,
						  Report.ResourceId, SAHPI_OK);

		if (status == SA_ERR_HPI_INVALID_SESSION)
			retval = SAF_TEST_PASS;
		else {
			e_print(saHpiResourceSeveritySet,
				SA_ERR_HPI_INVALID_SESSION, status);
			retval = SAF_TEST_FAIL;
		}
	}

	return (retval);
}
开发者ID:basheerk,项目名称:autotest-client-tests,代码行数:39,代码来源:2.c


示例14: set_resource_tag

int set_resource_tag(SaHpiSessionIdT sessionid)
{
	SaHpiRptEntryT rptentry;
	SaHpiEntryIdT rptentryid;
	SaHpiEntryIdT nextrptentryid;
	SaHpiTextBufferT new_resource_tag;
	SaHpiTextBufferT old_resource_tag;

	int rv;
	SaHpiResourceIdT resource_id;
	char id_buf[SAHPI_MAX_TEXT_BUFFER_LENGTH], *res_id;
	char tag_buf[SAHPI_MAX_TEXT_BUFFER_LENGTH], *res_tag;

	rptentryid = SAHPI_FIRST_ENTRY;
	rv = SA_OK;

	while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) {
		rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
				      &rptentry);
		if (rv != SA_OK) {
			printf("Error getting RPT entry: rv = %d\n", rv);
			return (-1);
		}
		printf("Resource Id: %d\n", rptentry.ResourceId);
		printf("Resource Tag: %s\n", (char *)rptentry.ResourceTag.Data);

		rptentryid = nextrptentryid;
	}

	res_id = NULL;
	res_tag = NULL;
	printf("\nResource Id to change: ");
	res_id = fgets(id_buf, 255, stdin);
	if ((res_id = strchr(id_buf, '\n')) != NULL)
		*res_id = '\0';

	resource_id = (SaHpiResourceIdT) atoi(id_buf);

	printf("New Resource Tag: ");
	res_tag = fgets(tag_buf, SAHPI_MAX_TEXT_BUFFER_LENGTH, stdin);
	if ((res_tag = strchr(tag_buf, '\n')) != NULL)
		*res_tag = '\0';

	rv = saHpiRptEntryGetByResourceId(sessionid, resource_id, &rptentry);
	if (rv != SA_OK) {
		printf("Erro getting RPT entry for resource: %d\n",
		       resource_id);
		return (-1);
	}

        if (rptentry.ResourceEntity.Entry[0].EntityType == SAHPI_ENT_SYS_MGMNT_MODULE) {
                printf("On some systems, changing the Tag is no allowed\n");
                printf("for System Management Modules\n");
                printf("Failed to change tag for resource: %d\n", resource_id);
                return(1);
        }
          

	old_resource_tag = rptentry.ResourceTag;

	new_resource_tag.DataType = SAHPI_TL_TYPE_ASCII6;
	new_resource_tag.Language = SAHPI_LANG_ENGLISH;
	new_resource_tag.DataLength = strlen(tag_buf);
	memcpy(new_resource_tag.Data, tag_buf, strlen(tag_buf) + 1);

	rv = saHpiResourceTagSet(sessionid, resource_id, &new_resource_tag);
	if (rv != SA_OK) {
		printf("Erro setting custom tag for resource: %d\n",
		       resource_id);
		return -1;
	}

	memset(&rptentry, 0, 0);
	rv = saHpiRptEntryGetByResourceId(sessionid, resource_id, &rptentry);
	if (rv != SA_OK) {
		printf("Erro getting RPT entry for resource: %d\n",
		       resource_id);
		return (-1);
	} else {
		printf("Old resource Tag was: %s, new Tag: %s\n",
		       (char *)old_resource_tag.Data,
		       (char *)rptentry.ResourceTag.Data);
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:86,代码来源:hpi_cmd.c


示例15: main

int main(int argc, char **argv)
{
   int c;
   SaErrorT rv;
   SaErrorT rvx;
   SaHpiVersionT hpiVer;
   SaHpiSessionIdT sessionid;
   SaHpiRptInfoT rptinfo;
   SaHpiRptEntryT rptentry;
   SaHpiEntryIdT rptentryid;
   SaHpiEntryIdT nextrptentryid;
   SaHpiResourceIdT resourceid;

   char input[255], *p;
   pthread_t discover_thread;
   void *thread_done;
   int valid = 0;

   printf("%s ver %s\n", argv[0], progver);

   while ((c = getopt(argc, argv, "x?")) != EOF) {
        switch (c) {
                case 'x':
                        debug = 1;
                        break;
                default:
                        printf("Usage: %s [-x]\n", progname);
                        printf("   -x  Display debug messages\n");
                        exit(1);
        }
   }

   rv = saHpiInitialize(&hpiVer);
   
   if (rv != SA_OK) {
     	printf("saHpiInitialize error %d\n", rv);
	exit(-1);
   }

   rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID, &sessionid, NULL);
   if (rv != SA_OK) {
     	printf("saHpiSessionOpen error %d\n", rv);
	exit(-1);
   }

   rv = saHpiResourcesDiscover(sessionid);
   if (debug)
     	printf("saHpiResourcesDiscover rv = %d\n", rv);

restart:
   rv = saHpiRptInfoGet(sessionid, &rptinfo);
   if (debug)
     	printf("saHpiRptInfoGet rv = %d\n", rv);

   printf("RptInfo: UpdateCount = %d, UpdateTime = %lx\n",
	  rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp);
   
   /* walk the RPT list */

   rptentryid = SAHPI_FIRST_ENTRY;
   rvx = SA_OK;

   while ((rvx == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) {
        rv = saHpiRptEntryGet(sessionid, rptentryid, &nextrptentryid,
                              &rptentry);
	if (rvx != SA_OK)
	  	printf("RptEntryGet: rv = %d\n", rv);

	if (rvx == SA_OK && (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_RDR)
	    		&& (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_INVENTORY_DATA)) {

                resourceid = rptentry.ResourceId;

                list_inv(sessionid, resourceid);

        }

        rptentryid = nextrptentryid;
   }

   printf("Initial discovery done\n");
   printf("\tEnter a command or \"help\" for list of commands\n");
   printf("Command> ");

   rv = pthread_create(&discover_thread, NULL, sahpi_discover_thread,
		      (void *)sessionid);

   if (rv)
     printf("Error creating event thread\n");

   while (!valid) {
        
        fflush(stdout);
        
        p = fgets(input, 255, stdin);
        
        if ((p = strchr(input, '\n')) != NULL)
            *p = '\0';
        
        if (!strcmp(input, "list_all_inv")) {
//.........这里部分代码省略.........
开发者ID:openhpi1,项目名称:testrepo,代码行数:101,代码来源:hpi_cmd.c


示例16: populate_saHpiEventLog

SaErrorT populate_saHpiEventLog (SaHpiSessionIdT sessionid)
{

	SaErrorT rv;
        SaHpiEntryIdT rpt_entry_id;

        SaHpiEventLogEntryIdT      event_entry_id;
        SaHpiEventLogEntryIdT  pre_event_entry_id;
        SaHpiEventLogEntryT       event_log_entry;
        
	SaHpiRptEntryT rpt_entry;

	SaHpiRptEntryT  event_rpt_entry;
	SaHpiRdrT       event_rdr_entry;

	oid evt_log_oid[EVENT_LOG_INDEX_NR];
	netsnmp_index evt_log_index;
	saHpiEventLogTable_context *evt_log_context;

        DR_XREF *dr_entry;
	SaHpiDomainIdResourceIdArrayT dr_pair;

        oid child_oid[MAX_OID_LEN];
        size_t child_oid_len;

	printf( "populate_saHpiEventLog\n");
        printf(" ***************************************\n");
        printf(" ***************************************\n");
        printf(" EVENT LOG TABLES \n");


        rpt_entry_id = SAHPI_FIRST_ENTRY;
        do {
                rv = saHpiRptEntryGet(sessionid, rpt_entry_id, &rpt_entry_id, &rpt_entry);

                if (rv != SA_OK) {
                        DEBUGMSGTL ((AGENT, 
                        "populate_saHpiEventLog, saHpiRptEntryGet Failed: rv = %d\n",rv));
                        rv =  AGENT_ERR_INTERNAL_ERROR;
                        break;
                }

                printf("ResourceId [%d]\n", rpt_entry.ResourceId);

                event_entry_id = SAHPI_OLDEST_ENTRY;
                do {
                        rv = saHpiEventLogEntryGet (sessionid, 
                                                    rpt_entry.ResourceId,
                                                    event_entry_id,
                                                    &pre_event_entry_id,
                                                    &event_entry_id,
                                                    &event_log_entry,
                                                    &event_rdr_entry,
                                                    &event_rpt_entry);

                        printf("        Entry ID [%d]\n", event_entry_id);
                        printf("        EventType [%d]\n", event_log_entry.Event.EventType);
                        printf("        rv [%d]\n", rv);


                        if (rv == SA_ERR_HPI_CAPABILITY) {
                                printf ("populate_saHpiEventLog, saHpiEventLogEntryGet() == SA_ERR_HPI_CAPABILITY\n");
                                DEBUGMSGTL ((AGENT, "populate_saHpiEventLog, saHpiEventLogEntryGet() == SA_ERR_HPI_CAPABILITY\n"));
                                rv = AGENT_ERR_NOERROR;
                                break;
                        } else if (rv == SA_ERR_HPI_NOT_PRESENT) {
                                printf ("populate_saHpiEventLog, saHpiEventLogEntryGet() == SA_ERR_HPI_NOT_PRESENT\n");
                                DEBUGMSGTL ((AGENT, "populatesaHpiResourcesDiscover_saHpiEventLog, saHpiEventLogEntryGet() == SA_ERR_HPI_NOT_PRESENT\n"));
                                rv = AGENT_ERR_NOERROR;
                                break;
                        } else if (rv != SA_OK) {
                                printf ("populate_saHpiEventLog Failed: rv = %d\n",rv);
                                DEBUGMSGTL ((AGENT, "populate_saHpiEventLog Failed: rv = %d\n",rv));
                                rv = AGENT_ERR_INTERNAL_ERROR;
                                break;
                        }


                        switch (event_log_entry.Event.EventType) {
                        case SAHPI_ET_RESOURCE:
                                printf("SAHPI_ET_RESOURCE: rv [%d]\n", rv);
                                printf("        Event Type: [%s]\n", 
                                       oh_lookup_resourceeventtype(event_log_entry.Event.EventDataUnion.ResourceEvent.ResourceEventType));
                                printf("        Resource: [%d]\n", event_log_entry.Event.Source);
                                printf("        Severity: [%s]\n\n",oh_lookup_severity(event_log_entry.Event.Severity));
                                populate_saHpiResourceEventLogTable(sessionid, &event_log_entry,                                           
                                                                    child_oid, 
                                                                    &child_oid_len);
                                break;
                        case SAHPI_ET_SENSOR:
                                printf("SAHPI_ET_SENSOR: rv [%d]\n", rv);
                                printf("        Sensor Type: [%s]\n\n",
                                       oh_lookup_sensortype(event_log_entry.Event.EventDataUnion.SensorEvent.SensorType));
                                populate_saHpiSensorEventLogTable(sessionid, &event_log_entry,                                           
                                                                  child_oid, 
                                                                  &child_oid_len,
                                                                  &event_rdr_entry);
                                break;
                        case SAHPI_ET_SENSOR_ENABLE_CHANGE:
                                printf("SAHPI_ET_SENSOR_ENABLE_CHANGE: rv [%d]\n\n", rv);
//.........这里部分代码省略.........
开发者ID:openhpi1,项目名称:testrepo,代码行数:101,代码来源:saHpiEventLogTable.c


示例17: main

int
main(int argc, char **argv)
{
        SaHpiVersionT    hpiVer;
        SaHpiSessionIdT  sessionid;
        SaHpiRptInfoT    rptinfo;
        SaHpiRptEntryT   rptentry;
        SaHpiEntryIdT    rptentryid;
        SaHpiEntryIdT    nextrptentryid;
        SaHpiEntryIdT    entryid;
        SaHpiEntryIdT    nextentryid;
        SaHpiResourceIdT resourceid;
        SaHpiRdrT        rdr;
        SaErrorT         rv;


        pname = argv[0];

        if (argc < 2) {
                usage();
                exit(-1);
        }

        sensor_name = argv[1];
        have_minor = 0;
        have_major = 0;

        if (argc >= 3) {
                have_minor = 1;
                minor_value = atof(argv[2]);
        }

        if (argc >=4) {
                have_major = 1;
                major_value = atof(argv[3]);
        }

        rv = saHpiInitialize(&hpiVer);

        if (rv != SA_OK) {
                printf("saHpiInitialize error %d\n",rv);
                exit(-1);
        }
        rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL);

        if (rv != SA_OK) {
                printf("saHpiSessionOpen error %d\n",rv);
                exit(-1);
        }
 
        rv = saHpiResourcesDiscover(sessionid);

        rv = saHpiRptInfoGet(sessionid,&rptinfo);

        rptentryid = SAHPI_FIRST_ENTRY;
        while (rptentryid != SAHPI_LAST_ENTRY) {
                rv = saHpiRptEntryGet(sessionid,rptentryid,
                                      &nextrptentryid,&rptentry);
                if (rv != SA_OK) {
                        printf("saHpiRptEntryGet(%s)Error: %d\n",
                               gettext(&rptentry.ResourceTag), rv);
                        break;
                }

                resourceid = rptentry.ResourceId;
                printf("Resource Id:%d Tag: %s\n", resourceid,
                        gettext(&rptentry.ResourceTag));

                entryid = SAHPI_FIRST_ENTRY;
                while (entryid != SAHPI_LAST_ENTRY) {
                        rv = saHpiRdrGet(sessionid, resourceid, entryid,
                                        &nextentryid, &rdr);
               	        if (rv != SA_OK) {
                            printf( "saHpiRdrGet(%s) Error: %d\n",
                                    gettext(&rptentry.ResourceTag), rv);
                            break;
                        }
                        dordr(sessionid, resourceid, &rdr);
	                entryid = nextentryid;
                }

                rptentryid = nextrptentryid;
         }
         rv = saHpiSessionClose(sessionid);
         rv = saHpiFinalize();
         exit(0);
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:87,代码来源:set_thres.c


示例18: main

int
main(int argc, char **argv)
{
  int c;
  SaErrorT rv,rv_rdr;
  SaHpiSessionIdT sessionid;
  SaHpiDomainInfoT rptinfo;
  SaHpiRptEntryT rptentry;
  SaHpiEntryIdT rptentryid;
  SaHpiEntryIdT nextrptentryid;
  SaHpiEntryIdT entryid;
  SaHpiEntryIdT nextentryid;
  SaHpiResourceIdT resourceid;
  SaHpiRdrT rdr;
  SaHpiIdrInfoT idrInfo;
  SaHpiIdrIdT 	idrid;
  int invfound = 0;
  int nloops = 0;

  oh_prog_version(argv[0], OH_SVN_REV);
  atag.tlen = 0;

  while ( (c = getopt( argc, argv,"a:vxz?")) != EOF )
  switch(c) {
    case 'z': fzdebug = 1; /* fall thru to include next setting */
    case 'x': fdebug = 1; break;
    case 'v': fverbose = 1; break;
    case 'a':
          fasset = 1;
          if (optarg) {
	    atag.tag  = (char *)strdup(optarg);
	    atag.tlen = strlen(optarg);
	  }
          break;
    default:
          printf("Usage: %s [-x] [-a asset_tag]\n", argv[0]);
          printf("   -a  Sets the asset tag\n");
          printf("   -x  Display debug messages\n");
          printf("   -z  Display extra debug messages\n");
          exit(1);
  }

	/* compile error */
//  inv = (SaHpiIdrAreaHeaderT *)&inbuff[0];
  inv = (SaHpiIdrAreaHeaderT *)(void *)&inbuff[0];
  rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL);
  if (fdebug) printf("saHpiSessionOpen rv = %d sessionid = %x\n",rv,sessionid);
  if (rv != SA_OK) {
    printf("saHpiSessionOpen error %d\n",rv);
    exit(-1);
  }
 
  rv = saHpiDomainInfoGet(sessionid,&rptinfo);
  if (fdebug) printf("saHpiDomainInfoGet rv = %d\n",rv);
  // if (fdebug) printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n",
  //      rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp);

  while (!invfound && (nloops < 7)) 
  {
    /*
     * The OpenHPI ipmi plugin has a bug whereby the FRU RDR is added 
     * much later, and always requires a rediscovery. (bug #1095256)
     * This should not apply to other well-behaved plugins.
     */
    nloops++;
    if (fdebug) printf("Starting Discovery, pass %d ...\n",nloops);
    rv = saHpiDiscover(sessionid);
    if (fdebug) printf("saHpiDiscover rv = %d\n",rv);
    if (rv != SA_OK) {
        printf("saHpiDiscover error %d\n",rv);
        break;
    }
 
  /* walk the RPT list */
  rptentryid = SAHPI_FIRST_ENTRY;
  while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY))
  {
    rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry);
    if (rv != SA_OK) printf("RptEntryGet: rid=%d rv = %d\n",rptentryid,rv);
    if (rv == SA_OK)
    {
      /* walk the RDR list for this RPT entry */
      entryid = SAHPI_FIRST_ENTRY;
      /* OpenHPI plugin sometimes has bad RPT Tag DataLength here. */
      // rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0;
      resourceid = rptentry.ResourceId;
      if (fdebug) printf("rptentry[%d] resourceid=%d\n", rptentryid,resourceid);
      if (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_INVENTORY_DATA)
      {
        printf("Resource[%d] Tag: %s \thas inventory capability\n", rptentryid,rptentry.ResourceTag.Data);
	rv_rdr = SA_OK;
	while ((rv_rdr == SA_OK) && (entryid != SAHPI_LAST_ENTRY))
	{
          rv_rdr = saHpiRdrGet(sessionid,resourceid, entryid,&nextentryid, &rdr);
  	  if (fdebug) printf("saHpiRdrGet[%x] rv = %d\n",entryid,rv_rdr);
	  if (rv_rdr == SA_OK)
	  {
  	    if (fdebug) printf("Rdr[%x] type = %d tag = %s\n",entryid,
				rdr.RdrType,rdr.IdString.Data);
	    if (rdr.RdrType == SAHPI_INVENTORY_RDR)
//.........这里部分代码省略.........
开发者ID:ystk,项目名称:debian-openhpi,代码行数:101,代码来源:hpiinv.c


示例19: main

int
main(int argc, char **argv)
{
  int c;
  SaHpiVersionT hpiVer;
  SaHpiSessionIdT sessionid;
  SaHpiRptInfoT rptinfo;
  SaHpiRptEntryT rptentry;
  SaHpiEntryIdT rptentryid;
  SaHpiEntryIdT nextrptentryid;
  SaHpiEntryIdT entryid;
  SaHpiEntryIdT nextentryid;
  SaHpiResourceIdT resourceid;
  SaHpiRdrT rdr;

  printf("%s  ver %s\n", progname,progver);
  sensor_name = (char *)strdup(s_name);
  while ( (c = getopt( argc, argv,"ms:xz?")) != EOF )
  switch(c)
  {
    case 'z': fxdebug = 1; /* fall thru to include next setting */
    case 'x': fdebug = 1; break;
	      /*
    case 'l': slist = 1; break;
	      */
    case 'm': 
	      sensor_name = (char *)strdup(sm_name);
	      break;
    case 's':
	  fsensor = 1;
          if (optarg) {
	    sensor_name = (char *)strdup(optarg);
	  }
          break;
    default:
          printf("Usage: %s [-xm] [-s sensor_descriptor]\n", progname);
          printf("   -s  Sensor descriptor\n");
          printf("   -m  use Mullins sensor descriptor\n");
	  /*
          printf("   -l  Display entire sensor list\n");
	  */
          printf("   -x  Display debug messages\n");
          printf("   -z  Display extra debug messages\n");
          exit(1);
  }

  rv = saHpiInitialize(&hpiVer);

  if (rv != SA_OK) {
    printf("saHpiInitialize error %d\n",rv);
    exit(-1);
  }
  rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL);

  if (rv != SA_OK) {
    printf("saHpiSessionOpen error %d\n",rv);
    exit(-1);
  }
 
  rv = saHpiResourcesDiscover(sessionid);

  if (fxdebug) printf("saHpiResourcesDiscover rv = %d\n",rv);

  rv = saHpiRptInfoGet(sessionid,&rptinfo);

  if (fxdebug) printf("saHpiRptInfoGet rv = %d\n",rv);
  if (fdebug) printf("RptInfo: UpdateCount = %d, UpdateTime = %lx\n",
         rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp);
 
  /* walk the RPT list */
  rptentryid = SAHPI_FIRST_ENTRY;
  while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY))
  {
    rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry);
    if (rv == SA_OK)
    {
      /* walk the RDR list for this RPT entry */
      entryid = SAHPI_FIRST_ENTRY;
      rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0;
      resourceid = rptentry.ResourceId;
      
      if (fdebug) printf("rptentry[%d] resourceid=%d\n", entryid,resourceid);

      printf("Resource Tag: %s\n", rptentry.ResourceTag.Data);
      while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY))
      {
        rv = saHpiRdrGet(sessionid,resourceid, entryid,&nextentryid, &rdr);

  	if (fxdebug) printf("saHpiRdrGet[%d] rv = %d\n",entryid,rv);

	if (rv == SA_OK)
	{
	  if (rdr.RdrType == SAHPI_SENSOR_RDR)
	  { 
	    /*type 2 includes sensor and control records*/
	    rdr.IdString.Data[rdr.IdString.DataLength] = 0;
	    if (strncmp(rdr.IdString.Data, sensor_name,
		rdr.IdString.DataLength) == 0)
	    {
	      printf( "%02d %s\t", rdr.RecordId, rdr.IdString.Data);
//.........这里部分代码省略.........
开发者ID:openhpi1,项目名称:testrepo,代码行数:101,代码来源:hpievent.c


示例20: main

/**********************************************************
*   Main Function
*      takes no arguments
*
*       returns: SAF_TEST_PASS when successfull
*                SAF_TEST_FAIL when an unexpected error occurs
*************************************************************/
int main(int argc, char **argv)
{
	SaHpiSessionIdT session, new_session;
	SaErr 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ saHpiSessionClose函数代码示例发布时间:2022-05-30
下一篇:
C++ saHpiRdrGet函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap