By the way, it's just a wrapper for Nodejs, but otherwise I'm not changing
a thing. So far all I really want / need is:

"use strict";
var fs = require('fs');
var exec = require('child_process').exec;

exports.config = function(pin, value){

    var params = pin + ' ' + value;
    var child = exec('/usr/bin/config-pin ' + params, (error, stdout,
stderr) => {
        if(error){throw error;}
    });
};

exports.listModes = function(pin, callback){

    var params = pin;
    var child = exec('/usr/bin/config-pin -l ' + params, (error, stdout,
stderr) => {
        if(error){throw error;}

        callback(stdout);
    });
};

william@beaglebone:~/dev/bonejs$ node config-pin-example.js
default gpio gpio_pu gpio_pd timer

So the wrapper is really simple. But what I plan on doing with said wrapper
will be really neat I think. How does configurering your pin modes from a
web page sound ? ;)




On Thu, Jun 23, 2016 at 3:22 PM, William Hermans <[email protected]> wrote:

> Thanks Charles.
>
> Yes, initially I was thinking that perhaps that file reflected what the
> current values of pins were. But after thinking while waiting for your
> reply I was thinking that too. Initial state of the pins at the time the
> overlay was loaded.
>
> Another question regarding config-pin . . .I have a Nodejs project here:
> https://github.com/wphermans/Bonejs, but I just now wrote a Nodejs(
> Javascript ) wrapper for config-pin and wanted to make sure that would be
> ok. I do also have plans on using that wrapper for a much bigger, and
> cooler project, which was requested by Robert not long ago . . .
>
> No idea how long it'll take me with other priorities in the mix too. But I
> figured I should ask.
>
> On Thu, Jun 23, 2016 at 3:00 PM, Charles Steinkuehler <
> [email protected]> wrote:
>
>> The status file is created by the kernel logic, and I believe simply
>> reflects the load-time configuration of the GPIO, which all default to
>> inputs when the overlay loads)...but I haven't crawled through the
>> kernel code to figure out exactly what it's doing to create the status
>> file.  I suspect the kernel logic generating the status file doesn't
>> understand the GPIO have been exported and are not directly controlled
>> by the cape-universal overlay.  Honestly, I'm not sure I've ever
>> looked at the contents of the status file previously.
>>
>> Anyway, I get the same results on my system here, so I don't think
>> it's anything you need to worry about:
>>
>> machinekit@beaglebone:~$ config-pin  P8.07 hi
>> machinekit@beaglebone:~$ cat /sys/devices/ocp.3/cape-universal.51/status
>> ...
>> 34 P8_09                     69 IN  0
>> 35 P8_08                     67 IN  0
>> 36 P8_07                     66 IN  0
>> machinekit@beaglebone:~$ cat /sys/class/gpio/gpio66/direction
>> out
>> machinekit@beaglebone:~$ cat /sys/class/gpio/gpio66/value
>> 1
>>
>>
>> On 6/23/2016 4:30 PM, William Hermans wrote:
>> > @Charles
>> >
>> > So I'm not sure if this is normal or not. Thought I'd bring it to your
>> attention
>> > in case it's not.
>> >
>> > william@beaglebone:~$ sudo chown root:gpio /usr/bin/config-pin
>> > william@beaglebone:~$ config-pin  P8.07 hi
>> > william@beaglebone:~$ cat
>> /sys/devices/platform/ocp/ocp:cape-universal/status
>> > . . .
>> > 32 P8_07                     66 *IN  0
>> >
>> > *
>> > That should be OUT, and 1*? *the gpio sysfs stuff reports correctly
>> though*
>> > *
>> >
>> > william@beaglebone:~$ cat /sys/class/gpio/gpio66/direction
>> > out
>> > william@beaglebone:~$ cat /sys/class/gpio/gpio66/value
>> > 1
>> >   william@beaglebone:~$ config-pin -q P8.07
>> > P8_07 Mode: gpio Direction: out Value: 1
>> >
>> > As does the config-pin query option.
>> >
>> >
>> > On Thu, Jun 23, 2016 at 12:05 PM, William Hermans <[email protected]
>> > <mailto:[email protected]>> wrote:
>> >
>> >         It does, but it depends on the image you start with.  Usually
>> it's
>> >         found in /opt/source/beaglebone-universal-io/, with a symlink
>> for
>> >         config-pin in /usr/local/bin/config-pin:
>> >
>> >
>> https://github.com/RobertCNelson/omap-image-builder/blob/master/target/chroot/beagleboard.org-wheezy.sh#L389-L396
>> >
>> >
>> >     Oh, ok. I start with the console images always, and this is not the
>> first
>> >     time I've not been able to find config-pin. But after some
>> investigation,
>> >     and a system wide search for the file 'config-pin' turned up
>> nothing. It was
>> >     then just a matter of realizing that I had everything in place
>> already
>> >     except config pin. So I read the Makefile figured out where make
>> install
>> >     would put the file . . .and went from there ;)
>> >
>> >
>> > --
>> > For more options, visit http://beagleboard.org/discuss
>> > ---
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "BeagleBoard" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email
>> > to [email protected]
>> > <mailto:[email protected]>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/beagleboard/CALHSORrO-zF%3DzVRVFiYJmsuQFzGUE79bczDXg_G2w18m%3DxSbCg%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/beagleboard/CALHSORrO-zF%3DzVRVFiYJmsuQFzGUE79bczDXg_G2w18m%3DxSbCg%40mail.gmail.com?utm_medium=email&utm_source=footer
>> >.
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>>
>> --
>> Charles Steinkuehler
>> [email protected]
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beagleboard/c3dcd834-f69a-21ff-fbb6-4ce99ed12644%40steinkuehler.net
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CALHSORotdBm%3D_OaLv%3DRghDC6x9X0jMnHNZ-3SMXPsRHbt%3D8UWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to