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

Support IIO devices #43

Open
hadess opened this issue Nov 6, 2014 · 9 comments
Open

Support IIO devices #43

hadess opened this issue Nov 6, 2014 · 9 comments

Comments

@hadess
Copy link
Contributor

hadess commented Nov 6, 2014

This will be useful on tablets and phones to test for accelerometers, compasses, quaternion sensors, etc.

In particular, accelerometers will behave differently if they have a "trigger" or not, if they have scan_elements, etc.

@martinpitt
Copy link
Owner

I don't seem to have an IIO hardware (at least not on my ThinkPad X230 and on my Google Nexus 4 phone), so I can't investigate for myself what's missing here.

  • The /sys/ bits should certainly be ok, or is there something missing? How far do you get with detection if you umockdev-record such a device and recreate it in a testbed (umockdev-run)?
  • Do these devices have a /dev/ node? If so, do they need any particular ioctls which umockdev needs to learn? Or are these just normal char devices where you read/write from/to?

Some general info (umockdev-record dump, /dev structure, an open/read/write/ioctl/close strace what happens if some program talks to the device) would be appreciated. Thanks!

@dlech
Copy link
Contributor

dlech commented Aug 28, 2019

iio is bus instead of class (fixed by #94)

@martinpitt
Copy link
Owner

@dlech: Is that the only issue that keeps iio device emulation from working?

@dlech
Copy link
Contributor

dlech commented Sep 1, 2019

Probably. It doesn't use any ioctls that I know of. I haven't done anything fancy with it yet though.

@hadess
Copy link
Contributor Author

hadess commented Sep 2, 2019

Probably. It doesn't use any ioctls that I know of. I haven't done anything fancy with it yet though.

A way to manage the ring-buffers where the latest readouts are kept would be useful, but just being to instantiate the device is nice already.

@rgetz
Copy link

rgetz commented May 23, 2020

No, there are no ioctls in iio. You can emulate things with a "dummy" kernel device (if you want to compile your own kernel and check things out).

I just ran into umockdev - very cool.

This would be nice to use umockdev for validation automatic test of libiio - right now it's alot of manual testing when we make a release. Since libiio uses multiple backends (local, network, usb, serial), and iiod (which serve up local IIO devices to remote applications over USB or network), getting local working would be the most useful, but we eventually use all.

Since usb looks like it is more supported - I will start with there to get familiar with umockdev.

@hadess
Copy link
Contributor Author

hadess commented Jan 20, 2021

I've managed to make it work. It's not super easy, as I didn't want to rely on the ioctl() capture and replay, as it's not great for interactive tests.

It would be great if umockdev had some helper tools for that, something that could mock /dev devices which are just fancy data buffers (and which could mock -EAGAIN too).

See https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/317

@dlech
Copy link
Contributor

dlech commented Jan 20, 2021

A few years ago, I did some experimenting using libfuse to provide simulated sysfs devices - mainly to simulate returning errors like that. It looked promising but I didn't get very far with it.

@benzea
Copy link
Collaborator

benzea commented Jun 25, 2021

The SPI emulation from #125 could be a starting point now. In this case, my guess that custom code by using #132 might be better though. That can also mock -EAGAIN, it cannot mock poll state at this point though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants