Commit Graph

29 Commits

Author SHA1 Message Date
Steve Markgraf 197f421c98 lib: revert implementing RGB233 mode
We will soon have support for a palette mode,
which can replicate the RGB233 mode if required,
or any custom arrangement of bits per color.

Furthermore, the RGB233 mode did not work correctly
in this state, as we did not implement swapping of
the 32 bit words.

This reverts the following commits:
58de0a5bcc
3f44f8fc22
b82303f44f
2020-06-02 00:50:53 +02:00
Steve Markgraf b11fc430f3 lib: fix hang on exit
As the sample worker thread might still be waiting for a buffer,
we need to wake it up first before trying to join.
2020-05-26 23:13:31 +02:00
Steve Markgraf 44b6e3b929 lib: reuse hint message when zero-copy buffer alloc fails 2020-05-26 22:02:09 +02:00
Sergey Alirzaev b82303f44f lib: implement enabling RGB332 mode
I've decided to provide a separate pointer for a raw buffer in case the
library user comes up with a non-RGB332 use case that avoids byte
rearrangement (and copying should be replaced with pulling from the
user's pointer in this case)
2020-05-19 22:24:26 +02:00
Steve Markgraf f05c961455 lib: fall back to iface 1 in case iface 0 altsetting 1 fails
Some people on the mailing list reported that with older kernels
setting interface 0 altsetting 1 does not work, fall back to the
old behavior in this case for now, while still investigating the
root cause of this problem.
2020-01-26 20:52:24 +01:00
Steve Markgraf a9f3771eb6 lib: use interface 0 altsetting 1 instead of interface 1
This makes osmo-fl2k work again with Linux 5.5.0-rc6 or later,
as the FL2000 shares the endpoints for interface 0 and 1, which
is forbidden by the USB spec and the Kernel will not ignore this
anymore.

See: https://marc.info/?l=linux-usb&m=157944230213296&w=2
2020-01-19 16:59:34 +01:00
Steve Markgraf d534cb69ad fix compiler warnings
warning: absolute value function ‘fabsf’ given an argument of
type ‘double’ but has parameter of type ‘float’ which may cause
truncation of value

warning: ‘__builtin_strncpy’ specified bound 64 equals destination
size
2020-01-19 16:38:22 +01:00
Steve Markgraf c196faa009 fl2k_tcp: don't free buffer while lib still uses it
This sometimes caused a segfault when terminating
fl2k_tcp.
2019-08-26 19:27:11 +02:00
Steve Markgraf 077613efc5 improve exit handling on device removal 2019-08-26 19:26:30 +02:00
Steve Markgraf b8d33bfd82 lib: wait for sample worker thread before freeing buffers
This fixes a segfault when exiting, as sometimes it occured that
the USB worker thread completed before the sample worker thread,
and the buffers the latter was still accessing had already been
freed.
2019-08-25 17:34:20 +02:00
Steve Markgraf 6c21e9d01f fl2k_file: check read return value before repeating
In case of a FIFO that has been closed or a 0 byte file this
will otherwise lead to an endless loop.
2019-08-25 17:31:09 +02:00
Steve Markgraf d56968352c fl2k_fm: make inline functions static
Otherwise the linker will complain when building with
-DCMAKE_BUILD_TYPE=Debug
2019-08-25 17:29:34 +02:00
Steve Markgraf df33203db5 lib: Add workaround for Linux usbfs mmap() bug
The Linux Kernel has a bug on ARM/ARM64 systems where the USB CMA
memory is incorrectly mapped to userspace, breaking zerocopy.

When the Kernel allocates the memory, it clears it with memset().
If the mapping worked correctly, we should have zeroed out buffers,
if it doesn't, we get random Kernel memory. We now check for this,
and fall back to buffers in userspace if that's the case.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-10-07 01:44:23 +02:00
Steve Markgraf 0fb8849426 lib: add I2C support
Note that the FL2000 only supports I2C transfers with
a fixed length of 4 bytes.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-06-17 03:09:43 +02:00
Steve Markgraf 7ae9754ede fix sleep durations on Windows
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-06-17 02:38:15 +02:00
Thorsten Alteholz b9fff5b405 enable multiarch build by means of GNUInstallDirs
This patch is taken from the osmo-fl2k debian package.
2018-06-03 16:25:32 +02:00
Harald Welte 79908e1109 libusb-1.0.22 deprecated libusb_set_debug() with libusb_set_option()
This avoids the following compiler warnings when using more recent
versions of libusb:

src/libosmo-fl2k.c:384:2: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
  libusb_set_debug(dev->ctx, 3);
  ^~~~~~~~~~~~~~~~

Details can be found at 539f22e2fd
2018-06-03 16:25:32 +02:00
Steve Markgraf d5c4dcc597 fl2k_file: support reading from stdin
Thanks to Ted Yapo for reporting.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-05-23 23:13:14 +02:00
Steve Markgraf 16b102efcd lib: update output on zero-copy allocation
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-05-01 12:04:50 +02:00
Steve Markgraf dac9d8e3b7 lib: free zero-copy buffers in case of error
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-05-01 02:17:22 +02:00
Steve Markgraf 631ce38b30 fl2k_fm: add missing help text for stereo and rds
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-27 18:17:01 +02:00
Steve Markgraf fc6200b6a7 fl2k_test: fix build on Mac OS
Thanks to mot for reporting.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-27 00:15:24 +02:00
Martin Hauke 0325fa9496 Fix build with MinGW
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-24 21:40:14 +02:00
Steve Markgraf 0d520ba113 lib: libusb_dev_mem_free() is not present in old versions
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-23 23:56:48 +02:00
Steve Markgraf ab7cb27357 fl2k_fm: add SPDX identifier
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-23 23:56:28 +02:00
Steve Markgraf 632482623d fl2k_fm: add stereo and RDS support
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-18 23:07:54 +02:00
Steve Markgraf 12ec69362e add fl2k_fm
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-17 21:44:47 +02:00
Steve Markgraf 05cb15b0f3 fl2k_file: only output on red DAC for now
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-17 21:10:17 +02:00
Steve Markgraf 65d43393ed initial commit
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-17 00:23:07 +02:00