コード例 #1
0
ファイル: sfpi.c プロジェクト: Lewis-Kang/OpenNetworkLinux
int
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
{
    /*
     * Read the SFP eeprom into data[]
     *
     * Return MISSING if SFP is missing.
     * Return OK if eeprom is read
     */
    int front_port=0;

    memset(data, 0, 256);

    front_port=SFP_MAP_API_2_FRONT_PORT(port);
    if (set_active_port(front_port) < 0) {
        AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port);
        return ONLP_STATUS_E_INTERNAL;
    }

    if (deviceNodeReadBinary(SFP_EEPROM_NODE(sfp_eeprom), (char*)data, 256, 256) != 0) {
        AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port);
        return ONLP_STATUS_E_INTERNAL;
    }

    return ONLP_STATUS_OK;
}
コード例 #2
0
int
onlp_sfpi_dom_read(int port, uint8_t data[256])
{
    char* path = as5812_54x_sfp_get_port_path_addr(port, 51, "sfp_eeprom");
    memset(data, 0, 256);

    if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) {
        AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
        return ONLP_STATUS_E_INTERNAL;
    }

    return ONLP_STATUS_OK;
}
コード例 #3
0
int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len)
{
    int ret;

    if (data_len >= buf_size) {
	    return -1;
	}

	ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len);

    if (ret == 0) {
        buffer[buf_size-1] = '\0';
    }

    return ret;
}
コード例 #4
0
int
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
{
    char* path = as5812_54x_sfp_get_port_path(port, "sfp_eeprom");

    /*
     * Read the SFP eeprom into data[]
     *
     * Return MISSING if SFP is missing.
     * Return OK if eeprom is read
     */
    memset(data, 0, 256);

    if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) {
        AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
        return ONLP_STATUS_E_INTERNAL;
    }

    return ONLP_STATUS_OK;
}