From: Tom Rini Date: Fri, 23 Oct 2015 20:25:47 -0400 Subject: [U-Boot] [PATCH] gpio: return success if value is positiv In-Reply-To: <1445641158-22901-1-git-send-email-stefan@agner.ch> References: <1445641158-22901-1-git-send-email-stefan@agner.ch> Message-ID: <20151024002547.GA23893@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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: