diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2000-07-20 17:17:50 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2000-07-20 17:17:50 +0000 |
commit | bd73645d91a2d525eab13b9332ec45b12b3b105a (patch) | |
tree | 91f120769c2d3c189e280719ae7ea0513db2f260 | |
parent | 0fd5828e8f648d1e6cb6e7415f17e22adb016743 (diff) | |
download | src-test2-bd73645d91a2d525eab13b9332ec45b12b3b105a.tar.gz src-test2-bd73645d91a2d525eab13b9332ec45b12b3b105a.zip |
Notes
-rw-r--r-- | share/man/man4/ispfw.4 | 46 | ||||
-rw-r--r-- | share/man/man4/tap.4 | 217 | ||||
-rw-r--r-- | sys/kern/kern_accf.c | 142 | ||||
-rw-r--r-- | sys/kern/uipc_accf.c | 142 | ||||
-rw-r--r-- | sys/net/if_tap.h | 73 | ||||
-rw-r--r-- | usr.bin/usbhidctl/usbhidctl.1 | 92 | ||||
-rw-r--r-- | usr.sbin/ngctl/config.c | 103 |
7 files changed, 815 insertions, 0 deletions
diff --git a/share/man/man4/ispfw.4 b/share/man/man4/ispfw.4 new file mode 100644 index 000000000000..6380e96b2df2 --- /dev/null +++ b/share/man/man4/ispfw.4 @@ -0,0 +1,46 @@ +.\" $FreeBSD$ +.\" +.\" Copyright (c) 2000 +.\" Matthew Jacob +.\" +.\" 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. 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. +.\" +.\" +.Dd July 20, 2000 +.Dt ISPFW 4 +.Os +.Sh NAME +.Nm ispfw +.Nd Firmware Module for Qlogic based SCSI and FibreChannel SCSI Host Adapters +.Sh SYNOPSIS +.Cd "device ispfw" +.Sh DESCRIPTION +This trivial driver provides access to firmware sets for the Qlogic +based SCSI and FibreChannel SCSI Host Adapters. It may either be +statically linked into the kernel, or loaded as a module. In either +case, the +.Xr isp 4 +driver will notice that firmware is available to be downloaded onto +Qlogic cards (to replace the usually out of date firmware on the cards). +this will kick the f/w into getting unstuck. +.Sh SEE ALSO +.Xr isp 4 +.Sh AUTHOR +This driver was written by Matthew Jacob. diff --git a/share/man/man4/tap.4 b/share/man/man4/tap.4 new file mode 100644 index 000000000000..fba5466cd0bd --- /dev/null +++ b/share/man/man4/tap.4 @@ -0,0 +1,217 @@ +.\" $FreeBSD$ +.\" Based on PR#2411 +.\" +.Dd July 9, 2000 +.Os +.Dt TAP 4 +.Sh NAME +.Nm tap +.Nd Ethernet tunnel software network interface +.Sh SYNOPSIS +.Cd pseudo-device tap +.Sh DESCRIPTION +The +.Nm tap +interface is a software loopback mechanism that can be loosely +described as the network interface analog of the +.Xr pty 4 , +that is, +.Nm tap +does for network interfaces what the +.Nm pty +driver does for terminals. +.Pp +The +.Nm tap +driver, like the +.Nm pty +driver, provides two interfaces: an interface like the usual facility +it is simulating +.Po +an Ethernet network interface in the case of +.Nm tap , +or a terminal for +.Nm pty +.Pc , +and a character-special device +.Dq control +interface. +.Pp +The network interfaces are named +.Sy tap Ns Ar 0 , +.Sy tap Ns Ar 1 , +etc, as many as were made by +.Xr MAKEDEV 8 . +Each one supports the usual Ethernet network-interface +.Xr ioctl 2 Ns s , +such as +.Dv SIOCSIFADDR +and +.Dv SIOCSIFNETMASK , +and thus can be used with +.Xr ifconfig 8 +like any other Ethernet interface. When the system chooses to transmit +an Ethernet frame on the network interface, the frame can be read from +the control device +.Po +it appears as +.Dq input +there +.Pc ; +writing an Ethernet frame to the control device generates an input frame on +the network interface, as if the +.Pq non-existent +hardware had just received it. +.Pp +The Ethernet tunnel device, normally +.Pa /dev/tap Ns Sy N , +is exclusive-open +.Po +it cannot be opened if it is already open +.Pc +and is restricted to the super-user. +A +.Fn read +call will return an error +.Pq Er EHOSTDOWN +if the interface is not +.Dq ready . +Once the interface is ready, +.Fn read +will return an Ethernet frame if one is available; if not, it will +either block until one is or return +.Er EWOULDBLOCK , +depending on whether non-blocking I/O has been enabled. If the frame +is longer than is allowed for in the buffer passed to +.Fn read , +the extra data will be silently dropped. +.Pp +A +.Xr write 2 +call passes an Ethernet frame in to be +.Dq received +on the pseudo-interface. Each +.Fn write +call supplies exactly one frame; the frame length is taken from the +amount of data provided to +.Fn write . +Writes will not block; if the frame cannot be accepted +for a transient reason +.Pq e.g., no buffer space available , +it is silently dropped; if the reason is not transient +.Pq e.g., frame too large , +an error is returned. +The following +.Xr ioctl 2 +calls are supported +.Pq defined in Aq Pa net/if_tap.h Ns : +.Bl -tag -width VMIO_SIOCSETMACADDR +.It Dv TAPSDEBUG +The argument should be a pointer to an +.Va int ; +this sets the internal debugging variable to that value. What, if +anything, this variable controls is not documented here; see the source +code. +.It Dv TAPGDEBUG +The argument should be a pointer to an +.Va int ; +this stores the internal debugging variable's value into it. +.It Dv FIONBIO +Turn non-blocking I/O for reads off or on, according as the argument +.Va int Ns 's +value is or isn't zero +.Pq Writes are always nonblocking . +.It Dv FIOASYNC +Turn asynchronous I/O for reads +.Po +i.e., generation of +.Dv SIGIO +when data is available to be read +.Pc +off or on, according as the argument +.Va int Ns 's +value is or isn't zero. +.It Dv FIONREAD +If any frames are queued to be read, store the size of the first one into the argument +.Va int ; +otherwise, store zero. +.It Dv TIOCSPGRP +Set the process group to receive +.Dv SIGIO +signals, when asynchronous I/O is enabled, to the argument +.Va int +value. +.It Dv TIOCGPGRP +Retrieve the process group value for +.Dv SIGIO +signals into the argument +.Va int +value. +.It SIOCGIFADDR +Retrieve the Media Access Control +.Pq MAC +address. This command should be executed on descriptor, associated with +control device +.Pq Pa /dev/tap Ns Sy N . +The +.Va buffer , +which is passed as argument, is expected to have enought space to store +.Pq MAC +address. +.It SIOCSIFADDR +Set the Media Access Control +.Pq MAC +address. This command should be executed on a descriptor, associated with +control device +.Pq Pa /dev/tap Ns Sy N . +.El +.Pp +The control device also supports +.Xr select 2 +for read; selecting for write is pointless, and always succeeds, since +writes are always non-blocking. +.Pp +On the last close of the data device, by default, the interface is +brought down +.Po +as if with +.Dq ifconfig tap Ns Sy N No down +.Pc . +All queued frames are thrown away. If the interface is up when the data +device is not open output frames are always thrown away rather than +letting them pile up. +.Pp +The +.Nm tap +device is also can be used with VMware port as a replacement +of VMnet device driver. The driver uses minor number to select between +.Nm tap +and +.Nm vmnet +devices. VMnet minor numbering is +.Va 0x10000 ++ +.Va N . +Where +.Va N +is a VMnet unit number. In this case control device is expected to be +.Pa /dev/vmnet Ns Sy N , +and network interface will be +.Sy vmnet Ns Ar N . +Everything else is the same. +.Pp +In addition to mentioned above +.Xr ioctl 2 +there are additional one for VMware port. +.Bl -tag -width VMIO_SIOCSETMACADDR +.It VMIO_SIOCSIFFLAGS +VMware +.Dv SIOCSIFFLAGS . +.El +.Sh SEE ALSO +.Xr inet 4 , +.Xr intro 4 +.\" .Sh BUGS +.Sh AUTHORS +This man page has been obtained from +.Bx Free . diff --git a/sys/kern/kern_accf.c b/sys/kern/kern_accf.c new file mode 100644 index 000000000000..e6b7d612cc92 --- /dev/null +++ b/sys/kern/kern_accf.c @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 2000 Alfred Perlstein <alfred@FreeBSD.org> + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ + +#define ACCEPT_FILTER_MOD + +#include "opt_param.h" +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/domain.h> +#include <sys/kernel.h> +#include <sys/proc.h> +#include <sys/malloc.h> +#include <sys/mbuf.h> +#include <sys/protosw.h> +#include <sys/socket.h> +#include <sys/socketvar.h> +#include <sys/queue.h> + +static SLIST_HEAD(, accept_filter) accept_filtlsthd = + SLIST_HEAD_INITIALIZER(&accept_filtlsthd); + +MALLOC_DEFINE(M_ACCF, "accf", "accept filter data"); + +/* + * must be passed a malloc'd structure so we don't explode if the kld + * is unloaded, we leak the struct on deallocation to deal with this, + * but if a filter is loaded with the same name as a leaked one we re-use + * the entry. + */ +int +accept_filt_add(struct accept_filter *filt) +{ + struct accept_filter *p; + + SLIST_FOREACH(p, &accept_filtlsthd, accf_next) + if (strcmp(p->accf_name, filt->accf_name) == 0) { + if (p->accf_callback != NULL) { + return (EEXIST); + } else { + p->accf_callback = filt->accf_callback; + FREE(filt, M_ACCF); + return (0); + } + } + + if (p == NULL) + SLIST_INSERT_HEAD(&accept_filtlsthd, filt, accf_next); + return (0); +} + +int +accept_filt_del(char *name) +{ + struct accept_filter *p; + + p = accept_filt_get(name); + if (p == NULL) + return (ENOENT); + + p->accf_callback = NULL; + return (0); +} + +struct accept_filter * +accept_filt_get(char *name) +{ + struct accept_filter *p; + + SLIST_FOREACH(p, &accept_filtlsthd, accf_next) + if (strcmp(p->accf_name, name) == 0) + return (p); + + return (NULL); +} + +int +accept_filt_generic_mod_event(module_t mod, int event, void *data) +{ + struct accept_filter *p; + struct accept_filter *accfp = (struct accept_filter *) data; + int s, error; + + switch (event) { + case MOD_LOAD: + MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, M_WAITOK); + bcopy(accfp, p, sizeof(*p)); + s = splnet(); + error = accept_filt_add(p); + splx(s); + break; + + case MOD_UNLOAD: + /* + * Do not support unloading yet. we don't keep track of refcounts + * and unloading an accept filter callback and then having it called + * is a bad thing. A simple fix would be to track the refcount + * in the struct accept_filter. + */ +#if 0 + s = splnet(); + error = accept_filt_del(accfp->accf_name); + splx(s); +#endif + error = EOPNOTSUPP; + break; + + case MOD_SHUTDOWN: + error = 0; + break; + + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c new file mode 100644 index 000000000000..e6b7d612cc92 --- /dev/null +++ b/sys/kern/uipc_accf.c @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 2000 Alfred Perlstein <alfred@FreeBSD.org> + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ + +#define ACCEPT_FILTER_MOD + +#include "opt_param.h" +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/domain.h> +#include <sys/kernel.h> +#include <sys/proc.h> +#include <sys/malloc.h> +#include <sys/mbuf.h> +#include <sys/protosw.h> +#include <sys/socket.h> +#include <sys/socketvar.h> +#include <sys/queue.h> + +static SLIST_HEAD(, accept_filter) accept_filtlsthd = + SLIST_HEAD_INITIALIZER(&accept_filtlsthd); + +MALLOC_DEFINE(M_ACCF, "accf", "accept filter data"); + +/* + * must be passed a malloc'd structure so we don't explode if the kld + * is unloaded, we leak the struct on deallocation to deal with this, + * but if a filter is loaded with the same name as a leaked one we re-use + * the entry. + */ +int +accept_filt_add(struct accept_filter *filt) +{ + struct accept_filter *p; + + SLIST_FOREACH(p, &accept_filtlsthd, accf_next) + if (strcmp(p->accf_name, filt->accf_name) == 0) { + if (p->accf_callback != NULL) { + return (EEXIST); + } else { + p->accf_callback = filt->accf_callback; + FREE(filt, M_ACCF); + return (0); + } + } + + if (p == NULL) + SLIST_INSERT_HEAD(&accept_filtlsthd, filt, accf_next); + return (0); +} + +int +accept_filt_del(char *name) +{ + struct accept_filter *p; + + p = accept_filt_get(name); + if (p == NULL) + return (ENOENT); + + p->accf_callback = NULL; + return (0); +} + +struct accept_filter * +accept_filt_get(char *name) +{ + struct accept_filter *p; + + SLIST_FOREACH(p, &accept_filtlsthd, accf_next) + if (strcmp(p->accf_name, name) == 0) + return (p); + + return (NULL); +} + +int +accept_filt_generic_mod_event(module_t mod, int event, void *data) +{ + struct accept_filter *p; + struct accept_filter *accfp = (struct accept_filter *) data; + int s, error; + + switch (event) { + case MOD_LOAD: + MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, M_WAITOK); + bcopy(accfp, p, sizeof(*p)); + s = splnet(); + error = accept_filt_add(p); + splx(s); + break; + + case MOD_UNLOAD: + /* + * Do not support unloading yet. we don't keep track of refcounts + * and unloading an accept filter callback and then having it called + * is a bad thing. A simple fix would be to track the refcount + * in the struct accept_filter. + */ +#if 0 + s = splnet(); + error = accept_filt_del(accfp->accf_name); + splx(s); +#endif + error = EOPNOTSUPP; + break; + + case MOD_SHUTDOWN: + error = 0; + break; + + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} diff --git a/sys/net/if_tap.h b/sys/net/if_tap.h new file mode 100644 index 000000000000..30f742129191 --- /dev/null +++ b/sys/net/if_tap.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com> + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * BASED ON: + * ------------------------------------------------------------------------- + * + * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk> + * Nottingham University 1987. + */ + +/* + * $FreeBSD$ + * $Id: if_tap.h,v 0.7 2000/07/12 04:12:51 max Exp $ + */ + +#ifndef _NET_IF_TAP_H_ +#define _NET_IF_TAP_H_ + +/* refer to if_tapvar.h for the softc stuff */ + +/* maximum receive packet size (hard limit) */ +#define TAPMRU 16384 + +struct tapinfo { + int baudrate; /* linespeed */ + short mtu; /* maximum transmission unit */ + u_char type; /* ethernet, tokenring, etc. */ + u_char dummy; /* place holder */ +}; + +/* ioctl's for get/set debug */ +#define TAPSDEBUG _IOW('t', 90, int) +#define TAPGDEBUG _IOR('t', 89, int) +#define TAPSIFINFO _IOW('t', 91, struct tapinfo) +#define TAPGIFINFO _IOR('t', 92, struct tapinfo) + +/* VMware ioctl's */ +#define VMIO_SIOCSIFFLAGS _IO('V', 0) +#define VMIO_SIOCSKEEP _IO('V', 1) +#define VMIO_SIOCSIFBR _IO('V', 2) +#define VMIO_SIOCSLADRF _IO('V', 3) + +/* XXX -- unimplemented */ +#define VMIO_SIOCSETMACADDR _IO('V', 4) + +/* XXX -- not used? */ +#define VMIO_SIOCPORT _IO('V', 5) +#define VMIO_SIOCBRIDGE _IO('V', 6) +#define VMIO_SIOCNETIF _IO('V', 7) + +#endif /* !_NET_IF_TAP_H_ */ diff --git a/usr.bin/usbhidctl/usbhidctl.1 b/usr.bin/usbhidctl/usbhidctl.1 new file mode 100644 index 000000000000..3a9a49a8aeb3 --- /dev/null +++ b/usr.bin/usbhidctl/usbhidctl.1 @@ -0,0 +1,92 @@ +.\" $NetBSD: usbhidctl.1,v 1.8 1999/05/11 21:03:58 augustss Exp $ +.\" $FreeBSD$ +.\" +.\" Copyright (c) 1998 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Lennart Augustsson. +.\" +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``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 FOUNDATION OR CONTRIBUTORS +.\" 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. +.\" +.Dd July 12, 1998 +.Dt USBHIDCTL 1 +.Os +.Sh NAME +.Nm usbhidctl +.Nd manipulate USB HID devices +.Sh SYNOPSIS +.Nm +.Op Fl a +.Fl f Ar device +.Op Fl l +.Op Fl n +.Op Fl r +.Op Fl t Ar table +.Op Fl v +.Op Ar item ... +.Sh DESCRIPTION +.Nm +can be used to dump the state of a USB HID (Human Interface Device). +Each named +.Ar item +is printed. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl a +Show all items. +.It Fl f Ar device +Specify a path name for the device to operate on. +.It Fl l +Loop and dump the device data every time it changes. +.It Fl n +Suppress printing of the item name. +.It Fl r +Dump the report descriptor. +.It Fl t Ar table +Specify a path name for the HID usage table file. +.It Fl v +Be verbose. +.El +.Sh FILES +.Pa /usr/share/misc/usb_hid_usages +The default HID usage table. +.Sh BUGS +.Nm +cannot show nor set output and feature items. +.Sh SEE ALSO +.Xr usb 3 , +.Xr uhid 4 , +.Xr usb 4 +.Sh HISTORY +The +.Nm +command appeared in +.Nx 1.4 . diff --git a/usr.sbin/ngctl/config.c b/usr.sbin/ngctl/config.c new file mode 100644 index 000000000000..144293abd560 --- /dev/null +++ b/usr.sbin/ngctl/config.c @@ -0,0 +1,103 @@ +/* + * config.c + * + * Copyright (c) 1996-1999 Whistle Communications, Inc. + * All rights reserved. + * + * Subject to the following obligations and disclaimer of warranty, use and + * redistribution of this software, in source or object code forms, with or + * without modifications are expressly permitted by Whistle Communications; + * provided, however, that: + * 1. Any and all reproductions of the source or object code must include the + * copyright notice above and the following disclaimer of warranties; and + * 2. No rights are granted, in any manner or form, to use Whistle + * Communications, Inc. trademarks, including the mark "WHISTLE + * COMMUNICATIONS" on advertising, endorsements, or otherwise except as + * such appears in the above copyright notice or in the software. + * + * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND + * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO + * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, + * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. + * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY + * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS + * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. + * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES + * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING + * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER 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 WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "ngctl.h" + +#define NOCONFIG "<no config>" + +static int ConfigCmd(int ac, char **av); + +const struct ngcmd config_cmd = { + ConfigCmd, + "config <path> [arguments]", + "get or set configuration of node at <path>", + NULL +}; + +static int +ConfigCmd(int ac, char **av) +{ + u_char sbuf[sizeof(struct ng_mesg) + NG_TEXTRESPONSE]; + struct ng_mesg *const resp = (struct ng_mesg *) sbuf; + char *const status = (char *) resp->data; + char *path; + char buf[NG_TEXTRESPONSE]; + int nostat = 0, i; + + /* Get arguments */ + if (ac < 2) + return(CMDRTN_USAGE); + path = av[1]; + + *buf = '\0'; + for (i = 2; i < ac; i++) { + if (i != 2) + strcat(buf, " "); + strcat(buf, av[i]); + } + + /* Get node config summary */ + if (*buf != '\0') + i = NgSendMsg(csock, path, NGM_GENERIC_COOKIE, + NGM_TEXT_CONFIG, buf, strlen(buf) + 1); + else + i = NgSendMsg(csock, path, NGM_GENERIC_COOKIE, + NGM_TEXT_CONFIG, NULL, 0); + if (i < 0) { + switch (errno) { + case EINVAL: + nostat = 1; + break; + default: + warn("send msg"); + return(CMDRTN_ERROR); + } + } else { + if (NgRecvMsg(csock, resp, sizeof(sbuf), NULL) < 0 + || (resp->header.flags & NGF_RESP) == 0) + nostat = 1; + } + + /* Show it */ + if (nostat) + printf("No config available for \"%s\"\n", path); + else + printf("Config for \"%s\":\n%s\n", path, status); + return(CMDRTN_OK); +} + |