On Sat, Aug 06, 2022 at 12:12:31PM +0200, Andy Shevchenko wrote: > On Fri, Aug 5, 2022 at 1:17 PM Robert Baumgartner <rbaumgar@xxxxxxxxxx> wrote: > > > > Hi team, > > > > I try to migrate some python scripts for my Raspberry from RPi.GPIO to > > libgpiod, > > This is great and everyone should be encouraged to follow your example! > > > but I miss PWM features. > > Do I miss something? Or is it not available? > > No, you haven't missed anything except Unix ideology. That ideology is > telling us that one tool for one thing, and in very featurable mode. > That said, lingpiod is exclusively for GPIO ABI between kernel and > user space. For PWM you need to access the PWM ABI in a way how it's > represented by the Linux kernel. I believe there are plenty of > libraries more or less okayish for that purpose, but I never heard > about any official library and/or Python bindings for it. > I'm assuming Robert is refering to software PWM. AFAIAA Rpi.GPIO doesn't support hardware PWM, and the referenced article also refers to software PWM for the Python case. libgpiod doesn't directly support software PWM, but it is fairly straight forward to implement yourself using libgpiod. Separate from Andy's point on Unix ideology, adding it to libgpiod would involve threading or async, which in C would open cans of worms that are best left to the specific application to decide on. So I don't see it ever going into the core libgpiod. Not such an issue for Python with its included batteries, so I would personally consider adding something along those lines to the Python bindings, and possibly the Rust as well. OTOH I suspect Bart's preference is for the bindings to idiomatically wrap, not extend, the libgpiod API. Cheers, Kent.