Sync with NetBSD sources. Almost there. Mostly style fixes.

This commit is contained in:
Nick Hibma 1999-01-10 18:42:54 +00:00
parent d2dfa9aec1
commit 53809e8652
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42490
24 changed files with 287 additions and 199 deletions

View file

@ -1,5 +1,5 @@
/* $NetBSD: hid.c,v 1.5 1998/12/26 12:53:00 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: hid.c,v 1.7 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: hid.c,v 1.5 1999/01/07 23:31:29 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -103,7 +103,7 @@ hid_start_parse(d, len, kindset)
s = malloc(sizeof *s, M_TEMP, M_WAITOK);
memset(s, 0, sizeof *s);
s->start = s->p = d;
s->end = d + len;
s->end = (char *)d + len;
s->kindset = kindset;
return (s);
}

View file

@ -1,5 +1,5 @@
/* $NetBSD: ohci.c,v 1.21 1999/01/01 15:15:33 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: ohci.c,v 1.23 1999/01/07 02:06:05 augustss Exp $ */
/* FreeBSD $Id: ohci.c,v 1.7 1999/01/07 23:31:29 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.

View file

@ -1,5 +1,5 @@
/* $NetBSD: ucom.c,v 1.4 1998/12/30 17:46:20 augustss Exp $ */
/* FreeBSD $Id: ucom.c,v 1.5 1999/01/07 23:31:31 n_hibma Exp $ */
/* $NetBSD: ucom.c,v 1.6 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: ucom.c,v 1.6 1999/01/08 17:25:37 eivind Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -58,7 +58,6 @@
#include <sys/select.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/device.h>
#include <sys/poll.h>
#include <dev/usb/usb.h>
@ -125,7 +124,6 @@ USB_ATTACH(ucom)
static int
ucom_detach(device_t self)
{
struct ucom_softc *sc = device_get_softc(self);
char *devinfo = (char *) device_get_desc(self);
if (devinfo) {

View file

@ -1,5 +1,5 @@
/* $NetBSD: ugen.c,v 1.9 1999/01/03 01:03:22 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: ugen.c,v 1.11 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: ugen.c,v 1.4 1999/01/07 23:31:32 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -103,11 +103,6 @@ struct ugen_softc {
int sc_disconnected; /* device is gone */
};
/* XXX NWH Supposedly in USB_DECLARE_DRIVER_NAME_INIT
int ugen_match __P((bdevice *, struct cfdata *, void *));
void ugen_attach __P((bdevice *, struct device *, void *));
*/
int ugenopen __P((dev_t, int, int, struct proc *));
int ugenclose __P((dev_t, int, int, struct proc *p));
int ugenread __P((dev_t, struct uio *uio, int));
@ -436,7 +431,8 @@ ugenread(dev, uio, flag)
if (reqh == 0)
return (ENOMEM);
while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) {
DPRINTFN(1, ("ugenread: transfer %d bytes\n", n));
DPRINTFN(1, ("ugenread: start transfer %d bytes\n", n));
tn = n;
r = usbd_bulk_transfer(reqh, sce->pipeh, 0, buf,
&tn, "ugenrb");
if (r != USBD_NORMAL_COMPLETION) {
@ -446,6 +442,7 @@ ugenread(dev, uio, flag)
error = EIO;
break;
}
DPRINTFN(1, ("ugenread: got %d bytes\n", tn));
error = uiomove(buf, tn, uio);
if (error || tn < n)
break;
@ -467,7 +464,7 @@ ugenwrite(dev, uio, flag)
{
USB_GET_SC(ugen, UGENUNIT(dev), sc);
int endpt = UGENENDPOINT(dev);
struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][IN];
struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][OUT];
size_t n;
int error = 0;
char buf[UGEN_BBSIZE];
@ -973,7 +970,6 @@ ugenpoll(dev, events, p)
static int
ugen_detach(device_t self)
{
struct ugen_softc *sc = device_get_softc(self);
char *devinfo = (char *) device_get_desc(self);
if (devinfo) {

View file

@ -1,5 +1,5 @@
/* $NetBSD: uhci.c,v 1.20 1998/12/30 18:06:25 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: uhci.c,v 1.22 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: uhci.c,v 1.6 1999/01/07 23:31:33 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -418,9 +418,9 @@ uhci_dump_td(p)
if (uhci_longtd)
printf(" %b %b,errcnt=%d,actlen=%d pid=%02x,addr=%d,endpt=%d,"
"D=%d,maxlen=%d\n",
(long)p->td->td_link,
(int)p->td->td_link,
"\20\1T\2Q\3VF",
(long)p->td->td_status,
(int)p->td->td_status,
"\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27"
"STALLED\30ACTIVE\31IOC\32ISO\33LS\36SPD",
UHCI_TD_GET_ERRCNT(p->td->td_status),
@ -775,7 +775,7 @@ uhci_ii_done(ii, timo)
#endif
/* The transfer is done, compute length and status. */
/* XXX stop at first inactive to get toggle right. */
/* XXX Should stop at first inactive to get toggle right. */
/* XXX Is this correct for control xfers? */
for (len = status = 0, std = ii->stdstart;
std != 0;
@ -799,7 +799,7 @@ uhci_ii_done(ii, timo)
"status 0x%b\n",
reqh->pipe->device->address,
reqh->pipe->endpoint->edesc->bEndpointAddress,
(long)status,
(int)status,
"\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27"
"STALLED\30ACTIVE"));
if (status == UHCI_TD_STALLED)

View file

@ -1,5 +1,5 @@
/* $NetBSD: uhid.c,v 1.12 1998/12/26 12:53:02 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: uhid.c,v 1.14 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: uhid.c,v 1.5 1999/01/07 23:31:34 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -200,7 +200,6 @@ USB_ATTACH(uhid)
static int
uhid_detach(device_t self)
{
struct uhid_softc *sc = device_get_softc(self);
char *devinfo = (char *) device_get_desc(self);
if (devinfo) {

View file

@ -1,5 +1,5 @@
/* $NetBSD: uhub.c,v 1.13 1998/12/30 18:06:25 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: uhub.c,v 1.14 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: uhub.c,v 1.5 1999/01/07 23:31:34 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -477,7 +477,9 @@ uhub_disconnect(up)
up->device = 0;
/* XXX free */
#if defined(__FreeBSD__)
device_delete_child(device_get_parent(((struct softc *)dev->softc)->sc_dev), ((struct softc *)dev->softc)->sc_dev);
device_delete_child(
device_get_parent(((struct softc *)dev->softc)->sc_dev),
((struct softc *)dev->softc)->sc_dev);
#endif
}

