PiGPIO Library frustrating issue

Hi Everyone,

I’m currently using UBogun/Xojo-pigpio (GitHub - UBogun/Xojo-pigpio: A Xojo library for pigpio features in Raspberry Pi projects) Library in order to access PiGPIO (abyz.me.uk/rpi/pigpio).

It works really well but I have a frustrating problem I just can’t solve.

I haven’t used the WiringPi Library or the WiringPiXojo module due to the author withdrawing support.

As I’ve created a desktop app I need to run my App using

sudo ./GPIOTest

this elevates the privileges so that the app can use the library. This works! However it breaks something else. I have used some fonts in the app that have been installed on the Pi (in the .fonts folder) and rebuilt the font cache. As these are installed in the Pi user folder it seems the app cannot access the fonts when in elevated ‘mode’.

There is another way to allow apps to use external libraries (without running elevated) which is mentioned in this article: GPIO — Xojo documentation which says that:

Or set the environment variable before starting the app from the command line:

export WIRINGPI_GPIOMEM=1 ./WiringPi-UI

Obviously these lines are relevant to WiringPi and not PiGPIO. For the life of me I can’t figure out what the PiGPIO version would look like.

Any assistance/advice would be gratefully received, I’ve been trying to resolve this for days.

cheers

Ian

When running from sudo, is it looking at “/root/.fonts” rather than “/home//.fonts”? Sounds like PiGPIO has the ability to run in daemon mode with “sudo pigpiod” and then you can access the socket it creates at normal permission levels. I haven’t played with PiGPIO much yet so I am not sure how to implement it. I will probably be switching to this instead of wiringPi so hopefully I can figure it out and get back to you.

Woohoo!

Thanks Alex that did the trick.

Kinda obvious when you think about it but took someone brighter than me to point it out.

Yes, running with sudo runs as root so putting the fonts in /root/.fonts made it work fine. For completeness if anyone else has this issue then I ran the GUI File Manager using

sudo pcmanfm

as I need elevated privileges in order to do anything in the root folder, then created a .fonts folder, copied the font files over and it just worked.

Thanks again Alex

Ian

[quote=488336:@Ian Marshall]Woohoo!

Thanks Alex that did the trick.

Kinda obvious when you think about it but took someone brighter than me to point it out.

Yes, running with sudo runs as root so putting the fonts in /root/.fonts made it work fine. For completeness if anyone else has this issue then I ran the GUI File Manager using

sudo pcmanfm

as I need elevated privileges in order to do anything in the root folder, then created a .fonts folder, copied the font files over and it just worked.

Thanks again Alex

Ian[/quote]

I have been battling Raspberry Pi quirks for a while now, any time I can help someone not go through what I did is a win.

There is also another implementation for pigpio which is based on the link in the first post.

https://github.com/eugenedakin/pigpio-GPIO

I will probably buy his book and and see if I can save myself a lot of time…

[quote=495268:@Niels de Boer]There is also another implementation for pigpio which is based on the link in the first post.

https://github.com/eugenedakin/pigpio-GPIO

I will probably buy his book and and see if I can save myself a lot of time…[/quote]

The book is extremely well detailed - if have any interest in electronics generally and how to leverage the Pi to grow that interest practically then I would recommend you buy his book.