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

Restore support for reading/writing all attributes and improve compat layer #1088

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

pcercuei
Copy link
Contributor

A set of three commits that IIOD to work again with the iio-oscilloscope, and also allow iio-oscilloscope to run on top of the compatibility layer.

Libiio's new API does not allow reading or writing all attributes at the
same time. However, old clients connected to the old interface might
still try to use it.

Re-implement it in IIOD on top of the new API so that old clients still
work. The algorithm is based on the one in v0.25's local.c.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Check that we have an attribute before trying to read it, to avoid NULL
pointer deferences.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
This function existed in the old API but was not present in the compat
layer until now.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
@rgetz
Copy link
Contributor

rgetz commented Nov 28, 2023

Looks good. with this - older osc still works? which boards did you test on?

@pcercuei
Copy link
Contributor Author

Looks good. with this - older osc still works? which boards did you test on?

Only tested remotely with v1.0 IIOD. Later this week I will verify that it works properly with the v0.25 IIOD as well, and that it works locally too (on my ZCU102).

@rgetz
Copy link
Contributor

rgetz commented Nov 28, 2023

Ok - thanks - would hold off on merge until you confirm older setups for compatibility.

Might also want to check with https://github.com/f4exb/sdrangel - there are alot of pluto users that use that. I have not tried it with the compat layers yet.

The network backend should be named 'ip', for three reasons:

- iio_has_backend() always used "ip" as the identifier for the network
  backend, even in the v0.x API; instead of having to add a workaround
  in the compatibility layer, it's better to just rename the backend.

- the network backend was the only one whose URI did not contain the
  backend name.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
@pcercuei
Copy link
Contributor Author

I pushed an extra fix, and with that, all combinations work:

  • iio-oscilloscope with v0.25 libiio on PC + v0.25 IIOD/Libiio on remote (this obviously works)
  • iio-oscilloscope with v0.25 libiio on PC + v1.0 IIOD/Libiio on remote,
  • iio-oscilloscope with v1.0 libiio on PC through the compat layer + v0.25 IIOD/Libiio on remote,
  • iio-oscilloscope with v1.0 libiio on PC through the compat layer + v1.0 IIOD/Libiio on remote.

@pcercuei
Copy link
Contributor Author

Tested iio-osc with the compat layer on top of Libiio v1.0, with the local backend, on a ZCU102. Worked perfectly.

@rgetz
Copy link
Contributor

rgetz commented Nov 29, 2023

Not to add to your testing - but I assume you were using ip: context, not usb: or serial: ? (osc should support all).

@pcercuei
Copy link
Contributor Author

pcercuei commented Dec 1, 2023

Not to add to your testing - but I assume you were using ip: context, not usb: or serial: ? (osc should support all).

Provided that #1092 is merged too, the above four combinations are supported on all backends.

@rgetz
Copy link
Contributor

rgetz commented Dec 1, 2023

Provided that #1092 is merged too, the above four combinations are supported on all backends.

Thanks for testing. (and I'm sort of glad you found things to fix because of it :) )

@pcercuei pcercuei merged commit a11524a into main Dec 4, 2023
24 checks passed
@pcercuei pcercuei deleted the pcercuei/iiod-rw-all-attrs branch December 4, 2023 12:03
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