Updated USB kernel sources to NetBSD sources of 1998-12-09.

1 bug fix and several textual changes.
Preparing to feed back changes for port into NetBSD to create one source base.
This commit is contained in:
Nick Hibma 1998-12-13 22:27:42 +00:00
parent d284feaa7b
commit 3e041e6116
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41736
12 changed files with 88 additions and 77 deletions

View File

@ -399,19 +399,6 @@ uhci_dump_td(p)
UHCI_TD_GET_ENDPT(p->td->td_token),
UHCI_TD_GET_DT(p->td->td_token),
UHCI_TD_GET_MAXLEN(p->td->td_token));
#if 0 && defined(__FreeBSD__)
printf(" Link=0x%08lx,Status=0x%08lx\n errcnt=%d,actlen=%d,pid=%02x,addr=%d,endpt=%d,D=%d,maxlen=%d\n",
(long)p->td->td_link,
(long)p->td->td_status,
UHCI_TD_GET_ERRCNT(p->td->td_status),
UHCI_TD_GET_ACTLEN(p->td->td_status),
UHCI_TD_GET_PID(p->td->td_token),
UHCI_TD_GET_DEVADDR(p->td->td_token),
UHCI_TD_GET_ENDPT(p->td->td_token),
UHCI_TD_GET_DT(p->td->td_token),
UHCI_TD_GET_MAXLEN(p->td->td_token));
#endif
}
void
@ -637,8 +624,10 @@ uhci_intr(p)
sc->sc_intrs++;
#if defined(USB_DEBUG)
if (uhcidebug > 9)
if (uhcidebug > 9) {
DEVICE_MSG(sc->sc_bus.bdev, ("uhci_intr %p\n", sc));
uhci_dumpregs(sc);
}
#endif
status = UREAD2(sc, UHCI_STS);
ret = 0;
@ -765,7 +754,7 @@ uhci_ii_done(ii, timo)
tst = std->td->td_status;
status |= tst;
#ifdef USB_DEBUG
if ((tst & UHCI_TD_ERROR) && uhcidebug) {
if ((tst & UHCI_TD_ERROR) && uhcidebug>10) {
printf("uhci_ii_done: intr error TD:\n");
uhci_dump_td(std);
}
@ -776,13 +765,9 @@ uhci_ii_done(ii, timo)
status &= UHCI_TD_ERROR;
DPRINTFN(10, ("uhci_ii_done: len=%d\n", len));
if (status != 0) {
DPRINTFN(-1+(status==UHCI_TD_STALLED),
DPRINTFN(10,
("uhci_ii_done: error, status 0x%b\n", (long)status,
"\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27STALLED\30ACTIVE"));
#if 0 && defined(__FreeBSD__)
DPRINTFN(-1+(status==UHCI_TD_STALLED),
("uhci_ii_done: error, status 0x%08lx\n", (long)status));
#endif
if (status == UHCI_TD_STALLED)
reqh->status = USBD_STALLED;
else
@ -1440,7 +1425,7 @@ uhci_device_request(reqh)
int isread;
int s;
DPRINTFN(1,("uhci_device_control type=0x%02x, request=0x%02x, wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
DPRINTFN(5,("uhci_device_control type=0x%02x, request=0x%02x, wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
req->bmRequestType, req->bRequest, UGETW(req->wValue),
UGETW(req->wIndex), UGETW(req->wLength),
addr, endpt));

View File

@ -555,9 +555,16 @@ uhidioctl(dev, cmd, addr, flag, p)
break;
case USB_SET_IMMED:
if (*(int *)addr)
if (*(int *)addr) {
/* XXX should read into ibuf, but does it matter */
r = usbd_get_report(sc->sc_iface, UHID_INPUT_REPORT,
sc->sc_iid, sc->sc_ibuf,
sc->sc_isize);
if (r != USBD_NORMAL_COMPLETION)
return (EOPNOTSUPP);
sc->sc_state |= UHID_IMMED;
else
} else
sc->sc_state &= ~UHID_IMMED;
break;

View File

@ -382,7 +382,6 @@ bLength=%d bDescriptorType=%d bEndpointAddress=%d-%s bmAttributes=%d wMaxPacketS
}
#if defined(__FreeBSD__)
int
ukbd_detach(device_t self)
{
@ -397,20 +396,8 @@ ukbd_detach(device_t self)
free(devinfo, M_USB);
}
/* good bye, and thanks for all the fish */
ukbd_set_leds(sc, NUM_LOCK);
DELAY(50000);
ukbd_set_leds(sc, CAPS_LOCK);
DELAY(30000);
ukbd_set_leds(sc, SCROLL_LOCK);
DELAY(20000);
ukbd_set_leds(sc, CAPS_LOCK);
DELAY(15000);
ukbd_set_leds(sc, NUM_LOCK);
return 0;
}
#endif
void

View File

@ -648,7 +648,7 @@ ums_ioctl(v, cmd, data, flag, p)
return (0);
}
return (-1); /* NWH XXX ??? */
return (-1); /* NWH XXX Should we not return something ? */
}
#elif defined(__FreeBSD__)

View File

@ -60,6 +60,7 @@ struct usbd_quirk_entry {
{ USB_VENDOR_INSIDEOUT,USB_PRODUCT_INSIDEOUT_EDGEPORT4,
0x094, { UQ_SWAP_UNICODE}},
{ USB_VENDOR_UNIXTAR, USB_PRODUCT_UNIXTAR_UTUSB41, 0x100, { UQ_HUB_POWER }},
{ USB_VENDOR_BTC, USB_PRODUCT_BTC_BTC7932, 0x100, { UQ_NO_STRINGS }},
{ 0, 0, 0, { 0 } }
};

View File

@ -42,6 +42,7 @@ struct usbd_quirks {
#define UQ_SWAP_UNICODE 0x02 /* has some Unicode strings swapped. */
#define UQ_HUB_POWER 0x04 /* does not respond correctly to get
device status; use get hub status. */
#define UQ_NO_STRINGS 0x08 /* string descriptors are broken. */
};
extern struct usbd_quirks usbd_no_quirk;

View File

@ -122,21 +122,19 @@ usbd_get_string(dev, si, buf)
int lang; /* NWH */
if (si == 0)
return 0;
return (0);
if (dev->quirks->uq_flags & UQ_NO_STRINGS)
return (0);
/* NWH added fetching of language
* See 9.6.5 (spec v1.0)
*/
req.bmRequestType = UT_READ_DEVICE;
req.bmRequestType = UT_READ_DEVICE; /* fetch default language */
req.bRequest = UR_GET_DESCRIPTOR;
USETW2(req.wValue, UDESC_STRING, 0);
USETW(req.wIndex, 0);
USETW(req.wLength, 4); /* only first word in bString */
USETW(req.wLength, 1); /* only first word in bString */
r = usbd_do_request(dev, &req, &us);
if (r != USBD_NORMAL_COMPLETION)
return 0;
lang = UGETW(us.bString[0]);
/* NWH end */
req.bmRequestType = UT_READ_DEVICE;
req.bRequest = UR_GET_DESCRIPTOR;
@ -177,19 +175,6 @@ usbd_devinfo_vp(dev, v, p)
struct usb_knowndev *kdp;
#endif
if (!dev) {
DPRINTF(("usbd_devinfo_vp: dev not set\n"));
return;
}
if (!v) {
DPRINTF(("usbd_devinfo_vp: v not set\n"));
return;
}
if (!p) {
DPRINTF(("usbd_devinfo_vp: p not set\n"));
return;
}
vendor = usbd_get_string(dev, udd->iManufacturer, v);
product = usbd_get_string(dev, udd->iProduct, p);
#ifdef USBVERBOSE
@ -241,8 +226,7 @@ usbd_devinfo(dev, showclass, cp)
int bcdDevice, bcdUSB;
usbd_devinfo_vp(dev, vendor, product);
cp += sprintf(cp, "%s", vendor);
cp += sprintf(cp, " %s", product);
cp += sprintf(cp, "%s %s", vendor, product);
if (showclass)
cp += sprintf(cp, " (class %d/%d)",
udd->bDeviceClass, udd->bDeviceSubClass);
@ -253,7 +237,7 @@ usbd_devinfo(dev, showclass, cp)
*cp++ = '/';
cp += usbd_printBCD(cp, bcdDevice);
*cp++ = ')';
cp += sprintf(cp, " (addr %d)", dev->address);
cp += sprintf(cp, " addr %d", dev->address);
}
/* Delay for a certain number of ms */
@ -547,8 +531,6 @@ usbd_setup_pipe(dev, iface, ep, pipe)
usbd_pipe_handle p;
usbd_status r;
*pipe = NULL;
DPRINTFN(1,("usbd_setup_pipe: dev=%p iface=%p ep=%p pipe=%p\n",
dev, iface, ep, pipe));
p = malloc(dev->bus->pipe_size, M_USB, M_NOWAIT);
@ -849,10 +831,14 @@ usbd_print(aux, pnp)
if (!uaa->usegeneric)
return (QUIET);
usbd_devinfo(uaa->device, 1, devinfo);
printf("%s at %s", devinfo, pnp);
printf("%s, %s", devinfo, pnp);
}
if (uaa->port != 0)
printf(" port %d", uaa->port);
if (uaa->configno != UHUB_UNK_CONFIGURATION)
printf(" configuration %d", uaa->configno);
if (uaa->ifaceno != UHUB_UNK_INTERFACE)
printf(" interface %d", uaa->ifaceno);
return (UNCONF);
}
@ -864,9 +850,15 @@ usbd_submatch(parent, cf, aux)
{
struct usb_attach_arg *uaa = aux;
if (uaa->port != 0 &&
cf->uhubcf_port != UHUB_UNK_PORT &&
cf->uhubcf_port != uaa->port)
if ((uaa->port != 0 &&
cf->uhubcf_port != UHUB_UNK_PORT &&
cf->uhubcf_port != uaa->port) ||
(uaa->configno != UHUB_UNK_CONFIGURATION &&
cf->uhubcf_configuration != UHUB_UNK_CONFIGURATION &&
cf->uhubcf_configuration != uaa->configno) ||
(uaa->ifaceno != UHUB_UNK_INTERFACE &&
cf->uhubcf_interface != UHUB_UNK_INTERFACE &&
cf->uhubcf_interface != uaa->ifaceno))
return 0;
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
}

