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

iio_info.py example: pick uri automatically when there's only one #1159

Open
wants to merge 1 commit into
base: libiio-v0
Choose a base branch
from

Conversation

royalmo
Copy link

@royalmo royalmo commented Apr 11, 2024

PR Description

I was testing v0.25's iio_info.py and saw it didn't do anything when no command-line arguments were given. If there are more than one available uri a message is shown before exiting the program (with sys.exit(0)). However, this line is also executed when there's only one or zero of them, and without printing any message previously. This causes confusion, at least in my opinion. I've seen that v1 didn't had any changes in that file, meaning that this issue still persists.

For reference, the "oficial" C-programmed iio_info (the one that comes built in the releases) selects the first uri if only one exists by default.

What I've done in this PR is to mimic what it's being done in the iio_info executable. I'm not sure if the examples should change in v1, but at least it should be useful for v0.25 (this PR is on the main branch, but I can move it to the v0.25 branch if you prefer). I've also fixed a typo some lines below.

It's my first PR ever to an open-source project, so don't hesitate on giving me constructive feedback, it's all a little new to me!

Tested on v0.25, with Python3.6 and Python2.7 on a Ubuntu 18.04.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

(due to the simplicity of the fix, and given the fact that it is one of the example codes I consider that some of the checks don't apply, I left them unchecked)

  • I have conducted a self-review of my own code changes
  • I have commented new code, particulary complex or unclear areas
  • I have checked that I did not intoduced new warnings or errors (CI output)
  • I have checked that components that use libiio did not get broken
  • I have updated the documentation accordingly (GitHub Pages, READMEs, etc)

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.

1 participant