Add some ioctl()s for consumer IR.
This commit is contained in:
parent
a7d99a83b1
commit
0680aa8809
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cir.c,v 1.1 2001/12/02 10:44:43 augustss Exp $ */
|
||||
/* $NetBSD: cir.c,v 1.2 2001/12/12 15:33:53 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -46,8 +46,9 @@
|
|||
#include <sys/select.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <dev/ir/cirvar.h>
|
||||
#include <dev/ir/ir.h>
|
||||
#include <dev/ir/cirio.h>
|
||||
#include <dev/ir/cirvar.h>
|
||||
|
||||
cdev_decl(cir);
|
||||
|
||||
|
@ -84,7 +85,8 @@ cir_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (sc->sc_methods->im_read == NULL ||
|
||||
sc->sc_methods->im_write == NULL)
|
||||
sc->sc_methods->im_write == NULL ||
|
||||
sc->sc_methods->im_setparams == NULL)
|
||||
panic("%s: missing methods\n", sc->sc_dev.dv_xname);
|
||||
#endif
|
||||
printf("\n");
|
||||
|
@ -206,6 +208,15 @@ cirioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
|||
/* All handled in the upper FS layer. */
|
||||
error = 0;
|
||||
break;
|
||||
case CIR_GET_PARAMS:
|
||||
*(struct cir_params *)addr = sc->sc_params;
|
||||
break;
|
||||
case CIR_SET_PARAMS:
|
||||
error = sc->sc_methods->im_setparams(sc->sc_handle,
|
||||
(struct cir_params *)addr);
|
||||
if (!error)
|
||||
sc->sc_params = *(struct cir_params *)addr;
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/* $NetBSD: cirio.h,v 1.1 2001/12/12 15:33:53 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Lennart Augustsson (lennart@augustsson.net).
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DEV_CIRIO_H_
|
||||
#define _SYS_DEV_CIRIO_H_
|
||||
|
||||
struct cir_params {
|
||||
int raw;
|
||||
};
|
||||
|
||||
/* Coordinate numbering with irdaio.h. */
|
||||
#define CIR_GET_PARAMS _IOR('I', 201, struct cir_params)
|
||||
#define CIR_SET_PARAMS _IOW('I', 202, struct cir_params)
|
||||
|
||||
#endif /* _SYS_DEV_CIRIO_H_ */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cirvar.h,v 1.1 2001/12/02 10:44:43 augustss Exp $ */
|
||||
/* $NetBSD: cirvar.h,v 1.2 2001/12/12 15:33:53 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -41,12 +41,14 @@ struct cir_methods {
|
|||
int (*im_close)(void *h, int flag, int mode, struct proc *p);
|
||||
int (*im_read)(void *h, struct uio *uio, int flag);
|
||||
int (*im_write)(void *h, struct uio *uio, int flag);
|
||||
int (*im_setparams)(void *h, struct cir_params *params);
|
||||
};
|
||||
|
||||
struct cir_softc {
|
||||
struct device sc_dev;
|
||||
struct cir_methods *sc_methods;
|
||||
const struct cir_methods *sc_methods;
|
||||
void *sc_handle;
|
||||
char sc_open;
|
||||
struct selinfo sc_rdsel;
|
||||
struct cir_params sc_params;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue