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

rtlsdr_set_tuner_bandwidth #14

Closed
porjo opened this issue Feb 28, 2016 · 9 comments
Closed

rtlsdr_set_tuner_bandwidth #14

porjo opened this issue Feb 28, 2016 · 9 comments

Comments

@porjo
Copy link
Collaborator

porjo commented Feb 28, 2016

function rtlsdr_set_tuner_bandwidth() is not present in Linux distro releases of rtl-sdr package. Go packages that have gortlsdr as a depencency will fail to compile when using distro packaged librtlsdr.

I've confirmed this on Fedora 23 and Ubuntu 14.04.

Could SetTunerBw() be modified to return an error if rtlsdr_set_tuner_bandwidth() can't be found?

@jpoirier
Copy link
Owner

Frustrating; the last official release was something like two years ago and that function was added about nine months ago...

I'm not sure what the best approach is to fix this but we could A) wrap a rtlsdr_set_tuner_bandwidth function (would always return an error) behind a pre-compile switch in the go code but it would require the user to explicitly pass the flag when building gortlsdr, e.g. after go get fails due to the missing function, or B) provide two versions of gortlsdr but that would require using either Go 1.5 with the versioning environment flag set or Go 1.6, not sure if it would work with gccgo though.

What are your thoughts and/or suggestions?

I'll also submit a request to release a new version at https://lists.osmocom.org/mailman/listinfo/osmocom-sdr

done: http://lists.osmocom.org/pipermail/osmocom-sdr/2016-February/001373.html

edited

@bemasher
Copy link

A project I've been using this package in simply requires users to build rtlsdr from source. The official git repo at least has the necessary commits.

@jpoirier
Copy link
Owner

On Sun, Feb 28, 2016 at 3:40 PM, Douglas Hall notifications@github.com
wrote:

A project I've been using this package in simply requires users to build
rtlsdr from source. The official git repo at least has the necessary
commits.

Everyone I know that's using librtlsdr builds from source as I think it's
obligatory if you want the updates. I've not received any feedback
concerning the missing function, you're the first to mention it, so maybe
we can just wait and see what happens. It'd be nice if they released an
updated but I wouldn't bet on it.

-joe

@porjo
Copy link
Collaborator Author

porjo commented Mar 2, 2016

Assuming that upstream are slow in creating a new release and distros even slower in adopting it...

From my package (which imports gortlsdr) how would I specify the location of rtlsdr at build time?
Presumably I would need to pass some flags to go build or set some environment variables. Or do I need to tinker with gortlsdr itself?

@jpoirier
Copy link
Owner

jpoirier commented Mar 3, 2016

Go's cgo tool is expecting librtlsdr to be in your default library path
(e.g. /usr/lib, usr/local/lib, etc...), look at the top of gortlsdr for the
#cgo settings for LDFLAGS and CFLAGS.

It may be easiest to just modify the gortlsdr package in your GOPATH. E.g.

either clone gortlsdr in to your GOPATH yourself or just "go get -d
github.com/jpoirier/gortlsdr" then edit $GOPATH/src/
github.com/jpoirier/gortlsdr/rtlsdr.go and comment out the bandwidth
method. Once that method is commented out do the build/install via "go
install -a github.com/jpoirier/gortlsdr"

On Wed, Mar 2, 2016 at 4:46 PM, Ian Bishop notifications@github.com wrote:

Assuming that upstream are slow in creating a new release and distros even
slower in adopting it...

From my package (which imports gortlsdr) how would I specify the location
of rtlsdr at build time?
Presumably I would need to pass some flags to go build or set some
environment variables. Or do I need to tinker with gortlsdr itself?


Reply to this email directly or view it on GitHub
#14 (comment).

@porjo
Copy link
Collaborator Author

porjo commented Mar 4, 2016

Thanks for the pointers. I ended up compiling against the latest rtl-sdr source as follows:

  • compile and install latest rtl-sdr into /usr/local/rtl-sdr
  • run go build on my package with modified cgo environment variables:
$ CGO_LDFLAGS="-lrtlsdr -L/usr/local/rtl-sdr/lib" \
   CGO_CPPFLAGS="-I/usr/local/rtl-sdr/include"  \
     go build

@jpoirier
Copy link
Owner

jpoirier commented Mar 4, 2016

fyi - doing the last two build commands (from the readme) "sudo make
install" then "sudo ldconfig" for librtlsdr will put librtlsdr.so in your
default lib path /usr/local/lib and the header file in /usr/local/include,
then you won't need to modify/set any environment variables; gortlsdr will
just build.

On Thu, Mar 3, 2016 at 9:50 PM, Ian Bishop notifications@github.com wrote:

Thanks for the pointers. I ended up compiling against the latest rtl-sdr
source as follows:

  • compile and install latest rtl-sdr into /usr/local/rtl-sdr
  • run go build on my package with modified cgo environment variables:

$ CGO_LDFLAGS="-lrtlsdr -L/usr/local/rtl-sdr/lib"
CGO_CPPFLAGS="-I/usr/local/rtl-sdr/include"
go build


Reply to this email directly or view it on GitHub
#14 (comment).

@porjo
Copy link
Collaborator Author

porjo commented Aug 25, 2018

Good news - librtlsdr 0.5.4 was cut back in May. Fedora has already incorporated it into 27 + 28. It looks like the upcoming Ubuntu 19.04 will include it too.

@jpoirier
Copy link
Owner

jpoirier commented Aug 25, 2018

That is good news! Glad to see the code getting fixes and updates.

edit - spelling

@porjo porjo closed this as completed Sep 12, 2018
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

No branches or pull requests

3 participants