From owner-svn-src-head@FreeBSD.ORG Tue Sep 17 11:48:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5DB6AF1C; Tue, 17 Sep 2013 11:48:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3CB662F92; Tue, 17 Sep 2013 11:48:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8HBmmpD091601; Tue, 17 Sep 2013 11:48:48 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8HBmlbB091598; Tue, 17 Sep 2013 11:48:47 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309171148.r8HBmlbB091598@svn.freebsd.org> From: Sean Bruno Date: Tue, 17 Sep 2013 11:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255629 - in head: include usr.sbin/gpioctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 11:48:48 -0000 Author: sbruno Date: Tue Sep 17 11:48:47 2013 New Revision: 255629 URL: http://svnweb.freebsd.org/changeset/base/255629 Log: Assume that the -f argument is /dev/gpioc0 if it is not passed. hrs@ provided this verison of the patch and showed me where all the needed changes were to be made outside of gpioctl.c Approved by: re (hrs) MFC after: 2 weeks Modified: head/include/paths.h head/usr.sbin/gpioctl/gpioctl.8 head/usr.sbin/gpioctl/gpioctl.c Modified: head/include/paths.h ============================================================================== --- head/include/paths.h Tue Sep 17 08:43:12 2013 (r255628) +++ head/include/paths.h Tue Sep 17 11:48:47 2013 (r255629) @@ -50,6 +50,7 @@ #define _PATH_CSHELL "/bin/csh" #define _PATH_CSMAPPER "/usr/share/i18n/csmapper" #define _PATH_DEFTAPE "/dev/sa0" +#define _PATH_DEVGPIOC "/dev/gpioc" #define _PATH_DEVNULL "/dev/null" #define _PATH_DEVZERO "/dev/zero" #define _PATH_DRUM "/dev/drum" Modified: head/usr.sbin/gpioctl/gpioctl.8 ============================================================================== --- head/usr.sbin/gpioctl/gpioctl.8 Tue Sep 17 08:43:12 2013 (r255628) +++ head/usr.sbin/gpioctl/gpioctl.8 Tue Sep 17 11:48:47 2013 (r255629) @@ -36,20 +36,20 @@ .Sh SYNOPSIS .Nm .Cm -l -.Fl f Ar ctldev +.Op Fl f Ar ctldev .Op Fl v .Nm .Cm -t -.Fl f Ar ctldev +.Op Fl f Ar ctldev .Ar pin .Nm .Cm -c -.Fl f Ar ctldev +.Op Fl f Ar ctldev .Ar pin .Ar flag .Op flag ... .Nm -.Cm -f Ar ctldev +.Op Cm -f Ar ctldev .Ar pin .Ar [0|1] .Sh DESCRIPTION @@ -83,6 +83,8 @@ Inverted output pin .El .It Fl f Ar ctldev GPIO controller device to use +If not specified, defaults to +.Pa /dev/gpioc0 .It Fl l list available pins .It Fl t Ar pin Modified: head/usr.sbin/gpioctl/gpioctl.c ============================================================================== --- head/usr.sbin/gpioctl/gpioctl.c Tue Sep 17 08:43:12 2013 (r255628) +++ head/usr.sbin/gpioctl/gpioctl.c Tue Sep 17 11:48:47 2013 (r255629) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -63,10 +64,10 @@ static void usage(void) { fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\tgpioctl -f ctldev -l [-v]\n"); - fprintf(stderr, "\tgpioctl -f ctldev -t pin\n"); - fprintf(stderr, "\tgpioctl -f ctldev -c pin flag ...\n"); - fprintf(stderr, "\tgpioctl -f ctldev pin [0|1]\n"); + fprintf(stderr, "\tgpioctl [-f ctldev] -l [-v]\n"); + fprintf(stderr, "\tgpioctl [-f ctldev] -t pin\n"); + fprintf(stderr, "\tgpioctl [-f ctldev] -c pin flag ...\n"); + fprintf(stderr, "\tgpioctl [-f ctldev] pin [0|1]\n"); exit(1); } @@ -185,6 +186,7 @@ main(int argc, char **argv) int i; struct gpio_pin pin; struct gpio_req req; + char defctlfile[] = _PATH_DEVGPIOC "0"; char *ctlfile = NULL; int pinn, pinv, fd, ch; int flags, flag, ok; @@ -226,7 +228,7 @@ main(int argc, char **argv) printf("%d/%s\n", i, argv[i]); if (ctlfile == NULL) - fail("No gpioctl device provided\n"); + ctlfile = defctlfile; fd = open(ctlfile, O_RDONLY); if (fd < 0) {