I want to write code in my laptop by just using gpiomem to control the GPIO, is it possible to bring /dev/gpiomem to local, just like sshfs dose ?


I want to use go-rpio to control the GPIO, it require /dev/gpiomem or /dev/mem and /proc/device-tree/soc/ranges.

I want to map these device/file to my laptop, so I can run the program from my laptop, it's why better than using sshfs mount pi's folder to local edit and run from pi.

Current I use sshfs like this

sshfs -o sshfs_sync,sync_readdir,reconnect,follow_symlinks root@pi:/ pi

/proc/device-tree/soc/ranges is accessible, but

$ head pi/dev/gpiomem
head: error reading 'pi/dev/gpiomem': Operation not permitted
$ head pi/dev/mem
head: error reading 'pi/dev/mem': Operation not permitted

so, is there any way to map pi's /dev/mem or /dev/gpio to local ?


1 Answer 1


My pigpio lets you control the GPIO of one or more Pis from your laptop.

Your Python script talks over the network to the pigpio daemon which needs to be running on the Pis. You can write C programs as well if your laptop is Linux.

The pigpio daemon uses /dev/mem rather than /dev/gpiomem (it allows access to more than just the GPIO).

Alternatively you could just launch a command on the Pi with ssh.

ssh pi@raspberry command

  • I try to use go-rpio from my Mac, currently I sshfs code to edit from my laptop, go-rpio need gpiomem or mem and ranges, ranges is ok, but gpiomem and mem are not permitted from sshfs.
    – wener
    Apr 9, 2016 at 8:08
  • @wener I suggest that information is important enough to be edited into your question as it may affect the answers you get.
    – joan
    Apr 9, 2016 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.