how to bring shell builtin into QNX 6.6 QT 5.3.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
-
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
-
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
-
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
-
@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..."
-
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.
-
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.