Results 1 to 5 of 5
While working on an ARM based embedded system ( TS-TPC-7395 ARM Touch Panel Computer w/ 7-inch TFT-LCD and PoE ) I encountered something weired: there are a couple of commands: ...
- 10-28-2009 #1Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
commands works only through console on embedded ARM system
While working on an ARM based embedded system (TS-TPC-7395 ARM Touch Panel Computer w/ 7-inch TFT-LCD and PoE) I encountered something weired: there are a couple of commands: lcd_on, lcd_off in this system that are used to turn on and off the touch screen. The problem is I can only execute them in the shell through the console. If I try to use it via system("lcd_on") in a c program, I got:
I've checked $PATH, ~/.bashrc, /etc/bash.bashrc but just couldn't find either executable lcd_on or function definition of lcd_on. Also tab completion does not work for those two commands either: As we know in bash after you type in the leading characters of a command, the tab key will bring up all commands starting with the word typed, it's not the case for those two commands. Does anyone know how to locate commands that are not in the $PATH or defined as functions?Code:sh: lcd_on: not found
- 10-29-2009 #2Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
Perhaps they are builtins. For example:
See more at help type. Best wishes ... cheers, drlCode:$ bash -version GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu) $ type -a ssh ssh is /home/drl/bin/ssh ssh is /usr/bin/ssh ssh is /usr/X11R6/bin/ssh $ type gcc gcc is /usr/bin/gcc $ type printf printf is a shell builtin
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 10-29-2009 #3Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
drl,
Thanks for the detail explanation - I learned something new again. Now I know that's a shell built-in command, is there any way I can call it in my C program?
- 10-29-2009 #4Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
This should give you an idea of the combinations of things that work and don't work. It compares the OS utility printf (/usr/bin/printf) with the bash builtin printf:
when compiled and executed, produces:Code:#include <stdio.h> /* t.c - Demonstrate system, bash, command, builtin. */ int main() { void slew(); slew(); system("printf ' Hello, world from printf.\n'"); slew(); system("command printf --version"); slew(); system("builtin printf --version"); slew(); system("printf --version"); slew(); system("/usr/bin/printf --version | head -1"); slew(); system(" builtin printf ' Hi there.\n'"); slew(); system(" builtin printf ' Hello, world from builtin printf.\n'"); slew(); system("bash -c \" builtin printf ' Hi there.\n'\""); return( 0 ); } void slew() { printf("\n"); }
Best wishes ... cheers, drlCode:Hello, world from printf. sh: line 0: printf: --: invalid option printf: usage: printf [-v var] format [arguments] sh: line 0: printf: --: invalid option printf: usage: printf [-v var] format [arguments] sh: line 0: printf: --: invalid option printf: usage: printf [-v var] format [arguments] printf (GNU coreutils) 6.10 Hi there. Hello, world from builtin printf. Hi there.
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 10-30-2009 #5Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
Hi drl,
Thanks for the illustration. Regarding the lcd_on command, I found out it's a function defined in one of the script files. So I create another script wrapper (named LCD_ON) with that function defined:
Then I run system("LCD_ON") directly from my c program. Thanks again for the help.Code:$ cat LCD_ON lcd_on() { ... } lcd_on


Reply With Quote