NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/52219: Example included in gpio(3lua) incorrect



The following reply was made to PR bin/52219; it has been noted by GNATS.

From: Marc Balmer <marc%msys.ch@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/52219: Example included in gpio(3lua) incorrect
Date: Mon, 8 May 2017 08:58:41 +0200

 Am 08.05.17 um 03:50 schrieb venture37%geeklan.co.uk@localhost:
 >> Number:         52219
 >> Category:       bin
 >> Synopsis:       Example included in gpio(3lua) incorrect
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       low
 >> Responsible:    bin-bug-people
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Mon May 08 01:50:00 +0000 2017
 >> Originator:     Sevan Janiyan
 >> Release:        NetBSD-HEAD
 >> Organization:
 >> Environment:
 > NetBSD armv7 7.99.71 NetBSD 7.99.71 (BEAGLEBONE) #0: Fri May  5 12:21:28 UTC 2017  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/BEAGLEBONE evbarm
 >> Description:
 > The example included in gpio(3lua) in incorrect & does not run.
 > lua reports
 > lua: GPIOREAD
 > stack traceback:
 >         [C]: in function 'gpio.read'
 >         ppp.lua:8: in main chunk
 >         [C]: in ?
 > 
 > 
 > The reason is that gpio.read is expecting the configured gpio pin to read from whereas the example passes the value of number of configured pins on the system, minus one.
 
 No, it enumerates all pins and reads them.  Are you GPIO pins set to
 input, i.e. at they readable?  What happens when you try to read them
 out using gpioctl?
 
 > 
 >> How-To-Repeat:
 > Adding the following to a text file, eg gpio.lua
 > local gpio = require 'gpio'
 > 
 > gpiodev = gpio.open('/dev/gpio0')
 > 
 > local npins = gpiodev:info()
 > 
 > for n = 1, npins do
 >     print('pin ' .. n .. ': ' .. gpiodev:read(n - 1))
 > end
 > 
 > execute it with lua
 > lua gpio.lua
 >> Fix:
 > 
 


Home | Main Index | Thread Index | Old Index