Exemple #1
0
int rxtx_cmd_start_check(struct cli_state *s, struct rxtx_data *rxtx,
                         const char *argv0)
{
    int status = CLI_RET_UNKNOWN;
    bool have_file;

    if (rxtx_get_state(rxtx) != RXTX_STATE_IDLE) {
        return CLI_RET_STATE;
    } else {
        MUTEX_LOCK(&rxtx->file_mgmt.file_meta_lock);
        have_file = (rxtx->file_mgmt.path != NULL);
        MUTEX_UNLOCK(&rxtx->file_mgmt.file_meta_lock);

        if (!have_file) {
            cli_err(s, argv0, "File not configured\n");
            status = CLI_RET_INVPARAM;
        } else {
            status = validate_stream_params(s, rxtx, argv0);
        }

        if (status == 0) {
            check_samplerate(s, rxtx);
        }
    }

    return status;
}
Exemple #2
0
int rxtx_cmd_start_check(struct cli_state *s, struct rxtx_data *rxtx,
                         const char *argv0)
{
    int status = CMD_RET_UNKNOWN;
    int fpga_status;
    bool have_file;

    if (!cli_device_is_opened(s)) {
        return CMD_RET_NODEV;
    } else if (rxtx_get_state(rxtx) != RXTX_STATE_IDLE) {
        return CMD_RET_STATE;
    } else {
        fpga_status = bladerf_is_fpga_configured(s->dev);
        if (fpga_status < 0) {
            s->last_lib_error = fpga_status;
            status = CMD_RET_LIBBLADERF;
        } else if (fpga_status != 1) {
            status = CMD_RET_NOFPGA;
        } else {
            pthread_mutex_lock(&rxtx->file_mgmt.file_meta_lock);
            have_file = (rxtx->file_mgmt.path != NULL);
            pthread_mutex_unlock(&rxtx->file_mgmt.file_meta_lock);

            if (!have_file) {
                cli_err(s, argv0, "File not configured");
                status = CMD_RET_INVPARAM;
            } else {
                status = validate_stream_params(s, rxtx, argv0);
            }

            if (status == 0) {
                check_samplerate(s, rxtx);
            }
        }
    }

    return status;
}