View File

@ -1,10 +1,10 @@
/* $NetBSD: usbdevs.h,v 1.6 1998/10/05 02:31:13 mark Exp $ */
/* $NetBSD: usbdevs.h,v 1.8 1998/12/02 22:51:50 augustss Exp $ */
/*
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* NetBSD: usbdevs,v 1.5 1998/10/05 02:30:17 mark Exp
* NetBSD: usbdevs,v 1.8 1998/12/02 22:49:51 augustss Exp
*/
/*
@ -49,14 +49,22 @@
#define USB_VENDOR_NEC 0x0409 /* NEC */
#define USB_VENDOR_KODAK 0x040a /* Eastman Kodak */
/* Computer Access Technology Corporation */
#define USB_VENDOR_CATC 0x0423 /* CATC */
#define USB_VENDOR_NANAO 0x0440 /* Nanao */
#define USB_VENDOR_UNIXTAR 0x0451 /* Unixtar */
#define USB_VENDOR_GENIUS 0x0458 /* Genius */
#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_CYPRESS 0x04b4 /* Cypress Semicondutor */
#define USB_VENDOR_CYPRESS 0x04b4 /* Cypress Semiconductor */
#define USB_VENDOR_3COM 0x04c1 /* 3Com */
#define USB_VENDOR_JAZZ 0x04fa /* Jazz */
#define USB_VENDOR_ATEN 0x0557 /* ATen */
#define USB_VENDOR_EIZO 0x056d /* EIZO */
#define USB_VENDOR_AGILER 0x056e /* Agiler */
#define USB_VENDOR_BELKIN 0x05ab /* Belkin */
#define USB_VENDOR_EIZONANAO 0x05e7 /* EIZO Nanao */
#define USB_VENDOR_CHIC 0x05fe /* Chic Technology */
@ -74,6 +82,9 @@
/* Kodak products */
#define USB_PRODUCT_KODAK_DC260 0x0110 /* Digital Science DC260 */
/* 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 */
@ -89,6 +100,9 @@
#define USB_PRODUCT_CHERRY_MY3000KBD 0x0001 /* My3000 keyboard */
#define USB_PRODUCT_CHERRY_MY3000HUB 0x0003 /* My3000 hub */
/* Behavior Technology Corporation products */
#define USB_PRODUCT_BTC_BTC7932 0x6782 /* Keyboard with mouse port */
/* Philips products */
#define USB_PRODUCT_PHILIPS_DSS 0x0101 /* DSS 350 Digital Speaker System */
#define USB_PRODUCT_PHILIPS_HUB 0x0201 /* hub */
@ -96,9 +110,21 @@
/* Connectix products */
#define USB_PRODUCT_CONNECTIX_QUICKCAM 0x0001 /* QuickCam */
/* 3Com products */
#define USB_PRODUCT_3COM_USR56K 0x3021 /* U.S.Robotics 56000 Voice USB Modem */
/* Jazz products */
#define USB_PRODUCT_JAZZ_J6502 0x4201 /* J-6502 speakers */
/* Cypress Semiconduuctor products */
#define USB_PRODUCT_CYPRESS_MOUSE 0x0001 /* mouse */
/* ATen */
#define USB_PRODUCT_ATEN_UC1284 0x2001 /* Parallel printer adapter */
/* Agiler products */
#define USB_PRODUCT_AGILER_MOUSE29UO 0x0002 /* mouse 29UO */
/* Belkin products */
#define USB_PRODUCT_BELKIN_F5U002 0x0002 /* Parallel printer adapter */

