All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Can't find trigger_now for sysfs-based triggering
@ 2021-06-12 16:43 William Huang
  2021-06-13 11:18 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: William Huang @ 2021-06-12 16:43 UTC (permalink / raw)
  To: linux-iio

Hi everyone,

I hope this is the right place to ask my noob question.
I'm trying to learn how to write an IIO driver and using a couple
books as my resource. I managed to write a simple one and perform
oneshot-based data reads (e.g. cat iio:device0/in_temp_raw).

Now, I'm trying to set up a trigger-buffered data read. I believe I
set up the triggers correctly:
cat trigger0/name > iio:device0/trigger/current_trigger
echo 1 > iio:device0/scan_elements/in_temp_en
echo 1 > iio:device0/buffer/enable
cat /dev/iio\:device0 | xxd -

Now, I'm not understanding how I should actually perform the trigger.
From my books, there should be a trigger_now file where I can echo 1
to trigger, but it's not available in my trigger0/ directory. Also,
the book references a add_trigger in /sys/devices/iio_sysfs_trigger/
directory, but that's nowhere to be found as well.

My .config also has CONFIG_IIO_SYSFS_TRIGGER=m.

Any help/advice would be appreciated!

Thanks,
William Huang

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Can't find trigger_now for sysfs-based triggering
  2021-06-12 16:43 Can't find trigger_now for sysfs-based triggering William Huang
@ 2021-06-13 11:18 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2021-06-13 11:18 UTC (permalink / raw)
  To: William Huang; +Cc: linux-iio

On Sat, 12 Jun 2021 12:43:12 -0400
William Huang <whuang8933@gmail.com> wrote:

> Hi everyone,
> 
> I hope this is the right place to ask my noob question.
> I'm trying to learn how to write an IIO driver and using a couple
> books as my resource. I managed to write a simple one and perform
> oneshot-based data reads (e.g. cat iio:device0/in_temp_raw).
> 
> Now, I'm trying to set up a trigger-buffered data read. I believe I
> set up the triggers correctly:
> cat trigger0/name > iio:device0/trigger/current_trigger

Sounds like you have a trigger which is not a sysfs trigger
(probably dataready signal from some other sensor).

> echo 1 > iio:device0/scan_elements/in_temp_en
> echo 1 > iio:device0/buffer/enable
> cat /dev/iio\:device0 | xxd -
> 
> Now, I'm not understanding how I should actually perform the trigger.
> From my books, there should be a trigger_now file where I can echo 1
> to trigger, but it's not available in my trigger0/ directory. Also,
> the book references a add_trigger in /sys/devices/iio_sysfs_trigger/
> directory, but that's nowhere to be found as well.
> 
> My .config also has CONFIG_IIO_SYSFS_TRIGGER=m.

You will need to manually probe that module

modprobe iio-sysfs-trig

There is no simple way of autoloading that module as it's not associated
with any actual hardware.

Then you should find the /sys/devices/iio_sysfs_trigger/ directory and
can create a new instance of the sysfs trigger which should work as you
expect.

Jonathan
> 
> Any help/advice would be appreciated!
> 
> Thanks,
> William Huang


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-13 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-12 16:43 Can't find trigger_now for sysfs-based triggering William Huang
2021-06-13 11:18 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.