From owner-freebsd-current Mon Feb 8 07:23:49 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA19071 for freebsd-current-outgoing; Mon, 8 Feb 1999 07:23:49 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from mail.kt.rim.or.jp (mail.kt.rim.or.jp [202.247.130.53]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA19059 for ; Mon, 8 Feb 1999 07:23:46 -0800 (PST) (envelope-from kuriyama@sky.rim.or.jp) Received: from moon.sky.rim.or.jp (ppp541.kt.rim.or.jp [202.247.140.191]) by mail.kt.rim.or.jp (8.8.5/3.6W-RIMNET-98-06-09) with ESMTP id AAA08912; Tue, 9 Feb 1999 00:21:28 +0900 (JST) Received: from sky.rim.or.jp (earth.sky.rim.or.jp [192.168.1.2]) by moon.sky.rim.or.jp (8.8.8/3.5Wpl4/moon-1.0) with ESMTP id AAA06977; Tue, 9 Feb 1999 00:21:05 +0900 (JST) Message-ID: <36BF00DC.B491EB28@sky.rim.or.jp> Date: Tue, 09 Feb 1999 00:21:00 +0900 From: Jun Kuriyama X-Mailer: Mozilla 4.06 [ja] (Win95; I) MIME-Version: 1.0 To: FreeBSD-current CC: Nate Williams Subject: Re: [Call for Review] new ioctl for src/sys/pccard/* References: <36BDAD4E.CC8A2452@sky.rim.or.jp> <199902071644.JAA19307@mt.sri.com> Content-Type: multipart/mixed; boundary="------------67D2CB606CE5B722719048FA" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 + */ + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +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 + */ + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +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