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

Set label when PlutoSDR is USB-connected #48

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

argilo
Copy link
Contributor

@argilo argilo commented Jan 29, 2022

When a PlutoSDR device is connected by USB, SoapyPlutoSDR calculates a label but fails to assign it to the options object. This results in PlutoSDR devices being displayed as "Unknown" in Gqrx.

I also noticed that the label is generated using a fixed-length buffer and sprintf, which is dangerous. I've replaced this with std::ostringstream.

Finally, I changed the device name to PlutoSDR instead of plutosdr to match how other devices are displayed.

Before:

% SoapySDRUtil --find
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Found device 0
  device = plutosdr
  driver = plutosdr
  uri = usb:20.2.5

After:

% SoapySDRUtil --find
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Found device 0
  device = PlutoSDR
  driver = plutosdr
  label = PlutoSDR #0 usb:20.2.5
  uri = usb:20.2.5

@zuckschwerdt
Copy link
Member

I had a look through other modules, and the commonality seems to be "label" and "serial". The key "device" is used in HackRF, but specifically to identify the hardware type.
A descriptive "label" seems good practice. But "device" (if we can claim to known anything about the hardware) should likely be just "Pluto" or "ADALM Pluto", right?

@argilo
Copy link
Contributor Author

argilo commented Jan 29, 2022

"ADALM Pluto" sounds good to me. I'll update it to that.

@argilo
Copy link
Contributor Author

argilo commented Jan 29, 2022

Done. I also updated the PR description with the new output.

@zuckschwerdt
Copy link
Member

I like it. Let's give this a few days for other users to maybe offer feedback.

@argilo
Copy link
Contributor Author

argilo commented Jan 29, 2022

Actually, it looks like the official name is "ADALM-PLUTO", with "PlutoSDR" being the short version: https://wiki.analog.com/university/tools/pluto

The iio_context_info_get_description function returns this:

0456:b673 (Analog Devices Inc. PlutoSDR (ADALM-PLUTO)), serial=1044735411960001110030006e061e4d34

So it would seem that either "PlutoSDR" or "ADALM-PLUTO" would be best. Which of those do you prefer?

@zuckschwerdt
Copy link
Member

Oops, sorry. That's confusing. I guess "PlutoSDR" would be nicer than "ADALM-PLUTO", if those are the options of "official" names for the hardware.

@argilo
Copy link
Contributor Author

argilo commented Jan 29, 2022

Agreed, I like "PlutoSDR" better as well. I'll switch it back.

@argilo
Copy link
Contributor Author

argilo commented Feb 7, 2022

Let's give this a few days for other users to maybe offer feedback.

10 days have passed with no other feedback. Can this be merged now?

@zuckschwerdt zuckschwerdt merged commit a243128 into pothosware:master Feb 7, 2022
@argilo argilo deleted the fix-label branch February 7, 2022 14:13
@argilo
Copy link
Contributor Author

argilo commented Feb 7, 2022

Thanks!

@zuckschwerdt
Copy link
Member

No need. It's not my project, just lots of community effort!

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