Don't freak out if the calibration information is not there.
This commit is contained in:
parent
aea04c5f11
commit
f96bef205b
4 changed files with 38 additions and 25 deletions
|
|
@ -736,12 +736,12 @@ static int lusb_get_otp(struct bladerf *dev, char *otp)
|
|||
int read_size = dev->speed ? 256 : 64;
|
||||
int nbytes;
|
||||
|
||||
for (nbytes = 0; nbytes < 256; nbytes += read_size) {
|
||||
for (nbytes = 0; nbytes < 256; nbytes += status) {
|
||||
status = libusb_control_transfer(
|
||||
lusb->handle,
|
||||
LIBUSB_RECIPIENT_INTERFACE |
|
||||
LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
EP_DIR_IN,
|
||||
LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
EP_DIR_IN,
|
||||
BLADE_USB_CMD_READ_OTP,
|
||||
0,
|
||||
0,
|
||||
|
|
@ -749,11 +749,11 @@ static int lusb_get_otp(struct bladerf *dev, char *otp)
|
|||
read_size,
|
||||
BLADERF_LIBUSB_TIMEOUT_MS);
|
||||
if (status < 0) {
|
||||
dbg_printf("Failed to read OTP with errno=%d: %s\n", errno, strerror(errno));
|
||||
break;
|
||||
dbg_printf("Failed to read OTP (%d): %s\n", status, libusb_error_name(status));
|
||||
return error_libusb2bladerf(status);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lusb_get_cal(struct bladerf *dev, char *cal) {
|
||||
|
|
|
|||
|
|
@ -116,16 +116,22 @@ int bladerf_open(struct bladerf **device, const char *dev_id)
|
|||
|
||||
if (!status) {
|
||||
status = bladerf_get_and_cache_vctcxo_trim(dev);
|
||||
} else {
|
||||
dbg_printf( "Could not extract serial number\n" ) ;
|
||||
}
|
||||
|
||||
if (!status) {
|
||||
status = bladerf_get_and_cache_fpga_size(dev);
|
||||
} else {
|
||||
dbg_printf( "Could not extract VCTCXO trim value\n" ) ;
|
||||
}
|
||||
|
||||
if (!status) {
|
||||
dbg_printf("%s: fw=v%d.%d serial=%s trim=0x%.4x fpga_size=%d\n",
|
||||
__FUNCTION__, dev->fw_major, dev->fw_minor,
|
||||
dev->serial, dev->dac_trim, dev->fpga_size);
|
||||
} else {
|
||||
dbg_printf( "Could not extract FPGA size\n" ) ;
|
||||
}
|
||||
} else {
|
||||
printf("********************************************************************************\n");
|
||||
|
|
@ -133,6 +139,9 @@ int bladerf_open(struct bladerf **device, const char *dev_id)
|
|||
printf("* wget http://nuand.com/fx3/latest.img ; bladeRF-cli -b -f latest.img\n");
|
||||
printf("********************************************************************************\n");
|
||||
}
|
||||
|
||||
/* All status in here is not fatal, so whatever */
|
||||
status = 0 ;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ int str2devinfo(const char *dev_id_const, struct bladerf_devinfo *d)
|
|||
bladerf_init_devinfo(d);
|
||||
|
||||
/* No device indentifier -- pick anything we can find */
|
||||
if (!dev_id_const || strlen(dev_id_const) == 0) {
|
||||
if ( dev_id_const == NULL || strlen(dev_id_const) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -189,15 +189,12 @@ static void print_error_need_devarg()
|
|||
static int open_device(struct rc_config *rc, struct cli_state *state, int status)
|
||||
{
|
||||
if (!status) {
|
||||
if (rc->device) {
|
||||
status = bladerf_open(&state->dev, rc->device);
|
||||
if (status) {
|
||||
fprintf(stderr, "Failed to open device: %s\n",
|
||||
bladerf_strerror(status));
|
||||
status = -1;
|
||||
}
|
||||
} else {
|
||||
status = bladerf_open(&state->dev, NULL);
|
||||
status = bladerf_open(&state->dev, rc->device);
|
||||
if (status) {
|
||||
fprintf(stderr, "Failed to open device (%s): %s\n",
|
||||
rc->device ? rc->device : "NULL",
|
||||
bladerf_strerror(status));
|
||||
status = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -309,18 +306,30 @@ int main(int argc, char *argv[])
|
|||
if (!exit_immediately) {
|
||||
/* Conditionally performed items, depending on runtime config */
|
||||
status = open_device(&rc, state, status);
|
||||
if (status)
|
||||
if (status) {
|
||||
fprintf(stderr, "Could not open device\n");
|
||||
status = flash_fw(&rc, state, status);
|
||||
if (status)
|
||||
fprintf(stderr, "Could not flash firmware\n");
|
||||
status = load_fpga(&rc, state, status);
|
||||
if (status)
|
||||
fprintf(stderr, "Could not load fpga\n");
|
||||
status = open_script(&rc, state, status);
|
||||
if (status)
|
||||
fprintf(stderr, "Could not load scripts\n");
|
||||
goto main__issues ;
|
||||
}
|
||||
|
||||
status = flash_fw(&rc, state, status);
|
||||
if (status) {
|
||||
fprintf(stderr, "Could not flash firmware\n");
|
||||
goto main__issues ;
|
||||
}
|
||||
|
||||
status = load_fpga(&rc, state, status);
|
||||
if (status) {
|
||||
fprintf(stderr, "Could not load fpga\n");
|
||||
goto main__issues ;
|
||||
}
|
||||
|
||||
status = open_script(&rc, state, status);
|
||||
if (status) {
|
||||
fprintf(stderr, "Could not load scripts\n");
|
||||
goto main__issues ;
|
||||
}
|
||||
|
||||
main__issues:
|
||||
/* These items are no longer needed */
|
||||
free(rc.device);
|
||||
rc.device = NULL;
|
||||
|
|
@ -334,11 +343,6 @@ int main(int argc, char *argv[])
|
|||
free(rc.script_file);
|
||||
rc.script_file = NULL;
|
||||
|
||||
if (status) {
|
||||
fprintf(stderr, "Could not launch interactive shell\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Exit cleanly when configured for batch mode. Remember that this is
|
||||
* implicit with some commands */
|
||||
if (!rc.batch_mode || state->script != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue