How to test the return of a command in U-Boot CLIHow do I ignore files in Subversion?Calling an external command in PythonRun Command Prompt CommandsHow to determine the current shell I'm working on?What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?How to setenv based on sed results (for gnome-keyring-daemon)Echo a command on screenFind b'' in command output?Raspberry 3: booting a Kernel by using U-BootUsing GPIO-Poweroff on a Raspberry Pi Compute Module with DAS U-Boot to turn off the PSU
Was Switzerland really impossible to invade during WW2?
Can I switch to third-person while not in 'town' in Destiny 2?
Ask for a paid taxi in order to arrive as early as possible for an interview within the city
Is it insecure to have an ansible user with passwordless sudo?
Vacuum collapse -- why do strong metals implode but glass doesn't?
How would one country purchase another?
Why is 日本 read as "nihon" but not "nitsuhon"?
Why is my Earth simulation slower than the reality?
How should I face my manager if I make a mistake because a senior coworker explained something incorrectly to me?
Shouldn't the "credit score" prevent Americans from going deeper and deeper into personal debt?
Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")
Solve a logarithmic equation by NSolve
Brexit and backstop: would changes require unanimous approval by all EU countries? Does Ireland hold a veto?
Potential new partner angry about first collaboration - how to answer email to close up this encounter in a graceful manner
Co-author responds to email by mistake cc'ing the EiC
Does an object count as "being moved" when placed in a Bag of Holding before its wielder moves, and then after moving they take the object out again?
Is it safe to remove the bottom chords of a series of garage roof trusses?
Do ability scores have any effect on casting Wish spell
How big would a Daddy Longlegs Spider need to be to kill an average Human?
If the first law of thermodynamics ensures conservation of energy, why does it allow systems to lose energy?
Give function defaults arguments from a dictionary in Python
On the feasibility of space battleships
How to dismiss intrusive questions from a colleague with whom I don't work?
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
How to test the return of a command in U-Boot CLI
How do I ignore files in Subversion?Calling an external command in PythonRun Command Prompt CommandsHow to determine the current shell I'm working on?What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?How to setenv based on sed results (for gnome-keyring-daemon)Echo a command on screenFind b'' in command output?Raspberry 3: booting a Kernel by using U-BootUsing GPIO-Poweroff on a Raspberry Pi Compute Module with DAS U-Boot to turn off the PSU
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to use the return of the command 'gpio input' in an if statement in U-Boot but it doesn't seem to work.
So I've tried something like :
if test gpio status 50 -eq 1; then echo 1; else echo 0; fi;
But it always return 1 whether the GPIO is high or low.
I also tried to store the result of the gpio status command into a variable by using the setenv command but it doesn't work either.
PS: I've modified the gpio.c file in the U-boot source code so the command returns just '0' or '1' instead of 'gpio: pin 50 (gpio 50) value is 1' but I think it doesn't matter. Just precising since otherwise the '-eq 1' makes no sense.
Do you have any idea of how I could proceed to do this ?
Thanks in advance !
command csh u-boot setenv
add a comment |
I would like to use the return of the command 'gpio input' in an if statement in U-Boot but it doesn't seem to work.
So I've tried something like :
if test gpio status 50 -eq 1; then echo 1; else echo 0; fi;
But it always return 1 whether the GPIO is high or low.
I also tried to store the result of the gpio status command into a variable by using the setenv command but it doesn't work either.
PS: I've modified the gpio.c file in the U-boot source code so the command returns just '0' or '1' instead of 'gpio: pin 50 (gpio 50) value is 1' but I think it doesn't matter. Just precising since otherwise the '-eq 1' makes no sense.
Do you have any idea of how I could proceed to do this ?
Thanks in advance !
command csh u-boot setenv
add a comment |
I would like to use the return of the command 'gpio input' in an if statement in U-Boot but it doesn't seem to work.
So I've tried something like :
if test gpio status 50 -eq 1; then echo 1; else echo 0; fi;
But it always return 1 whether the GPIO is high or low.
I also tried to store the result of the gpio status command into a variable by using the setenv command but it doesn't work either.
PS: I've modified the gpio.c file in the U-boot source code so the command returns just '0' or '1' instead of 'gpio: pin 50 (gpio 50) value is 1' but I think it doesn't matter. Just precising since otherwise the '-eq 1' makes no sense.
Do you have any idea of how I could proceed to do this ?
Thanks in advance !
command csh u-boot setenv
I would like to use the return of the command 'gpio input' in an if statement in U-Boot but it doesn't seem to work.
So I've tried something like :
if test gpio status 50 -eq 1; then echo 1; else echo 0; fi;
But it always return 1 whether the GPIO is high or low.
I also tried to store the result of the gpio status command into a variable by using the setenv command but it doesn't work either.
PS: I've modified the gpio.c file in the U-boot source code so the command returns just '0' or '1' instead of 'gpio: pin 50 (gpio 50) value is 1' but I think it doesn't matter. Just precising since otherwise the '-eq 1' makes no sense.
Do you have any idea of how I could proceed to do this ?
Thanks in advance !
command csh u-boot setenv
command csh u-boot setenv
asked Mar 27 at 16:01
p-lafondp-lafond
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The return value of a command can be found in environment variable $?, e.g.
gpio input 50; echo $?
If an if statement exists depends on the configuration when compiling U-Boot. Use CONFIG_HUSH_PARSER=y to enable it. When enabled you can write
if gpio input 102; then setenv board_name revA ; else setenv board_name revB;fi
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381641%2fhow-to-test-the-return-of-a-command-in-u-boot-cli%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The return value of a command can be found in environment variable $?, e.g.
gpio input 50; echo $?
If an if statement exists depends on the configuration when compiling U-Boot. Use CONFIG_HUSH_PARSER=y to enable it. When enabled you can write
if gpio input 102; then setenv board_name revA ; else setenv board_name revB;fi
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
add a comment |
The return value of a command can be found in environment variable $?, e.g.
gpio input 50; echo $?
If an if statement exists depends on the configuration when compiling U-Boot. Use CONFIG_HUSH_PARSER=y to enable it. When enabled you can write
if gpio input 102; then setenv board_name revA ; else setenv board_name revB;fi
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
add a comment |
The return value of a command can be found in environment variable $?, e.g.
gpio input 50; echo $?
If an if statement exists depends on the configuration when compiling U-Boot. Use CONFIG_HUSH_PARSER=y to enable it. When enabled you can write
if gpio input 102; then setenv board_name revA ; else setenv board_name revB;fi
The return value of a command can be found in environment variable $?, e.g.
gpio input 50; echo $?
If an if statement exists depends on the configuration when compiling U-Boot. Use CONFIG_HUSH_PARSER=y to enable it. When enabled you can write
if gpio input 102; then setenv board_name revA ; else setenv board_name revB;fi
edited Mar 29 at 3:07
answered Mar 28 at 21:35
XypronXypron
9521 gold badge5 silver badges11 bronze badges
9521 gold badge5 silver badges11 bronze badges
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
add a comment |
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
Thanks to @trini to pointing me to HUSH_PARSER.
– Xypron
Mar 29 at 3:09
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381641%2fhow-to-test-the-return-of-a-command-in-u-boot-cli%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown