2018-03-06 21:49 GMT+01:00 Timur Tabi <timur@xxxxxxxxxxxxxx>: > On 03/06/2018 01:30 PM, Timur Tabi wrote: >> >> >> Never mind, I figured it out. I was passing the wrong parameter to >> pthread_create(). Everything works now. >> >> Thanks for all your help. libgpiod makes a lot more sense to me now. > > > So I found one small oddity. > > When I start the interrupt test, the output pin is set to 1, and therefore > the input pin is also set to 1 since they're wired together. > > It appears that gpiod_line_event_wait() is receiving a rising-edge event > when I call gpiod_line_set_value(..., 1). That is, the input is reading 1, > and it is still set to 1, but I get a rising event anyway. > This is normal, you're generating an interrupt anyway. > At one point, I told it to write a 0 to output, and I still got a rising > event: > This isn't normal - do you have an strace output for that? We need to figure out if it's something in libgpiod or in the kernel. > Oscillate thread started > Initial input value: 1 > Setting output to 0 > Received rising edge event, value=0, elapsed=-0.000204s > > And it apparently went backwards in time. > > What happens in this scenario: > > 1. gpiod_line_request_both_edges_events() is called > 2. GPIO line transitions from 0 to 1 > 3. gpiod_line_event_wait() is called > Is it possible that this event was queued in the kernel buffer and that you actually read one of the previous events? > Will gpiod_line_event_wait() return immediately, or will it wait until the > next transition? > It will return immediately if there's an unread event pending. > > -- > 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. -- 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