libbladeRF: Environment Variables

| libbladeRF 2.4.0-git Nuand bladeRF library

Environment Variables

libbladeRF uses a few environment variables to allow users and developers to modify behavior at runtime. These environment variables should be treated as diagnostic features, rather than part of the API. They may be modified or removed in future versions of the library.

### BLADERF_LOG_LEVEL

This environment variable controls the default log level setting, which is usually BLADERF_LOG_LEVEL_INFO.

This may be useful when a program using libbladeRF is encountering errors. Setting the log level to `debug` or `verbose` often yields information that allows the reason for failures to be identified.

Note that this environment variable may not help if a program overrides the default log level by calling bladerf_log_set_verbosity().

The values supplied to this environment variable correspond directly with the bladerf_log_level values of the same name. The available values are listed below, and are handled in a case-insensitive manner.

- critical
- error
- warning
- info
- debug
- verbose

### BLADERF_SEARCH_DIR

Usually, libbladeRF searches the following directories for files, such as FPGA bitstreams for software-based autoloading.

Linux and OSX:

- The current working directory
- The directory containing the program being executed
- `~/.config/Nuand/bladeRF`
- `~/.Nuand/bladeRF`
- `/etc/Nuand/bladeRF`
- `/usr/share/Nuand/bladeRF`

Windows:

- The current working directory
- The directory containing the program being executed
- `C:\Users\USERNAME\AppData\Roaming\Nuand\bladeRF` (via FOLDERID_RoamingAppData)
- The installation path, via `HKEY_LOCAL_MACHINE\Software\Nuand LLC\Path`

This environment variable may be used to specify a path to search prior to those listed above.

### BLADERF_DEFAULT_TUNING_MODE

Normally, the default tuning mode is set per the conditions described in the documentation of the bladerf_tuning_mode enumeration.

This environment variable allows this default to be overridden at runtime and is intended to facilitate debugging. Valid values are: `host` and `fpga`.

Generally this environment variable is most useful when set to `host` and used in conjunction with setting the BLADERF_LOG_LEVEL environment variable to `verbose`. This allows low-level information about the frequency tuning operation to be observed, even though a program may not provide a means to change the log level or tuning mode.

Attempting to force the tuning mode to `fpga` on FPGA versions that do not support this will yield unexpected (and likely undesirable) behavior.

### BLADERF_FORCE_LEGACY_NIOS_PKT

If defined, this forces libbladeRF to use the legacy packet format when communicating with the FPGA. This is intended for development and debugging.

### BLADERF_FORCE_NO_FPGA_PRESENT

Defining this forces libbladeRF to behave as if it does not detect that an FPGA is loaded. This prevents it from attempting to initialize the device.

This was added as a means to allow users to remove an incompatible FPGA from flash, should they have forgotten to do so prior to updating libbladeRF and FX3 firmware.

### BLADERF_SKIP_FPGA_SIZE_CHECK

Defining this overrides a check for the correct FPGA bitstream size when loading an FPGA bitstream from the host or writing it to flash for headless loading.

Under normal circumstances, users should not need to use this. This is intended to allow developers and those making customizations (e.g., adding FPGA compression) to skip this check without needing to rebuild libbladeRF.

If the size check is reporting an error, the most likely scenario is that an incorrect or corrupted FPGA bitstream is being provided. Check that the bitstream file is appropriate for the target device.