Commit graph

326 commits

Author SHA1 Message Date
Jon Szymaniak
4be58b1b07 bladeRF-cli: Fixed duplicate code blocks (CID 1321689) 2015-09-01 17:21:33 -04:00
Jon Szymaniak
12ebcb3c13 bladeRF-cli: Show values after 'set' and made whitespace more consistent 2015-09-01 15:47:56 -04:00
Jon Szymaniak
e3758691d0 bladeRF-cli: Updated 'print/set [xb_gpio | xb_gpio_dir]' for pin-based access 2015-09-01 14:51:50 -04:00
Jon Szymaniak
43269aac57 bladeRF-cli: Check file write access before kicking off table generation 2015-08-25 15:49:03 -04:00
Jon Szymaniak
ed805993b5 bladeRF-cli: Added return code for insufficient permissions
This should help clarify the cause of file-related errors in
cases where folks are trying to rx into a location where they
do not have write permissions.
2015-08-25 14:52:55 -04:00
Jon Szymaniak
a6aea0905c bladeRF-cli: Updated help text items
Updated 'print' to note that all parameters are now printed when
no arguments are provided.

Adjusted print and set widths to yield the same formatting in the
bladeRF-cli help output. (Closes #422)

Added help text entries for xb_* commands. (Closes #423)
2015-08-23 03:34:43 -04:00
Jon Szymaniak
08f69c7822 bladeRF-cli: Cleaned up 'print' formatting
Various items supported by 'print' have been made a bit more
consistent in terms of spacing.

Units have been separated from numbers, as typically recommended by
NIST.

Some options have been added to the printset_table to specify how
to group items when printing all of them (and to skip items).
2015-08-23 03:03:57 -04:00
Martin Murray
aeb78b3984 bladeRF-cli: 'print' with no arguments now prints all available values
The print command invoked without arguments in bladeRF-cli
is modified to invoke all the print/set parameter
handlers in order. Old behavior was to display usage note.

The leading and trailing cosmetic newlines were moved from the
individual printset handlers to cmd_print() to allow for a concise
table.

Original usage information is still available via help command.
2015-08-23 02:41:34 -04:00
Jon Szymaniak
68c33907af bladeRF-cli: Created cli_err() variant without added newlines 2015-08-23 02:41:34 -04:00
Jon Szymaniak
24f2cda363 bladeRF-cli: Fixed unchecked return value 2015-08-12 14:43:29 -04:00
Jon Szymaniak
3b9e9bf546 bladeRF-cli: Updated version to 1.2.1 for fixes 2015-07-16 11:23:48 -04:00
Jon Szymaniak
ab441d15cb bladeRF-cli: Fixed errors and inconsistencies in interactive help text 2015-07-15 22:26:23 -04:00
Jon Szymaniak
c2b3881a50 bladeRF-cli: Flush zero samples through the device at the end of a TX
When the file to TX does not have any sort of "padding" zero samples
at the end, there's a risk that we'll turn off the TX front-end
before the samples are actually transmitted.

As a "quick and dirty" solution, we just flush (num_buffers + 1)
buffers worth of 0+0j after completing the TX of the file.
2015-07-09 11:17:51 -04:00
Jon Szymaniak
974e8ecfd9 bladeRF-cli: Updated version to v1.2.0 2015-06-30 18:58:12 -04:00
Jon Szymaniak
7ff879ff44 bladeRF-cli: Added 'print trimdac' support 2015-06-23 23:12:04 -04:00
Jon Szymaniak
07e64a8a53 bladeRF-cli: Remove unneeded casts 2015-06-21 22:53:40 -04:00
Jon Szymaniak
0a71588c9c bladeRF-cli: Fixed error code translation issue
libbladeRF error codes were being treated as CLI error codes,
resulting in confusing messages on misbehaving hardware.
2015-05-22 13:48:02 -04:00
Jon Szymaniak
2dbc1c8521 bladeRF-cli: Added some comments to input processing loop 2015-05-02 14:44:22 -04:00
Jon Szymaniak
41f7cc1793 bladeRF-cli: Removed redundant logic 2015-05-02 14:44:22 -04:00
Jon Szymaniak
bc1f6f2106 bladeRF-cli: Moved and modified logic to split up line with delimiters
Moved this logic to zeroize_next_delimeter() to improve readability.

This has also been changed to remove the use of an unnecessary
variable-length array, which would cause build failures with
some compilers (e.g., MSVC).
2015-05-02 14:44:19 -04:00
Jens Elofsson
b6ba3b20d6 bladeRF-cli: Can now specify multiple commands, separated by ';' 2015-05-02 13:22:23 -04:00
Jon Szymaniak
41f45836c0 bladeRF-cli: Bumped version to 1.1.2 2015-02-28 15:38:07 -05:00
Jon Szymaniak
7082cdd5c8 bladeRF-cli: Updated copyright date on generated help text 2015-02-17 11:23:04 -05:00
Michael Ambrus
89612e7dc3 bladeRF-cli: Improved robustness of help text generator
generate.bash uses pandoc to generate both documentation and code from a
markdown document. For code, pandoc is also used as an intermediate
step, but the pandoc format varies between versions 1.12.x and 1.13.x.

These changes handle this format change and introduce some additional
improvements to make the script more resilient to format changes.
2015-02-17 11:22:59 -05:00
Jon Szymaniak
a2b6d12d4b bladeRF-cli: Version bumped to v1.1.1 2015-01-31 16:21:26 -05:00
Edward O'Callaghan
39cd5de280 host/utilities: help2man: can't get `--help' info from ./bladeRF-cli
This fixes the following error while building man pages on NixOS:

 [100%] Generating bladeRF-cli.1
 Constant subroutine main::LC_ALL redefined at /nix/store/482l1wbyrbqzy8pm0mh9psvk7f7x2qnf-perl-5.20.1/lib/perl5/5.20.1/Exporter.pm line 66.
 at /nix/store/glg7vc73js5pmhg23c452105ngcqw56y-help2man-1.46.4/bin/.help2man-wrapped line 29.
 Prototype mismatch: sub main::LC_ALL () vs none at /nix/store/482l1wbyrbqzy8pm0mh9psvk7f7x2qnf-perl-5.20.1/lib/perl5/5.20.1/Exporter.pm line 66.
 at /nix/store/glg7vc73js5pmhg23c452105ngcqw56y-help2man-1.46.4/bin/.help2man-wrapped line 29.
 help2man: can't get `--help' info from ./bladeRF-cli
 Try `--no-discard-stderr' if option outputs to stderr
 make[2]: *** [host/utilities/bladeRF-cli/bladeRF-cli.1] Error 127
 make[1]: *** [host/utilities/bladeRF-cli/CMakeFiles/bladeRF-cli-manpage.dir/all] Error 2
 make: *** [all] Error 2

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
2015-01-29 17:23:11 -05:00
Jon Szymaniak
9039ccacd8 bladeRF-cli: Added additional bit definitions for 'peek lms'
In more recent LMS docs, SPARE bits have become documented. These
changes are based upon the LMS6002 Programming and Calibration Guide
(rev 1.4 2013-06-11)
2015-01-23 15:22:40 -05:00
Jon Szymaniak
8d6a9f46a2 bladeRF-cli: Version bumped to v1.1.0 2014-12-23 13:15:50 -05:00
Jon Szymaniak
c3761293c7 bladeRF-cli: Touched up help text for 'info' command 2014-12-19 10:50:56 -05:00
Jon Szymaniak
13668758b3 bladeRF-cli: Inform user if bootloader devices are present
Before attempting to open any devices when going into interactive mode,
running a script, or executing "-e" arguments, bladeRF-cli now checks
for any FX3-based devices in bootloader mode, and alerts the user
to their presence, recommending that he or she see 'help recover'
for more information.

Previously, a libbladeRF log_info() message was used to alert users
to the presence of FX3-based devices enumerating in bootloader mode.
This was removed to alleviate noise and because it was buried in
backend-specific code.

Given that the bladeRF-cli is intended to be the "go to" program for
debugging the state of a bladeRF device, this alert is more
appropriately located in this program.
2014-12-19 10:50:56 -05:00
Jon Szymaniak
68fb83ed1b bladeRF-cli: Use libbladeRF functionality for bootloader recovery
This was previously dependent on libusb-specific code. The functionality
added to libbladeRF is now used in order to support recovery when
using the Cypress driver backend (as well as any future back
implementations.)
2014-12-19 10:50:56 -05:00
Jon Szymaniak
41bcf7b12c host: Centralized duplicated code
Moved function to get string description to conversions.c.

There's a similar function within libbladeRF's backend.c, but that
is intended to be used in the device information string; this is
intended to be a bit more humand-readable.
2014-12-18 17:58:21 -05:00
Jon Szymaniak
dc6cc03820 bladeRF-cli: Documentation typo fix 2014-12-18 15:25:09 -05:00
Jon Szymaniak
e16f46da5a bladeRF-cli: Return non-zero code when --probe does not find devices
An optional `strict` parameter has been added to the interactive
mode `probe` command. Specifying this parameter instructs the command
to treat the case where no devices are found as an error.

Without specifying this `strict` parameter, the command will operate
as it has previously, treating this case as normal operation.

The handling of the --probe command-line option now uses `probe strict`,
as this provides shell scripts an easy way to determine if devices were
or were not found.
2014-12-18 15:18:50 -05:00
Jon Szymaniak
98ecdbfcce bladeRF-cli: Added CLI_RET_CMD_HANDLED 2014-12-17 14:48:45 -05:00
Jon Szymaniak
c5437be23a bladeRF-cli: Version bumped to v1.0.0 2014-11-29 17:23:59 -05:00
Jon Szymaniak
64275e768f host: Updated and moved Windows C99 compatibility headers
Visual Studio 2013 now includes these headers, so they have
been moved as not to conflict (even though they are intended to
be equivalent.)

Our stdbool.h was providing an incorrect typedef; sizeof(bool)
should have been 1, not sizeof(int).

Per http://msdn.microsoft.com/en-us/library/tf4dy80a.aspx:
    "In Visual C++4.2, the Standard C++ header files contained a typedef
    that equated bool with int. In Visual C++ 5.0 and later, bool is
    implemented as a built-in type with a size of 1 byte. That means
    that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in
    Visual C++ 5.0 and later, the same call yields 1. This can cause
    memory corruption problems if you have defined structure members of
    type bool in Visual C++ 4.2 and are mixing object files (OBJ) and/or
    DLLs built with the 4.2 and 5.0 or later compilers."
2014-11-14 15:19:18 -05:00
Jon Szymaniak
80023a2f4b bladeRF-cli: Updated version to v0.12.0 2014-10-30 21:20:17 -04:00
Jon Szymaniak
3c6485776a bladeRF-cli: Addressed 'Value stored...is never read' warning
Reported by clang version 3.4-1ubuntu3
2014-10-30 17:22:02 -04:00
Jon Szymaniak
e78ddac246 bladeRF-cli: Use points at edges of calibration range for TX DC cal
Failures for the algorithm to converge (i.e., find a turning point in
magnitude) can be avoided if the tested values span the range of valid
calibration values.
2014-10-29 18:49:34 -04:00
Jon Szymaniak
6bc39afd4a bladeRF-cli: Flush rx/tx modules before cal, always disable them at end 2014-10-29 18:49:30 -04:00
Jon Szymaniak
23d12dbd15 bladeRF-cli: Check if the device is streaming in main command handler
It was found that the 'calibrate' command could (incorrectly) be
executed while actively transmitting or receiving, which causes issues.

Since a number of commands already check if the device is currently
streaming, this check has been moved to the main command loop. Command
definitions now denote if they can be executed safely while the device
is streaming via an 'allow_while_streaming' flag.

The flash-related, open, and load commands have had their checks
removed, as they are now covered by the above flag.
2014-10-29 17:09:02 -04:00
Jon Szymaniak
a1c9c88bd1 bladeRF-cli: Changed type of tx_buffer from void* to int16_t*
There's no reason to use void* here. Using int16_t* to be more explicit,
since SC16Q11 samples are being used.
2014-10-29 14:30:39 -04:00
Jon Szymaniak
c8b1b1d517 bladeRF-cli: Addressed possible NULL-dereference (CID1250040)
The status here is forced to a non-zero value (CLI_RET_MEM) instead
of assuming *every* malloc implementation will set errno to ensure
we don't enter the loop and attempt to use tx_buffer when NULL.
2014-10-29 14:27:23 -04:00
Jon Szymaniak
85e0ff9643 bladeRF-cli: Updated error message to include str from bladerf_strerror()
Asking the user if the FX3 is programmed isn't terribly helpful, and
actually causes more confusion. Showing the bladerf_strerror() output
instead is more useful when troubleshooting.
2014-10-29 10:46:26 -04:00
Jon Szymaniak
b03580e3e0 bladeRF-cli: Additional fix for CID1234624
The fix in 2f193db1 missed the return that occurs if no device is open.
2014-10-29 10:44:32 -04:00
Jon Szymaniak
bd32c99468 bladeRF-cli: Warning cleanup (MSVC)
Fixed some type-related warnings encountered with MSVC.

size_t was uneccessy for the data_mgmt fields. These are initialized via
unsigned ints anyway.
2014-10-28 13:43:43 -04:00
Jon Szymaniak
b36989a05b bladeRF_cli: Reset rx/tx worker status after on successive startups
Upon a failure, a bad status value was being kept around, causing
the rx/tx tasks to not begin functioning.
2014-10-28 13:01:21 -04:00
Jon Szymaniak
75f1dab9e8 bladeRF-cli: Fixed potential lockup when starting up RX/TX task
The `status` variable needs to be checked in the while loop, otherwise
a timeout from pthread_cond_timedwait() would be ignored.
2014-10-28 13:01:20 -04:00
Jon Szymaniak
d0e20fdd5a bladeRF-cli: Use MUTEX_* macros from thread.h
These macros allow for deadlock checks to be compiled in.
2014-10-28 13:01:19 -04:00