Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. gpio error
Forum Updated to NodeBB v4.3 + New Features

gpio error

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
16 Posts 4 Posters 1.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by
    #2

    I suggest you to use pigpio or wiringpi library in order to manage raspberry pi gpios.

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    1 Reply Last reply
    1
    • T Offline
      T Offline
      tinashe
      wrote on last edited by
      #3

      Thanks mrdebug
      but i do not think it will work because i tried the following
      code since /dev/gpiomem does not need root permission
      int fd = open("/dev/gpiomem", O_RDONLY) ;

      if (fd == -1) {

         qDebug()<<"Unable to open /dev/gpiomem";
        exit(1);
      

      }
      else{

        qDebug()<< "gpio /dev/gpiomem";
      

      }
      and still unable to access the file

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Hi,

        Since you are using Emeria.os, you should ask their folks on whether these GPIO's are accessible and if so, how.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        T 1 Reply Last reply
        0
        • T Offline
          T Offline
          tinashe
          wrote on last edited by tinashe
          #5
          This post is deleted!
          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Since you are using Emeria.os, you should ask their folks on whether these GPIO's are accessible and if so, how.

            T Offline
            T Offline
            tinashe
            wrote on last edited by
            #6

            @SGaist
            thank you for the reply
            Sorry its Emteria.os
            i was told to
            the gpios are accessable
            Make sure those files are accessible from your application. Check Linux file permissions. and how do i check for these permissions?

            jsulmJ 1 Reply Last reply
            0
            • T tinashe

              @SGaist
              thank you for the reply
              Sorry its Emteria.os
              i was told to
              the gpios are accessable
              Make sure those files are accessible from your application. Check Linux file permissions. and how do i check for these permissions?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @tinashe said in gpio error:

              and how do i check for these permissions?

              ls -lh /sys/class/gpio/unexport
              

              You should read about UNIX/Linux basics.
              To get access for the group your user is in:

              chmod g+rw /sys/class/gpio/unexport
              

              For user

              chmod u+rw /sys/class/gpio/unexport
              

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              T 2 Replies Last reply
              0
              • jsulmJ jsulm

                @tinashe said in gpio error:

                and how do i check for these permissions?

                ls -lh /sys/class/gpio/unexport
                

                You should read about UNIX/Linux basics.
                To get access for the group your user is in:

                chmod g+rw /sys/class/gpio/unexport
                

                For user

                chmod u+rw /sys/class/gpio/unexport
                
                T Offline
                T Offline
                tinashe
                wrote on last edited by
                #8

                @jsulm
                thank you very much
                how do i run this in my main file or c++ file because i have seen these commands run in cmd terminal.

                jsulmJ T 2 Replies Last reply
                0
                • T tinashe

                  @jsulm
                  thank you very much
                  how do i run this in my main file or c++ file because i have seen these commands run in cmd terminal.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  @tinashe said in gpio error:

                  how do i run this in my main file or c++ file because i have seen these commands run in cmd terminal

                  Why do you want to do it in your app? Just do it once in a terminal...
                  The commands I provided to set access rights need root access (via sudo for example):

                  sudo chmod g+rw /sys/class/gpio/unexport
                  

                  So, your app will not be able to do this.
                  But you should really check how access rights are handled in Emteria.os

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  T 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @tinashe said in gpio error:

                    and how do i check for these permissions?

                    ls -lh /sys/class/gpio/unexport
                    

                    You should read about UNIX/Linux basics.
                    To get access for the group your user is in:

                    chmod g+rw /sys/class/gpio/unexport
                    

                    For user

                    chmod u+rw /sys/class/gpio/unexport
                    
                    T Offline
                    T Offline
                    tinashe
                    wrote on last edited by
                    #10

                    @jsulm said in gpio error:

                    For user
                    unfortunately i can not do it on the terminal.
                    or can i do this in the cmd.txt found in boot folder?

                    1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @tinashe said in gpio error:

                      how do i run this in my main file or c++ file because i have seen these commands run in cmd terminal

                      Why do you want to do it in your app? Just do it once in a terminal...
                      The commands I provided to set access rights need root access (via sudo for example):

                      sudo chmod g+rw /sys/class/gpio/unexport
                      

                      So, your app will not be able to do this.
                      But you should really check how access rights are handled in Emteria.os

                      T Offline
                      T Offline
                      tinashe
                      wrote on last edited by
                      #11

                      @jsulm
                      unfortunately the ssh server is locked for demo which am using currently

                      jsulmJ 1 Reply Last reply
                      0
                      • T tinashe

                        @jsulm
                        unfortunately the ssh server is locked for demo which am using currently

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @tinashe See "man 2 chmod".
                        But most probably your user will need to start the app as root (sudo for example).

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        T 1 Reply Last reply
                        0
                        • T tinashe

                          @jsulm
                          thank you very much
                          how do i run this in my main file or c++ file because i have seen these commands run in cmd terminal.

                          T Offline
                          T Offline
                          tinashe
                          wrote on last edited by
                          #13

                          @tinashe

                          i was told to do permission seeting in /data/init.d

                          1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @tinashe See "man 2 chmod".
                            But most probably your user will need to start the app as root (sudo for example).

                            T Offline
                            T Offline
                            tinashe
                            wrote on last edited by
                            #14

                            @jsulm
                            chmod g+rw /sys/class/gpio/unexport
                            cd /etc/udev/rules.d/
                            touch local.rules
                            ACTION=="add", KERNEL=="gpio", MODE="0666"
                            and did notwork

                            jsulmJ 1 Reply Last reply
                            0
                            • T tinashe

                              @jsulm
                              chmod g+rw /sys/class/gpio/unexport
                              cd /etc/udev/rules.d/
                              touch local.rules
                              ACTION=="add", KERNEL=="gpio", MODE="0666"
                              and did notwork

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #15

                              @tinashe This does not have anything to do with Qt now, please find out how to do this with Linux.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              T 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @tinashe This does not have anything to do with Qt now, please find out how to do this with Linux.

                                T Offline
                                T Offline
                                tinashe
                                wrote on last edited by
                                #16

                                @jsulm
                                thank you very much will do that

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved