Hello community, here is the log from the commit of package osmo-fl2k for openSUSE:Factory checked in at 2020-06-12 21:41:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/osmo-fl2k (Old) and /work/SRC/openSUSE:Factory/.osmo-fl2k.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "osmo-fl2k" Fri Jun 12 21:41:32 2020 rev:2 rq:814048 version:0.1.1+git.20200602 Changes: -------- --- /work/SRC/openSUSE:Factory/osmo-fl2k/osmo-fl2k.changes 2018-04-30 22:53:27.160471644 +0200 +++ /work/SRC/openSUSE:Factory/.osmo-fl2k.new.3606/osmo-fl2k.changes 2020-06-12 21:43:33.916357677 +0200 @@ -1,0 +2,42 @@ +Thu Jun 11 19:09:24 UTC 2020 - Martin Hauke <mar...@gmx.de> + +- Update to version 0.1.1+git.20200602: + * lib: revert implementing RGB233 mode + * lib: fix hang on exit + * lib: reuse hint message when zero-copy buffer alloc fails + * lib: fixed rgb332 macros + * lib: added utility macros for rgb332 mode + * lib: implement enabling RGB332 mode + * lib: fall back to iface 1 in case iface 0 altsetting 1 fails + * lib: use interface 0 altsetting 1 instead of interface 1 + * set CMake policy CMP0075 if it exists + * fix compiler warnings + * fl2k_tcp: don't free buffer while lib still uses it + * improve exit handling on device removal + * lib: wait for sample worker thread before freeing buffers + * fl2k_file: check read return value before repeating + * fl2k_fm: make inline functions static + * contrib/jenkins.sh: osmo-fl2k build verification + * lib: Add workaround for Linux usbfs mmap() bug + * lib: add I2C support + * fix sleep durations on Windows + * debian: build-dep on dh-autoreconf for Ubuntu 16.04/Debian8 + * debian: Attempt to down-grade the debhelper version requirement + * Add Debian packaging information + * enable multiarch build by means of GNUInstallDirs + * libusb-1.0.22 deprecated libusb_set_debug() with + libusb_set_option() + * fl2k_file: support reading from stdin + * lib: update output on zero-copy allocation + * lib: free zero-copy buffers in case of error + +------------------------------------------------------------------- +Sat Apr 28 20:33:02 UTC 2018 - mar...@gmx.de + +- Update to version 0.1.1+git.20180428: + * fl2k_test: fix build on Mac OS + * fl2k_fm: add missing help text for stereo and rds + * update version to 0.1.1 + * set version to 0.1git + +------------------------------------------------------------------- Old: ---- osmo-fl2k-0.1.0+git.20180424.tar.xz New: ---- osmo-fl2k-0.1.1+git.20200602.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ osmo-fl2k.spec ++++++ --- /var/tmp/diff_new_pack.fOBv7n/_old 2020-06-12 21:43:34.940360251 +0200 +++ /var/tmp/diff_new_pack.fOBv7n/_new 2020-06-12 21:43:34.944360261 +0200 @@ -1,7 +1,7 @@ # # spec file for package osmo-fl2k # -# # Copyright (c) 2018, Martin Hauke <mar...@gmx.de> +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,14 +12,14 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define sover 0 %define libname libosmo-fl2k%{sover} Name: osmo-fl2k -Version: 0.1.0+git.20180424 +Version: 0.1.1+git.20200602 Release: 0 Summary: SDR driver for FL2000 based USB 3.0 to VGA adapters License: GPL-2.0-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.fOBv7n/_old 2020-06-12 21:43:34.976360341 +0200 +++ /var/tmp/diff_new_pack.fOBv7n/_new 2020-06-12 21:43:34.976360341 +0200 @@ -3,7 +3,8 @@ <param name="url">git://git.osmocom.org/osmo-fl2k</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> - <param name="versionformat">0.1.0+git.%cd</param> + <param name="versionrewrite-pattern">v(.*)</param> + <param name="versionformat">@PARENT_TAG@+git.%cd</param> </service> <service mode="disabled" name="recompress"> <param name="file">*.tar</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.fOBv7n/_old 2020-06-12 21:43:34.996360391 +0200 +++ /var/tmp/diff_new_pack.fOBv7n/_new 2020-06-12 21:43:34.996360391 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://git.osmocom.org/osmo-fl2k</param> - <param name="changesrevision">a968dd560385372b444db0770cc317831467e016</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">197f421c98f929d4266a09bc9d667b7869e09c27</param></service></servicedata> \ No newline at end of file ++++++ osmo-fl2k-0.1.0+git.20180424.tar.xz -> osmo-fl2k-0.1.1+git.20200602.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/CMakeLists.txt new/osmo-fl2k-0.1.1+git.20200602/CMakeLists.txt --- old/osmo-fl2k-0.1.0+git.20180424/CMakeLists.txt 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/CMakeLists.txt 2020-06-02 00:50:53.000000000 +0200 @@ -22,6 +22,13 @@ cmake_minimum_required(VERSION 2.6) project(libosmo-fl2k C) +include(GNUInstallDirs) + +# CMP0075 Include file check macros honor CMAKE_REQUIRED_LIBRARIES +if(POLICY CMP0075) + cmake_policy(SET CMP0075 NEW) +endif() + #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") @@ -157,7 +164,7 @@ INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libosmo-fl2k.pc - DESTINATION ${LIB_INSTALL_DIR}/pkgconfig + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) ######################################################################## diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/contrib/jenkins.sh new/osmo-fl2k-0.1.1+git.20200602/contrib/jenkins.sh --- old/osmo-fl2k-0.1.0+git.20180424/contrib/jenkins.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/contrib/jenkins.sh 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,18 @@ +#!/bin/sh -ex +# This is how we build on jenkins.osmocom.org. + +CFLAGS="-Werror" + +if ! [ -x "$(command -v osmo-clean-workspace.sh)" ]; then + echo "Error: We need to have scripts/osmo-clean-workspace.sh from osmo-ci.git in PATH!" + exit 2 +fi + +osmo-clean-workspace.sh +cmake \ + -DINSTALL_UDEV_RULES=ON \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + . +make $PARALLEL_MAKE +make DESTDIR="_install" install +osmo-clean-workspace.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/changelog new/osmo-fl2k-0.1.1+git.20200602/debian/changelog --- old/osmo-fl2k-0.1.0+git.20180424/debian/changelog 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/changelog 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,18 @@ +osmo-fl2k (0.1.0git) unstable; urgency=medium + + * Osmocom debian recipes for nightly builds + + -- Harald Welte <lafo...@gnumonks.org> Sun, 03 Jun 2018 16:13:07 +0200 + +osmo-fl2k (0.1.0+20180423git9e79bde-2) unstable; urgency=medium + + * debian/control: set team as maintainer + * debian/copyright: add some entries (Closes: #896832) + + -- Thorsten Alteholz <deb...@alteholz.de> Wed, 25 Apr 2018 19:28:07 +0200 + +osmo-fl2k (0.1.0+20180423git9e79bde-1) unstable; urgency=medium + + * Initial release. + + -- Thorsten Alteholz <deb...@alteholz.de> Tue, 24 Apr 2018 18:28:07 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/compat new/osmo-fl2k-0.1.1+git.20200602/debian/compat --- old/osmo-fl2k-0.1.0+git.20180424/debian/compat 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/compat 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1 @@ +9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/control new/osmo-fl2k-0.1.1+git.20200602/debian/control --- old/osmo-fl2k-0.1.0+git.20180424/debian/control 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/control 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,50 @@ +Source: osmo-fl2k +Section: libs +Priority: optional +Maintainer: Debian Mobcom Maintainers <debian-mobcom-maintain...@lists.alioth.debian.org> +Uploaders: Thorsten Alteholz <deb...@alteholz.de> +Build-Depends: debhelper (>= 9.0.0~), dh-autoreconf + , pkg-config + , cmake + , libusb-1.0-0-dev +Standards-Version: 4.1.4 +Vcs-Browser: https://salsa.debian.org/debian-mobcom-team/osmo-fl2k +Vcs-Git: https://salsa.debian.org/debian-mobcom-team/osmo-fl2k.git +Homepage: https://projects.osmocom.org/projects/osmo-fl2k + +Package: osmo-fl2k +Section: net +Architecture: any +Multi-Arch: no +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: use a VGA USB adapter as DAC and SDR transmitter + This software allows one to use USB 3.0 to VGA adapters based on the + Fresco Logic FL2000 chip as general purpose DACs and SDR transmitter + generating a continuous stream of samples by avoiding the HSYNC and + VSYNC blanking intervals. + +Package: libosmo-fl2k0 +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: use a VGA USB adapter as DAC and SDR transmitter - library + This software allows one to use USB 3.0 to VGA adapters based on the + Fresco Logic FL2000 chip as general purpose DACs and SDR transmitter + generating a continuous stream of samples by avoiding the HSYNC and + VSYNC blanking intervals. + . + This package provides the shared library. + +Package: libosmo-fl2k-dev +Section: libdevel +Architecture: any +Depends: libosmo-fl2k0 (= ${binary:Version}), ${misc:Depends} +Description: use a VGA USB adapter as DAC and SDR transmitter - development + This software allows one to use USB 3.0 to VGA adapters based on the + Fresco Logic FL2000 chip as general purpose DACs and SDR transmitter + generating a continuous stream of samples by avoiding the HSYNC and + VSYNC blanking intervals. + . + This package provides the development files. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/copyright new/osmo-fl2k-0.1.1+git.20200602/debian/copyright --- old/osmo-fl2k-0.1.0+git.20180424/debian/copyright 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/copyright 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,97 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: osmo-fl2k +Source: git://git.osmocom.org/ + +Files: * +Copyright: 2012-2018 Steve Markgraf <st...@steve-m.de> + 2009 Bartek Kania <m...@gnarf.org> + 2012-2014 Kyle Keen <keen...@gmail.com> + 2014 Michael Tatarinov <kuk...@gmail.com> +License: GPL-2.0+ + +Files: src/rds_mod.c include/rds_mod.h +Copyright: 2018 Steve Markgraf <st...@steve-m.de> + 2014 Christophe Jacquet, F8FTK +License: GPL-3.0+ + +Files: src/rds_waveforms.c +Copyright: 2014 Christophe Jacquet. +License: GPL-3.0 + +Files: src/getopt/* +Copyright: 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. +License: LGPL-2.1+ +Comment: This file is part of the GNU C Library. + +License: LGPL-2.1+ + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + . + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + . + On Debian systems, the complete text of the GNU Lesser General Public + License Version 2.1 can be found in `/usr/share/common-licenses/LGPL-2.1'. + +Files: debian/* +Copyright: 2018 Thorsten Alteholz <deb...@alteholz.de> +License: GPL-2.0+ + +License: GPL-2.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU General Public License + Version 2 can be found in `/usr/share/common-licenses/GPL-2'. + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU General Public License + Version 3 can be found in `/usr/share/common-licenses/GPL-3'. + +License: GPL-3.0 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation in version 3 of the License. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU General Public License + Version 3 can be found in `/usr/share/common-licenses/GPL-3'. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/libosmo-fl2k-dev.install new/osmo-fl2k-0.1.1+git.20200602/debian/libosmo-fl2k-dev.install --- old/osmo-fl2k-0.1.0+git.20180424/debian/libosmo-fl2k-dev.install 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/libosmo-fl2k-dev.install 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,4 @@ +usr/include/* +usr/lib/*/pkgconfig/libosmo-fl2k.pc +usr/lib/*/libosmo-fl2k.a +usr/lib/*/*.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/libosmo-fl2k0.install new/osmo-fl2k-0.1.1+git.20200602/debian/libosmo-fl2k0.install --- old/osmo-fl2k-0.1.0+git.20180424/debian/libosmo-fl2k0.install 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/libosmo-fl2k0.install 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1 @@ +usr/lib/*/*.so.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/osmo-fl2k.install new/osmo-fl2k-0.1.1+git.20200602/debian/osmo-fl2k.install --- old/osmo-fl2k-0.1.0+git.20180424/debian/osmo-fl2k.install 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/osmo-fl2k.install 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1 @@ +usr/bin/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/rules new/osmo-fl2k-0.1.1+git.20200602/debian/rules --- old/osmo-fl2k-0.1.0+git.20180424/debian/rules 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/rules 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ --with autoreconf + +# Print test results in case of a failure +override_dh_auto_test: + dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/source/format new/osmo-fl2k-0.1.1+git.20200602/debian/source/format --- old/osmo-fl2k-0.1.0+git.20180424/debian/source/format 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/source/format 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1 @@ +3.0 (native) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/debian/watch new/osmo-fl2k-0.1.1+git.20200602/debian/watch --- old/osmo-fl2k-0.1.0+git.20180424/debian/watch 1970-01-01 01:00:00.000000000 +0100 +++ new/osmo-fl2k-0.1.1+git.20200602/debian/watch 2020-06-02 00:50:53.000000000 +0200 @@ -0,0 +1,3 @@ +version=4 +opts="mode=git, dversionmangle=s/\+ds//" https://git.osmocom.org/osmo-fl2k refs/tags/([\d\.]+) debian uupdate + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/include/osmo-fl2k.h new/osmo-fl2k-0.1.1+git.20200602/include/osmo-fl2k.h --- old/osmo-fl2k-0.1.0+git.20180424/include/osmo-fl2k.h 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/include/osmo-fl2k.h 2020-06-02 00:50:53.000000000 +0200 @@ -37,6 +37,7 @@ FL2K_ERROR_NO_DEVICE = -2, FL2K_ERROR_NOT_FOUND = -5, FL2K_ERROR_BUSY = -6, + FL2K_ERROR_TIMEOUT = -7, FL2K_ERROR_NO_MEM = -11, }; @@ -121,6 +122,40 @@ */ FL2K_API int fl2k_stop_tx(fl2k_dev_t *dev); +/*! + * Read 4 bytes via the FL2K I2C bus + * + * \param dev the device handle given by fl2k_open() + * \param i2c_addr address of the I2C device + * \param reg_addr start address of the 4 bytes to be read + * \param data pointer to byte array of size 4 + * \return 0 on success + * \note A read operation will look like this on the bus: + * START, I2C_ADDR(W), REG_ADDR, REP_START, I2C_ADDR(R), DATA[0], STOP + * START, I2C_ADDR(W), REG_ADDR+1, REP_START, I2C_ADDR(R), DATA[1], STOP + * START, I2C_ADDR(W), REG_ADDR+2, REP_START, I2C_ADDR(R), DATA[2], STOP + * START, I2C_ADDR(W), REG_ADDR+3, REP_START, I2C_ADDR(R), DATA[3], STOP + */ +FL2K_API int fl2k_i2c_read(fl2k_dev_t *dev, uint8_t i2c_addr, + uint8_t reg_addr, uint8_t *data); + +/*! + * Write 4 bytes via the FL2K I2C bus + * + * \param dev the device handle given by fl2k_open() + * \param i2c_addr address of the I2C device + * \param reg_addr start address of the 4 bytes to be written + * \param data pointer to byte array of size 4 + * \return 0 on success + * \note A write operation will look like this on the bus: + * START, I2C_ADDR(W), REG_ADDR, DATA[0], STOP + * START, I2C_ADDR(W), REG_ADDR+1, DATA[1], STOP + * START, I2C_ADDR(W), REG_ADDR+2, DATA[2], STOP + * START, I2C_ADDR(W), REG_ADDR+3, DATA[3], STOP + */ +FL2K_API int fl2k_i2c_write(fl2k_dev_t *dev, uint8_t i2c_addr, + uint8_t reg_addr, uint8_t *data); + #ifdef __cplusplus } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/CMakeLists.txt new/osmo-fl2k-0.1.1+git.20200602/src/CMakeLists.txt --- old/osmo-fl2k-0.1.0+git.20180424/src/CMakeLists.txt 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/CMakeLists.txt 2020-06-02 00:50:53.000000000 +0200 @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +include(GNUInstallDirs) + MACRO(LIBFL2K_APPEND_SRCS) LIST(APPEND libosmo-fl2k_srcs ${ARGV}) ENDMACRO(LIBFL2K_APPEND_SRCS) @@ -124,7 +126,7 @@ # Install built library files & utilities ######################################################################## install(TARGETS ${INSTALL_TARGETS} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} # .so/.dylib file - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} # .lib file + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .lib file RUNTIME DESTINATION bin # .dll file ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_file.c new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_file.c --- old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_file.c 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_file.c 2020-06-02 00:50:53.000000000 +0200 @@ -28,11 +28,13 @@ #ifndef _WIN32 #include <unistd.h> +#define sleep_ms(ms) usleep(ms*1000) #else #include <windows.h> #include <io.h> #include <fcntl.h> #include "getopt/getopt.h" +#define sleep_ms(ms) Sleep(ms) #endif #include "osmo-fl2k.h" @@ -83,6 +85,12 @@ int r, left = FL2K_BUF_LEN; static uint32_t repeat_cnt = 0; + if (data_info->device_error) { + fprintf(stderr, "Device error, exiting.\n"); + do_exit = 1; + return; + } + data_info->sampletype_signed = 1; data_info->r_buf = txbuf; @@ -93,7 +101,7 @@ fprintf(stderr, "File Error\n"); if (feof(file)) { - if (repeat) { + if (repeat && (r > 0)) { repeat_cnt++; fprintf(stderr, "repeat %d\n", repeat_cnt); rewind(file); @@ -145,10 +153,17 @@ if (dev_index < 0) exit(1); - file = fopen(filename, "rb"); - if (!file) { - fprintf(stderr, "Failed to open %s\n", filename); - goto out; + if (strcmp(filename, "-") == 0) { /* Read samples from stdin */ + file = stdin; +#ifdef _WIN32 + _setmode(_fileno(stdin), _O_BINARY); +#endif + } else { + file = fopen(filename, "rb"); + if (!file) { + fprintf(stderr, "Failed to open %s\n", filename); + return -ENOENT; + } } txbuf = malloc(FL2K_BUF_LEN); @@ -184,13 +199,8 @@ SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE ); #endif - while (!do_exit) { -#ifndef _WIN32 - usleep(500000); -#else - Sleep(0.5); -#endif - } + while (!do_exit) + sleep_ms(500); fl2k_close(dev); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_fm.c new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_fm.c --- old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_fm.c 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_fm.c 2020-06-02 00:50:53.000000000 +0200 @@ -94,6 +94,8 @@ "\t[-f FM deviation (default: 75000 Hz, WBFM)]\n" "\t[-i input audio sample rate (default: 44100 Hz for mono FM)]\n" "\t[-s samplerate in Hz (default: 100 MS/s)]\n" + "\t[--rds (enables RDS, forces audio sample rate to 228 kHz)]\n" + "\t[--stereo (enables stereo, requires audio sample rate >= 114 kHz)]\n" "\tfilename (use '-' to read from stdin)\n\n" ); exit(1); @@ -151,17 +153,17 @@ unsigned long int phase_slope; } dds_t; -inline void dds_setphase(dds_t *dds, double phase) +static inline void dds_setphase(dds_t *dds, double phase) { dds->phase = phase * ANG_INCR; } -inline double dds_getphase(dds_t *dds) +static inline double dds_getphase(dds_t *dds) { return dds->phase / ANG_INCR; } -inline void dds_set_freq(dds_t *dds, double freq, double fslope) +static inline void dds_set_freq(dds_t *dds, double freq, double fslope) { dds->fslope = fslope; dds->phase_step = (freq / dds->sample_freq) * 2 * M_PI * ANG_INCR; @@ -194,7 +196,7 @@ return dds; } -inline int8_t dds_real(dds_t *dds) +static inline int8_t dds_real(dds_t *dds) { int tmp; @@ -207,7 +209,7 @@ return sine_table[tmp]; } -inline void dds_real_buf(dds_t *dds, int8_t *buf, int count) +static inline void dds_real_buf(dds_t *dds, int8_t *buf, int count) { int i; for (i = 0; i < count; i++) @@ -265,7 +267,7 @@ pthread_exit(NULL); } -inline int writelen(int maxlen) +static inline int writelen(int maxlen) { int rp = readpos; int len; @@ -281,7 +283,7 @@ return r; } -inline double modulate_sample(int lastwritepos, double lastfreq, double sample) +static inline double modulate_sample(int lastwritepos, double lastfreq, double sample) { double freq, slope; @@ -417,6 +419,7 @@ void fl2k_callback(fl2k_data_info_t *data_info) { if (data_info->device_error) { + fprintf(stderr, "Device error, exiting.\n"); do_exit = 1; pthread_cond_signal(&fm_cond); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_tcp.c new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_tcp.c --- old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_tcp.c 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_tcp.c 2020-06-02 00:50:53.000000000 +0200 @@ -36,9 +36,12 @@ #include <netinet/in.h> #include <netinet/tcp.h> /* for TCP_NODELAY */ #include <fcntl.h> +#define sleep_ms(ms) usleep(ms*1000) #else +#include <windows.h> #include <winsock2.h> #include "getopt/getopt.h" +#define sleep_ms(ms) Sleep(ms) #endif #include "osmo-fl2k.h" @@ -104,6 +107,12 @@ int r; struct timeval tv = { 1, 0 }; + if (data_info->device_error) { + fprintf(stderr, "Device error, exiting.\n"); + do_exit = 1; + return; + } + if (!connected) return; @@ -119,6 +128,12 @@ if (r) { received = recv(sock, txbuf + (FL2K_BUF_LEN - left), left, 0); + if (!received) { + fprintf(stderr, "Connection was closed!\n"); + fl2k_stop_tx(dev); + do_exit = 1; + } + left -= received; } } @@ -217,11 +232,7 @@ fprintf(stderr, "Connecting to %s:%d...\n", addr, port); while (connect(sock, (struct sockaddr *)&remote, sizeof(remote)) != 0) { -#ifndef _WIN32 - usleep(500000); -#else - Sleep(0.5); -#endif + sleep_ms(500); if (do_exit) goto out; } @@ -230,17 +241,12 @@ fprintf(stderr, "Connected\n"); connected = 1; - while (!do_exit) { -#ifndef _WIN32 - usleep(500000); -#else - Sleep(0.5); -#endif - } + while (!do_exit) + sleep_ms(500); out: - free(txbuf); fl2k_close(dev); + free(txbuf); closesocket(s); #ifdef _WIN32 WSACleanup(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_test.c new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_test.c --- old/osmo-fl2k-0.1.0+git.20180424/src/fl2k_test.c 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/fl2k_test.c 2020-06-02 00:50:53.000000000 +0200 @@ -41,9 +41,11 @@ #ifndef _WIN32 #include <unistd.h> +#define sleep_ms(ms) usleep(ms*1000) #else #include <windows.h> #include "getopt/getopt.h" +#define sleep_ms(ms) Sleep(ms) #endif #include "osmo-fl2k.h" @@ -123,8 +125,8 @@ struct timeval tv; rv = gettimeofday(&tv, NULL); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * 1000; + tg->tv_sec = tv.tv_sec; + tg->tv_nsec = tv.tv_usec * 1000; #endif return rv; } @@ -211,6 +213,12 @@ void fl2k_callback(fl2k_data_info_t *data_info) { + if (data_info->device_error) { + fprintf(stderr, "Device error, exiting.\n"); + do_exit = 1; + return; + } + /* drop first couple of callbacks until everything is settled */ if (cb_cnt > 20) { ppm_test(FL2K_BUF_LEN); @@ -220,7 +228,6 @@ data_info->r_buf = buffer; cb_cnt++; } - } int main(int argc, char **argv) @@ -290,17 +297,8 @@ fprintf(stderr, "Reporting PPM error measurement every %u seconds...\n", ppm_duration); fprintf(stderr, "Press ^C after a few minutes.\n"); - while (!do_exit) { -#ifndef _WIN32 - usleep(500000); -#else - Sleep(0.5); -#endif - } - - if (do_exit) { - fprintf(stderr, "\nUser cancel, exiting...\n"); - } + while (!do_exit) + sleep_ms(500); exit: fl2k_close(dev); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/libosmo-fl2k.c new/osmo-fl2k-0.1.1+git.20200602/src/libosmo-fl2k.c --- old/osmo-fl2k-0.1.0+git.20180424/src/libosmo-fl2k.c 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/libosmo-fl2k.c 2020-06-02 00:50:53.000000000 +0200 @@ -2,7 +2,7 @@ * osmo-fl2k, turns FL2000-based USB 3.0 to VGA adapters into * low cost DACs * - * Copyright (C) 2016-2018 by Steve Markgraf <st...@steve-m.de> + * Copyright (C) 2016-2020 by Steve Markgraf <st...@steve-m.de> * * SPDX-License-Identifier: GPL-2.0+ * @@ -25,15 +25,18 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> +#include <math.h> +#include <libusb.h> +#include <pthread.h> #ifndef _WIN32 #include <unistd.h> +#define sleep_ms(ms) usleep(ms*1000) +#else +#include <windows.h> +#define sleep_ms(ms) Sleep(ms) #endif -#include <math.h> -#include <libusb.h> -#include <pthread.h> - /* * All libusb callback functions should be marked with the LIBUSB_CALL macro * to ensure that they are compiled with the same calling convention as libusb. @@ -247,9 +250,9 @@ error = sample_clock - (double)target_freq; /* Keep closest match */ - if (fabsf(error) < last_error) { + if (fabs(error) < last_error) { result_reg = reg; - last_error = fabsf(error); + last_error = fabs(error); } } } @@ -259,7 +262,7 @@ error = sample_clock - (double)target_freq; dev->rate = sample_clock; - if (fabsf(error) > 1) + if (fabs(error) > 1) fprintf(stderr, "Requested sample rate %d not possible, using" " %f, error is %f\n", target_freq, sample_clock, error); @@ -381,7 +384,11 @@ return -1; } +#if LIBUSB_API_VERSION >= 0x01000106 + libusb_set_option(dev->ctx, LIBUSB_OPTION_LOG_LEVEL, 3); +#else libusb_set_debug(dev->ctx, 3); +#endif dev->dev_lost = 1; @@ -437,11 +444,16 @@ fprintf(stderr, "usb_claim_interface 0 error %d\n", r); goto err; } - r = libusb_claim_interface(dev->devh, 1); + r = libusb_set_interface_alt_setting(dev->devh, 0, 1); if (r < 0) { - fprintf(stderr, "usb_claim_interface 1 error %d\n", r); - goto err; + fprintf(stderr, "Failed to switch interface 0 to " + "altsetting 1, trying to use interface 1\n"); + + r = libusb_claim_interface(dev->devh, 1); + if (r < 0) { + fprintf(stderr, "Could not claim interface 1: %d\n", r); + } } r = fl2k_init_device(dev); @@ -472,13 +484,8 @@ if(!dev->dev_lost) { /* block until all async operations have been completed (if any) */ - while (FL2K_INACTIVE != dev->async_status) { -#ifdef _WIN32 - Sleep(1); -#else - usleep(1000); -#endif - } + while (FL2K_INACTIVE != dev->async_status) + sleep_ms(100); fl2k_deinit_device(dev); } @@ -527,6 +534,7 @@ fl2k_xfer_info_t *next_xfer_info; fl2k_dev_t *dev = (fl2k_dev_t *)xfer_info->dev; struct libusb_transfer *next_xfer = NULL; + int r = 0; if (LIBUSB_TRANSFER_COMPLETED == xfer->status) { /* resubmit transfer */ @@ -539,8 +547,7 @@ /* Submit next filled transfer */ next_xfer_info->state = BUF_SUBMITTED; - libusb_submit_transfer(next_xfer); - + r = libusb_submit_transfer(next_xfer); xfer_info->state = BUF_EMPTY; pthread_cond_signal(&dev->buf_cond); } else { @@ -549,17 +556,21 @@ * stops to output data and hangs * (happens only in the hacked 'gapless' * mode without HSYNC and VSYNC) */ - libusb_submit_transfer(xfer); + r = libusb_submit_transfer(xfer); pthread_cond_signal(&dev->buf_cond); dev->underflow_cnt++; } } - } else if (LIBUSB_TRANSFER_CANCELLED != xfer->status) { + } + + if (((LIBUSB_TRANSFER_CANCELLED != xfer->status) && + (LIBUSB_TRANSFER_COMPLETED != xfer->status)) || + (r == LIBUSB_ERROR_NO_DEVICE)) { dev->dev_lost = 1; fl2k_stop_tx(dev); pthread_cond_signal(&dev->buf_cond); - fprintf(stderr, "cb transfer status: %d, " - "canceling...\n", xfer->status); + fprintf(stderr, "cb transfer status: %d, submit " + "transfer %d, canceling...\n", xfer->status, r); } } @@ -567,6 +578,10 @@ { unsigned int i; int r = 0; + const char *incr_usbfs = "Please increase your allowed usbfs buffer" + " size with the following command:\n" + "echo 0 > /sys/module/usbcore/parameters/" + "usbfs_memory_mb\n"; if (!dev) return FL2K_ERROR_INVALID_PARAM; @@ -577,27 +592,57 @@ dev->xfer[i] = libusb_alloc_transfer(0); dev->xfer_buf = malloc(dev->xfer_buf_num * sizeof(unsigned char *)); + memset(dev->xfer_buf, 0, dev->xfer_buf_num * sizeof(unsigned char *)); + dev->xfer_info = malloc(dev->xfer_buf_num * sizeof(fl2k_xfer_info_t)); + memset(dev->xfer_info, 0, dev->xfer_buf_num * sizeof(fl2k_xfer_info_t)); #if defined (__linux__) && LIBUSB_API_VERSION >= 0x01000105 - fprintf(stderr, "Using %d zero-copy buffers\n", dev->xfer_buf_num); + fprintf(stderr, "Allocating %d zero-copy buffers\n", dev->xfer_buf_num); dev->use_zerocopy = 1; for (i = 0; i < dev->xfer_buf_num; ++i) { dev->xfer_buf[i] = libusb_dev_mem_alloc(dev->devh, dev->xfer_buf_len); - if (!dev->xfer_buf[i]) { - fprintf(stderr, "Failed to allocate zerocopy" - " buffer for transfer %d\n", - i); - - // TODO: free dev_mem buffers again + if (dev->xfer_buf[i]) { + /* Check if Kernel usbfs mmap() bug is present: if the + * mapping is correct, the buffers point to memory that + * was memset to 0 by the Kernel, otherwise, they point + * to random memory. We check if the buffers are zeroed + * and otherwise fall back to buffers in userspace. + */ + if (dev->xfer_buf[i][0] || memcmp(dev->xfer_buf[i], + dev->xfer_buf[i] + 1, + dev->xfer_buf_len - 1)) { + fprintf(stderr, "Detected Kernel usbfs mmap() " + "bug, falling back to buffers " + "in userspace\n"); + dev->use_zerocopy = 0; + break; + } + } else { + fprintf(stderr, "Failed to allocate zero-copy " + "buffer for transfer %d\n%sFalling " + "back to buffers in userspace\n", + i, incr_usbfs); dev->use_zerocopy = 0; break; } } + + /* zero-copy buffer allocation failed (partially or completely) + * we need to free the buffers again if already allocated */ + if (!dev->use_zerocopy) { + for (i = 0; i < dev->xfer_buf_num; ++i) { + if (dev->xfer_buf[i]) + libusb_dev_mem_free(dev->devh, + dev->xfer_buf[i], + dev->xfer_buf_len); + } + } #endif + /* no zero-copy available, allocate buffers in userspace */ if (!dev->use_zerocopy) { for (i = 0; i < dev->xfer_buf_num; ++i) { dev->xfer_buf[i] = malloc(dev->xfer_buf_len); @@ -633,12 +678,8 @@ dev->xfer_info[i].state = BUF_SUBMITTED; if (r < 0) { - fprintf(stderr, "Failed to submit transfer %i\n" - "Please increase your allowed " - "usbfs buffer size with the " - "following command:\n" - "echo 0 > /sys/module/usbcore" - "/parameters/usbfs_memory_mb\n", i); + fprintf(stderr, "Failed to submit transfer %i\n%s", + i, incr_usbfs); break; } } @@ -746,6 +787,11 @@ } } + /* wake up sample worker */ + pthread_cond_signal(&dev->buf_cond); + + /* wait for sample worker thread to finish before freeing buffers */ + pthread_join(dev->sample_worker_thread, NULL); _fl2k_free_async_buffers(dev); dev->async_status = next_status; @@ -886,7 +932,6 @@ if (dev->dev_lost && dev->cb) { data_info.device_error = 1; dev->cb(&data_info); - fl2k_stop_tx(dev); } pthread_exit(NULL); @@ -969,3 +1014,104 @@ return FL2K_ERROR_BUSY; } + +int fl2k_i2c_read(fl2k_dev_t *dev, uint8_t i2c_addr, uint8_t reg_addr, uint8_t *data) +{ + int i, r, timeout = 1; + uint32_t reg; + + if (!dev) + return FL2K_ERROR_INVALID_PARAM; + + r = fl2k_read_reg(dev, 0x8020, ®); + if (r < 0) + return r; + + /* apply mask, clearing bit 30 disables periodic repetition of read */ + reg &= 0x3ffc0000; + + /* set I2C register and address, select I2C read (bit 7) */ + reg |= (1 << 28) | (reg_addr << 8) | (1 << 7) | (i2c_addr & 0x7f); + + r = fl2k_write_reg(dev, 0x8020, reg); + if (r < 0) + return r; + + for (i = 0; i < 10; i++) { + sleep_ms(10); + + r = fl2k_read_reg(dev, 0x8020, ®); + if (r < 0) + return r; + + /* check if operation completed */ + if (reg & (1 << 31)) { + timeout = 0; + break; + } + } + + if (timeout) + return FL2K_ERROR_TIMEOUT; + + /* check if slave responded and all data was read */ + if (reg & (0x0f << 24)) + return FL2K_ERROR_NOT_FOUND; + + /* read data from register 0x8024 */ + return libusb_control_transfer(dev->devh, CTRL_IN, 0x40, + 0, 0x8024, data, 4, CTRL_TIMEOUT); +} + +int fl2k_i2c_write(fl2k_dev_t *dev, uint8_t i2c_addr, uint8_t reg_addr, uint8_t *data) +{ + int i, r, timeout = 1; + uint32_t reg; + + if (!dev) + return FL2K_ERROR_INVALID_PARAM; + + /* write data to register 0x8028 */ + r = libusb_control_transfer(dev->devh, CTRL_OUT, 0x41, + 0, 0x8028, data, 4, CTRL_TIMEOUT); + + if (r < 0) + return r; + + r = fl2k_read_reg(dev, 0x8020, ®); + if (r < 0) + return r; + + /* apply mask, clearing bit 30 disables periodic repetition of read */ + reg &= 0x3ffc0000; + + /* set I2C register and address */ + reg |= (1 << 28) | (reg_addr << 8) | (i2c_addr & 0x7f); + + r = fl2k_write_reg(dev, 0x8020, reg); + if (r < 0) + return r; + + for (i = 0; i < 10; i++) { + sleep_ms(10); + + r = fl2k_read_reg(dev, 0x8020, ®); + if (r < 0) + return r; + + /* check if operation completed */ + if (reg & (1 << 31)) { + timeout = 0; + break; + } + } + + if (timeout) + return FL2K_ERROR_TIMEOUT; + + /* check if slave responded and all data was written */ + if (reg & (0x0f << 24)) + return FL2K_ERROR_NOT_FOUND; + + return FL2K_SUCCESS; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osmo-fl2k-0.1.0+git.20180424/src/rds_mod.c new/osmo-fl2k-0.1.1+git.20200602/src/rds_mod.c --- old/osmo-fl2k-0.1.0+git.20180424/src/rds_mod.c 2018-04-24 21:40:36.000000000 +0200 +++ new/osmo-fl2k-0.1.1+git.20200602/src/rds_mod.c 2020-06-02 00:50:53.000000000 +0200 @@ -38,8 +38,8 @@ struct { uint16_t pi; int ta; - char ps[PS_LENGTH]; - char rt[RT_LENGTH]; + char ps[PS_LENGTH+1]; + char rt[RT_LENGTH+1]; } rds_params = { 0 }; /* The RDS error-detection code generator polynomial is