View File

@ -930,7 +930,7 @@ usbd_transfer_cb(reqh)
if (reqh->status == USBD_NORMAL_COMPLETION &&
reqh->actlen < reqh->length &&
!(reqh->flags & USBD_SHORT_XFER_OK)) {
DPRINTFN(-1, ("usbd_transfer_cb: short xfer %d < %d\n",
DPRINTFN(-1, ("usbd_transfer_cb: short xfer %d+1<%d+1 (bytes)\n",
reqh->actlen, reqh->length));
reqh->status = USBD_SHORT_XFER;
}
@ -948,7 +948,7 @@ usbd_transfer_cb(reqh)
pipe->running = 0;
else {
SIMPLEQ_REMOVE_HEAD(&pipe->queue, nreqh, next);
pipe->curreqh = reqh;
pipe->curreqh = nreqh;
r = pipe->methods->transfer(nreqh);
if (r != USBD_IN_PROGRESS)
printf("usbd_transfer_cb: error=%d\n", r);

View File

@ -336,9 +336,10 @@ usbd_set_idle(iface, duration, id)
}
usbd_status
usbd_get_report_descriptor(dev, i, size, d)
usbd_get_report_descriptor(dev, ifcno, repid, size, d)
usbd_device_handle dev;
int i;
int ifcno;
int repid;
int size;
void *d;
{
@ -346,8 +347,8 @@ usbd_get_report_descriptor(dev, i, size, d)
req.bmRequestType = UT_READ_INTERFACE;
req.bRequest = UR_GET_DESCRIPTOR;
USETW2(req.wValue, UDESC_REPORT, 0);
USETW(req.wIndex, i);
USETW2(req.wValue, UDESC_REPORT, repid);
USETW(req.wIndex, ifcno);
USETW(req.wLength, size);
return (usbd_do_request(dev, &req, d));
}
@ -393,6 +394,7 @@ usbd_alloc_report_desc(ifc, descp, sizep, mem)
#endif
{
usb_interface_descriptor_t *id;
usb_hid_descriptor_t *hid;
usbd_device_handle dev;
usbd_status r;
@ -400,6 +402,9 @@ usbd_alloc_report_desc(ifc, descp, sizep, mem)
r = usbd_interface2device_handle(ifc, &dev);
if (r != USBD_NORMAL_COMPLETION)
return (r);
id = usbd_get_interface_descriptor(ifc);
if (!id)
return (USBD_INVAL);
hid = usbd_get_hid_descriptor(ifc);
if (!hid)
return (USBD_IOERROR);
@ -407,7 +412,9 @@ usbd_alloc_report_desc(ifc, descp, sizep, mem)
*descp = malloc(*sizep, mem, M_NOWAIT);
if (!*descp)
return (USBD_NOMEM);
r = usbd_get_report_descriptor(dev, 0, *sizep, *descp);
/* XXX should not use 0 Report ID */
r = usbd_get_report_descriptor(dev, id->bInterfaceNumber, 0,
*sizep, *descp);
if (r != USBD_NORMAL_COMPLETION) {
free(*descp, mem);
return (r);

View File

@ -54,7 +54,7 @@ usbd_status usbd_get_hub_status __P((usbd_device_handle dev,
usb_hub_status_t *st));
usbd_status usbd_set_protocol __P((usbd_interface_handle dev, int report));
usbd_status usbd_get_report_descriptor
__P((usbd_device_handle dev, int i, int size, void *d));
__P((usbd_device_handle dev, int ifcno, int repid, int size, void *d));
struct usb_hid_descriptor *usbd_get_hid_descriptor
__P((usbd_interface_handle ifc));
usbd_status usbd_set_report

View File

@ -219,7 +219,12 @@ extern int usbd_use_polling;
#endif
#define uhubcf_port cf_loc[UHUBCF_PORT]
#define uhubcf_configuration cf_loc[UHUBCF_CONFIGURATION]
#define uhubcf_interface cf_loc[UHUBCF_INTERFACE]
#define UHUB_UNK_PORT UHUBCF_PORT_DEFAULT /* wildcarded 'port' */
#define UHUB_UNK_CONFIGURATION UHUBCF_CONFIGURATION_DEFAULT /* wildcarded 'configuration' */
#define UHUB_UNK_INTERFACE UHUBCF_INTERFACE_DEFAULT /* wildcarded 'interface' */
/* Junk. */