Make sure to abort the interrupt pipe on disconnect of a mouse or keyboard.
Improve some error messages.
This commit is contained in:
parent
92fa3a68ad
commit
6aff95b06c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhub.c,v 1.3 1998/08/01 18:16:19 augustss Exp $ */
|
||||
/* $NetBSD: uhub.c,v 1.4 1998/08/01 20:11:38 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -346,8 +346,8 @@ uhub_explore(parent, dev)
|
||||
* address, and since we cannot leave
|
||||
* at 0 we have to disable the port
|
||||
* instead. */
|
||||
printf("%s: disable port %d\n",
|
||||
"usb", port); /* XXX */
|
||||
printf("%s: device problem, disable port %d\n",
|
||||
parent->dv_xname, port);
|
||||
usbd_clear_port_feature(dev, port,
|
||||
UHF_PORT_ENABLE);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ukbd.c,v 1.6 1998/08/01 18:16:19 augustss Exp $ */
|
||||
/* $NetBSD: ukbd.c,v 1.7 1998/08/01 20:11:38 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -306,6 +306,9 @@ ukbd_disco(p)
|
||||
void *p;
|
||||
{
|
||||
struct ukbd_softc *sc = p;
|
||||
|
||||
DPRINTF(("ukbd_disco: sc=%p\n", sc));
|
||||
usbd_abort_pipe(sc->sc_intrpipe);
|
||||
sc->sc_disconnected = 1;
|
||||
}
|
||||
|
||||
@ -446,6 +449,8 @@ ukbd_ioctl(v, cmd, data, flag, p)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Console interface. */
|
||||
/* XXX does not work. */
|
||||
void
|
||||
ukbd_cngetc(v, type, data)
|
||||
void *v;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ums.c,v 1.7 1998/07/29 20:50:12 augustss Exp $ */
|
||||
/* $NetBSD: ums.c,v 1.8 1998/08/01 20:11:39 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -269,6 +269,9 @@ ums_disco(p)
|
||||
void *p;
|
||||
{
|
||||
struct ums_softc *sc = p;
|
||||
|
||||
DPRINTF(("ums_disco: sc=%p\n", sc));
|
||||
usbd_abort_pipe(sc->sc_intrpipe);
|
||||
sc->sc_disconnected = 1;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usb_subr.c,v 1.5 1998/08/01 18:16:20 augustss Exp $ */
|
||||
/* $NetBSD: usb_subr.c,v 1.6 1998/08/01 20:11:39 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -431,8 +431,9 @@ usbd_set_config_no(dev, no)
|
||||
power = cdp->bMaxPower * 2;
|
||||
if (power > dev->powersrc->power) {
|
||||
/* XXX print nicer message. */
|
||||
printf("usb: device addr %d (config %d) exceeds power budget, %d mA > %d mA\n",
|
||||
dev->address, cdp->bConfigurationValue,
|
||||
printf("%s: device addr %d (config %d) exceeds power budget, %d mA > %d mA\n",
|
||||
dev->bus->bdev.dv_xname, dev->address,
|
||||
cdp->bConfigurationValue,
|
||||
power, dev->powersrc->power);
|
||||
r = USBD_NO_POWER;
|
||||
goto bad;
|
||||
@ -455,6 +456,7 @@ usbd_set_config_no(dev, no)
|
||||
r = USBD_NOMEM;
|
||||
goto bad;
|
||||
}
|
||||
DPRINTFN(5,("usbd_set_config_no: dev=%p cdesc=%p\n", dev, cdp));
|
||||
dev->cdesc = cdp;
|
||||
dev->config = cdp->bConfigurationValue;
|
||||
dev->state = USBD_DEVICE_CONFIGURED;
|
||||
@ -600,10 +602,17 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
|
||||
|
||||
up->device = dev;
|
||||
d = &dev->ddesc;
|
||||
/* Get the first 8 bytes of the device descriptor. */
|
||||
r = usbd_get_desc(dev, UDESC_DEVICE, 0, USB_MAX_IPACKET, d);
|
||||
/* Try a few times in case the device is slow (i.e. outside specs.) */
|
||||
for (i = 0; i < 5; i++) {
|
||||
/* Get the first 8 bytes of the device descriptor. */
|
||||
r = usbd_get_desc(dev, UDESC_DEVICE, 0, USB_MAX_IPACKET, d);
|
||||
if (r == USBD_NORMAL_COMPLETION)
|
||||
break;
|
||||
usbd_delay_ms(dev->bus, 200);
|
||||
}
|
||||
if (r != USBD_NORMAL_COMPLETION) {
|
||||
DPRINTFN(-1, ("usbd_new_device: addr=%d, getting first desc failed\n", addr));
|
||||
DPRINTFN(-1, ("usbd_new_device: addr=%d, getting first desc failed\n",
|
||||
addr));
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@ -650,9 +659,8 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
|
||||
DPRINTF(("usbd_new_device: no device driver found\n"));
|
||||
/* Next try with interface drivers. */
|
||||
/* XXX should we try all configurations? */
|
||||
|
||||
/* Next try with interface drivers. */
|
||||
for (confi = 0; confi < d->bNumConfigurations; confi++) {
|
||||
r = usbd_set_config_no(dev, confi);
|
||||
if (r != USBD_NORMAL_COMPLETION) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user