[U-Boot] [PATCH] gpio: return success if value is positiv

Tom Rini trini at konsulko.com
Sat Oct 24 02:25:47 CEST 2015


On Fri, Oct 23, 2015 at 03:59:18PM -0700, Stefan Agner wrote:

> Currently we return the GPIO value directly as command exit code.
> In shell exit codes, 0 means success. Hence if a GPIO is one, we
> actually return a "failure". Fix this by returning SUCCESS if the
> value is positive.
> 
> This allows to implement scripts more naturally e.g.:
> if gpio input 47; then echo "Pressed"; else echo "Not pressed"; fi
> 
> Signed-off-by: Stefan Agner <stefan at agner.ch>
> ---
> Not sure if it is the right thing to do to change that, maybe there
> are a lot of users which rely on that output already?
> 
> It just feels a bit more natural to me when using the command in
> scripts...

My first reaction is, wait, we don't work like that today?  I need to
try the omap3_beagle gpio stuff out on my board again since there are
users today that at first blush read like what you're saying doesn't
work today, so I wonder if things broke by accident at some point in the
(hopefully not too distant) past.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151023/e18405b5/attachment.sig>


More information about the U-Boot mailing list