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.9k 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.
  • T Offline
    T Offline
    tinashe
    wrote on 11 May 2020, 12:05 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 May 2020, 12:16 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 11 May 2020, 13:34
      0
      • T Offline
        T Offline
        tinashe
        wrote on 11 May 2020, 13:06 last edited by tinashe 5 Nov 2020, 13:14
        #5
        This post is deleted!
        1 Reply Last reply
        0
        • S SGaist
          11 May 2020, 12:16

          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 11 May 2020, 13:34 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?

          J 1 Reply Last reply 11 May 2020, 13:37
          0
          • T tinashe
            11 May 2020, 13:34

            @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?

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 11 May 2020, 13:37 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 11 May 2020, 14:45
            0
            • J jsulm
              11 May 2020, 13:37

              @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 11 May 2020, 14:45 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.

              J T 2 Replies Last reply 11 May 2020, 14:52
              0
              • T tinashe
                11 May 2020, 14:45

                @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.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 11 May 2020, 14:52 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 11 May 2020, 15:10
                0
                • J jsulm
                  11 May 2020, 13:37

                  @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 11 May 2020, 14:56 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
                  • J jsulm
                    11 May 2020, 14:52

                    @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 11 May 2020, 15:10 last edited by
                    #11

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

                    J 1 Reply Last reply 12 May 2020, 06:34
                    0
                    • T tinashe
                      11 May 2020, 15:10

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

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 12 May 2020, 06:34 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 12 May 2020, 07:55
                      0
                      • T tinashe
                        11 May 2020, 14:45

                        @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 12 May 2020, 07:25 last edited by
                        #13

                        @tinashe

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

                        1 Reply Last reply
                        0
                        • J jsulm
                          12 May 2020, 06:34

                          @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 12 May 2020, 07:55 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

                          J 1 Reply Last reply 12 May 2020, 08:43
                          0
                          • T tinashe
                            12 May 2020, 07:55

                            @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

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 12 May 2020, 08:43 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 12 May 2020, 09:25
                            0
                            • J jsulm
                              12 May 2020, 08:43

                              @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 12 May 2020, 09:25 last edited by
                              #16

                              @jsulm
                              thank you very much will do that

                              1 Reply Last reply
                              0

                              12/16

                              12 May 2020, 06:34

                              • Login

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