Pushing to 2.39 as I have have not done the last one rightly...
This commit is contained in:
30
gpio/gpio.c
30
gpio/gpio.c
@@ -2,7 +2,7 @@
|
||||
* gpio.c:
|
||||
* Swiss-Army-Knife, Set-UID command-line interface to the Raspberry
|
||||
* Pi's GPIO.
|
||||
* Copyright (c) 2012-2015 Gordon Henderson
|
||||
* Copyright (c) 2012-2017 Gordon Henderson
|
||||
***********************************************************************
|
||||
* This file is part of wiringPi:
|
||||
* https://projects.drogon.net/raspberry-pi/wiringpi/
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <gertboard.h>
|
||||
#include <piFace.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "../version.h"
|
||||
|
||||
extern int wiringPiDebug ;
|
||||
|
||||
@@ -64,7 +64,9 @@ int wpMode ;
|
||||
|
||||
char *usage = "Usage: gpio -v\n"
|
||||
" gpio -h\n"
|
||||
" gpio [-g|-1] [-x extension:params] ...\n"
|
||||
" gpio [-g|-1] ...\n"
|
||||
" gpio [-d] ...\n"
|
||||
" [-x extension:params] [[ -x ...]] ...\n"
|
||||
" gpio [-p] <read/write/wb> ...\n"
|
||||
" gpio <read/write/aread/awritewb/pwm/clock/mode> ...\n"
|
||||
" gpio <toggle/blink> <pin>\n"
|
||||
@@ -357,7 +359,7 @@ static void doUnLoad (int argc, char *argv [])
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
static void doI2Cdetect (int argc, char *argv [])
|
||||
static void doI2Cdetect (UNU int argc, char *argv [])
|
||||
{
|
||||
int port = piGpioLayout () == 1 ? 0 : 1 ;
|
||||
char *c, *command ;
|
||||
@@ -388,7 +390,7 @@ static void doI2Cdetect (int argc, char *argv [])
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
static void doExports (int argc, char *argv [])
|
||||
static void doExports (UNU int argc, UNU char *argv [])
|
||||
{
|
||||
int fd ;
|
||||
int i, l, first ;
|
||||
@@ -714,7 +716,7 @@ void doUnexportall (char *progName)
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
static void doReset (char *progName)
|
||||
static void doReset (UNU char *progName)
|
||||
{
|
||||
printf ("GPIO Reset is dangerous and has been removed from the gpio command.\n") ;
|
||||
printf (" - Please write a shell-script to reset the GPIO pins into the state\n") ;
|
||||
@@ -1264,8 +1266,11 @@ static void doVersion (char *argv [])
|
||||
char name [80] ;
|
||||
FILE *fd ;
|
||||
|
||||
printf ("gpio version: %s\n", VERSION) ;
|
||||
printf ("Copyright (c) 2012-2015 Gordon Henderson\n") ;
|
||||
int vMaj, vMin ;
|
||||
|
||||
wiringPiVersion (&vMaj, &vMin) ;
|
||||
printf ("gpio version: %d.%d\n", vMaj, vMin) ;
|
||||
printf ("Copyright (c) 2012-2017 Gordon Henderson\n") ;
|
||||
printf ("This is free software with ABSOLUTELY NO WARRANTY.\n") ;
|
||||
printf ("For details type: %s -warranty\n", argv [0]) ;
|
||||
printf ("\n") ;
|
||||
@@ -1347,7 +1352,7 @@ int main (int argc, char *argv [])
|
||||
if (strcasecmp (argv [1], "-warranty") == 0)
|
||||
{
|
||||
printf ("gpio version: %s\n", VERSION) ;
|
||||
printf ("Copyright (c) 2012-2015 Gordon Henderson\n") ;
|
||||
printf ("Copyright (c) 2012-2017 Gordon Henderson\n") ;
|
||||
printf ("\n") ;
|
||||
printf (" This program is free software; you can redistribute it and/or modify\n") ;
|
||||
printf (" it under the terms of the GNU Leser General Public License as published\n") ;
|
||||
@@ -1447,8 +1452,11 @@ int main (int argc, char *argv [])
|
||||
}
|
||||
|
||||
// Check for -x argument to load in a new extension
|
||||
// -x extension:base:args
|
||||
// Can load many modules, but unless daemon mode we can only send one
|
||||
// command at a time.
|
||||
|
||||
if (strcasecmp (argv [1], "-x") == 0)
|
||||
while (strcasecmp (argv [1], "-x") == 0)
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
@@ -1459,6 +1467,8 @@ int main (int argc, char *argv [])
|
||||
if (!loadWPiExtension (argv [0], argv [2], TRUE)) // Prints its own error messages
|
||||
exit (EXIT_FAILURE) ;
|
||||
|
||||
// Shift args down by 2
|
||||
|
||||
for (i = 3 ; i < argc ; ++i)
|
||||
argv [i - 2] = argv [i] ;
|
||||
argc -= 2 ;
|
||||
|
||||
Reference in New Issue
Block a user