Sync with NetBSD:

date: 2000/02/29 21:37:01;  author: augustss;  state: Exp;
	Distinguish between device and interface classes.
	(I finally found a document that said that they were different.)
This commit is contained in:
joe 2002-01-02 18:28:45 +00:00
parent cec7ec547b
commit cff14677d4
11 changed files with 106 additions and 84 deletions

View File

@ -22,7 +22,7 @@ ohcireg.h Hardware definitions for OHCI
ohcivar.h API for ohci.c
uaudio.c USB audio class driver
uaudioreg.h and definitions for it
ugen.c generic driver that can handle access to any USB device
[Merged] ugen.c generic driver that can handle access to any USB device
uhci.c Host controller driver for UHCI
uhcireg.h Hardware definitions for UHCI
uhcivar.h API for uhci.c

View File

@ -1949,8 +1949,8 @@ Static usb_device_descriptor_t ohci_devd = {
USB_DEVICE_DESCRIPTOR_SIZE,
UDESC_DEVICE, /* type */
{0x00, 0x01}, /* USB version */
UCLASS_HUB, /* class */
USUBCLASS_HUB, /* subclass */
UDCLASS_HUB, /* class */
UDSUBCLASS_HUB, /* subclass */
0, /* protocol */
64, /* max packet */
{0},{0},{0x00,0x01}, /* device id */
@ -1977,8 +1977,8 @@ Static usb_interface_descriptor_t ohci_ifcd = {
0,
0,
1,
UCLASS_HUB,
USUBCLASS_HUB,
UICLASS_HUB,
UISUBCLASS_HUB,
0,
0
};

View File

@ -2540,8 +2540,8 @@ usb_device_descriptor_t uhci_devd = {
USB_DEVICE_DESCRIPTOR_SIZE,
UDESC_DEVICE, /* type */
{0x00, 0x01}, /* USB version */
UCLASS_HUB, /* class */
USUBCLASS_HUB, /* subclass */
UDCLASS_HUB, /* class */
UDSUBCLASS_HUB, /* subclass */
0, /* protocol */
64, /* max packet */
{0},{0},{0x00,0x01}, /* device id */
@ -2568,8 +2568,8 @@ usb_interface_descriptor_t uhci_ifcd = {
0,
0,
1,
UCLASS_HUB,
USUBCLASS_HUB,
UICLASS_HUB,
UISUBCLASS_HUB,
0,
0
};

View File

@ -175,7 +175,7 @@ USB_MATCH(uhid)
if (uaa->iface == NULL)
return (UMATCH_NONE);
id = usbd_get_interface_descriptor(uaa->iface);
if (id == NULL || id->bInterfaceClass != UCLASS_HID)
if (id == NULL || id->bInterfaceClass != UICLASS_HID)
return (UMATCH_NONE);
return (UMATCH_IFACECLASS_GENERIC);
}

View File

@ -141,7 +141,7 @@ USB_MATCH(uhub)
* The subclass for hubs seems to be 0 for some and 1 for others,
* so we just ignore the subclass.
*/
if (uaa->iface == NULL && dd->bDeviceClass == UCLASS_HUB)
if (uaa->iface == NULL && dd->bDeviceClass == UDCLASS_HUB)
return (UMATCH_DEVCLASS_DEVSUBCLASS);
return (UMATCH_NONE);
}

View File

@ -1345,8 +1345,8 @@ probe_keyboard(struct usb_attach_arg *uaa, int flags)
/* Check that this is a keyboard that speaks the boot protocol. */
id = usbd_get_interface_descriptor(uaa->iface);
if (id
&& id->bInterfaceClass == UCLASS_HID
&& id->bInterfaceSubClass == USUBCLASS_BOOT
&& id->bInterfaceClass == UICLASS_HID
&& id->bInterfaceSubClass == UISUBCLASS_BOOT
&& id->bInterfaceProtocol == UPROTO_BOOT_KEYBOARD)
return 0; /* found it */

View File