View file

@ -1,5 +1,5 @@
/* $NetBSD: ukbd.c,v 1.20 1998/12/30 19:25:27 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: ukbd.c,v 1.22 1999/01/09 12:10:36 drochner Exp $ */
/* FreeBSD $Id: ukbd.c,v 1.5 1999/01/07 23:31:34 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -274,8 +274,6 @@ USB_ATTACH(ukbd)
char devinfo[1024];
#if defined(__NetBSD__)
struct wskbddev_attach_args a;
#else
int i;
#endif
sc->sc_disconnected = 1;

View file

@ -1,5 +1,5 @@
/* $NetBSD: ulpt.c,v 1.9 1998/12/30 17:46:20 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: ulpt.c,v 1.10 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: ulpt.c,v 1.4 1999/01/07 23:31:35 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -400,7 +400,6 @@ ulptioctl(dev, cmd, data, flag, p)
static int
ulpt_detach(device_t self)
{
struct ulpt_softc *sc = device_get_softc(self);
char *devinfo = (char *) device_get_desc(self);
if (devinfo) {

View file

@ -1,5 +1,4 @@
/* $NetBSD: umodem.c,v 1.4 1998/12/30 17:46:20 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: umodem.c,v 1.5 1999/01/08 11:58:25 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -43,7 +42,6 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#if defined(__NetBSD__)
#include <sys/device.h>
#include <sys/ioctl.h>
#elif defined(__FreeBSD__)
#include <sys/module.h>
@ -60,13 +58,12 @@
#include <sys/poll.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
#include <dev/usb/usbcdc.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usbdevs.h>
#include <dev/usb/usb_quirks.h>
#include <dev/usb/hid.h>
#ifdef USB_DEBUG
#define DPRINTF(x) if (umodemdebug) printf x
@ -79,7 +76,10 @@ int umodemdebug = 0;
struct umodem_softc {
bdevice sc_dev; /* base device */
usbd_interface_handle sc_iface; /* interface */
usbd_interface_handle sc_ctl; /* control interface */
usbd_interface_handle sc_data; /* data interface */
uByte cmCaps;
uByte acmCaps;
};
void umodem_intr __P((usbd_request_handle, usbd_private_handle, usbd_status));
@ -111,7 +111,7 @@ USB_ATTACH(umodem)
usb_interface_descriptor_t *id;
char devinfo[1024];
sc->sc_iface = iface;
sc->sc_ctl = iface;
id = usbd_get_interface_descriptor(iface);
usbd_devinfo(uaa->device, 0, devinfo);
USB_ATTACH_SETUP;
@ -125,18 +125,18 @@ USB_ATTACH(umodem)
static int
umodem_detach(device_t self)
{
struct umodem_softc *sc = device_get_softc(self);
char *devinfo = (char *) device_get_desc(self);
if (devinfo) {
device_set_desc(self, NULL);
free(devinfo, M_USB);
}
}
return 0;
}
#endif
#if defined(__FreeBSD__)
DRIVER_MODULE(umodem, usb, umodem_driver, umodem_devclass, usbd_driver_load, 0);
DRIVER_MODULE(umodem, usb, umodem_driver, umodem_devclass, usbd_driver_load,0);
#endif

