memory mapping using /dev/mem versus /dev/gpiomem ?
Per doc /dev/mem usage requires "root" "privileges.
Also per doc /dev/gpiomem no "root privileges " are necessary since "Linux will take care of privileges". I am not sure my complier is smart enough to stop me from opening the /dev/mem if my app has no root privileges. My app does not fully run so at this point I do not know that. For now I can open both /dev/mem and /dev/gpiomem. Since it appears that I can use both , therefore my question to the forum is which /dev is more appropriate to use to access RPi hardware. |
/dev/gpiomem
It is your program which decides to use which /dev/xxx. There is no automatic choice. Unless you use some development library or framework and have not told us. Libraries often offer functions which encapsulate access to /dev/xxx. So you don't see which device is used. IIRC Python offers a library with functions to read/write GPIO. It doesn't tell you, but if /dev/gpiomem is available it uses /dev/gpiomem. If it is not available it reverts to /dev/mem and you need to run the program with root privileges. Not 100%, I access GPIO with Tcl. jlinkels |
All times are GMT -5. The time now is 07:01 PM. |