1*1d44892eSthfr /* $OpenBSD: uhid.h,v 1.2 2021/01/23 05:08:36 thfr Exp $ */ 21ba9f8e2Sreyk /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ 31ba9f8e2Sreyk 41ba9f8e2Sreyk /* 51ba9f8e2Sreyk * Copyright (c) 1998 The NetBSD Foundation, Inc. 61ba9f8e2Sreyk * All rights reserved. 71ba9f8e2Sreyk * 81ba9f8e2Sreyk * This code is derived from software contributed to The NetBSD Foundation 91ba9f8e2Sreyk * by Lennart Augustsson (lennart@augustsson.net) at 101ba9f8e2Sreyk * Carlstedt Research & Technology. 111ba9f8e2Sreyk * 121ba9f8e2Sreyk * Redistribution and use in source and binary forms, with or without 131ba9f8e2Sreyk * modification, are permitted provided that the following conditions 141ba9f8e2Sreyk * are met: 151ba9f8e2Sreyk * 1. Redistributions of source code must retain the above copyright 161ba9f8e2Sreyk * notice, this list of conditions and the following disclaimer. 171ba9f8e2Sreyk * 2. Redistributions in binary form must reproduce the above copyright 181ba9f8e2Sreyk * notice, this list of conditions and the following disclaimer in the 191ba9f8e2Sreyk * documentation and/or other materials provided with the distribution. 201ba9f8e2Sreyk * 211ba9f8e2Sreyk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 221ba9f8e2Sreyk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 231ba9f8e2Sreyk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 241ba9f8e2Sreyk * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 251ba9f8e2Sreyk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 261ba9f8e2Sreyk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 271ba9f8e2Sreyk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 281ba9f8e2Sreyk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 291ba9f8e2Sreyk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 301ba9f8e2Sreyk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 311ba9f8e2Sreyk * POSSIBILITY OF SUCH DAMAGE. 321ba9f8e2Sreyk */ 331ba9f8e2Sreyk 341ba9f8e2Sreyk #ifdef _KERNEL 351ba9f8e2Sreyk 361ba9f8e2Sreyk struct uhid_softc { 371ba9f8e2Sreyk struct uhidev sc_hdev; 381ba9f8e2Sreyk 391ba9f8e2Sreyk u_char *sc_obuf; 401ba9f8e2Sreyk 411ba9f8e2Sreyk struct clist sc_q; 421ba9f8e2Sreyk struct selinfo sc_rsel; 431ba9f8e2Sreyk u_char sc_state; /* driver state */ 441ba9f8e2Sreyk #define UHID_ASLP 0x01 /* waiting for device data */ 451ba9f8e2Sreyk 461ba9f8e2Sreyk int sc_refcnt; 471ba9f8e2Sreyk }; 481ba9f8e2Sreyk 491ba9f8e2Sreyk extern struct cfdriver uhid_cd; 501ba9f8e2Sreyk extern struct cfdriver fido_cd; 51*1d44892eSthfr extern struct cfdriver ujoy_cd; 521ba9f8e2Sreyk 531ba9f8e2Sreyk #define UHIDUNIT(dev) (minor(dev)) 541ba9f8e2Sreyk #define UHID_CHUNK 128 /* chunk size for read */ 551ba9f8e2Sreyk #define UHID_BSIZE 1020 /* buffer size */ 561ba9f8e2Sreyk 571ba9f8e2Sreyk void uhid_intr(struct uhidev *, void *, u_int); 581ba9f8e2Sreyk struct uhid_softc *uhid_lookup(dev_t); 591ba9f8e2Sreyk 601ba9f8e2Sreyk int uhid_do_open(dev_t, int, int, struct proc *); 611ba9f8e2Sreyk 621ba9f8e2Sreyk void uhid_attach(struct device *, struct device *, void *); 631ba9f8e2Sreyk int uhid_detach(struct device *, int); 641ba9f8e2Sreyk 651ba9f8e2Sreyk #endif /* _KERNEL */ 66