Skip to content

Commit cf552e3

Browse files
committed
fx3_firmware: Fixed string index error introduced in 58c13c6
1 parent 5cb9e61 commit cf552e3

File tree

5 files changed

+31
-36
lines changed

5 files changed

+31
-36
lines changed

fx3_firmware/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.3)
33
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../host/cmake/modules)
44
set(VERSION_INFO_MAJOR 1)
55
set(VERSION_INFO_MINOR 5)
6-
set(VERSION_INFO_PATCH 2)
6+
set(VERSION_INFO_PATCH 3)
77
set(VERSION_INFO_EXTRA "git")
88
include(Version)
99

fx3_firmware/bladeRF.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ void bladeRFInit(void)
857857

858858
/* Configure the serial number string descriptor */
859859
apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR,
860-
BLADE_USB_STR_INDEX_PRODUCT,
860+
BLADE_USB_STR_INDEX_SERIAL,
861861
(uint8_t *)CyFxUSBSerial);
862862

863863
if (apiRetStatus != CY_U3P_SUCCESS) {

host/utilities/bladeRF-cli/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ project(bladeRF-cli C)
1111
################################################################################
1212

1313
set(VERSION_INFO_MAJOR 0)
14-
set(VERSION_INFO_MINOR 4)
15-
set(VERSION_INFO_PATCH 2)
14+
set(VERSION_INFO_MINOR 5)
15+
set(VERSION_INFO_PATCH 0)
1616
set(VERSION_INFO_EXTRA "git")
1717
include(Version)
1818

@@ -85,6 +85,7 @@ set(BLADERF_CLI_SOURCE
8585
src/cmd/calibrate.c
8686
src/cmd/cmd.c
8787
src/cmd/erase.c
88+
src/cmd/info.c
8889
src/cmd/load.c
8990
src/cmd/open.c
9091
src/cmd/peek.c

host/utilities/bladeRF-cli/src/cmd/cmd.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
DECLARE_CMD(calibrate);
99
DECLARE_CMD(clear);
1010
DECLARE_CMD(help);
11+
DECLARE_CMD(info);
1112
DECLARE_CMD(load);
1213
DECLARE_CMD(open);
1314
DECLARE_CMD(peek);
@@ -33,6 +34,7 @@ struct cmd {
3334
static const char *cmd_names_calibrate[] = { "calibrate", "cal", NULL };
3435
static const char *cmd_names_clear[] = { "clear", "cls", NULL };
3536
static const char *cmd_names_help[] = { "help", "h", "?", NULL };
37+
static const char *cmd_names_info[] = { "info", "i", NULL };
3638
static const char *cmd_names_load[] = { "load", "ld", NULL };
3739
static const char *cmd_names_open[] = { "open", "op", "o", NULL };
3840
static const char *cmd_names_peek[] = { "peek", "pe", NULL };
@@ -220,6 +222,21 @@ static const struct cmd cmd_table[] = {
220222
"Provides extended help, like this, on any command.\n"
221223
)
222224
},
225+
{
226+
FIELD_INIT(.names, cmd_names_info),
227+
FIELD_INIT(.exec, cmd_info),
228+
FIELD_INIT(.desc, "Print information about the currently opened device"),
229+
FIELD_INIT(.help,
230+
"info\n"
231+
"\n"
232+
"Prints the following information about an opened device:\n"
233+
" Serial number\n"
234+
" VCTCXO DAC calibration value\n"
235+
" FPGA size\n"
236+
" Whether or not the FPGA is loaded\n"
237+
" USB bus and address\n"
238+
)
239+
},
223240
{
224241
FIELD_INIT(.names, cmd_names_load),
225242
FIELD_INIT(.exec, cmd_load),

host/utilities/bladeRF-cli/src/cmd/version.c

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
int cmd_version(struct cli_state *state, int argc, char **argv)
66
{
77
int status;
8-
char serial[BLADERF_SERIAL_LENGTH] = { 0 };
9-
bladerf_fpga_size fpga_size;
10-
uint16_t dac_trim;
118

129
struct bladerf_version fw_version, fpga_version, lib_version;
1310
bool fpga_loaded = false;
@@ -19,41 +16,31 @@ int cmd_version(struct cli_state *state, int argc, char **argv)
1916
printf(" libbladeRF version: %s\n", lib_version.describe);
2017
printf("\n");
2118

19+
/* Exit cleanly if no device is attached */
2220
if (state->dev == NULL) {
23-
printf(" No device attached to retrive version information from.\n\n");
21+
printf(" Device version information unavailable: No device attached.\n");
2422
return 0;
2523
}
2624

2725
status = bladerf_is_fpga_configured(state->dev);
2826
if (status < 0) {
29-
return status;
30-
} else if (status) {
27+
state->last_lib_error = status;
28+
return CMD_RET_LIBBLADERF;
29+
} else if (status != 0) {
3130
fpga_loaded = true;
3231
status = bladerf_fpga_version(state->dev, &fpga_version);
3332
if (status < 0) {
34-
return status;
33+
state->last_lib_error = status;
34+
return CMD_RET_LIBBLADERF;
3535
}
3636
}
3737

3838
status = bladerf_fw_version(state->dev, &fw_version);
3939
if (status < 0) {
40-
return status;
40+
state->last_lib_error = status;
41+
return CMD_RET_LIBBLADERF;
4142
}
4243

43-
status = bladerf_get_serial(state->dev, serial);
44-
if (status < 0) {
45-
return status;
46-
}
47-
48-
status = bladerf_get_fpga_size(state->dev, &fpga_size);
49-
if (status < 0) {
50-
return status;
51-
}
52-
53-
status = bladerf_get_vctcxo_trim(state->dev, &dac_trim);
54-
if (status < 0) {
55-
return status;
56-
}
5744

5845
printf(" Firmware version: %s\n", fw_version.describe);
5946

@@ -63,17 +50,7 @@ int cmd_version(struct cli_state *state, int argc, char **argv)
6350
printf(" FPGA version: Unknown (FPGA not loaded)\n");
6451
}
6552

66-
/* TODO: Move these into an info command */
67-
printf(" Serial #: %s\n", serial);
68-
printf(" VCTCXO DAC calibration: 0x%.4x\n", dac_trim);
69-
if (fpga_size != 0) {
70-
printf(" FPGA size: %d KLE\n", fpga_size);
71-
} else {
72-
printf(" FPGA size: Unknown\n");
73-
}
7453
printf("\n");
75-
76-
7754
return CMD_RET_OK;
7855
}
7956

0 commit comments

Comments
 (0)