Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send rtl_tcp header/magic number for compatibility #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theY4Kman
Copy link

This PR alters the protocol a bit: it sends an rtl_tcp-compatible header, including the RTL0 magic number, upon client connection.

This PR is a fix for #2

The header structure also contains a tuner type and count of gain values supported by the tuner. The tuner type is an enum, statically defined in rtl-sdr.h

enum rtlsdr_tuner {
	RTLSDR_TUNER_UNKNOWN = 0,
	RTLSDR_TUNER_E4000,
	RTLSDR_TUNER_FC0012,
	RTLSDR_TUNER_FC0013,
	RTLSDR_TUNER_FC2580,
	RTLSDR_TUNER_R820T,
	RTLSDR_TUNER_R828D
};

Since none of those quite fit, this PR simply uses 0 for unknown.

The tuner gain counts also doesn't quite fit — those tuners above appear to have statically defined sets of gain values:

int rtlsdr_get_tuner_gains(rtlsdr_dev_t *dev, int *gains)
{
	/* all gain values are expressed in tenths of a dB */
	const int e4k_gains[] = { -10, 15, 40, 65, 90, 115, 140, 165, 190, 215,
				  240, 290, 340, 420 };
	const int fc0012_gains[] = { -99, -40, 71, 179, 192 };
	const int fc0013_gains[] = { -99, -73, -65, -63, -60, -58, -54, 58, 61,
				       63, 65, 67, 68, 70, 71, 179, 181, 182,
				       184, 186, 188, 191, 197 };
	const int fc2580_gains[] = { 0 /* no gain values */ };
	const int r82xx_gains[] = { 0, 9, 14, 27, 37, 77, 87, 125, 144, 157,
				     166, 197, 207, 229, 254, 280, 297, 328,
				     338, 364, 372, 386, 402, 421, 434, 439,
				     445, 480, 496 };
	const int unknown_gains[] = { 0 /* no gain values */ };

And the Limes appear to accept 0-73dB, which would be 0-730 in rtl_tcp parlance... I guess 730 could be passed for gain counts, but I'm not sure what value it would add. This PR just uses 0 for that value, too.

@sally-yachts
Copy link

And the Limes appear to accept 0-73dB, which would be 0-730 in rtl_tcp parlance... I guess 730 could be passed for gain counts, but I'm not sure what value it would add. This PR just uses 0 for that value, too.

I tested with GQRX and it looks like this may prevent a gain slider from being presented to the end user. I can connect over the network but gain starts and remains at zero. When doing some testing with Nooelec NESDR SMArt v4 dongles with rtl_tcp I do get a gain slider and see the rtl_tcp output setting gain, although interestingly not using the r82xx_gains values above. Are there any command line switches to change the gain, or perhaps another client app (command line?) to test adjusting gain?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants