Re: [libgpiod] gpiod_line_get_value_bulk may be broken?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 05, 2023 at 11:55:44PM +0100, andy pugh wrote:
> On Sat, 29 Jul 2023 at 03:03, Kent Gibson <warthog618@xxxxxxxxx> wrote:
> 
> > > Unfortunately I won't know what chip the line is on, but I have
> > > already considered that and plan to have an array of structs
> > > containing the "bulk" and the "chip" for each chip that is needed
> > > according to the IO line list submitted by the (pesky!) users.
> > >
> >
> > So the IO lines are specified by name?
> 
> Yes, they are.
> 
> Before I go too far down the wrong path, it has occurred to me that I
> probably can't allow the lines to go out of scope?
> 
> ie, this (pseudocode) won't work
> 
> for each lineName in lineList
>     temp_line = gpiod_chip_find_line(chip, lineName)
>     gpiod_line_bulk_add(&bulk, temp_line);
> next
> 
> As each line in the bulk will actually point to the same (last found) line?
> Or am I missing a subtlety?
> 

This pseudocode is fine, as the gpiod_chip_find_line() returns a new
gpiod_line object for each line, and that is passed to the bulk.
So they are definitely not using the same gpiod_line object.

That pseudocode is essentially what gpiod_chip_find_lines() does too,
though that requires all the lines being on the same chip, and I assume
you have a separate bulk for each chip, so there is more going on in the
loop than you show.

And I maintain that the wrong path here is to use v1, rather than v2.
So v2 is absolutely not an option?

Cheers,
Kent.



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux