LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 05-20-2018, 02:34 PM   #1
Jim232
Member
 
Registered: Apr 2018
Posts: 53

Rep: Reputation: Disabled
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.
 
Old 05-20-2018, 04:13 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
/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
 
  


Reply

Tags
/dev/mapper



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Stupidly ran "cat /dev/urandom > /dev/mem", worried I broke firmware crosstalk Linux - Hardware 2 10-25-2010 05:27 PM
What would happen if I where to cat /dev/mem > /dev/null Joey.Dale Linux - General 11 07-26-2009 12:46 PM
[SOLVED] wiping HDD using /dev/urandom versus /dev/zero, a theoretical question H_TeXMeX_H Linux - General 6 06-29-2009 06:55 AM
using flash drive changes device /dev/sr0 to /dev/sr1 for mapping to /dev/pktcdvd/0? lugoteehalt Linux - Software 3 10-24-2007 10:27 AM
Startx Permission problems on /dev/null and /dev/mem on freshly compiled 2.6.22.1 Eric_Cartman Linux - Kernel 2 09-09-2007 01:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 05:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration