On Thu, 4 Mar 2021 21:48:25 +0100 Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > On Thu, Mar 4, 2021 at 5:00 PM Bastien Nocera <hadess@xxxxxxxxxx> wrote: > > > If I'm not mistaken, "-a" does that for the iio_generic_buffer tool. > > Yeah I implemented that, and I thought about doing the same here > but ... the name of the tool sort of announce that one want to > listen to all events so I thought it should just default-enable > all of them in this case. > > > Maybe moving enable_disable_all_channels() to a common location and > > using that would cut down on the duplicated code? > > The event enablement is slightly different, the generic buffer > turns on various channels, which is conceptually different > from various events, but let's see what Jonathan says. > > We are sharing most of the code already in the iio-utils.c > but I can try to break out more if it doesn't get to abstract. Sadly this doesn't work for many devices. It is a common thing for hardware to only support a much smaller set of event monitoring registers / threshold detectors than the number of channels. In many cases we handle that by working on a fifo basis. So what this will do is enable a bunch of events which will then be replaced by later events - end result some random event will be enabled (or maybe 2 of them across N channels) Not intuitive at all :( I'm fine with it being controlled by a parameter though if that works for you. Docs should explain it doesn't always result in all events being enabled however if the hardware is not capable of doing that. Jonathan > > Thanks Bastien, > Linus Walleij