@ -173,10 +173,10 @@ USB_MATCH(ulpt)
return (UMATCH_NONE);
id = usbd_get_interface_descriptor(uaa->iface);
if (id != NULL &&
id->bInterfaceClass == UCLASS_PRINTER &&
id->bInterfaceSubClass == USUBCLASS_PRINTER &&
(id->bInterfaceProtocol == UPROTO_PRINTER_UNI ||
id->bInterfaceProtocol == UPROTO_PRINTER_BI))
id->bInterfaceClass == UICLASS_PRINTER &&
id->bInterfaceSubClass == UISUBCLASS_PRINTER &&
(id->bInterfaceProtocol == UIPROTO_PRINTER_UNI ||
id->bInterfaceProtocol == UIPROTO_PRINTER_BI))
return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);
return (UMATCH_NONE);
}
@ -223,9 +223,9 @@ USB_ATTACH(ulpt)
id = (void *)((char *)id + id->bLength)) {
if (id->bDescriptorType == UDESC_INTERFACE &&
id->bInterfaceNumber == ifcd->bInterfaceNumber) {
if (id->bInterfaceClass == UCLASS_PRINTER &&
id->bInterfaceSubClass == USUBCLASS_PRINTER &&
id->bInterfaceProtocol == UPROTO_PRINTER_BI)
if (id->bInterfaceClass == UICLASS_PRINTER &&
id->bInterfaceSubClass == UISUBCLASS_PRINTER &&
id->bInterfaceProtocol == UIPROTO_PRINTER_BI)
goto found;
altno++;
}

View File

@ -662,7 +662,7 @@ umass_match_proto(struct umass_softc *sc, usbd_interface_handle iface,
}
id = usbd_get_interface_descriptor(iface);
if (id == NULL || id->bInterfaceClass != UCLASS_MASS)
if (id == NULL || id->bInterfaceClass != UICLASS_MASS)
return(UMATCH_NONE);
if (UGETW(dd->idVendor) == USB_VENDOR_SONY
@ -688,18 +688,18 @@ umass_match_proto(struct umass_softc *sc, usbd_interface_handle iface,
}
switch (id->bInterfaceSubClass) {
case USUBCLASS_SCSI:
case UISUBCLASS_SCSI:
sc->proto |= PROTO_SCSI;
break;
case USUBCLASS_UFI:
case UISUBCLASS_UFI:
sc->transfer_speed = UMASS_FLOPPY_TRANSFER_SPEED;
sc->proto |= PROTO_UFI;
break;
case USUBCLASS_RBC:
case UISUBCLASS_RBC:
sc->proto |= PROTO_RBC;
break;
case USUBCLASS_SFF8020I:
case USUBCLASS_SFF8070I:
case UISUBCLASS_SFF8020I:
case UISUBCLASS_SFF8070I:
sc->proto |= PROTO_ATAPI;
break;
default:
@ -709,20 +709,20 @@ umass_match_proto(struct umass_softc *sc, usbd_interface_handle iface,
}
switch (id->bInterfaceProtocol) {
case UPROTO_MASS_CBI:
case UIPROTO_MASS_CBI:
sc->proto |= PROTO_CBI;
break;
case UPROTO_MASS_CBI_I:
case UIPROTO_MASS_CBI_I:
#if CBI_I
sc->proto |= PROTO_CBI_I;
#else
sc->proto |= PROTO_CBI;
#endif
break;
case UPROTO_MASS_BBB:
case UIPROTO_MASS_BULK:
sc->proto |= PROTO_BBB;
break;
case UPROTO_MASS_BBB_P:
case UIPROTO_MASS_BULK_P:
sc->drive = ZIP_100;
sc->proto |= PROTO_BBB;
sc->transfer_speed = UMASS_ZIP100_TRANSFER_SPEED;

View File

@ -211,9 +211,9 @@ USB_MATCH(umodem)
id = usbd_get_interface_descriptor(uaa->iface);
if (id == 0 ||
id->bInterfaceClass != UCLASS_CDC ||
id->bInterfaceSubClass != USUBCLASS_ABSTRACT_CONTROL_MODEL ||
id->bInterfaceProtocol != UPROTO_CDC_AT)
id->bInterfaceClass != UICLASS_CDC ||
id->bInterfaceSubClass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
id->bInterfaceProtocol != UIPROTO_CDC_AT)
return (UMATCH_NONE);
umodem_get_caps(uaa->device, &cm, &acm);

View File

@ -173,7 +173,7 @@ USB_MATCH(ums)
if (!uaa->iface)
return (UMATCH_NONE);
id = usbd_get_interface_descriptor(uaa->iface);
if (!id || id->bInterfaceClass != UCLASS_HID)
if (!id || id->bInterfaceClass != UICLASS_HID)
return (UMATCH_NONE);
err = usbd_alloc_report_desc(uaa->iface, &desc, &size, M_TEMP);

View File

@ -338,56 +338,78 @@ typedef struct {
#define UPS_C_PORT_RESET 0x0010
} usb_port_status_t;
#define UCLASS_UNSPEC 0
#define UCLASS_AUDIO 1
#define USUBCLASS_AUDIOCONTROL 1
#define USUBCLASS_AUDIOSTREAM 2
#define USUBCLASS_MIDISTREAM 3
#define UCLASS_CDC 2 /* communication */
#define USUBCLASS_DIRECT_LINE_CONTROL_MODEL 1
#define USUBCLASS_ABSTRACT_CONTROL_MODEL 2
#define USUBCLASS_TELEPHONE_CONTROL_MODEL 3
#define USUBCLASS_MULTICHANNEL_CONTROL_MODEL 4
#define USUBCLASS_CAPI_CONTROLMODEL 5
#define USUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
#define USUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
#define UPROTO_CDC_AT 1
#define UCLASS_HID 3
#define USUBCLASS_BOOT 1
#define UCLASS_PRINTER 7
#define USUBCLASS_PRINTER 1
#define UPROTO_PRINTER_UNI 1
#define UPROTO_PRINTER_BI 2
#define UCLASS_MASS 8
#define USUBCLASS_RBC 1
#define USUBCLASS_SFF8020I 2
#define USUBCLASS_QIC157 3
#define USUBCLASS_UFI 4
#define USUBCLASS_SFF8070I 5
#define USUBCLASS_SCSI 6
#define UPROTO_MASS_CBI_I 0
#define UPROTO_MASS_CBI 1
#define UPROTO_MASS_BBB 2
#define UPROTO_MASS_BBB_P 80 /* 'P' for the Iomega Zip drive */
#define UCLASS_HUB 9
#define USUBCLASS_HUB 0
#define UCLASS_DATA 10
#define USUBCLASS_DATA 0
#define UPROTO_DATA_ISDNBRI 0x30 /* Physical iface */
#define UPROTO_DATA_HDLC 0x31 /* HDLC */
#define UPROTO_DATA_TRANSPARENT 0x32 /* Transparent */
#define UPROTO_DATA_Q921M 0x50 /* Management for Q921 */
#define UPROTO_DATA_Q921 0x51 /* Data for Q921 */
#define UPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */
#define UPROTO_DATA_V42BIS 0x90 /* Data compression */
#define UPROTO_DATA_Q931 0x91 /* Euro-ISDN */
#define UPROTO_DATA_V120 0x92 /* V.24 rate adaption */
#define UPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */
#define UPROTO_DATA_HOST_BASED 0xfd /* Host based driver */
#define UPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/
#define UPROTO_DATA_VENDOR 0xff /* Vendor specific */
#define UCLASS_VENDOR_DA 0xfe /* Doug Ambrisko */
#define USUBCLASS_DA 0xda /* Doug Ambrisko */
/* Device class codes */
#define UDCLASS_AUDIO 0x00
#define UDCLASS_COMM 0x02
#define UDCLASS_HID 0x00
#define UDCLASS_HUB 0x09
#define UDSUBCLASS_HUB 0
#define UDCLASS_MASS 0x00
/* Interface class codes */
#define UICLASS_UNSPEC 0x00
#define UICLASS_AUDIO 0x01
#define UISUBCLASS_AUDIOCONTROL 1
#define UISUBCLASS_AUDIOSTREAM 2
#define UISUBCLASS_MIDISTREAM 3
#define UICLASS_CDC 0x02 /* communication */
#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1
#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2
#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3
#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4
#define UISUBCLASS_CAPI_CONTROLMODEL 5
#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
#define UIPROTO_CDC_AT 1
#define UICLASS_HID 0x03
#define UISUBCLASS_BOOT 1
#define UIPROTO_BOOT_KEYBOARD 1
#define UICLASS_PHYSICAL 0x05
#define UICLASS_PRINTER 0x07
#define UISUBCLASS_PRINTER 1
#define UIPROTO_PRINTER_UNI 1
#define UIPROTO_PRINTER_BI 2
#define UICLASS_MASS 0x08
#define UISUBCLASS_RBC 1
#define UISUBCLASS_SFF8020I 2
#define UISUBCLASS_QIC157 3
#define UISUBCLASS_UFI 4
#define UISUBCLASS_SFF8070I 5
#define UISUBCLASS_SCSI 6
#define UIPROTO_MASS_CBI_I 0
#define UIPROTO_MASS_CBI 1
#define UIPROTO_MASS_BULK 2
#define UIPROTO_MASS_BULK_P 80 /* 'P' for the Iomega Zip drive */
#define UICLASS_HUB 0x09
#define UISUBCLASS_HUB 0
#define UICLASS_CDC_DATA 0x0a
#define UISUBCLASS_DATA 0
#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */
#define UIPROTO_DATA_HDLC 0x31 /* HDLC */
#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */
#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */
#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */
#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */
#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */
#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */
#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */
#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */
#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */
#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/
#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */
#define UICLASS_FIRM_UPD 0x0c
#define UICLASS_APPL_SPEC 0xfe
#define UICLASS_VENDOR 0xff
#define USB_HUB_MAX_DEPTH 5