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

Wrong IIO device attribute (and a iio_rwdev fix) #1237

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

nunojsa
Copy link
Contributor

@nunojsa nunojsa commented Jan 29, 2025

PR Description

Fix a device attribute being wrongly displayed and make sure iio_rwdev does not crash if we hit ctrl-c while streaming with a command as iio_rwdev -u ip:192.168.1.79 -b 1048576 axi-adrv9002-rx-lpc | pv > /dev/null

There's also a stylistic patch on local.c

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

  • 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)

When dumping device attributes, 'waiting_for_supplier' is being included
and that is part of device links and has nothing to do with IIO.

Signed-off-by: Nuno Sá <[email protected]>
Some minor cosmetics to make the style more consistent. Changes include:

* New line between variables declaration and actual code;
* Remove some redundant 'else' and 'else if()';
* No new line between variables declaration;
* First check for errors instead.

Signed-off-by: Nuno Sá <[email protected]>
If we try to cancel the utility with a signal, we'll cancel the buffer (at
least on linux) which means we'll likely fail to dequeue a block if we
are waiting for one. On top of that the flag 'app_running' is set to false
which means that the loop condition '(ret && app_running)' is false and
so we do not leave it. This all means that we'll proceed with an
invalid block leading to a segfault.

Hence, always break the loop if iio_stream_get_next_block() fails (which
was the previous behavior) but only log it if the application is
running.

Signed-off-by: Nuno Sá <[email protected]>
Copy link
Contributor

@dNechita dNechita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dNechita dNechita merged commit e8c251b into main Jan 30, 2025
23 checks passed
@dNechita dNechita deleted the staging/device-file-ignore branch January 30, 2025 11:33
@rgetz
Copy link
Contributor

rgetz commented Jan 30, 2025

I would rather fix all the style issues in one massive commit with a tool - rather than patching things by hand piecemeal (one file at a time). - using git blame will be harder when we need to ignore multple random commits over time...

@nunojsa
Copy link
Contributor Author

nunojsa commented Jan 30, 2025

Hmm, don't really agree. At least me, 99% (if not 100) of the time, I'll just blame one file to see what commit changed some line and I prefer git show giving me a small diff only related with that particular file rather than a huge diff with lots of unrelated changes.

Hardly applies in this case but if for some reason we wanted to revert the changes in just this file, we could easily revert the commit but if we touch multiple files at a time...

Finally, I didn't really wanted to go over all the other files or messing around with a tool to change the style everywhere. But I don't think that should be a show stopper for improving things in the sources I was working with.

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.

3 participants