Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Feb 1999 00:21:00 +0900
From:      Jun Kuriyama <kuriyama@sky.rim.or.jp>
To:        FreeBSD-current <FreeBSD-current@FreeBSD.ORG>
Cc:        Nate Williams <nate@mt.sri.com>
Subject:   Re: [Call for Review] new ioctl for src/sys/pccard/*
Message-ID:  <36BF00DC.B491EB28@sky.rim.or.jp>
References:  <36BDAD4E.CC8A2452@sky.rim.or.jp> <199902071644.JAA19307@mt.sri.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------67D2CB606CE5B722719048FA
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

Thank you for your comment.

Nate Williams wrote:
> The patch implementing these changes are adequate in the kernel, but are
> incomplete.

Yes, I should have attached patch for usr.sbin/pccard/* too.

> What about the changes to usr.sbin/pccard/*?  With regard
> to the power-on modifications, it is necessary to see these changes for
> insertion/removal as well as suspend/resume, not to mention the
> documentation changes.

Hmmm, I'm planning to change pccardc like below.  Only functional
additions.  Could you point out where we should modify with these
changes?

> ps. I like the new 'beep' ioctl better than the original implementation
> in PAO.

Thanks.  But I've changed only a little from PAO implementation.  I like
PAO's melodious beep sound (that isn't included in this patch), what you
said is this?

# Of course, I think that is not "must needed" feature. :-)

-- 
Jun Kuriyama // kuriyama@sky.rim.or.jp
            // kuriyama@FreeBSD.ORG
--------------67D2CB606CE5B722719048FA
Content-Type: text/plain; charset=iso-2022-jp; name="pccardc.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="pccardc.diff.txt"

Index: pccardc/Makefile
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pccard/pccardc/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile	1998/02/26 14:36:00	1.7
+++ Makefile	1999/02/08 11:50:25
@@ -5,7 +5,7 @@
 #
 PROG=	pccardc
 NOMAN=	noman
-SRCS=	dumpcis.c enabler.c pccardc.c pccardmem.c printcis.c \
+SRCS=	beep.c dumpcis.c enabler.c pccardc.c pccardmem.c power.c printcis.c \
 	rdattr.c rdmap.c rdreg.c readcis.c wrattr.c wrreg.c
 
 CFLAGS+=	-I${.CURDIR}/../pccardd
Index: pccardc/beep.c
===================================================================
RCS file: beep.c
diff -N beep.c
--- /dev/null	Mon Feb  8 20:41:26 1999
+++ beep.c	Mon Feb  8 20:49:00 1999
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1995 Andrew McRae.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Code cleanup, bug-fix and extension
+ * by Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
+ */
+
+#ifndef lint
+static const char rcsid[] =
+	"$Id$";
+#endif /* not lint */
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <pccard/cardinfo.h>
+
+int
+beep_main(argc, argv)
+	int     argc;
+	char   *argv[];
+{
+	int     fd, newstat, valid = 1;
+	char    name[64], *p;
+
+	if (argc != 2)
+		valid = 0;
+	if (valid) {
+		for (p = argv[1]; *p; p++) {
+			if (!isdigit(*p)) {
+				valid = 0;
+				break;
+			}
+		}
+	}
+	if (!valid)
+		errx(1, "Usage: %s beep newstat", argv[0]);
+
+	sscanf(argv[1], "%d", &newstat);
+	sprintf(name, CARD_DEVICE, 0);
+	fd = open(name, O_RDWR);
+	if (fd < 0)
+		err(1, "%s", name);
+	if (ioctl(fd, PIOCSBEEP, &newstat) < 0)
+		err(1, "ioctl (PIOCSBEEP)");
+	return 0;
+}
Index: pccardc/pccardc.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pccard/pccardc/pccardc.c,v
retrieving revision 1.7
diff -u -r1.7 pccardc.c
--- pccardc.c	1998/02/26 14:36:01	1.7
+++ pccardc.c	1999/02/08 11:51:17
@@ -36,10 +36,12 @@
 typedef int (*main_t)(int, char **);
 
 #define DECL(foo) int foo(int, char**);
+DECL(beep_main);
 DECL(dumpcis_main);
 DECL(enabler_main);
 DECL(help_main);
 DECL(pccardmem_main);
+DECL(power_main);
 DECL(rdattr_main);
 DECL(rdmap_main);
 DECL(rdreg_main);
@@ -51,10 +53,12 @@
 	main_t  func;
 	char   *help;
 } subcommands[] = {
+	{ "beep", beep_main, "Beep type" },
 	{ "dumpcis", dumpcis_main, "Prints CIS for all cards" },
 	{ "enabler", enabler_main, "Device driver enabler" },
 	{ "help", help_main, "Prints command summary" },
 	{ "pccardmem", pccardmem_main, "Allocate memory for pccard driver" },
+	{ "power", power_main, "Power on/off slots" },
 	{ "rdattr", rdattr_main, "Read attribute memory" },
 	{ "rdmap", rdmap_main, "Read pcic mappings" },
 	{ "rdreg", rdreg_main, "Read pcic register" },
Index: pccardc/power.c
===================================================================
RCS file: power.c
diff -N power.c
--- /dev/null	Mon Feb  8 20:41:26 1999
+++ power.c	Mon Feb  8 20:49:00 1999
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1995 Andrew McRae.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Code cleanup, bug-fix and extension
+ * by Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
+ */
+
+#ifndef lint
+static const char rcsid[] =
+	"$Id$";
+#endif /* not lint */
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include <pccard/cardinfo.h>
+
+int
+power_main(argc, argv)
+	int     argc;
+	char   *argv[];
+{
+	int     fd, i, newstat, valid = 1;
+	char    name[64], *p;
+
+	if (argc != 3)
+		valid = 0;
+	for (i = 1; i <= 2; i++) {
+		if (valid) {
+			for (p = argv[i]; *p; p++) {
+				if (!isdigit(*p)) {
+					valid = 0;
+					break;
+				}
+			}
+		}
+	}
+	if (!valid)
+		errx(1, "Usage: %s power slot newstat", argv[0]);
+
+	sscanf(argv[2], "%d", &newstat);
+	sprintf(name, CARD_DEVICE, atoi(argv[1]));
+	fd = open(name, O_RDWR);
+	if (fd < 0)
+		err(1, "%s", name);
+	newstat = newstat ? 1 : 0;
+	if (ioctl(fd, PIOCSVIR, &newstat) < 0)
+		err(1, "ioctl (PIOCSVIR)");
+	return 0;
+}

--------------67D2CB606CE5B722719048FA--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36BF00DC.B491EB28>