View file

@ -1,5 +1,5 @@
/* $NetBSD: ums.c,v 1.18 1998/12/30 17:46:20 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: ums.c,v 1.19 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: ums.c,v 1.6 1999/01/07 23:31:36 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -110,13 +110,14 @@ struct ums_softc {
int flags; /* device configuration */
#define UMS_Z 0x01 /* z direction available */
int nbuttons;
#define MAX_BUTTONS 7 /* chosen because sc_buttons is u_char */
#if defined(__NetBSD__)
u_char sc_buttons; /* mouse button status */
struct device *sc_wsmousedev;
#elif defined(__FreeBSD__)
u_char qbuf[QUEUE_BUFSIZE];
u_char dummy[100]; /* just for safety and for now */
u_char dummy[100]; /* XXX just for safety and for now */
int qcount, qhead, qtail;
mousehw_t hw;
mousemode_t mode;
@ -275,12 +276,19 @@ USB_ATTACH(ums)
if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
sc->sc_loc_z.size = 0; /* Bad Z coord, ignore it */
} else {
#if defined(__FreeBSD__)
#ifdef USBVERBOSE
printf("%s: Z dir. ignored due to bugs in ums.c\n",
USBDEVNAME(sc->sc_dev));
#endif
#else
sc->flags |= UMS_Z;
#endif
}
}
/* figure out the number of buttons, 7 is an arbitrary limit */
for (i = 1; i <= 7; i++)
/* figure out the number of buttons */
for (i = 1; i <= MAX_BUTTONS; i++)
if (!hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),
hid_input, &loc_btn, 0))
break;
@ -404,6 +412,7 @@ ums_intr(reqh, addr, status)
int dx, dy, dz;
u_char buttons = 0;
int i;
#if defined(__NetBSD__)
#define UMS_BUT(i) ((i) == 1 || (i) == 2 ? 3 - (i) : i)
#elif defined(__FreeBSD__)
@ -428,12 +437,10 @@ ums_intr(reqh, addr, status)
if (*ibuf++ != sc->sc_iid)
return;
}
dx = hid_get_data(ibuf, &sc->sc_loc_x);
dy = -hid_get_data(ibuf, &sc->sc_loc_y);
dz = hid_get_data(ibuf, &sc->sc_loc_z);
/* NWH Why are you modifying the button assignments here?
* That's the purpose of a high level mouse driver
*/
for (i = 0; i < sc->nbuttons; i++)
if (hid_get_data(ibuf, &sc->sc_loc_btn[i]))
buttons |= (1 << UMS_BUT(i));

View file

