#1190 Tuner management redesign. Updates all tuners with direct threaded support. Incorporates USB Hotplug support. Adds black/white listing of tuners. Updates all tuner editors to have a common look and feel. Changes location of tuner configuration file and changes format to JSON. (#1208)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2022-04-18 07:30:58 -04:00
committed by GitHub
parent 0fb148d31e
commit 96d3996bec
259 changed files with 11974 additions and 12454 deletions

View File

@@ -1,288 +1,118 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
*
* * ******************************************************************************
* * Copyright (C) 2014-2019 Dennis Sheirer
* *
* * 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/>
* * *****************************************************************************
* 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/>
* ****************************************************************************
*/
package io.github.dsheirer.source.tuner;
import javax.usb.UsbDeviceDescriptor;
import java.util.EnumSet;
/**
* Tuner Class enumeration
*/
public enum TunerClass
{
AIRSPY( TunerType.AIRSPY_R820T, "1D50", "60A1", "Airspy", "Airspy" ),
GENERIC_2832( TunerType.RTL2832_VARIOUS, "0BDA", "2832", "RTL2832", "SDR" ),
GENERIC_2838( TunerType.RTL2832_VARIOUS, "0BDA", "2838", "RTL2832", "SDR" ),
COMPRO_VIDEOMATE_U620F( TunerType.ELONICS_E4000, "185B", "0620", "Compro", "Videomate U620F" ),
COMPRO_VIDEOMATE_U650F( TunerType.ELONICS_E4000, "185B", "0650", "Compro", "Videomate U620F" ),
COMPRO_VIDEOMATE_U680F( TunerType.ELONICS_E4000, "185B", "0680", "Compro", "Videomate U620F" ),
DEXATEK_LOGILINK_VG002A( TunerType.FCI_FC2580, "1D19", "1101", "Dexatek", "Logilink VG0002A" ),
DEXATEK_DIGIVOX_MINI_II_REV3( TunerType.FCI_FC2580, "1D19", "1102", "Dexatek", "MSI Digivox Mini II v3.0" ),
DEXATEK_5217_DVBT( TunerType.FCI_FC2580, "1D19", "1103", "Dexatek", "5217 DVB-T" ),
ETTUS_USRP_B100( TunerType.ETTUS_VARIOUS, "2500", "0002", "Ettus Research", "USRP B100" ),
FUNCUBE_DONGLE_PRO( TunerType.FUNCUBE_DONGLE_PRO, "04D8", "FB56", "Hamlincrest", "Funcube Dongle Pro" ),
FUNCUBE_DONGLE_PRO_PLUS( TunerType.FUNCUBE_DONGLE_PRO_PLUS, "04D8", "FB31", "Hamlincrest", "Funcube Dongle Pro Plus" ),
GIGABYTE_GTU7300( TunerType.FITIPOWER_FC0012, "1B80", "D393", "Gigabyte", "GT-U7300" ),
GTEK_T803( TunerType.FITIPOWER_FC0012, "1F4D", "B803", "GTek", "T803" ),
HACKRF_ONE( TunerType.HACKRF, "1D50", "6089", "Great Scott Gadgets", "HackRF One" ),
HACKRF_JAWBREAKER( TunerType.HACKRF, "1D50", "604B", "Great Scott Gadgets", "HackRF Jawbreaker" ),
RAD1O( TunerType.HACKRF, "1D50", "CC15", "Munich hackerspace", "Rad1o" ),
LIFEVIEW_LV5T_DELUXE( TunerType.FITIPOWER_FC0012, "1F4D", "C803", "Liveview", "LV5T Deluxe" ),
MYGICA_TD312( TunerType.FITIPOWER_FC0012, "1F4D", "D286", "MyGica", "TD312" ),
PEAK_102569AGPK( TunerType.FITIPOWER_FC0012, "1B80", "D395", "Peak", "102569AGPK" ),
PROLECTRIX_DV107669( TunerType.FITIPOWER_FC0012, "1F4D", "D803", "Prolectrix", "DV107669" ),
SVEON_STV20( TunerType.FITIPOWER_FC0012, "1B80", "D39D", "Sveon", "STV20 DVB-T USB & FM" ),
TERRATEC_CINERGY_T_REV1( TunerType.FITIPOWER_FC0012, "0CCD", "00A9", "Terratec", "Cinergy T R1" ),
TERRATEC_CINERGY_T_REV3( TunerType.ELONICS_E4000, "0CCD", "00D3", "Terratec", "Cinergy T R3" ),
TERRATEC_NOXON_REV1_B3( TunerType.FITIPOWER_FC0013, "0CCD", "00B3", "Terratec", "NOXON R1 (B3)" ),
TERRATEC_NOXON_REV1_B4( TunerType.FITIPOWER_FC0013, "0CCD", "00B4", "Terratec", "NOXON R1 (B4)" ),
TERRATEC_NOXON_REV1_B7( TunerType.FITIPOWER_FC0013, "0CCD", "00B7", "Terratec", "NOXON R1 (B7)" ),
TERRATEC_NOXON_REV1_C6( TunerType.FITIPOWER_FC0013, "0CCD", "00C6", "Terratec", "NOXON R1 (C6)" ),
TERRATEC_NOXON_REV2( TunerType.ELONICS_E4000, "0CCD", "00E0", "Terratec", "NOXON R2" ),
TERRATEC_T_STICK_PLUS( TunerType.ELONICS_E4000, "0CCD", "00D7", "Terratec", "T Stick Plus" ),
TWINTECH_UT40( TunerType.FITIPOWER_FC0013, "1B80", "D3A4", "Twintech", "UT-40" ),
ZAAPA_ZTMINDVBZP( TunerType.FITIPOWER_FC0012, "1B80", "D398", "Zaapa", "ZT-MINDVBZP" ),
TEST_TUNER(TunerType.TEST, "0", "0", "ABC Tuners Inc.", "Model XYZ"),
RECORDING_TUNER(TunerType.RECORDING, "0", "0", "Recording Tuner", "Recording"),
UNKNOWN( TunerType.UNKNOWN, "0", "0", "Unknown Manufacturer", "Unknown Device" );
AIRSPY("Airspy"),
FUNCUBE_DONGLE_PRO("Funcube Dongle Pro" ),
FUNCUBE_DONGLE_PRO_PLUS("Funcube Dongle Pro+" ),
HACKRF("HackRF" ),
RTL2832("RTL-2832"),
TEST_TUNER("Test"),
RECORDING_TUNER("Recording"),
UNKNOWN("Unknown" );
private TunerType mTunerType;
private String mVendorID;
private String mDeviceID;
private String mVendorDescription;
private String mDeviceDescription;
private TunerClass( TunerType tunerType,
String vendorID,
String deviceID,
String vendorDescription,
String deviceDescription )
private String mDescription;
/**
* Constructs an entry
* @param description of the entry
*/
TunerClass(String description)
{
mTunerType = tunerType;
mVendorID = vendorID;
mDeviceID = deviceID;
mVendorDescription = vendorDescription;
mDeviceDescription = deviceDescription;
mDescription = description;
}
@Override
public String toString()
{
return "USB" +
" Tuner:" + mTunerType.toString() +
" Vendor:" + mVendorDescription +
" Device:" + mDeviceDescription +
" Address:" + mVendorID + ":" + mDeviceID;
return mDescription;
}
public String getVendorDeviceLabel()
{
return mVendorDescription + " " + mDeviceDescription;
}
public TunerType getTunerType()
{
return mTunerType;
}
public static TunerClass valueOf( UsbDeviceDescriptor descriptor )
{
return valueOf( descriptor.idVendor(), descriptor.idProduct() );
}
public static TunerClass valueOf( short vendor, short product )
{
TunerClass retVal = TunerClass.UNKNOWN;
//Cast the short to integer so that we can switch on unsigned numbers
int vendorID = vendor & 0xFFFF;
int productID = product & 0xFFFF;
switch( vendorID )
public static final EnumSet<TunerClass> SUPPORTED_USB_TUNERS = EnumSet.of(AIRSPY, HACKRF, RTL2832,
FUNCUBE_DONGLE_PRO, FUNCUBE_DONGLE_PRO_PLUS);
/**
* Indicates if this tuner class entry is a supported USB tuner class.
*/
public boolean isSupportedUsbTuner()
{
return SUPPORTED_USB_TUNERS.contains(this);
}
/**
* Lookup a USB tuner class from the USB vid and pid
* @param vendor id
* @param product id
* @return tuner class or UNKNOWN
*/
public static TunerClass lookup(short vendor, short product)
{
//Combine vid & pid to make an integer that we can switch on
int id = ((vendor & 0xFFFF) << 16) | (product & 0xFFFF);
switch(id)
{
case 1240: //04DA
if( productID == 64305 ) //FB31
{
retVal = FUNCUBE_DONGLE_PRO_PLUS;
}
else if( productID == 64342 ) //FB56
{
retVal = FUNCUBE_DONGLE_PRO;
}
break;
case 3034: //0BDA
if( productID == 10290 ) //2832
{
retVal = GENERIC_2832;
}
else if( productID == 10296 ) //2838
{
retVal = GENERIC_2838;
}
break;
case 6235: //185B
if( productID == 1568 ) //0620
{
retVal = COMPRO_VIDEOMATE_U620F;
}
else if( productID == 1616 ) //0650
{
retVal = COMPRO_VIDEOMATE_U650F;
}
else if( productID == 1664 ) //0680
{
retVal = COMPRO_VIDEOMATE_U680F;
}
break;
case 7040: //1B80
if( productID == 54163 ) //D393
{
retVal = GIGABYTE_GTU7300;
}
else if( productID == 54165 ) //D395
{
retVal = PEAK_102569AGPK;
}
else if( productID == 54168 ) //D398
{
retVal = ZAAPA_ZTMINDVBZP;
}
else if( productID == 54173 ) //D39D
{
retVal = SVEON_STV20;
}
else if( productID == 54180 ) //D3A4
{
retVal = TWINTECH_UT40;
}
break;
case 7449: //1D19
if( productID == 4353 ) //1101
{
retVal = DEXATEK_LOGILINK_VG002A;
}
else if( productID == 4354 ) //1102
{
retVal = DEXATEK_DIGIVOX_MINI_II_REV3;
}
else if( productID == 4355 ) //1103
{
retVal = DEXATEK_5217_DVBT;
}
break;
case 7504: //1D50
if( productID == 24713 ) //6089
{
retVal = HACKRF_ONE;
}
else if( productID == 24737 ) //60A1
{
retVal = AIRSPY;
}
else if( productID == 52245 ) //CC15
{
retVal = HACKRF_ONE;
}
else if( productID == 24651 ) //604B
{
retVal = HACKRF_JAWBREAKER;
}
break;
case 8013: //1F4D
if( productID == 47107 ) //B803
{
retVal = GTEK_T803;
}
else if( productID == 51203 ) //C803
{
retVal = LIFEVIEW_LV5T_DELUXE;
}
else if( productID == 53894 ) //D286
{
retVal = MYGICA_TD312;
}
else if( productID == 55299 ) //D803
{
retVal = PROLECTRIX_DV107669;
}
break;
case 3277: //0CCD
if( productID == 169 ) //00A9
{
retVal = TERRATEC_CINERGY_T_REV1;
}
else if( productID == 179 ) //00B3
{
retVal = TERRATEC_NOXON_REV1_B3;
}
else if( productID == 180 ) //00B4
{
retVal = TERRATEC_NOXON_REV1_B4;
}
else if( productID == 181 ) //00B5
{
retVal = TERRATEC_NOXON_REV1_B7;
}
else if( productID == 198 ) //00C6
{
retVal = TERRATEC_NOXON_REV1_C6;
}
else if( productID == 211 ) //00D3
{
retVal = TERRATEC_CINERGY_T_REV3;
}
else if( productID == 215 ) //00D7
{
retVal = TERRATEC_T_STICK_PLUS;
}
else if( productID == 224) //00E0
{
retVal = TERRATEC_NOXON_REV2;
}
break;
case 9472: //2500
if( productID == 2 ) //0002
{
retVal = ETTUS_USRP_B100;
}
break;
default:
case 0x04D8FB31:
return FUNCUBE_DONGLE_PRO_PLUS;
case 0x04D8FB56:
return FUNCUBE_DONGLE_PRO;
case 0x0BDA2832: //GENERIC RTL-2832
case 0x0BDA2838: //GENERIC RTL-2832/2838
case 0x185B0620: //COMPRO VIDEOMATE U620F
case 0x185B0650: //COMPRO VIDEOMATE U650F
case 0x185B0680: //COMPRO VIDEOMATE U680F
case 0x1B80D393: //GIGABYTE GTU7300
case 0x1B80D395: //PEAK 102569AGPK
case 0x1B80D398: //ZAAPA ZTMINDVBZP
case 0x1B80D39D: //SVEON_STV20
case 0x1B80D3A4: //TWINTECH UT40
case 0x1D191101: //DEXATEK LIGILINK VG002A
case 0x1D191102: //DEXATEK DIGIVOX MINI II REV3
case 0x1D191103: //DEXATEK 5217 DVBT
case 0x1F4DB803: //GTEK T803
case 0x1F4DC803: //LIFEVIEW LV5T DELUXE
case 0x1F4DD286: //MIGICA TD312
case 0x1F4DD803: //PROLECTRIX DV107669
case 0x0CCD00A9: //TERRATEC CINERGY T REV1
case 0x0CCD00B3: //TERRATEC NOXON REV1 B3
case 0x0CCD00B4: //TERRATEC NOXON REV1 B4
case 0x0CCD00B7: //TERRATEC NOXON REV1 B7
case 0x0CCD00C6: //TERRATEC NOXON REV1 C6
case 0x0CCD00D3: //TERRATEC CINERGY T REV3
case 0x0CCD00D7: //TERRATEC T STICK PLUS
case 0x0CCD00E0: //TERRATEC NOXON REV2
return RTL2832;
case 0x1D506089: //HACKRF ONE
case 0x1D50CC15: //HACKRF ONE
case 0x1D50604B: //HACKRF JAWBREAKER
return HACKRF;
case 0x1D5060A1:
return AIRSPY;
}
return retVal;
}
public String getVendorID()
{
return mVendorID;
}
public String getDeviceID()
{
return mDeviceID;
}
public String getVendorDescription()
{
return mVendorDescription;
}
public String getDeviceDescription()
{
return mDeviceDescription;
return TunerClass.UNKNOWN;
}
}