Coder Social home page Coder Social logo

Comments (2)

brgl avatar brgl commented on August 25, 2024

Hi! Can you try the following patch?

Scratch that. Actually it doesn't make sense. The order in which settings are added affects the order of offsets in the resulting request. This bit is missing from python docs but the core C library mentions it:

When calling ::gpiod_chip_request_lines, the library will request all
offsets that were assigned settings in the order that they were assigned.
If any of the offsets was duplicated, the last one will take precedence.

from libgpiod.

dex6 avatar dex6 commented on August 25, 2024

Yeah, that patch does not make sense; and it makes things even worse. In my case 4 lines initially have identical configuration, so my request dict actually mixes integer and tuple keys. But unlike py2, python 3 loudly refuses to sort objects of different types... So the only way would probably require sorting resulting _ext.LineConfig that goes to the C library/kernel, but that probably will break other things. Agreed improving docs is best what can be done in gpiod here.

I'll switch my script to integer-keys-only dicts, sorted before passing to gpiod. Hmm... Leaving original request_lines config dict around, and then updating it in-place before passing again to reconfigure_lines, also seems like a possible option.

Thanks for quick help and your work on the gpiod library!

from libgpiod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.