@ -1,5 +1,5 @@
/* $NetBSD: usb.c,v 1.10 1999/01/03 01:00:56 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usb.c,v 1.11 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: usb.c,v 1.5 1999/01/07 23:31:37 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -337,7 +337,7 @@ usbpoll(dev, events, p)
return (revents);
}
#if defined(__NetBSD__)
#if 0
int
usb_bus_count()
{
@ -348,7 +348,9 @@ usb_bus_count()
n++;
return (n);
}
#endif
#if defined(__NetBSD__)
usbd_status
usb_get_bus_handle(n, h)
int n;
@ -402,7 +404,6 @@ usb_needs_explore(bus)
int
usb_detach(device_t self)
{
struct usb_softc *sc = device_get_softc(self);
char *devinfo = (char *) device_get_desc(self);
if (devinfo) {

View file

@ -1,5 +1,5 @@
/* $NetBSD: usb.h,v 1.17 1999/01/03 01:09:18 augustss Exp $ */
/* FreeBSD $Id$ */
/* FreeBSD $Id: usb.h,v 1.6 1999/01/07 23:31:37 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -385,7 +385,7 @@ struct usb_ctl_request {
int flags;
/* XXX must match flags in usbdi.h */
#define USBD_SHORT_XFER_OK 0x04
int actlen;
int actlen; /* actual length transferred */
};
struct usb_alt_interface {

View file

@ -1,5 +1,5 @@
/* $NetBSD: usb_mem.h,v 1.3 1998/12/26 12:53:03 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usb_mem.h,v 1.4 1999/01/09 12:16:54 augustss Exp $ */
/* FreeBSD $Id: usb_mem.h,v 1.4 1999/01/07 23:31:38 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -81,8 +81,6 @@ void usb_freemem __P((bus_dma_tag_t, usb_dma_t *));
#include <machine/pmap.h> /* for vtophys */
typedef void * usb_dma_t;
#define usb_allocmem(t,s,a,p) (*(p) = malloc(s, M_USB, M_NOWAIT), (*(p) == NULL? USBD_NOMEM: USBD_NORMAL_COMPLETION))

View file

@ -1,5 +1,5 @@
/* $NetBSD$ */
/* FreeBSD $Id$ */
/* $NetBSD: usb_port.h,v 1.5 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: usb_port.h,v 1.8 1999/01/07 23:31:38 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Macro's to cope with the differences between NetBSD and FreeBSD
/*
* Macro's to cope with the differences between operating systems.
*/
/*
@ -55,7 +57,7 @@ typedef struct device bdevice; /* base device */
#define usb_timeout(f, d, t, h) timeout((f), (d), (t))
#define usb_untimeout(f, d, h) untimeout((f), (d))
#define USB_DECLARE_DRIVER_NAME_INIT(_1, dname, _2...) \
#define USB_DECLARE_DRIVER_NAME_INIT(_1, dname, _2) \
int __CONCAT(dname,_match) __P((struct device *, struct cfdata *, void *)); \
void __CONCAT(dname,_attach) __P((struct device *, struct device *, void *)); \
\
@ -118,7 +120,8 @@ __CONCAT(dname,_attach)(parent, self, aux) \
*/
#include "opt_usb.h"
/* The following is not a type def to avoid error messages
/*
* The following is not a type def to avoid error messages
* because of includes in the wrong order.
*/
#define bdevice device_t

View file

@ -1,5 +1,5 @@
/* $NetBSD: usb_quirks.c,v 1.6 1998/12/29 15:23:59 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usb_quirks.c,v 1.8 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: usb_quirks.c,v 1.5 1999/01/07 23:31:39 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -43,13 +43,16 @@
#if defined(__FreeBSD__)
#include <sys/bus.h>
#endif
#include <sys/select.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdevs.h>
#include <dev/usb/usb_quirks.h>
#ifdef USB_DEBUG
extern int usbdebug;
#endif
struct usbd_quirk_entry {
u_int16_t idVendor;
u_int16_t idProduct;
@ -82,12 +85,10 @@ usbd_find_quirk(d)
break;
}
#ifdef USB_DEBUG
{ extern int usbdebug;
if (usbdebug && t->quirks.uq_flags)
printf("usbd_find_quirk 0x%04x/0x%04x/%x: %d\n",
UGETW(d->idVendor), UGETW(d->idProduct),
UGETW(d->bcdDevice), t->quirks.uq_flags);
}
#endif
return (&t->quirks);
}

View file

@ -1,5 +1,5 @@
/* $NetBSD: usb_subr.c,v 1.24 1999/01/01 15:21:42 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usb_subr.c,v 1.27 1999/01/08 11:58:25 augustss Exp $ */
/* FreeBSD $Id: usb_subr.c,v 1.6 1999/01/07 23:31:40 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -80,8 +80,6 @@ int usbd_getnewaddr __P((usbd_bus_handle bus));
int usbd_print __P((void *aux, const char *pnp));
int usbd_submatch __P((bdevice *, struct cfdata *cf, void *));
#endif
usb_interface_descriptor_t *usbd_find_idesc __P((usb_config_descriptor_t *cd,
int ifaceidx, int altidx));
void usbd_free_iface_data __P((usbd_device_handle dev, int ifcno));
void usbd_kill_pipe __P((usbd_pipe_handle));
usbd_status usbd_probe_and_attach
@ -725,7 +723,6 @@ usbd_probe_and_attach(parent, dev, port, addr)
int port;
int addr;
{
bdevice bdev;
struct usb_attach_arg uaa;
usb_device_descriptor_t *dd = &dev->ddesc;
int r, found, i, confi, nifaces;
@ -735,6 +732,7 @@ usbd_probe_and_attach(parent, dev, port, addr)
/* XXX uaa is a static var. Not a problem as it _should_ be used only
* during probe and attach. Should be changed however
*/
bdevice bdev;
bdev = device_add_child(*parent, NULL, -1, &uaa);
if (!bdev) {
printf("%s: Device creation failed\n", USBDEVNAME(dev->bus->bdev));
@ -1029,14 +1027,6 @@ usbd_submatch(parent, cf, aux)
return 0;
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
}
#elif defined(__FreeBSD__)
static void
usbd_bus_print_child(device_t bus, device_t dev)
{
/* FIXME print the device address and the configuration used
*/
}
#endif
usbd_status

141
sys/dev/usb/usbcdc.h Normal file
View file

@ -0,0 +1,141 @@
/* $NetBSD: usbcdc.h,v 1.3 1999/01/03 01:09:18 augustss Exp $ */
/* FreeBSD $Id$ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Lennart Augustsson (augustss@carlstedt.se) at
* Carlstedt Research & Technology.
*
* 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 _USBCDC_H_
#define _USBCDC_H_
#define UDESCSUB_CDC_HEADER 0
#define UDESCSUB_CDC_CM 1 /* Call Management */
#define UDESCSUB_CDC_ACM 2 /* Abstract Control Model */
#define UDESCSUB_CDC_DLM 3 /* Direct Line Management */
#define UDESCSUB_CDC_TRF 4 /* Telephone Ringer */
#define UDESCSUB_CDC_TCLSR 5 /* Telephone Call ... */
#define UDESCSUB_CDC_UNION 6
#define UDESCSUB_CDC_CS 7 /* Country Selection */
#define UDESCSUB_CDC_TOM 8 /* Telephone Operational Modes */
#define UDESCSUB_CDC_USBT 9 /* USB Terminal */
typedef struct {
uByte bLength;
uByte bDescriptorType;
uByte bDescriptorSubtype;
uWord bcdCDC;
} usb_cdc_header_descriptor_t;
typedef struct {
uByte bLength;
uByte bDescriptorType;
uByte bDescriptorSubtype;
uByte bmCapabilities;
#define USB_CDC_CM_DOES_CM 0x01
#define USB_CDC_CM_CM_OVER_DATA 0x02
uByte bDataInterface;
} usb_cdc_cm_descriptor_t;
typedef struct {
uByte bLength;
uByte bDescriptorType;
uByte bDescriptorSubtype;
uByte bmCapabilities;
#define USB_CDC_ACM_HAS_FEATURE 0x01
#define USB_CDC_ACM_HAS_LINE 0x02
#define USB_CDC_ACM_HAS_BREAK 0x04
#define USB_CDC_ACM_HAS_NETWORK_CONN 0x08
} usb_cdc_acm_descriptor_t;
typedef struct {
uByte bLength;
uByte bDescriptorType;
uByte bDescriptorSubtype;
uByte bMasterInterface;
uByte bSlaveInterface[1];
} usb_cdc_union_descriptor_t;
#define UCDC_SEND_ENCAPSULATED_COMMAND 0x00
#define UCDC_GET_ENCAPSULATED_RESPONSE 0x01
#define UCDC_SET_COMM_FEATURE 0x02
#define UCDC_GET_COMM_FEATURE 0x03
#define UCDC_ABSTRACT_STATE 0x01
#define UCDC_COUNTRY_SETTING 0x02
#define UCDC_CLEAR_COMM_FEATURE 0x04
#define UCDC_SET_LINE_CODING 0x20
#define UCDC_GET_LINE_CODING 0x21
typedef struct {
uWord wState;
#define UCDC_IDLE_SETTING 0x0001
#define UCDC_DATA_MULTIPLEXED 0x0002
} usb_cdc_abstract_state_t;
typedef struct {
uDWord dwDTERate;
uByte bCharFormat;
#define UCDC_STOP_BIT_1 0
#define UCDC_STOP_BIT_1_5 1
#define UCDC_STOP_BIT_2 2
uByte bParityType;
#define UCDC_PARITY_NONE 0
#define UCDC_PARITY_ODD 1
#define UCDC_PARITY_EVEN 2
#define UCDC_PARITY_MARK 3
#define UCDC_PARITY_SPACE 4
uByte bDataBits;
} usb_cdc_line_state_t;
typedef struct {
uByte bmRequestType;
#define UCDC_NOTIFICATION 0xa1
uByte bNotification;
#define UCDC_N_NETWORK_CONNECTION 0x00
#define UCDC_N_RESPONSE_AVAILABLE 0x01
#define UCDC_N_AUX_JACK_HOOK_STATE 0x08
#define UCDC_N_RING_DETECT 0x09
#define UCDC_N_SERIAL_STATE 0x20
#define UCDC_N_CALL_STATE_CHANGED 0x28
#define UCDC_N_LINE_STATE_CHANGED 0x29
#define UCDC_N_CONNECTION_SPEED_CHANGE 0x2a
uWord wValue;
uWord wIndex;
uWord wLength;
uByte data[16];
} usb_cdc_notification_t;
#define UCDC_NOTIFICATION_LENGTH 8
#endif /* _USBCDC_H_ */

View file

@ -1,10 +1,10 @@
/* $NetBSD$ */
/* FreeBSD $Id$ */
/*
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* NetBSD: usbdevs,v 1.14 1998/12/30 03:52:30 augustss Exp
* NetBSD: usbdevs,v 1.19 1999/01/08 11:18:38 augustss Exp
*/
/*
@ -56,11 +56,13 @@
#define USB_VENDOR_UNIXTAR 0x0451 /* Unixtar */
#define USB_VENDOR_GENIUS 0x0458 /* Genius */
#define USB_VENDOR_MICROSOFT 0x045e /* Microsoft */
#define USB_VENDOR_KENSINGTON 0x0461 /* Kensington */
#define USB_VENDOR_CHERRY 0x046a /* Cherry */
/* Behavior Technology Corporation */
#define USB_VENDOR_BTC 0x046e /* BTC */
#define USB_VENDOR_PHILIPS 0x0471 /* Philips */
#define USB_VENDOR_CONNECTIX 0x0478 /* Connectix */
#define USB_VENDOR_ACER 0x04a5 /* Acer Peripherals */
#define USB_VENDOR_CYPRESS 0x04b4 /* Cypress Semiconductor */
#define USB_VENDOR_3COM 0x04c1 /* 3Com */
#define USB_VENDOR_SHUTTLE 0x04e6 /* Shuttle Technology */
@ -92,12 +94,8 @@
/* CATC products */
#define USB_PRODUCT_CATC_ANDROMEDA 0x1237 /* Andromeda hub */
/* Nanao products */
#define USB_PRODUCT_NANAO_HUB 0x0000 /* hub */
#define USB_PRODUCT_NANAO_MONITOR 0x0001 /* monitor */
/* Unixtar products */
#define USB_PRODUCT_UNIXTAR_UTUSB41 0x1446 /* UT-USB41 */
#define USB_PRODUCT_UNIXTAR_UTUSB41 0x1446 /* UT-USB41 hub */
/* Genius products */
#define USB_PRODUCT_GENIUS_NICHE 0x0001 /* Niche mouse */
@ -106,6 +104,9 @@
/* Microsoft products */
#define USB_PRODUCT_MICROSOFT_INTELLIMOUSE 0x0009 /* IntelliMouse */
/* Kensington products */
#define USB_PRODUCT_KENSINGTON_MOUSEINABOX 0x4d02 /* Mouse-in-a-Box */
/* Cherry products */
#define USB_PRODUCT_CHERRY_MY3000KBD 0x0001 /* My3000 keyboard */
#define USB_PRODUCT_CHERRY_MY3000HUB 0x0003 /* My3000 hub */
@ -120,6 +121,9 @@
/* Connectix products */
#define USB_PRODUCT_CONNECTIX_QUICKCAM 0x0001 /* QuickCam */
/* Acer products */
#define USB_PRODUCT_ACER_ACERSCAN_C310U 0x12a6 /* Acerscan C310U */
/* Cypress Semiconduuctor products */
#define USB_PRODUCT_CYPRESS_MOUSE 0x0001 /* mouse */
@ -152,10 +156,6 @@
#define USB_PRODUCT_LOGITECH_M2452 0x0203 /* M2452 keyboard */
#define USB_PRODUCT_LOGITECH_M4848 0x0301 /* M4848 mouse */
/* EIZO Nanao products */
#define USB_PRODUCT_EIZONANAO_HUB 0x0000 /* hub */
#define USB_PRODUCT_EIZONANAO_MONITOR 0x0001 /* monitor */
/* Chic Technology products */
#define USB_PRODUCT_CHIC_MOUSE1 0x0001 /* mouse */
@ -166,7 +166,7 @@
#define USB_PRODUCT_PLX_TESTBOARD 0x9060 /* test board */
/* Inside Out Networks products */
#define USB_PRODUCT_INSIDEOUT_EDGEPORT4 0x0001 /* EdgePort/4 */
#define USB_PRODUCT_INSIDEOUT_EDGEPORT4 0x0001 /* EdgePort/4 serial ports */
/* Intel products */
#define USB_PRODUCT_INTEL_TESTBOARD 0x9890 /* 82930 test board */

View file

@ -1,12 +1,10 @@
/* $NetBSD$ */
/* FreeBSD $Id$ */
/*
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* NetBSD: usbdevs,v 1.14 1998/12/30 03:52:30 augustss Exp
* NetBSD: usbdevs,v 1.19 1999/01/08 11:18:38 augustss Exp
*/
/*
@ -71,23 +69,11 @@ struct usb_knowndev usb_knowndevs[] = {
"CATC",
"Andromeda hub",
},
{
USB_VENDOR_NANAO, USB_PRODUCT_NANAO_HUB,
0,
"Nanao",
"hub",
},
{
USB_VENDOR_NANAO, USB_PRODUCT_NANAO_MONITOR,
0,
"Nanao",
"monitor",
},
{
USB_VENDOR_UNIXTAR, USB_PRODUCT_UNIXTAR_UTUSB41,
0,
"Unixtar",
"UT-USB41",
"UT-USB41 hub",
},
{
USB_VENDOR_GENIUS, USB_PRODUCT_GENIUS_NICHE,
@ -107,6 +93,12 @@ struct usb_knowndev usb_knowndevs[] = {
"Microsoft",
"IntelliMouse",
},
{
USB_VENDOR_KENSINGTON, USB_PRODUCT_KENSINGTON_MOUSEINABOX,
0,
"Kensington",
"Mouse-in-a-Box",
},
{
USB_VENDOR_CHERRY, USB_PRODUCT_CHERRY_MY3000KBD,
0,
@ -143,6 +135,12 @@ struct usb_knowndev usb_knowndevs[] = {
"Connectix",
"QuickCam",
},
{
USB_VENDOR_ACER, USB_PRODUCT_ACER_ACERSCAN_C310U,
0,
"Acer Peripherals",
"Acerscan C310U",
},
{
USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_MOUSE,
0,
@ -215,18 +213,6 @@ struct usb_knowndev usb_knowndevs[] = {
"Logitech",
"M4848 mouse",
},
{
USB_VENDOR_EIZONANAO, USB_PRODUCT_EIZONANAO_HUB,
0,
"EIZO Nanao",
"hub",
},
{
USB_VENDOR_EIZONANAO, USB_PRODUCT_EIZONANAO_MONITOR,
0,
"EIZO Nanao",
"monitor",
},
{
USB_VENDOR_CHIC, USB_PRODUCT_CHIC_MOUSE1,
0,
@ -249,7 +235,7 @@ struct usb_knowndev usb_knowndevs[] = {
USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
0,
"Inside Out Networks",
"EdgePort/4",
"EdgePort/4 serial ports",
},
{
USB_VENDOR_INTEL, USB_PRODUCT_INTEL_TESTBOARD,
@ -299,6 +285,12 @@ struct usb_knowndev usb_knowndevs[] = {
"Microsoft",
NULL,
},
{
USB_VENDOR_KENSINGTON, 0,
USB_KNOWNDEV_NOPROD,
"Kensington",
NULL,
},
{
USB_VENDOR_CHERRY, 0,
USB_KNOWNDEV_NOPROD,
@ -323,6 +315,12 @@ struct usb_knowndev usb_knowndevs[] = {
"Connectix",
NULL,
},
{
USB_VENDOR_ACER, 0,
USB_KNOWNDEV_NOPROD,
"Acer Peripherals",
NULL,
},
{
USB_VENDOR_CYPRESS, 0,
USB_KNOWNDEV_NOPROD,

View file

@ -1,5 +1,5 @@
/* $NetBSD: usbdi.c,v 1.19 1999/01/03 01:00:56 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usbdi.c,v 1.20 1999/01/08 11:58:26 augustss Exp $ */
/* FreeBSD $Id: usbdi.c,v 1.7 1999/01/07 23:31:42 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -227,55 +227,6 @@ usbd_do_transfer(reqh)
return (pipe->methods->transfer(reqh));
}
#if 0
static usbd_status
usbd_do_transfer(reqh)
usbd_request_handle reqh;
{
usbd_pipe_handle pipe = reqh->pipe;
DPRINTFN(10,("usbd_do_transfer: reqh=%p\n", reqh));
reqh->done = 0;
s = splusb();
if (pipe->state == USBD_PIPE_IDLE ||
(iface && iface->state == USBD_INTERFACE_IDLE)) {
splx(s);
return (USBD_IS_IDLE);
}
SIMPLEQ_INSERT_TAIL(&pipe->queue, reqh, next);
if (pipe->state == USBD_PIPE_ACTIVE &&
(!iface || iface->state == USBD_INTERFACE_ACTIVE)) {
r = usbd_start(pipe);
} else
r = USBD_NOT_STARTED;
splx(s);
return (r);
}
static usbd_status
usbd_start(pipe)
usbd_pipe_handle pipe;
{
usbd_request_handle reqh;
DPRINTFN(5, ("usbd_start: pipe=%p, running=%d\n",
pipe, pipe->running));
if (pipe->running)
return (USBD_IN_PROGRESS);
reqh = SIMPLEQ_FIRST(&pipe->queue);
if (!reqh) {
/* XXX */
printf("usbd_start: pipe empty!\n");
pipe->running = 0;
return (USBD_XXX);
}
SIMPLEQ_REMOVE_HEAD(&pipe->queue, reqh, next);
pipe->running = 1;
pipe->curreqh = reqh;
return (pipe->methods->transfer(reqh));
}
#endif
usbd_request_handle
usbd_alloc_request()
{
@ -707,13 +658,15 @@ usbd_interface_count(dev, count)
return (USBD_NORMAL_COMPLETION);
}
#if defined(__NetBSD__)
#if 0
u_int8_t
usbd_bus_count()
{
return (usb_bus_count());
}
#endif
#if defined(__NetBSD__)
usbd_status
usbd_get_bus_handle(index, bus)
u_int8_t index;
@ -934,6 +887,7 @@ usbd_ar_pipe(pipe)
{
usbd_request_handle reqh;
#if 0
for (;;) {
reqh = SIMPLEQ_FIRST(&pipe->queue);
if (reqh == 0)
@ -943,6 +897,12 @@ usbd_ar_pipe(pipe)
if (reqh->callback)
reqh->callback(reqh, reqh->priv, reqh->status);
}
#else
while ((reqh = SIMPLEQ_FIRST(&pipe->queue))) {
pipe->methods->abort(reqh);
SIMPLEQ_REMOVE_HEAD(&pipe->queue, reqh, next);
}
#endif
return (USBD_NORMAL_COMPLETION);
}
@ -1319,14 +1279,13 @@ usbd_device_set_desc(device_t device, char *devinfo)
device_set_desc(device, desc);
}
/*
* A static buffer is a loss if this routine is used from an interrupt,
* but it's not fatal.
*/
char *
usbd_devname(bdevice *bdev)
{
static char buf[20];
/* XXX a static buffer is not exactly a good idea, but the only
* thing that goes wrong is the string that is being printed
*/
sprintf(buf, "%s%d", device_get_name(*bdev), device_get_unit(*bdev));
return (buf);

View file

@ -1,5 +1,5 @@
/* $NetBSD: usbdi.h,v 1.15 1999/01/03 01:00:56 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usbdi.h,v 1.16 1999/01/08 11:58:26 augustss Exp $ */
/* FreeBSD $Id: usbdi.h,v 1.4 1999/01/07 23:31:43 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -175,7 +175,9 @@ usbd_status usbd_endpoint_count
__P((usbd_interface_handle dev, u_int8_t *count));
usbd_status usbd_interface_count
__P((usbd_device_handle dev, u_int8_t *count));
#if 0
u_int8_t usbd_bus_count __P((void));
#endif
usbd_status usbd_get_bus_handle __P((u_int8_t index, usbd_bus_handle *bus));
usbd_status usbd_get_root_hub
__P((usbd_bus_handle bus, usbd_device_handle *dev));

View file

@ -1,5 +1,5 @@
/* $NetBSD: usbdi_util.c,v 1.11 1999/01/03 01:00:56 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usbdi_util.c,v 1.13 1999/01/08 11:58:26 augustss Exp $ */
/* FreeBSD $Id: usbdi_util.c,v 1.5 1999/01/07 23:31:43 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -46,7 +46,6 @@
#if defined(__FreeBSD__)
#include <sys/bus.h>
#endif
#include <sys/select.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@ -488,7 +487,7 @@ usbd_bulk_transfer(reqh, pipe, flags, buf, size, lbl)
flags, USBD_NO_TIMEOUT, usbd_bulk_transfer_cb);
if (r != USBD_NORMAL_COMPLETION)
return (r);
DPRINTFN(1, ("usbd_bulk_transfer: transfer %d bytes\n", *size));
DPRINTFN(1, ("usbd_bulk_transfer: start transfer %d bytes\n", *size));
s = splusb(); /* don't want callback until tsleep() */
r = usbd_transfer(reqh);
if (r != USBD_IN_PROGRESS) {
@ -502,8 +501,9 @@ usbd_bulk_transfer(reqh, pipe, flags, buf, size, lbl)
return (USBD_INTERRUPTED);
}
usbd_get_request_status(reqh, &priv, &buffer, size, &r);
DPRINTFN(1,("usbd_bulk_transfer: transferred %d\n", *size));
if (r != USBD_NORMAL_COMPLETION) {
DPRINTF(("ugenread: error=%d\n", r));
DPRINTF(("usbd_bulk_transfer: error=%d\n", r));
usbd_clear_endpoint_stall(pipe);
}
return (r);

View file

@ -1,5 +1,5 @@
/* $NetBSD: usbdivar.h,v 1.14 1998/12/30 18:06:25 augustss Exp $ */
/* FreeBSD $Id$ */
/* $NetBSD: usbdivar.h,v 1.16 1999/01/08 11:58:26 augustss Exp $ */
/* FreeBSD $Id: usbdivar.h,v 1.6 1999/01/07 23:31:45 n_hibma Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -180,7 +180,6 @@ void usbd_init __P((void));
int usbctlprint __P((void *, const char *));
void usb_delay_ms __P((usbd_bus_handle, u_int));
void usbd_devinfo_vp __P((usbd_device_handle, char *, char *));
usbd_status usbd_set_config_no __P((usbd_device_handle, int, int));
usbd_status usbd_reset_port __P((usbd_device_handle dev,
int port, usb_port_status_t *ps));
usbd_status usbd_setup_pipe __P((usbd_device_handle dev,
@ -204,9 +203,6 @@ int usb_bus_count __P((void));
usbd_status usb_get_bus_handle __P((int, usbd_bus_handle *));
void usb_needs_explore __P((usbd_bus_handle));
extern int usbd_use_polling;
/* Locator stuff. */
#if defined(__NetBSD__)