Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to bring shell builtin into QNX 6.6 QT 5.3.1
Forum Updated to NodeBB v4.3 + New Features

how to bring shell builtin into QNX 6.6 QT 5.3.1

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 1.1k 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.
  • M Offline
    M Offline
    mike scott
    wrote on last edited by
    #1

    Hi QT,

       qnx sdp 6.6,
       BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
       beaglebone black Rev. C
       QT 5.3.1
    

    I asked the same question in http://community.qnx.com/sf/discussion/do/listPosts/projects.qt/discussion.general.topc27634

    but didn't get answer from QNX. Please help, thanks in advance.

    I implemented a QT program similar to https://evileg.com/en/post/261/

    input filesystem command such as "ls", which will list the files under current directory. and "pwd" will show the
    current directory path. "ls" / "pwd" and lots of other commands are available @ /opt/qnx660/target/qnx6/armle-v7/bin,
    however there is no "cd" since 'cd' is a shell builtin.

    Please advise how I can bring the shell environment into this QT program, in which then I am able to use "cd" to
    change directories.

    Thanks in advance

    Mike

    aha_1980A 1 Reply Last reply
    0
    • M mike scott

      Hi QT,

         qnx sdp 6.6,
         BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
         beaglebone black Rev. C
         QT 5.3.1
      

      I asked the same question in http://community.qnx.com/sf/discussion/do/listPosts/projects.qt/discussion.general.topc27634

      but didn't get answer from QNX. Please help, thanks in advance.

      I implemented a QT program similar to https://evileg.com/en/post/261/

      input filesystem command such as "ls", which will list the files under current directory. and "pwd" will show the
      current directory path. "ls" / "pwd" and lots of other commands are available @ /opt/qnx660/target/qnx6/armle-v7/bin,
      however there is no "cd" since 'cd' is a shell builtin.

      Please advise how I can bring the shell environment into this QT program, in which then I am able to use "cd" to
      change directories.

      Thanks in advance

      Mike

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mike-scott

      in that case, the command is the shells name, and cd is the first parameter.

      I wonder however, what you really want to achive. Usually, API functions are used for such tasks.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by
        #3

        QNX supports the standard clib functions to modify the current process environment.

        See https://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/c/chdir.html

        M 1 Reply Last reply
        0
        • Kent-DorfmanK Kent-Dorfman

          QNX supports the standard clib functions to modify the current process environment.

          See https://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/c/chdir.html

          M Offline
          M Offline
          mike scott
          wrote on last edited by
          #4

          Hi aha_1980,

          Thank you all for the suggestions. However, the problem is not that simple.

          I actually plan to run myown-built elf (arm executable file) beyond file system commands of "ls"/"cd"/"pwd". For example, "./myblinky" will blinky the LEDs on the device board from putty terminal, however, there is nothing happening on this platform.

          On the other side, FFT program, which generates a sine wave and then computes FFT results. works well from both putty terminal and this platform.

          notice myblinky includes

          #include <sys/mman.h>
          #include <hw/inout.h>
          #include <arm/am335x.h>
          #include <sys/iofunc.h>
          #include <sys/dispatch.h>

          gpio_base = mmap_device_memory(0, AM335X_GPIO_SIZE, PROT_READ | PROT_WRITE | PROT_NOCACHE, 0, AM335X_GPIO1_BASE);

          while FFT just arithmetic calculation.

          please advise, thanks in advance

          Mike

          jsulmJ 1 Reply Last reply
          0
          • M mike scott

            Hi aha_1980,

            Thank you all for the suggestions. However, the problem is not that simple.

            I actually plan to run myown-built elf (arm executable file) beyond file system commands of "ls"/"cd"/"pwd". For example, "./myblinky" will blinky the LEDs on the device board from putty terminal, however, there is nothing happening on this platform.

            On the other side, FFT program, which generates a sine wave and then computes FFT results. works well from both putty terminal and this platform.

            notice myblinky includes

            #include <sys/mman.h>
            #include <hw/inout.h>
            #include <arm/am335x.h>
            #include <sys/iofunc.h>
            #include <sys/dispatch.h>

            gpio_base = mmap_device_memory(0, AM335X_GPIO_SIZE, PROT_READ | PROT_WRITE | PROT_NOCACHE, 0, AM335X_GPIO1_BASE);

            while FFT just arithmetic calculation.

            please advise, thanks in advance

            Mike

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

            @mike-scott As @aha_1980 said you will need to call the shell itself with the build in command as parameter. Like

            "sh -c cp..."
            

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

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

              Hi,

              Did you check whether you need specific user rights to access the GPIO device ? On *nix system, especially on embedded system, it's not unusual that standard users don't have access to any device. Most of the time, you have to be part of a group to access them.

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

              1 Reply Last reply
              2
              • jsulmJ jsulm

                @mike-scott As @aha_1980 said you will need to call the shell itself with the build in command as parameter. Like

                "sh -c cp..."
                
                M Offline
                M Offline
                mike scott
                wrote on last edited by
                #7

                @jsulm

                I can run

                /bin/sh -c ls
                /bin/sh -c ./testFFT

                however, still not working with following,

                /bin/sh -c cd ..
                /bin/sh -c ./myblinky

                Please advise. Thx

                Kent-DorfmanK 1 Reply Last reply
                0
                • M mike scott

                  @jsulm

                  I can run

                  /bin/sh -c ls
                  /bin/sh -c ./testFFT

                  however, still not working with following,

                  /bin/sh -c cd ..
                  /bin/sh -c ./myblinky

                  Please advise. Thx

                  Kent-DorfmanK Offline
                  Kent-DorfmanK Offline
                  Kent-Dorfman
                  wrote on last edited by
                  #8

                  @mike-scott

                  when you call sh from within your program the changes only affect the child shell environment, not the parent environment. you MUST call the native clib chdir() in your program to change the working directory.

                  1 Reply Last reply
                  2

                  • Login

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