OK. So the Pi v2 I have had older firmware and it wasn't quite
the same as everyone elses. This is an interim version which will work on both Pi v1 and v2 boards until I have a bit more time to implement the correct stuff for v2.
This commit is contained in:
@@ -185,9 +185,11 @@ Print a list (if any) of all the exported GPIO pins and their current values.
|
||||
.TP
|
||||
.B export
|
||||
Export a GPIO pin in the \fI/sys/class/gpio\fR directory. Use like the
|
||||
mode command above however only \fIin\fR and \fIout\fR are supported at
|
||||
this time. Note that the pin number is the \fBBCM_GPIO\fR number and
|
||||
not the wiringPi number.
|
||||
mode command above however only \fIin\fR, \fIout\fR, \fIhigh\fR and
|
||||
\fRlow\fR are supported at this time. Note that the pin number is the
|
||||
\fBBCM_GPIO\fR number and not the wiringPi number. The \fIhigh\fR and
|
||||
\fIlow\fR commands pre-set the output value at the same time as the
|
||||
export to output mode.
|
||||
|
||||
Once a GPIO pin has been exported, the \fBgpio\fR program changes the
|
||||
ownership of the \fI/sys/class/gpio/gpioX/value\fR and if present in
|
||||
|
||||
12
gpio/gpio.c
12
gpio/gpio.c
@@ -434,19 +434,23 @@ void doExport (int argc, char *argv [])
|
||||
exit (1) ;
|
||||
}
|
||||
|
||||
/**/ if ((strcasecmp (mode, "in") == 0) || (strcasecmp (mode, "input") == 0))
|
||||
/**/ if ((strcasecmp (mode, "in") == 0) || (strcasecmp (mode, "input") == 0))
|
||||
fprintf (fd, "in\n") ;
|
||||
else if ((strcasecmp (mode, "out") == 0) || (strcasecmp (mode, "output") == 0))
|
||||
else if ((strcasecmp (mode, "out") == 0) || (strcasecmp (mode, "output") == 0))
|
||||
fprintf (fd, "out\n") ;
|
||||
else if ((strcasecmp (mode, "high") == 0) || (strcasecmp (mode, "up") == 0))
|
||||
fprintf (fd, "high\n") ;
|
||||
else if ((strcasecmp (mode, "low") == 0) || (strcasecmp (mode, "down") == 0))
|
||||
fprintf (fd, "low\n") ;
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s: Invalid mode: %s. Should be in or out\n", argv [1], mode) ;
|
||||
fprintf (stderr, "%s: Invalid mode: %s. Should be in, out, high or low\n", argv [1], mode) ;
|
||||
exit (1) ;
|
||||
}
|
||||
|
||||
fclose (fd) ;
|
||||
|
||||
// Change ownership so the current user can actually use it!
|
||||
// Change ownership so the current user can actually use it
|
||||
|
||||
sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ;
|
||||
changeOwner (argv [0], fName) ;
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define VERSION "2.24"
|
||||
#define VERSION "2.25"
|
||||
|
||||
Reference in New Issue
Block a user