Among the TODOs:
* Refactor obtaining LPC serial number and chip ID into separate API and header/source files. Remove from main().
* Create a usb_set_serial_number_descriptor() or similar function to be called before USB stack is started.
* Ensure USB serial number descriptor is valid even if code forgets to initialize the serial number before the USB stack is started. May be as simple as providing default initializer for usb_descriptor_string_serial_number[].
* Create a #define/constant for the usb_descriptor_string_serial_number length.
* Identify what's causing intermittent crashes in hackrf_transfer when no serial number is specified. I'm probably misusing getopt.
* Permit serial number without leading zeros so you don't have to type as much.
* Add support for serial number argument in other hackrf_* tools.
* Provide libhackrf support for enumerating multiple HackRFs, so that hackrf_info can list all devices. May require an additional libhackrf function, outside of hackrf_open().
...and anything else that makes this less of a hack.
We now use a separate USB configuration for CPLD updates. To avoid
misuse of the interface, hackrf_cpld_write is now a one-shot call,
expecting the entire CPLD buffer. The library will then take care that
the device is placed in the CPLD update configuration and the entire
buffer uploaded. Unfortunately, this means that users of the interface
will have substantially fewer opportunities to provide status updates to
the user.
libusb can return LIBUSB_ERROR_INTERRUPTED and it's not really an error,
just a sign some syscall got interrupted by something. Don't abort on
that.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* Added new hackrf_error especially for streaming to return more details.
* Adding management of usb transfer cancelled for hackrf_stop_rx()/hackrf_stop_tx().
* Added robustness on hackrf_close() to correctly close libusb related stuff even if USB device is removed or other problems.
* Fixed threading problems (start, stop() then start() ...).
* Cleanup the whole code.