0

I browsed most of that litterature already and the kernel side of it is very much covered, understood and assimilated.

However my question is basically: How can I be alerted, for example through a callback function, when an interruption occurs in the kernel space and my daemon lives in userspace.

IRQ Occuring -------> Upper half of the interrupt(put the timestamp in the buffer) ---------> Lower half of the interrupt handler (read data and adds the timestamp in the buffer) -----------> ???? userspace daemon (async callback of some description) that will write a log on the HD.

I have everything up to the daemon part written and working, I seem to understand that through libiio you can assign a trigger to a particular channel or attribute but that is where I get stuck.

Litterature on the libiio (most notably its wiki) has a chapter on triggers that is 4 lines long ... not very helpful to say the least.

iioinfo lists the devices present in the LSM6DSLTR (18 devices including two triggers) and I have been unable to assign the triggers to any device that they are not assigned to already (No such file or directory) which I gather refer to the absence of the trigger directory in the sysfs for that particular device.

I also gather that the sysfs directory is, of course, slave to the kernel device tree and that the creation of that part of the device tree is made as the driver is loaded.

So there must be a way to alter that part of the sysfs filesystem by asking the kernel driver to provision a device in the context to implement the trigger directory so we can assign a trigger to it

second part will be to slave that trigger to an actual IRQ (42 in my case - as listed in /proc/interrupts) and be alerted in the userspace daemon when a thresold has been reached in terms of either acceleration or vibration ...

Well, this is the nuts and bolts of what I am trying to achieve. the last part will be to write a few registers on the chip to configure how and when IRQ will occur for any given integrated devices.

  • 1
    Simplest is to implement a read. User space can block on read call or use aio for async. Put your program logic in user space. Kernel should not be initiating actions except in response to user space requests. – stark Jul 30 '21 at 11:49
  • 1
    You are absolutely right. Turns out that the LSM6DSLTR driver doesn’t provide any hooks in its driver for libiio to hook up onto so triggers can not be assigned IRQ in any case – Patrick Regnouf Jul 31 '21 at 12:17

0 Answers0