int getFanInfo(int index, struct sdm_ce_fan_running_info *fan) { int is_raise_alarm =0 ; unsigned short fan_speed[2]; cdebug("Start fan getFanInfo\n"); if(index != 1) // For 1610, There are one fan module with 3 subunit { cdebug("Error Fan index %d. \n", index); return (-1); } //if(NULL == fan || NULL == fan[0].SubUnitHwState || NULL == fan[0].RunSpeed) if(NULL == fan) { cdebug("The parameter in function getFanInfo is NULL\n"); return (-1); } memset(fan, 0, sizeof(struct sdm_ce_fan_running_info)); if(getFanSpeed(fan_speed)<0) { cdebug("Can not get the fan speed\n"); return (-1); } fan[0].RunSpeed[0] = fan_speed[0]; if (fan_speed[0]<=FAN_SPEED_THRESH) is_raise_alarm = 1 ; fan[0].RunSpeed[1] = fan_speed[1]; if (fan_speed[1]<=FAN_SPEED_THRESH) is_raise_alarm = 1 ; // cdebug("The fan speed in function getFanInfo is: \n"); // pdata((unsigned char *)fan[0].RunSpeed,4); // setFanRunLed(is_raise_alarm); return 0; }
inline void GrillPid::commitFanOutput(void) { /* Long PWM period is 10 sec */ const unsigned int LONG_PWM_PERIOD = 10000; const unsigned int PERIOD_SCALE = (LONG_PWM_PERIOD / TEMP_MEASURE_PERIOD); unsigned char fanSpeed = getFanSpeed(); /* For anything above _minFanSpeed, do a nomal PWM write. For below _minFanSpeed we use a "long pulse PWM", where the pulse is 10 seconds in length. For each percent we are emulating, run the fan for one interval. */ if (fanSpeed >= _minFanSpeed) _longPwmTmr = 0; else { // Simple PWM, ON for first [FanSpeed] intervals then OFF // for the remainder of the period if (((PERIOD_SCALE * fanSpeed / _minFanSpeed) > _longPwmTmr)) fanSpeed = _minFanSpeed; else fanSpeed = 0; if (++_longPwmTmr > (PERIOD_SCALE - 1)) _longPwmTmr = 0; } /* long PWM */ if (bit_is_set(_outputFlags, PIDFLAG_INVERT_FAN)) fanSpeed = _maxFanSpeed - fanSpeed; analogWrite(_fanPin, mappct(fanSpeed, 0, 255)); }
void saveState() { for(char i = 0; i < 12; i++) { save_compbuff[i] = compbuff[i]; eeprom_write_byte((unsigned char*)(i+1),save_compbuff[i]); } save_fanspeed = getFanSpeed(); eeprom_write_byte((unsigned char*)13,save_fanspeed); }
void SolanaServer::recomputeFS(std::string policy) { //Optimum proactive fan control policy if (policy.compare(SERVER_OPTIMUM_POLICY) == 0){ double fanPlusLeak=10000; for ( int i=0; i< NUM_FAN_SPEED; i++ ){ setFanSpeed(fanSpeedLUT[i]); computeCPUTemp(m_cpuDynPower); double leak = computeLeakage(); double fanpower = computeFanPower(); if ( (leak+fanpower) < fanPlusLeak ){ fanPlusLeak = leak+fanpower; VLOG_2 << " -- Fan+Leak power for FS: " << getFanSpeed() << " is: " << fanPlusLeak ; } else { VLOG_2 << " -- FanSpeed: " << getFanSpeed() << " increases power (" << leak+fanpower << ")"; setFanSpeed(fanSpeedLUT[i-1]); break; } } } }
inline void GrillPid::commitFanOutput(void) { /* Long PWM period is 10 sec */ const unsigned int LONG_PWM_PERIOD = 10000; const unsigned int PERIOD_SCALE = (LONG_PWM_PERIOD / TEMP_MEASURE_PERIOD); unsigned char fanSpeed = getFanSpeed(); /* For anything above _minFanSpeed, do a nomal PWM write. For below _minFanSpeed we use a "long pulse PWM", where the pulse is 10 seconds in length. For each percent we are emulating, run the fan for one interval. */ if (fanSpeed >= _minFanSpeed) _longPwmTmr = 0; else { // Simple PWM, ON for first [FanSpeed] intervals then OFF // for the remainder of the period if (((PERIOD_SCALE * fanSpeed / _minFanSpeed) > _longPwmTmr)) fanSpeed = _minFanSpeed; else fanSpeed = 0; if (++_longPwmTmr > (PERIOD_SCALE - 1)) _longPwmTmr = 0; } /* long PWM */ if (bit_is_set(_outputFlags, PIDFLAG_INVERT_FAN)) fanSpeed = _maxFanSpeed - fanSpeed; unsigned char newBlowerOutput = mappct(fanSpeed, 0, 255); analogWrite(_fanPin, newBlowerOutput); #if defined(GRILLPID_FAN_BOOST_ENABLED) // If going from 0% to non-0%, turn the blower fully on for one period // to get it moving if (_lastBlowerOutput == 0 && newBlowerOutput != 0) { digitalWrite(_fanPin, HIGH); _fanBoostActive = true; } _lastBlowerOutput = newBlowerOutput; #endif }
void GrillPid::status(void) const { SerialX.print(getSetPoint(), DEC); Serial_csv(); for (unsigned char i=0; i<TEMP_COUNT; ++i) { if (Probes[i]->hasTemperature()) SerialX.print(Probes[i]->Temperature, 1); else Serial_char('U'); Serial_csv(); } SerialX.print(getFanSpeed(), DEC); Serial_csv(); SerialX.print((int)FanSpeedAvg, DEC); Serial_csv(); SerialX.print(LidOpenResumeCountdown, DEC); }
/* hardware or reads values from the operatings system. */ static int nvml_hardware_read( long long *value, int which_one) //, nvml_context_t *ctx) { nvml_native_event_entry_t *entry; nvmlDevice_t handle; int cudaIdx = -1; entry = &nvml_native_table[which_one]; *value = (long long) -1; /* replace entry->resources with the current cuda_device->nvml device */ cudaGetDevice( &cudaIdx ); if ( cudaIdx < 0 || cudaIdx > device_count ) return PAPI_EINVAL; /* Make sure the device we are running on has the requested event */ if ( !HAS_FEATURE( features[cudaIdx] , entry->type) ) return PAPI_EINVAL; handle = devices[cudaIdx]; switch (entry->type) { case FEATURE_CLOCK_INFO: *value = getClockSpeed( handle, (nvmlClockType_t)entry->options.clock ); break; case FEATURE_ECC_LOCAL_ERRORS: *value = getEccLocalErrors( handle, (nvmlEccBitType_t)entry->options.ecc_opts.bits, (int)entry->options.ecc_opts.which_one); break; case FEATURE_FAN_SPEED: *value = getFanSpeed( handle ); break; case FEATURE_MAX_CLOCK: *value = getMaxClockSpeed( handle, (nvmlClockType_t)entry->options.clock ); break; case FEATURE_MEMORY_INFO: *value = getMemoryInfo( handle, (int)entry->options.which_one ); break; case FEATURE_PERF_STATES: *value = getPState( handle ); break; case FEATURE_POWER: *value = getPowerUsage( handle ); break; case FEATURE_TEMP: *value = getTemperature( handle ); break; case FEATURE_ECC_TOTAL_ERRORS: *value = getTotalEccErrors( handle, (nvmlEccBitType_t)entry->options.ecc_opts.bits ); break; case FEATURE_UTILIZATION: *value = getUtilization( handle, (int)entry->options.which_one ); break; default: return PAPI_EINVAL; } return PAPI_OK; }
/** * Expects one of: * 70,MODE_ECO,FAN_AUTO (temp,acMode,fanSpeed) * OFF * */ int setState(String command) { Spark.publish("SET_STATE", command); int start = Time.now(); bool toggleOn = false; int temp; enum AcModes mode; enum FanSpeeds speed; if (command == "OFF") { temp = 0; mode = MODE_OFF; speed = FAN_OFF; } else if (command == "ON") { toggleOn = true; // Ignored but set to surpress compiler warnings temp = 72; mode = MODE_ECO; speed = FAN_AUTO; } else { int firstComma = command.indexOf(","); if (firstComma == -1) { return 2; } int secondComma = command.indexOf(",", firstComma + 1); if (secondComma == -1) { return 3; } temp = command.substring(0, firstComma).toInt(); if (temp < MIN_TEMP || temp > MAX_TEMP) { return 4; } mode = getModeForName(command.substring(firstComma + 1, secondComma)); if (mode == MODE_INVALID) { Spark.publish("MODE_INVALID", command.substring(firstComma + 1, secondComma)); return 5; } speed = getSpeedForName(command.substring(secondComma + 1)); if (speed == FAN_INVALID) { Spark.publish("FAN_INVALID", command.substring(secondComma + 1)); return 6; } } // Try to get AC to the correct state for up to 10 seconds while (Time.now() - start < 10) { // Special handling for OFF if (toggleOn) { if (!isAcOn()) { Spark.publish("ON", ""); sendNEC(AC_CMD__ON_OFF); } else { break; } } else if (mode == MODE_OFF) { if (isAcOn()) { Spark.publish("OFF", ""); sendNEC(AC_CMD__ON_OFF); } else { break; } } else if (!isAcOn()) { // First turn it on if it is off Spark.publish("ON", ""); sendNEC(AC_CMD__ON_OFF); } else { bool stable = true; if (mode != getAcMode()) { stable = false; switch (mode) { case MODE_FAN: Spark.publish("MODE", "MODE_FAN"); sendNEC(AC_CMD__FAN_ONLY); break; case MODE_ECO: Spark.publish("MODE", "MODE_ECO"); sendNEC(AC_CMD__ENERGY_SAVER); break; case MODE_COOL: Spark.publish("MODE", "MODE_COOL"); sendNEC(AC_CMD__COOL); break; } } if (speed != getFanSpeed()) { stable = false; switch (speed) { case FAN_AUTO: Spark.publish("SPEED", "FAN_AUTO"); sendNEC(AC_CMD__AUTO_FAN); break; case FAN_LOW: Spark.publish("SPEED", "FAN_LOW"); sendNEC(AC_CMD__FAN_SPEED_D); sendNEC(AC_CMD__FAN_SPEED_D); sendNEC(AC_CMD__FAN_SPEED_D); break; case FAN_MEDIUM: Spark.publish("SPEED", "FAN_MEDIUM"); sendNEC(AC_CMD__FAN_SPEED_D); sendNEC(AC_CMD__FAN_SPEED_D); sendNEC(AC_CMD__FAN_SPEED_D); sendNEC(AC_CMD__FAN_SPEED_U); break; case FAN_HIGH: Spark.publish("SPEED", "FAN_HIGH"); sendNEC(AC_CMD__FAN_SPEED_U); sendNEC(AC_CMD__FAN_SPEED_U); break; } } if (mode != MODE_FAN && temp != getTemp()) { stable = false; int tempDiff = temp - getTemp(); if (tempDiff < 0) { for (int i = 0; i < abs(tempDiff); i++) { sendNEC(AC_CMD__TEMP_TIMER_D); } } else { for (int i = 0; i < abs(tempDiff); i++) { sendNEC(AC_CMD__TEMP_TIMER_U); } } } // Yay at a stable state! if (stable) { return 0; } } // Wait for the AC to handle IR codes and the display to update delay(2000); processAcDisplayData(); } if (Time.now() - start >= 30) { // Return 1000 for timeout return 1000; } else { // Return 0 for success return 0; } }
int main(int argc, char *argv[]) { char *cmdName; const char *opts="Dvqt:l:h:o:m:Q:i:"; char parameter[100]; char *p; EUI64 destPortGuid = -1; int c; int i; uint8 hfi = 0; uint8 port = 0; IB_PATH_RECORD path; uint16 sessionID; uint32 regValue; uint32 fanSpeed[OPASW_PSOC_FAN_CTRL_TACHS]; char tempStrs[I2C_OPASW_TEMP_SENSOR_COUNT][TEMP_STR_LENGTH]; uint32 psStatus; uint8 fwVersion[40]; vpd_fruInfo_rec_t vpdInfo; char mfgID[10]; char mfgDate[20]; char mfgTime[10]; uint8 nodeDesc[80]; opasw_ini_descriptor_get_t tableDescriptors; table_parsed_data_t *portParsedDataTable=NULL; uint32 numPorts; uint32 portEntrySize; uint8 memoryData[200]; uint8 boardID; VENDOR_MAD mad; FSTATUS status = FSUCCESS; uint32 asicVersion; uint8 chipStep; uint8 chipRev; table_parsed_data_t *portPtrs=NULL; uint32 portLinkWidthSupportedIndex; uint32 portLinkSpeedSupportedIndex; uint32 portFMEnabledIndex; uint32 portLinkCRCModeIndex; uint32 portvCUIndex; uint32 portExternalLoopbackAllowedIndex; char portLinkCRCModeValue[35]; char portLinkWidthSupportedText[20]; char portLinkSpeedSupportedText[20]; struct oib_port *oib_port_session = NULL; // determine how we've been invoked cmdName = strrchr(argv[0], '/'); // Find last '/' in path if (cmdName != NULL) { cmdName++; // Skip over last '/' } else { cmdName = argv[0]; } // Initialize // parse options and parameters while (-1 != (c = getopt(argc, argv, opts))) { switch (c) { case 'D': g_debugMode = 1; oib_set_dbg(stderr); break; case 't': errno = 0; strncpy(parameter, optarg, sizeof(parameter)-1); parameter[sizeof(parameter)-1] = 0; if ((p = strchr(parameter, ',')) != NULL) { *p = '\0'; } if (FSUCCESS != StringToUint64(&destPortGuid, parameter, NULL, 0, TRUE)) { fprintf(stderr, "%s: Error: Invalid GUID: %s\n", cmdName, optarg); usage(cmdName); } break; case 'l': #if !LIST_FILE_SUPPORTED fprintf(stderr, "Error: l option is not supported at this time\n"); exit(1); #endif break; case 'v': oib_set_dbg(stderr); g_verbose = 1; break; case 'q': g_quiet = 1; break; case 'h': if (FSUCCESS != StringToUint8(&hfi, optarg, NULL, 0, TRUE)) { fprintf(stderr, "%s: Error: Invalid HFI Number: %s\n", cmdName, optarg); usage(cmdName); } g_gotHfi = 1; break; case 'o': if (FSUCCESS != StringToUint8(&port, optarg, NULL, 0, TRUE)) { fprintf(stderr, "%s: Error: Invalid Port Number: %s\n", cmdName, optarg); usage(cmdName); } g_gotPort = 1; break; case 'Q': if (FSUCCESS != StringToUint8(&g_queryNum, optarg, NULL, 0, TRUE)) { fprintf(stderr, "%s: Error: Invalid Query Number: %s\n", cmdName, optarg); usage(cmdName); } break; case 'i': if (FSUCCESS != StringToInt8(&g_intParam, optarg, NULL, 0, TRUE) || g_intParam < 0) { fprintf(stderr, "%s: Error: Invalid integer parameter: %s\n", cmdName, optarg); usage(cmdName); } break; default: usage(cmdName); break; } } // user has requested display of help if (argc == 1) { usage(cmdName); exit(0); } if (-1 == destPortGuid) { fprintf(stderr, "%s: Error: Must specify a target GUID\n", cmdName); exit(1); } if (g_queryNum == 0) { fprintf(stderr, "%s: Error: must enter a query number\n", cmdName); exit(1); } if ((g_queryNum == 8) && ((g_intParam > MAX_PS) || (g_intParam < MIN_PS))) { fprintf(stderr, "%s: Error: Query number 8 - must use -i for valid Power Supply number %d - %d\n", cmdName, MIN_PS, MAX_PS); usage(cmdName); } if (g_quiet && (g_debugMode || g_verbose)) { fprintf(stderr, "%s: Error: Can not specify both -q and -D|-v\n", cmdName); exit(1); } // Get the path status = oib_open_port_by_num(&oib_port_session, hfi, port); if (status != 0) { fprintf(stderr, "%s: Error: Unable to open fabric interface.\n", cmdName); exit(1); } if (getDestPath(oib_port_session, destPortGuid, cmdName, &path) != FSUCCESS) { fprintf(stderr, "%s: Error: Failed to get destination path\n", cmdName); goto err_exit; } // Send a ClassPortInfo to see if the switch is responding status = sendClassPortInfoMad(oib_port_session, &path, &mad); if (status != FSUCCESS) { fprintf(stderr, "%s: Error: Failed to send/rcv ClassPortInfo\n", cmdName); goto err_exit; } // Get a session ID sessionID = getSessionID(oib_port_session, &path); if (sessionID == (uint16)-1) { fprintf(stderr, "%s: Error: Failed to obtain sessionID\n", cmdName); status = FERROR; goto err_exit; } // Send the test mad switch (g_queryNum) { case 1: fprintf(stderr, "Error: Module type query no longer supported.\n"); status = FERROR; break; case 2: status = sendRegisterAccessMad(oib_port_session, &path, &mad, sessionID, (uint8)0x6f, ®Value, 1); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to access register - status %d\n", status); break; } printf("Switch has booted from %s firmware image\n", (regValue & EEPROM_MASK) ? "failsafe" : "primary"); break; case 3: status = getFwVersion(oib_port_session, &path, &mad, sessionID, fwVersion); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to acquire fw version - status %d\n", status); break; } printf("FW Version is %s\n", fwVersion); break; case 4: status = getVPDInfo(oib_port_session, &path, &mad, sessionID, OPASW_MODULE, &vpdInfo); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to access vpd info - status %d\n", status); break; } snprintf(mfgID, sizeof(mfgID), "%02x%02x%02x", vpdInfo.mfgID[0] & 0xff, vpdInfo.mfgID[1] & 0xff, vpdInfo.mfgID[2] & 0xff); snprintf(mfgDate, sizeof(mfgDate), "%d-%02d-%d", vpdInfo.mfgMonth, vpdInfo.mfgDay, vpdInfo.mfgYear + 2000); snprintf(mfgTime, sizeof(mfgTime), "%02d:%02d", vpdInfo.mfgHours, vpdInfo.mfgMins); printf("VPD \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n", vpdInfo.serialNum, vpdInfo.partNum, vpdInfo.model, vpdInfo.version, vpdInfo.mfgName, vpdInfo.productName, mfgID, mfgDate, mfgTime); break; case 5: status = getNodeDescription(oib_port_session, &path, sessionID, nodeDesc); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to acquire node description - status %d\n", status); break; } printf("Node description is %s\n", nodeDesc); break; case 6: status = getTempReadings(oib_port_session, &path, &mad, sessionID, tempStrs); for (i=0; i<I2C_OPASW_TEMP_SENSOR_COUNT; i++) { printf("SENSOR %d: %s ", i, tempStrs[i]); } printf("\n"); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to get one or more temperature readings - status %s\n", iba_fstatus_msg(status & 0xFF)); } break; case 7: for (i = 0; i < OPASW_PSOC_FAN_CTRL_TACHS; i++) { status = getFanSpeed(oib_port_session, &path, &mad, sessionID, (uint32)i, &fanSpeed[i]); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to get fan speed for fan %d - status %d\n", i, status); break; } if (g_verbose) { printf("Fan speed is %d\n", fanSpeed[i]); } // TODO: stl1baseboard.c only reports the speed itself, not FAST/SLOW/NORMAL, so I can't confirm that this matches if (fanSpeed[i] > MAX_FAN_SPEED) printf("FAN %d:FAST ", i); else if (fanSpeed[i] < MIN_FAN_SPEED) printf("FAN %d:SLOW ", i); else printf("FAN %d:NORMAL ", i); } printf("\n"); break; case 8: status = getPowerSupplyStatus(oib_port_session, &path, &mad, sessionID, g_intParam, &psStatus); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to get power supply status for ps %d - status %d\n", g_intParam, status); break; } switch (psStatus) { case PS_ONLINE: printf("PS %d: ONLINE\n", g_intParam); break; case PS_OFFLINE: printf("PS %d: OFFLINE\n", g_intParam); break; case PS_NOT_PRESENT: printf("PS %d: NOT PRESENT\n", g_intParam); break; case PS_INVALID: printf("PS %d: INVALID\n", g_intParam); break; default: fprintf(stderr, "Error: Failed to get power supply status for ps %d\n", g_intParam); break; } break; case 9: status = getAsicVersion(oib_port_session, &path, &mad, sessionID, &asicVersion); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to get ASIC version - status %d\n", status); break; } chipStep = (asicVersion & ASIC_CHIP_STEP_MASK) >> ASIC_CHIP_STEP_SHFT; chipRev = (asicVersion & ASIC_CHIP_REV_MASK) >> ASIC_CHIP_REV_SHFT; printf("ASIC Version: V"); if (chipRev == 0) { switch (chipStep) { case ASIC_CHIP_STEP_A: printf("1\n"); break; case ASIC_CHIP_STEP_B: printf("2\n"); break; case ASIC_CHIP_STEP_C: printf("3\n"); break; default: printf("0\n"); break; } } else { printf("0\n"); } break; case 10: printf("Session ID: %d\n", sessionID); break; case 11: { /* query port 2 */ int dest_port_query=1; printf("Switch configuration values\n"); status = sendIniDescriptorGetMad(oib_port_session, &path, &mad, sessionID, &tableDescriptors); if (status != FSUCCESS) { fprintf(stderr, "%s: Error: Failed to get ini descriptors - status %d\n", cmdName, status); goto retErr; } numPorts = getNumPorts(oib_port_session, &path, sessionID); if( numPorts <= 0){ fprintf(stderr,"error in fetching port records\n"); goto retErr; } portEntrySize = tableDescriptors.portDataLen / numPorts; status = sendMemAccessGetMad(oib_port_session, &path, &mad, sessionID, tableDescriptors.portDataAddr + (dest_port_query * portEntrySize), portEntrySize*4, memoryData); if (status != FSUCCESS) { printf("Mem Access MAD Failed \n"); goto retErr; } if (g_verbose) { printf("MemoryData dump:\n"); opaswDisplayBuffer((char *)memoryData, portEntrySize * 4); } portParsedDataTable = malloc(tableDescriptors.portMetaDataLen * sizeof(table_parsed_data_t)); if(portParsedDataTable == NULL) { fprintf(stderr,"Not enough memory \n"); goto retErr; } status = parseDataTable(&portMetaData[0], memoryData, portMetaDataSize, portParsedDataTable, 0); if(status != FSUCCESS) { fprintf(stderr," failed: parseDataTable \n"); goto retErr; } portPtrs = portParsedDataTable; portLinkWidthSupportedIndex = getMetaDataIndexByField(&portMetaData[0], tableDescriptors.portMetaDataLen, "LINK_WIDTH_SUPPORTED"); portLinkSpeedSupportedIndex = getMetaDataIndexByField(&portMetaData[0], tableDescriptors.portMetaDataLen, "LINK_SPEED_SUPPORTED"); portFMEnabledIndex = getMetaDataIndexByField(&portMetaData[0], tableDescriptors.portMetaDataLen, "FM_ENABLED"); portLinkCRCModeIndex = getMetaDataIndexByField(&portMetaData[0], tableDescriptors.portMetaDataLen, "LTP_CRC_MODE_SUPPORTED"); portvCUIndex = getMetaDataIndexByField(&portMetaData[0], tableDescriptors.portMetaDataLen, "VCU"); portExternalLoopbackAllowedIndex = getMetaDataIndexByField(&portMetaData[0], tableDescriptors.portMetaDataLen, "EXTERNAL_LOOPBACK_ALLOWED"); status = getNodeDescription(oib_port_session, &path, sessionID, nodeDesc); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to acquire node description - status %d\n", status); goto retErr; } #define PRINT_REC(str,fmt,arg...) printf(" %-*s : "fmt,35,str,arg); StlLinkWidthToText(portPtrs[portLinkWidthSupportedIndex].val.intVal, portLinkWidthSupportedText, 20); StlLinkSpeedToText(portPtrs[portLinkSpeedSupportedIndex].val.intVal, portLinkSpeedSupportedText, 20); PRINT_REC("Link Width"," %s\n", portLinkWidthSupportedText); PRINT_REC("Link Speed"," %s\n", portLinkSpeedSupportedText); PRINT_REC("FM Enabled"," %s\n", portPtrs[portFMEnabledIndex].val.intVal ? "Yes" : "No"); PRINT_REC("Link CRC Mode"," %s\n", StlPortLtpCrcModeVMAToText(portPtrs[portLinkCRCModeIndex].val.intVal,portLinkCRCModeValue,sizeof(portLinkCRCModeValue))); PRINT_REC("vCU"," %d\n", portPtrs[portvCUIndex].val.intVal); PRINT_REC("External Loopback Allowed"," %s\n", portPtrs[portExternalLoopbackAllowedIndex].val.intVal ? "Yes" : "No"); PRINT_REC("Node Description"," %s\n", strlen((const char *)nodeDesc)==0?(const char *)"no description":(char *)nodeDesc); retErr: if(portParsedDataTable) free(portParsedDataTable); break; } case 12: status = getBoardID(oib_port_session, &path, &mad, sessionID, &boardID); if (status != FSUCCESS) { fprintf(stderr, "Error: Failed to get board id - status %d\n", status); break; } printf("BoardID: 0x%02x\n", boardID); break; default: fprintf(stderr, "Error: Invalid query number %d\n", g_queryNum); releaseSession(oib_port_session, &path, sessionID); usage(cmdName); break; } releaseSession(oib_port_session, &path, sessionID); printf("opaswquery completed\n"); err_exit: if (oib_port_session != NULL) { oib_close_port(oib_port_session); } if (status == FSUCCESS) exit(0); else exit(1); }