The signal handler for SIGINT/TERM/QUIT and, importantly, SIGPIPE tries
to write an informational message to stderr. When however stderr is
redirected to a closed pipe, this will cause (another) SIGPIPE, and in
turn the signal handler will get called again, and again and again.
Since we intend to exit rtl_fm anyways, we can just ignore this signal.
Librtlsdr has a workaround for libusb versions that lack
libusb_handle_events_timeout_completed, which was added in version 1.0.9
(released 2012-04-02). The workaround is always applied unless the
HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED macro is set, but the cmake
code that sets this macro was removed in
849f8efca4. As a result, the workaround is
now always applied. This results in an extra 1-second delay whenever a
GNU Radio flowgraph containing an RTL-SDR block is stopped, which makes
operations like switching between demodulators in Gqrx annoyingly slow.
To solve this problem, I've simply removed the workaround, as it should
no longer be needed.
I wonder if perhaps the workaround recently applied in
2659e2df31 might stem from the same bug.
Fix failures with some GCC versions:
/usr/src/packages/BUILD/src/rtl_tcp.c:90:24: error: initializer element is not constant
static int llbuf_num = DEFAULT_MAX_NUM_BUFFERS;
Fixes: 641c22 ("rtl_tcp: Extracted some constants out of printf strings")
Change-Id: Ia9e18d4c22d957f561dcdaf2657bb6d201374375
In r82xx_read, there is a 1-byte I2C write followed by the I2C read. If
this I2C write fails, r82xx_read correctly bails out but may return 0.
Callers that check whether (rc < 0) will assume that the buffer was written
when it has not been, e.g. in r82xx_set_tv_standard where
priv->fil_cal_code = data[4] & 0x0f;
consumes a garbage value for data[4].
This change resolves that issue by copying the error path from r82xx_write.