From a2a9c452105dafb2f680b1218caeb83a25b8c1c1 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 4 Sep 2015 05:02:45 +0200 Subject: [PATCH] Deep redesign: Better support for FCD dongles #7: Activate original Pro plugin with proper enumeration of Pro or Pro+ matching devices --- Readme.md | 2 -- plugins/samplesource/CMakeLists.txt | 1 + plugins/samplesource/fcdpro/fcdproplugin.cpp | 18 ++++++++++++++---- .../fcdproplus/fcdproplusplugin.cpp | 18 ++++++++++++++---- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Readme.md b/Readme.md index 0cc760e95..f26eedb4a 100644 --- a/Readme.md +++ b/Readme.md @@ -19,7 +19,6 @@ These plugins come from the parent code base and are still present in the source - tetra - Sample sources: - fcd - - fcdpro - gnuradio - osmosdr - v4l-msi @@ -28,7 +27,6 @@ These plugins come from the parent code base and are still present in the source

Funcube Dongle (fcd, fcdpro)

- fcd is the old driver and will be completely removed in the future. -- fcdpro is the plugin for the original FunCube Dongle Pro (not Pro+). It is temporarily removed from the build to avoid confusion until the enumeration of devices works properly.

Gnuradio

diff --git a/plugins/samplesource/CMakeLists.txt b/plugins/samplesource/CMakeLists.txt index 1642e0aaa..150632393 100644 --- a/plugins/samplesource/CMakeLists.txt +++ b/plugins/samplesource/CMakeLists.txt @@ -18,6 +18,7 @@ if(LIBUSB_FOUND AND UNIX) FIND_LIBRARY (LIBASOUND asound) endif() if(LIBASOUND AND ASOUNDH) + add_subdirectory(fcdpro) add_subdirectory(fcdproplus) endif() diff --git a/plugins/samplesource/fcdpro/fcdproplugin.cpp b/plugins/samplesource/fcdpro/fcdproplugin.cpp index 30333c5ca..2c5754703 100644 --- a/plugins/samplesource/fcdpro/fcdproplugin.cpp +++ b/plugins/samplesource/fcdpro/fcdproplugin.cpp @@ -51,10 +51,20 @@ PluginInterface::SampleSourceDevices FCDProPlugin::enumSampleSources() { SampleSourceDevices result; - QString displayedName(QString("Funcube Dongle Pro #1")); - SimpleSerializer s(1); - s.writeS32(1, 0); - result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.fcdpro", s.final())); + int i = 1; + struct hid_device_info *device_info = hid_enumerate(0x04D8, 0xFB56); + + while (device_info != 0) + { + QString serialNumber = QString::fromWCharArray(device_info->serial_number); + QString displayedName(QString("FunCube Dongle Pro #%1 ").arg(i) + serialNumber); + SimpleSerializer s(1); + s.writeS32(1, 0); + result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.fcdpro", s.final())); + + device_info = device_info->next; + i++; + } return result; } diff --git a/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp b/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp index 4f7c53a9a..69c066dfe 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp @@ -51,10 +51,20 @@ PluginInterface::SampleSourceDevices FCDProPlusPlugin::enumSampleSources() { SampleSourceDevices result; - QString displayedName(QString("FunCube Pro+ #1")); - SimpleSerializer s(1); - s.writeS32(1, 0); - result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.fcdproplus", s.final())); + int i = 1; + struct hid_device_info *device_info = hid_enumerate(0x04D8, 0xFB31); + + while (device_info != 0) + { + QString serialNumber = QString::fromWCharArray(device_info->serial_number); + QString displayedName(QString("FunCube Dongle Pro+ #%1 ").arg(i) + serialNumber); + SimpleSerializer s(1); + s.writeS32(1, 0); + result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.fcdproplus", s.final())); + + device_info = device_info->next; + i++; + } return result; }