linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pedro Botella <pbotella@gmail.com>
To: linux-gpio@vger.kernel.org
Subject: [libgpiod] Bug in python binding when requesting output?
Date: Thu, 11 Feb 2021 21:54:22 +0100	[thread overview]
Message-ID: <CAJAEvhib-M-UQeoCDs+aex-hdE-vJSQk=C5B7z4A9WmR+JcxQQ@mail.gmail.com> (raw)

Hi,

I'm experiencing what I think is a bug in the python bindings for libgpiod.
I believe a line.request with type gpiod.LINE_REQ_DIR_OUT always
results in that line being set to '0'.
To reproduce:
1. request a line with type gpiod.LINE_REQ_DIR_OUT
2. set the line to '1'
3. release the line
4. request the same line with type gpiod.LINE_REQ_DIR_OUT
5. get the value, it should now be '0'

I think the issue is in "gpiod_LineBulk_request" in
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/bindings/python/gpiodmodule.c
There a call to "gpiod_line_request_bulk" with default_vals being
passed as a pointer. Later on in the code, this parameter is checked
for NULL, if it is not NULL then the values in the array are used as
default_vals.
I believe that a NULL pointer should be passed instead if no
default_vals have been requested when doing a Line.request from
Python.

BR
Pedro

             reply	other threads:[~2021-02-11 20:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 20:54 Pedro Botella [this message]
2021-02-13  0:23 ` [libgpiod] Bug in python binding when requesting output? Kent Gibson
2021-02-15  8:15   ` Pedro Botella
2021-02-15  9:11     ` Kent Gibson
2021-02-15 11:33       ` Pedro Botella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJAEvhib-M-UQeoCDs+aex-hdE-vJSQk=C5B7z4A9WmR+JcxQQ@mail.gmail.com' \
    --to=pbotella@gmail.com \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).