Re: Need help with libgpiod gpiod_line_request_both_edges_events()

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

 



2018-03-06 16:11 GMT+01:00 Timur Tabi <timur@xxxxxxxxxxxxxx>:
> On 03/06/2018 01:46 AM, Bartosz Gołaszewski wrote:
>>
>> What is the error code (errno) after this function fails? Could you
>> share some code?
>
>
> EBUSY (16)
>
> However, strace shows that it never makes any library calls before it
> returns failure, so I'm not sure if that's accurate.
>
> write(1, "Top of loop\n", 12)           = 12
> ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0xb4, 0x04, 0x30), 0xffffe5c13270) = 0
> ioctl(3, GPIO_GET_LINEINFO_IOCTL, 0xffffe5c131c8) = 0
> ppoll([{fd=5, events=POLLIN|POLLPRI}], 1, {1, 0}, NULL, 8) = 1 ([{fd=5,
> revents=POLLIN}], left {0, 999996750})
> write(1, "Top of loop\n", 12)           = 12
> write(1, "Error: Could not create event (e"..., 41) = 41
>
> I've attached the source code.  I release the line before calling
> gpiod_line_request_both_edges_events, so I know it's free.
>
>
> --
> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
> Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
> Code Aurora Forum, a Linux Foundation Collaborative Project.

You need to call gpiod_line_request_both_edges_events() only once -
instead you call it within a while loop for already taken lines.

In your strace output gpiod_line_request_both_edges_events() returned
0 (the internal ioctl() returned 0) and then you even start polling
for event and the call to ppoll() returns an event on file descriptor
#5. Next iteration you bail out from gpiod_line_request_bulk() (called
indirectly by gpiod_line_request_both_edges_events()) where we check
if the line is busy.

-- 
Best regards,
Bartosz Golaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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