Debug application as sudo ?
-
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?
-
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
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
gpio
group 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.
-
@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/gpiomemAs 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.
-
@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/gpiomemAs 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.
-
@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/gpiomemAs 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 said in Debug application as sudo ?:
'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
pi
account? -
@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.