Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

roboard GPIO ioperm permission linux

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
2 postsPage 1 of 1
2 postsPage 1 of 1

roboard GPIO ioperm permission linux

Post by jlmunix » Thu Apr 15, 2010 11:08 pm

Post by jlmunix
Thu Apr 15, 2010 11:08 pm

I want to use the GPIO ports of the Roboard without sudo command. So i decided to make a simple program to enable permissions to the ports.

Code: Select all
void main(void)
{
   int alm;
   iopl(3);
   if (ioperm(0x98, 3, 1))     //Set the permission to the port.
     {
        perror("ioperm");
        exit(1);
     }
}



If i run this program with sudo when i turn on the roboard, i will be able to use the ports from user speace without specifying the sudo command! It works (i tested)

But my question is, what´s up if i let all GPIO with write permission always? can i make a damage?

From here im enabled to R/W port with simple instruction:
Code: Select all
outportb(0x98, 0xff);
I want to use the GPIO ports of the Roboard without sudo command. So i decided to make a simple program to enable permissions to the ports.

Code: Select all
void main(void)
{
   int alm;
   iopl(3);
   if (ioperm(0x98, 3, 1))     //Set the permission to the port.
     {
        perror("ioperm");
        exit(1);
     }
}



If i run this program with sudo when i turn on the roboard, i will be able to use the ports from user speace without specifying the sudo command! It works (i tested)

But my question is, what´s up if i let all GPIO with write permission always? can i make a damage?

From here im enabled to R/W port with simple instruction:
Code: Select all
outportb(0x98, 0xff);
jlmunix
Newbie
Newbie
Posts: 4
Joined: Tue Mar 16, 2010 11:42 pm

Re: roboard GPIO ioperm permission linux

Post by roboard » Thu Apr 29, 2010 5:18 am

Post by roboard
Thu Apr 29, 2010 5:18 am

If only a single program uses GPIO, then it is no problem to let all GPIO with write permission always. If you want that multiple programs share GPIO simultaneously, you may need a Linux GPIO driver (unfortunately, such a driver does not exist currently).
If only a single program uses GPIO, then it is no problem to let all GPIO with write permission always. If you want that multiple programs share GPIO simultaneously, you may need a Linux GPIO driver (unfortunately, such a driver does not exist currently).
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am


2 postsPage 1 of 1
2 postsPage 1 of 1