Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Debug application as sudo ?
Alan B last edited by Alan B
I am developing an application which uses the pigpio library and so needs to run as sudo in order to gain permission to the GPIO pins. Is there a way to run from the debugger in this mode?
@Alan-B Did you try to start debugger with sudo?
JonB last edited by
I know nothing about GPIO, pins or otherwise!
But is it worth reading, say, https://raspberrypi.stackexchange.com/questions/40105/access-gpio-pins-without-root-no-access-to-dev-mem-try-running-as-root ? Suggestions like making your non-sudo user a member of
gpiogroup to allow access?
@jsulm I added the '-e sudo' option to Tools | Options | Environment | System | Terminal but still no joy.
Also, pi appears to already be a member of the gpio group so I'm a bit stumped as to what to try next.
@Alan-B Did you check what is the group of the device file for gpio is (I don't know how that /dev/* file is called)? Also, check whether this group actually has read/write access to the device file.
@jsulm if I run 'ls -l /dev/gp*' I get the following:
crw-rw---- 1 root gpio 254, 0 Mar 22 12:57 /dev/gpiochip0
crw-rw---- 1 root gpio 254, 1 Mar 22 12:57 /dev/gpiochip1
crw-rw---- 1 root gpio 246, 0 Mar 22 12:57 /dev/gpiomem
As far as I know, access to these should allow access to the gpio. 'members gpio' returns pi, so pi is definitely a member of the gpio group and that group appears to have rw access according to the above output.
@Alan-B You definitely can't access gpio without sudo?
KroMignon last edited by KroMignon
'members gpio' returns pi, so pi is definitely a member of the gpio group and that group appears to have rw access according to the above output.
With which user did you start your application? Are you sure you are using
@KroMignon I only have 1 account on the pi so it has to be that one. I am remote debugging from a Linux machine using ssh, connecting using the default 'pi' user account.
Finally cracked it!
Not sure if it's the best/easiest way but it works.
- SSH into remote pi and issue this command : sudo gdbserver localhost:10000 appname
- In Creator select Debug | Start Debugging | Attach to Running Debug Server. Enter Server = 10000 and select Local Executable file.
Hit OK and debugging runs as normal but with sudo privileges.