- rename usb2_mode to usb_mode [1]
- change variable types to use the enum Submitted by: Hans Petter Selasky [1]
This commit is contained in:
parent
74904f7d58
commit
f29a072444
@ -399,7 +399,7 @@ ubt_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
|
||||
if (uaa->info.bIfaceIndex != 0)
|
||||
|
@ -174,7 +174,7 @@ ubtbcmfw_probe(device_t dev)
|
||||
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
|
||||
if (uaa->info.bIfaceIndex != 0)
|
||||
|
@ -1193,7 +1193,7 @@ at91dci_device_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
|
||||
xfer, xfer->pipe, error);
|
||||
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
ep_no = (xfer->endpoint & UE_ADDR);
|
||||
|
||||
/* disable endpoint interrupt */
|
||||
@ -1337,7 +1337,7 @@ at91dci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe)
|
||||
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
|
||||
|
||||
/* check mode */
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
@ -2264,12 +2264,12 @@ at91dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *ede
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_rt_addr);
|
||||
|
||||
if (udev->device_index != sc->sc_rt_addr) {
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -1076,7 +1076,7 @@ atmegadci_device_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n",
|
||||
xfer, xfer->pipe, error);
|
||||
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
ep_no = (xfer->endpoint & UE_ADDR);
|
||||
|
||||
/* select endpoint number */
|
||||
@ -1187,7 +1187,7 @@ atmegadci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe)
|
||||
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
|
||||
|
||||
/* check mode */
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
@ -2094,12 +2094,12 @@ atmegadci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *e
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d,%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_rt_addr, udev->device_index);
|
||||
|
||||
if (udev->device_index != sc->sc_rt_addr) {
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -3649,10 +3649,10 @@ ehci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc,
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_addr);
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -1441,7 +1441,7 @@ musbotg_device_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
|
||||
xfer, xfer->pipe, error);
|
||||
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
|
||||
musbotg_ep_int_set(xfer, 0);
|
||||
|
||||
@ -1645,7 +1645,7 @@ musbotg_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe)
|
||||
USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
|
||||
|
||||
/* check mode */
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
@ -2673,12 +2673,12 @@ musbotg_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *ede
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_rt_addr);
|
||||
|
||||
if (udev->device_index != sc->sc_rt_addr) {
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -2570,10 +2570,10 @@ ohci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc,
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_addr);
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -3050,10 +3050,10 @@ uhci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *edesc,
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_addr);
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ uss820dci_device_done(struct usb2_xfer *xfer, usb2_error_t error)
|
||||
DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
|
||||
xfer, xfer->pipe, error);
|
||||
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
uss820dci_intr_set(xfer, 0);
|
||||
}
|
||||
/* dequeue transfer and start next transfer */
|
||||
@ -1279,7 +1279,7 @@ uss820dci_clear_stall(struct usb2_device *udev, struct usb2_pipe *pipe)
|
||||
DPRINTFN(5, "pipe=%p\n", pipe);
|
||||
|
||||
/* check mode */
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
@ -2298,12 +2298,12 @@ uss820dci_pipe_init(struct usb2_device *udev, struct usb2_endpoint_descriptor *e
|
||||
|
||||
DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
|
||||
pipe, udev->address,
|
||||
edesc->bEndpointAddress, udev->flags.usb2_mode,
|
||||
edesc->bEndpointAddress, udev->flags.usb_mode,
|
||||
sc->sc_rt_addr);
|
||||
|
||||
if (udev->device_index != sc->sc_rt_addr) {
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE) {
|
||||
/* not supported */
|
||||
return;
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ uhid_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->use_generic == 0) {
|
||||
|
@ -598,7 +598,7 @@ ukbd_probe(device_t dev)
|
||||
if (sw == NULL) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
/* check that the keyboard speaks the boot protocol: */
|
||||
|
@ -339,7 +339,7 @@ ums_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
|
@ -279,7 +279,7 @@ udbp_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
/*
|
||||
|
@ -112,7 +112,7 @@ ufm_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if ((uaa->info.idVendor == USB_VENDOR_CYPRESS) &&
|
||||
|
@ -628,7 +628,7 @@ aue_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != AUE_CONFIG_INDEX)
|
||||
return (ENXIO);
|
||||
|
@ -662,7 +662,7 @@ axe_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != AXE_CONFIG_IDX)
|
||||
return (ENXIO);
|
||||
|
@ -105,7 +105,7 @@ static const struct usb2_config cdce_config[CDCE_N_TRANSFER] = {
|
||||
.flags = {.pipe_bof = 1,.short_frames_ok = 1,.short_xfer_ok = 1,.ext_buffer = 1,},
|
||||
.callback = cdce_bulk_read_callback,
|
||||
.timeout = 0, /* no timeout */
|
||||
.usb_mode = USB_MODE_MAX, /* both modes */
|
||||
.usb_mode = USB_MODE_DUAL, /* both modes */
|
||||
},
|
||||
|
||||
[CDCE_BULK_TX] = {
|
||||
@ -118,7 +118,7 @@ static const struct usb2_config cdce_config[CDCE_N_TRANSFER] = {
|
||||
.flags = {.pipe_bof = 1,.force_short_xfer = 1,.ext_buffer = 1,},
|
||||
.callback = cdce_bulk_write_callback,
|
||||
.timeout = 10000, /* 10 seconds */
|
||||
.usb_mode = USB_MODE_MAX, /* both modes */
|
||||
.usb_mode = USB_MODE_DUAL, /* both modes */
|
||||
},
|
||||
|
||||
[CDCE_INTR_RX] = {
|
||||
@ -361,7 +361,7 @@ alloc_transfers:
|
||||
sc->sc_ue.ue_eaddr[i / 2] |= c;
|
||||
}
|
||||
|
||||
if (uaa->usb2_mode == USB_MODE_DEVICE) {
|
||||
if (uaa->usb_mode == USB_MODE_DEVICE) {
|
||||
/*
|
||||
* Do not use the same MAC address like the peer !
|
||||
*/
|
||||
|
@ -360,7 +360,7 @@ cue_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != CUE_CONFIG_IDX)
|
||||
return (ENXIO);
|
||||
|
@ -436,7 +436,7 @@ kue_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != KUE_CONFIG_IDX)
|
||||
return (ENXIO);
|
||||
|
@ -546,7 +546,7 @@ rue_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != RUE_CONFIG_IDX)
|
||||
return (ENXIO);
|
||||
|
@ -211,7 +211,7 @@ udav_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != UDAV_CONFIG_INDEX)
|
||||
return (ENXIO);
|
||||
|
@ -420,7 +420,7 @@ u3g_probe(device_t self)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(self);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != U3G_CONFIG_INDEX) {
|
||||
|
@ -161,7 +161,7 @@ uark_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != 0) {
|
||||
|
@ -268,7 +268,7 @@ ubsa_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UBSA_CONFIG_INDEX) {
|
||||
|
@ -205,7 +205,7 @@ ubser_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
/* check if this is a BWCT vendor specific ubser interface */
|
||||
|
@ -281,7 +281,7 @@ uchcom_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UCHCOM_CONFIG_INDEX) {
|
||||
|
@ -179,7 +179,7 @@ ucycom_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != 0) {
|
||||
|
@ -322,7 +322,7 @@ ufoma_probe(device_t dev)
|
||||
struct usb2_config_descriptor *cd;
|
||||
usb2_mcpc_acm_descriptor *mad;
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
id = usb2_get_interface_descriptor(uaa->iface);
|
||||
|
@ -240,7 +240,7 @@ uftdi_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UFTDI_CONFIG_INDEX) {
|
||||
|
@ -161,7 +161,7 @@ ugensa_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UGENSA_CONFIG_INDEX) {
|
||||
|
@ -1078,7 +1078,7 @@ uipaq_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UIPAQ_CONFIG_INDEX) {
|
||||
|
@ -471,7 +471,7 @@ ulpt_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if ((uaa->info.bInterfaceClass == UICLASS_PRINTER) &&
|
||||
|
@ -208,7 +208,7 @@ umct_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UMCT_CONFIG_INDEX) {
|
||||
|
@ -257,7 +257,7 @@ umodem_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
error = usb2_lookup_id_by_uaa(umodem_devs, sizeof(umodem_devs), uaa);
|
||||
|
@ -274,7 +274,7 @@ umoscom_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UMOSCOM_CONFIG_INDEX) {
|
||||
|
@ -306,7 +306,7 @@ uplcom_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UPLCOM_CONFIG_INDEX) {
|
||||
|
@ -206,7 +206,7 @@ uslcom_probe(device_t dev)
|
||||
|
||||
DPRINTFN(11, "\n");
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != USLCOM_CONFIG_INDEX) {
|
||||
|
@ -273,7 +273,7 @@ uvisor_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UVISOR_CONFIG_INDEX) {
|
||||
|
@ -257,7 +257,7 @@ uvscom_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->info.bConfigIndex != UVSCOM_CONFIG_INDEX) {
|
||||
|
@ -1428,7 +1428,7 @@ umass_probe(device_t dev)
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
struct umass_probe_proto temp;
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->use_generic == 0) {
|
||||
|
@ -189,7 +189,7 @@ urio_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if ((((uaa->info.idVendor == USB_VENDOR_DIAMOND) &&
|
||||
|
@ -317,7 +317,7 @@ ustorage_fs_probe(device_t dev)
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
struct usb2_interface_descriptor *id;
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_DEVICE) {
|
||||
if (uaa->usb_mode != USB_MODE_DEVICE) {
|
||||
return (ENXIO);
|
||||
}
|
||||
if (uaa->use_generic == 0) {
|
||||
|
@ -1279,7 +1279,7 @@ usb2_bdma_work_loop(struct usb2_xfer_queue *pq)
|
||||
if (xfer->flags_int.control_xfr &&
|
||||
xfer->flags_int.control_hdr) {
|
||||
/* special case */
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
/* The device controller writes to memory */
|
||||
xfer->frbuffers[0].isread = 1;
|
||||
} else {
|
||||
|
@ -194,7 +194,7 @@ usb_linux_probe(device_t dev)
|
||||
struct usb_driver *udrv;
|
||||
int err = ENXIO;
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
mtx_lock(&Giant);
|
||||
@ -640,7 +640,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
if (dev->bsd_udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (dev->bsd_udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
/* not supported */
|
||||
return (-EINVAL);
|
||||
}
|
||||
|
@ -233,7 +233,7 @@
|
||||
* The following macro will tell if an USB transfer is currently
|
||||
* receiving or transferring data.
|
||||
*/
|
||||
#define USB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb2_mode == \
|
||||
#define USB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb_mode == \
|
||||
USB_MODE_DEVICE ? (((xfer)->endpoint & UE_DIR_IN) ? 0 : 1) : \
|
||||
(((xfer)->endpoint & UE_DIR_IN) ? 1 : 0))
|
||||
|
||||
@ -354,6 +354,8 @@ struct usb2_xfer_flags {
|
||||
* flags.
|
||||
*/
|
||||
struct usb2_xfer_flags_int {
|
||||
|
||||
enum usb_hc_mode usb_mode; /* shadow copy of "udev->usb_mode" */
|
||||
uint16_t control_rem; /* remainder in bytes */
|
||||
|
||||
uint8_t open:1; /* set if USB pipe has been opened */
|
||||
@ -381,7 +383,6 @@ struct usb2_xfer_flags_int {
|
||||
uint8_t bdma_setup:1; /* set if BUS-DMA has been setup */
|
||||
#endif
|
||||
uint8_t isochronous_xfr:1; /* set if isochronous transfer */
|
||||
uint8_t usb2_mode:1; /* shadow copy of "udev->usb2_mode" */
|
||||
uint8_t curr_dma_set:1; /* used by USB HC/DC driver */
|
||||
uint8_t can_cancel_immed:1; /* set if USB transfer can be
|
||||
* cancelled immediately */
|
||||
@ -399,13 +400,12 @@ struct usb2_config {
|
||||
#define USB_DEFAULT_INTERVAL 0
|
||||
usb2_timeout_t timeout; /* transfer timeout in milliseconds */
|
||||
struct usb2_xfer_flags flags; /* transfer flags */
|
||||
enum usb_hc_mode usb_mode; /* host or device mode */
|
||||
uint8_t type; /* pipe type */
|
||||
uint8_t endpoint; /* pipe number */
|
||||
uint8_t direction; /* pipe direction */
|
||||
uint8_t ep_index; /* pipe index match to use */
|
||||
uint8_t if_index; /* "ifaces" index to use */
|
||||
uint8_t usb_mode; /* see "USB_MODE_XXX",
|
||||
* "USB_MODE_MAX" means any mode! */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -495,7 +495,7 @@ struct usb2_attach_arg {
|
||||
const void *driver_info; /* for internal use */
|
||||
struct usb2_device *device; /* current device */
|
||||
struct usb2_interface *iface; /* current interface */
|
||||
uint8_t usb2_mode; /* see USB_MODE_XXX */
|
||||
enum usb_hc_mode usb_mode; /* host or device mode */
|
||||
uint8_t port;
|
||||
uint8_t use_generic; /* hint for generic drivers */
|
||||
};
|
||||
@ -529,7 +529,7 @@ uint8_t usb2_clear_stall_callback(struct usb2_xfer *xfer1,
|
||||
uint8_t usb2_get_interface_altindex(struct usb2_interface *iface);
|
||||
usb2_error_t usb2_set_alt_interface_index(struct usb2_device *udev,
|
||||
uint8_t iface_index, uint8_t alt_index);
|
||||
uint8_t usb2_get_mode(struct usb2_device *udev);
|
||||
enum usb_hc_mode usb2_get_mode(struct usb2_device *udev);
|
||||
uint8_t usb2_get_speed(struct usb2_device *udev);
|
||||
uint32_t usb2_get_isoc_fps(struct usb2_device *udev);
|
||||
usb2_error_t usb2_transfer_setup(struct usb2_device *udev,
|
||||
|
@ -597,13 +597,13 @@ usb2_dev_get_pipe(struct usb2_device *udev, uint8_t ep_index, uint8_t dir)
|
||||
pipe = &udev->default_pipe;
|
||||
} else {
|
||||
if (dir == USB_FIFO_RX) {
|
||||
if (udev->flags.usb2_mode == USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode == USB_MODE_HOST) {
|
||||
ep_dir = UE_DIR_IN;
|
||||
} else {
|
||||
ep_dir = UE_DIR_OUT;
|
||||
}
|
||||
} else {
|
||||
if (udev->flags.usb2_mode == USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode == USB_MODE_HOST) {
|
||||
ep_dir = UE_DIR_OUT;
|
||||
} else {
|
||||
ep_dir = UE_DIR_IN;
|
||||
|
@ -187,8 +187,8 @@ usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
|
||||
|
||||
/* check USB mode */
|
||||
|
||||
if ((setup->usb_mode != USB_MODE_MAX) &&
|
||||
(udev->flags.usb2_mode != setup->usb_mode)) {
|
||||
if (setup->usb_mode != USB_MODE_DUAL &&
|
||||
udev->flags.usb_mode != setup->usb_mode) {
|
||||
/* wrong mode - no pipe */
|
||||
return (NULL);
|
||||
}
|
||||
@ -197,11 +197,11 @@ usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
|
||||
|
||||
if (setup->direction == UE_DIR_RX) {
|
||||
ea_mask = (UE_DIR_IN | UE_DIR_OUT);
|
||||
ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ?
|
||||
ea_val = (udev->flags.usb_mode == USB_MODE_DEVICE) ?
|
||||
UE_DIR_OUT : UE_DIR_IN;
|
||||
} else if (setup->direction == UE_DIR_TX) {
|
||||
ea_mask = (UE_DIR_IN | UE_DIR_OUT);
|
||||
ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ?
|
||||
ea_val = (udev->flags.usb_mode == USB_MODE_DEVICE) ?
|
||||
UE_DIR_IN : UE_DIR_OUT;
|
||||
} else if (setup->direction == UE_DIR_ANY) {
|
||||
/* match any endpoint direction */
|
||||
@ -416,7 +416,7 @@ usb2_unconfigure(struct usb2_device *udev, uint8_t flag)
|
||||
|
||||
/* free "cdesc" after "ifaces" and "pipes", if any */
|
||||
if (udev->cdesc != NULL) {
|
||||
if (udev->flags.usb2_mode != USB_MODE_DEVICE)
|
||||
if (udev->flags.usb_mode != USB_MODE_DEVICE)
|
||||
free(udev->cdesc, M_USB);
|
||||
udev->cdesc = NULL;
|
||||
}
|
||||
@ -475,7 +475,7 @@ usb2_set_config_index(struct usb2_device *udev, uint8_t index)
|
||||
goto done;
|
||||
}
|
||||
/* get the full config descriptor */
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
/* save some memory */
|
||||
err = usb2_req_get_descriptor_ptr(udev, &cdp,
|
||||
(UDESC_CONFIG << 8) | index);
|
||||
@ -495,7 +495,7 @@ usb2_set_config_index(struct usb2_device *udev, uint8_t index)
|
||||
selfpowered = 0;
|
||||
if ((!udev->flags.uq_bus_powered) &&
|
||||
(cdp->bmAttributes & UC_SELF_POWERED) &&
|
||||
(udev->flags.usb2_mode == USB_MODE_HOST)) {
|
||||
(udev->flags.usb_mode == USB_MODE_HOST)) {
|
||||
/* May be self powered. */
|
||||
if (cdp->bmAttributes & UC_BUS_POWERED) {
|
||||
/* Must ask device. */
|
||||
@ -533,7 +533,7 @@ usb2_set_config_index(struct usb2_device *udev, uint8_t index)
|
||||
goto done;
|
||||
}
|
||||
/* Only update "self_powered" in USB Host Mode */
|
||||
if (udev->flags.usb2_mode == USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode == USB_MODE_HOST) {
|
||||
udev->flags.self_powered = selfpowered;
|
||||
}
|
||||
udev->power = power;
|
||||
@ -815,7 +815,7 @@ usb2_set_alt_interface_index(struct usb2_device *udev,
|
||||
err = USB_ERR_INVAL;
|
||||
goto done;
|
||||
}
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
usb2_detach_device(udev, iface_index,
|
||||
USB_UNCFG_FLAG_FREE_SUBDEV);
|
||||
} else {
|
||||
@ -1178,7 +1178,7 @@ usb2_init_attach_arg(struct usb2_device *udev,
|
||||
bzero(uaa, sizeof(*uaa));
|
||||
|
||||
uaa->device = udev;
|
||||
uaa->usb2_mode = udev->flags.usb2_mode;
|
||||
uaa->usb_mode = udev->flags.usb_mode;
|
||||
uaa->port = udev->port_no;
|
||||
|
||||
uaa->info.idVendor = UGETW(udev->ddesc.idVendor);
|
||||
@ -1416,8 +1416,8 @@ usb2_clear_stall_proc(struct usb2_proc_msg *_pm)
|
||||
*------------------------------------------------------------------------*/
|
||||
struct usb2_device *
|
||||
usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
|
||||
struct usb2_device *parent_hub, uint8_t depth,
|
||||
uint8_t port_index, uint8_t port_no, uint8_t speed, uint8_t usb2_mode)
|
||||
struct usb2_device *parent_hub, uint8_t depth, uint8_t port_index,
|
||||
uint8_t port_no, uint8_t speed, enum usb_hc_mode mode)
|
||||
{
|
||||
struct usb2_attach_arg uaa;
|
||||
struct usb2_device *udev;
|
||||
@ -1429,9 +1429,9 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
|
||||
uint8_t device_index;
|
||||
|
||||
DPRINTF("parent_dev=%p, bus=%p, parent_hub=%p, depth=%u, "
|
||||
"port_index=%u, port_no=%u, speed=%u, usb2_mode=%u\n",
|
||||
"port_index=%u, port_no=%u, speed=%u, usb_mode=%u\n",
|
||||
parent_dev, bus, parent_hub, depth, port_index, port_no,
|
||||
speed, usb2_mode);
|
||||
speed, mode);
|
||||
|
||||
/*
|
||||
* Find an unused device index. In USB Host mode this is the
|
||||
@ -1509,7 +1509,7 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
|
||||
udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET;
|
||||
|
||||
udev->speed = speed;
|
||||
udev->flags.usb2_mode = usb2_mode;
|
||||
udev->flags.usb_mode = mode;
|
||||
|
||||
/* search for our High Speed USB HUB, if any */
|
||||
|
||||
@ -1548,7 +1548,7 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
|
||||
/* Create a link from /dev/ugenX.X to the default endpoint */
|
||||
make_dev_alias(udev->default_dev, udev->ugen_name);
|
||||
#endif
|
||||
if (udev->flags.usb2_mode == USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode == USB_MODE_HOST) {
|
||||
|
||||
err = usb2_req_set_address(udev, NULL, device_index);
|
||||
|
||||
@ -1703,7 +1703,7 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
|
||||
usb2_check_strings(udev);
|
||||
#endif
|
||||
|
||||
if (udev->flags.usb2_mode == USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode == USB_MODE_HOST) {
|
||||
uint8_t config_index;
|
||||
uint8_t config_quirk;
|
||||
uint8_t set_config_failed = 0;
|
||||
@ -1981,7 +1981,7 @@ usb2_free_device(struct usb2_device *udev, uint8_t flag)
|
||||
udev->default_dev->si_drv1);
|
||||
#endif
|
||||
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
/* stop receiving any control transfers (Device Side Mode) */
|
||||
usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
|
||||
}
|
||||
@ -2239,10 +2239,10 @@ usb2_check_strings(struct usb2_device *udev)
|
||||
* Returns:
|
||||
* See: USB_MODE_XXX
|
||||
*/
|
||||
uint8_t
|
||||
enum usb_hc_mode
|
||||
usb2_get_mode(struct usb2_device *udev)
|
||||
{
|
||||
return (udev->flags.usb2_mode);
|
||||
return (udev->flags.usb_mode);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2452,7 +2452,7 @@ usb2_peer_can_wakeup(struct usb2_device *udev)
|
||||
const struct usb2_config_descriptor *cdp;
|
||||
|
||||
cdp = udev->cdesc;
|
||||
if ((cdp != NULL) && (udev->flags.usb2_mode == USB_MODE_HOST)) {
|
||||
if ((cdp != NULL) && (udev->flags.usb_mode == USB_MODE_HOST)) {
|
||||
return (cdp->bmAttributes & UC_REMOTE_WAKEUP);
|
||||
}
|
||||
return (0); /* not supported */
|
||||
|
@ -83,7 +83,7 @@ struct usb2_interface {
|
||||
* The following structure defines the USB device flags.
|
||||
*/
|
||||
struct usb2_device_flags {
|
||||
uint8_t usb2_mode:1; /* USB mode (see USB_MODE_XXX) */
|
||||
enum usb_hc_mode usb_mode; /* host or device mode */
|
||||
uint8_t self_powered:1; /* set if USB device is self powered */
|
||||
uint8_t no_strings:1; /* set if USB device does not support
|
||||
* strings */
|
||||
@ -190,7 +190,7 @@ extern int usb2_template;
|
||||
struct usb2_device *usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
|
||||
struct usb2_device *parent_hub, uint8_t depth,
|
||||
uint8_t port_index, uint8_t port_no, uint8_t speed,
|
||||
uint8_t usb2_mode);
|
||||
enum usb_hc_mode mode);
|
||||
struct usb2_pipe *usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
|
||||
const struct usb2_config *setup);
|
||||
struct usb2_pipe *usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val);
|
||||
|
@ -233,7 +233,7 @@ ugen_open_pipe_write(struct usb2_fifo *f)
|
||||
usb2_config[0].direction = UE_DIR_TX;
|
||||
usb2_config[0].interval = USB_DEFAULT_INTERVAL;
|
||||
usb2_config[0].flags.proxy_buffer = 1;
|
||||
usb2_config[0].usb_mode = USB_MODE_MAX; /* both modes */
|
||||
usb2_config[0].usb_mode = USB_MODE_DUAL; /* both modes */
|
||||
|
||||
switch (ed->bmAttributes & UE_XFERTYPE) {
|
||||
case UE_INTERRUPT:
|
||||
@ -301,7 +301,7 @@ ugen_open_pipe_read(struct usb2_fifo *f)
|
||||
usb2_config[0].direction = UE_DIR_RX;
|
||||
usb2_config[0].interval = USB_DEFAULT_INTERVAL;
|
||||
usb2_config[0].flags.proxy_buffer = 1;
|
||||
usb2_config[0].usb_mode = USB_MODE_MAX; /* both modes */
|
||||
usb2_config[0].usb_mode = USB_MODE_DUAL; /* both modes */
|
||||
|
||||
switch (ed->bmAttributes & UE_XFERTYPE) {
|
||||
case UE_INTERRUPT:
|
||||
@ -584,7 +584,7 @@ ugen_set_config(struct usb2_fifo *f, uint8_t index)
|
||||
{
|
||||
DPRINTFN(2, "index %u\n", index);
|
||||
|
||||
if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (f->udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
/* not possible in device side mode */
|
||||
return (ENOTTY);
|
||||
}
|
||||
@ -615,7 +615,7 @@ ugen_set_interface(struct usb2_fifo *f,
|
||||
{
|
||||
DPRINTFN(2, "%u, %u\n", iface_index, alt_index);
|
||||
|
||||
if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (f->udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
/* not possible in device side mode */
|
||||
return (ENOTTY);
|
||||
}
|
||||
@ -821,7 +821,7 @@ usb2_gen_fill_deviceinfo(struct usb2_fifo *f, struct usb2_device_info *di)
|
||||
di->udi_config_index = udev->curr_config_index;
|
||||
di->udi_power = udev->flags.self_powered ? 0 : udev->power;
|
||||
di->udi_speed = udev->speed;
|
||||
di->udi_mode = udev->flags.usb2_mode;
|
||||
di->udi_mode = udev->flags.usb_mode;
|
||||
di->udi_power_mode = udev->power_mode;
|
||||
di->udi_suspended = udev->flags.peer_suspended;
|
||||
|
||||
@ -1465,10 +1465,10 @@ ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
usb2_config[0].timeout = 0; /* no timeout */
|
||||
usb2_config[0].frames = u.popen->max_frames;
|
||||
usb2_config[0].bufsize = u.popen->max_bufsize;
|
||||
usb2_config[0].usb_mode = USB_MODE_MAX; /* both modes */
|
||||
usb2_config[0].usb_mode = USB_MODE_DUAL; /* both modes */
|
||||
|
||||
if (usb2_config[0].type == UE_CONTROL) {
|
||||
if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (f->udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -1477,7 +1477,7 @@ ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
isread = ((usb2_config[0].endpoint &
|
||||
(UE_DIR_IN | UE_DIR_OUT)) == UE_DIR_IN);
|
||||
|
||||
if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (f->udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
isread = !isread;
|
||||
}
|
||||
/* check permissions */
|
||||
@ -1530,7 +1530,7 @@ ugen_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags)
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (f->udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ uhub_explore_sub(struct uhub_softc *sc, struct usb2_port *up)
|
||||
}
|
||||
/* start control transfer, if device mode */
|
||||
|
||||
if (child->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (child->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
usb2_default_transfer_setup(child);
|
||||
}
|
||||
/* if a HUB becomes present, do a recursive HUB explore */
|
||||
@ -276,7 +276,7 @@ uhub_reattach_port(struct uhub_softc *sc, uint8_t portno)
|
||||
usb2_error_t err;
|
||||
uint8_t timeout;
|
||||
uint8_t speed;
|
||||
uint8_t usb2_mode;
|
||||
enum usb_hc_mode mode;
|
||||
|
||||
DPRINTF("reattaching port %d\n", portno);
|
||||
|
||||
@ -404,14 +404,14 @@ repeat:
|
||||
* NOTE: This part is currently FreeBSD specific.
|
||||
*/
|
||||
if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)
|
||||
usb2_mode = USB_MODE_DEVICE;
|
||||
mode = USB_MODE_DEVICE;
|
||||
else
|
||||
usb2_mode = USB_MODE_HOST;
|
||||
mode = USB_MODE_HOST;
|
||||
|
||||
/* need to create a new child */
|
||||
|
||||
child = usb2_alloc_device(sc->sc_dev, udev->bus, udev,
|
||||
udev->depth + 1, portno - 1, portno, speed, usb2_mode);
|
||||
udev->depth + 1, portno - 1, portno, speed, mode);
|
||||
if (child == NULL) {
|
||||
DPRINTFN(0, "could not allocate new device!\n");
|
||||
goto error;
|
||||
@ -495,7 +495,7 @@ uhub_suspend_resume_port(struct uhub_softc *sc, uint8_t portno)
|
||||
*/
|
||||
if (is_suspend == 0)
|
||||
usb2_dev_resume_peer(child);
|
||||
else if (child->flags.usb2_mode == USB_MODE_DEVICE)
|
||||
else if (child->flags.usb_mode == USB_MODE_DEVICE)
|
||||
usb2_dev_suspend_peer(child);
|
||||
}
|
||||
done:
|
||||
@ -638,7 +638,7 @@ uhub_probe(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST) {
|
||||
if (uaa->usb_mode != USB_MODE_HOST) {
|
||||
return (ENXIO);
|
||||
}
|
||||
/*
|
||||
@ -1505,7 +1505,7 @@ usb2_transfer_power_ref(struct usb2_xfer *xfer, int val)
|
||||
|
||||
if (xfer->flags_int.control_xfr) {
|
||||
udev->pwr_save.read_refs += val;
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_HOST) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_HOST) {
|
||||
/*
|
||||
* it is not allowed to suspend during a control
|
||||
* transfer
|
||||
@ -1706,7 +1706,7 @@ usb2_dev_resume_peer(struct usb2_device *udev)
|
||||
|
||||
DPRINTF("udev=%p\n", udev);
|
||||
|
||||
if ((udev->flags.usb2_mode == USB_MODE_DEVICE) &&
|
||||
if ((udev->flags.usb_mode == USB_MODE_DEVICE) &&
|
||||
(udev->flags.remote_wakeup == 0)) {
|
||||
/*
|
||||
* If the host did not set the remote wakeup feature, we can
|
||||
|
@ -34,8 +34,7 @@ struct usb2_port {
|
||||
uint8_t restartcnt;
|
||||
#define USB_RESTART_MAX 5
|
||||
uint8_t device_index; /* zero means not valid */
|
||||
uint8_t usb2_mode:1; /* current USB mode */
|
||||
uint8_t unused:7;
|
||||
enum usb_hc_mode usb_mode; /* host or device mode */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -176,7 +176,7 @@ static usb2_handle_request_t *
|
||||
usb2_get_hr_func(struct usb2_device *udev)
|
||||
{
|
||||
/* figure out if there is a Handle Request function */
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE)
|
||||
if (udev->flags.usb_mode == USB_MODE_DEVICE)
|
||||
return (usb2_temp_get_desc_p);
|
||||
else if (udev->parent_hub == NULL)
|
||||
return (udev->bus->methods->roothub_exec);
|
||||
@ -1485,7 +1485,7 @@ usb2_req_re_enumerate(struct usb2_device *udev, struct mtx *mtx)
|
||||
uint8_t old_addr;
|
||||
uint8_t do_retry = 1;
|
||||
|
||||
if (udev->flags.usb2_mode != USB_MODE_HOST) {
|
||||
if (udev->flags.usb_mode != USB_MODE_HOST) {
|
||||
return (USB_ERR_INVAL);
|
||||
}
|
||||
old_addr = udev->address;
|
||||
|
@ -36,8 +36,8 @@ enum usb2_speed {
|
||||
USB_SPEED_FULL,
|
||||
USB_SPEED_HIGH,
|
||||
USB_SPEED_SUPER,
|
||||
USB_SPEED_MAX
|
||||
};
|
||||
#define USB_SPEED_MAX (USB_SPEED_SUPER+1)
|
||||
|
||||
/*
|
||||
* The "USB_REV" macros defines all the supported USB revisions.
|
||||
@ -49,18 +49,19 @@ enum usb2_revision {
|
||||
USB_REV_1_1,
|
||||
USB_REV_2_0,
|
||||
USB_REV_2_5,
|
||||
USB_REV_3_0,
|
||||
USB_REV_MAX
|
||||
USB_REV_3_0
|
||||
};
|
||||
#define USB_REV_MAX (USB_REV_3_0+1)
|
||||
|
||||
/*
|
||||
* The "USB_MODE" macros defines all the supported USB modes.
|
||||
* Supported host contoller modes.
|
||||
*/
|
||||
enum usb2_mode {
|
||||
USB_MODE_HOST,
|
||||
USB_MODE_DEVICE,
|
||||
USB_MODE_MAX
|
||||
enum usb_hc_mode {
|
||||
USB_MODE_HOST, /* initiates transfers */
|
||||
USB_MODE_DEVICE, /* bus transfer target */
|
||||
USB_MODE_DUAL /* can be host or device */
|
||||
};
|
||||
#define USB_MODE_MAX (USB_MODE_DUAL+1)
|
||||
|
||||
/*
|
||||
* The "USB_MODE" macros defines all the supported device states.
|
||||
@ -71,6 +72,6 @@ enum usb2_dev_state {
|
||||
USB_STATE_POWERED,
|
||||
USB_STATE_ADDRESSED,
|
||||
USB_STATE_CONFIGURED,
|
||||
USB_STATE_MAX,
|
||||
};
|
||||
#define USB_STATE_MAX (USB_STATE_CONFIGURED+1)
|
||||
#endif /* _USB2_REVISION_H_ */
|
||||
|
@ -63,7 +63,7 @@ static const struct usb2_config usb2_control_ep_cfg[USB_DEFAULT_XFER_MAX] = {
|
||||
.bufsize = USB_EP0_BUFSIZE, /* bytes */
|
||||
.flags = {.proxy_buffer = 1,},
|
||||
.callback = &usb2_request_callback,
|
||||
.usb_mode = USB_MODE_MAX, /* both modes */
|
||||
.usb_mode = USB_MODE_DUAL, /* both modes */
|
||||
},
|
||||
|
||||
/* This transfer is used for generic clear stall only */
|
||||
@ -101,7 +101,7 @@ static void usb2_get_std_packet_size(struct usb2_std_packet_size *ptr,
|
||||
static void
|
||||
usb2_request_callback(struct usb2_xfer *xfer)
|
||||
{
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE)
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE)
|
||||
usb2_handle_request_callback(xfer);
|
||||
else
|
||||
usb2_do_request_callback(xfer);
|
||||
@ -327,7 +327,7 @@ usb2_transfer_setup_sub(struct usb2_setup_params *parm)
|
||||
xfer->max_packet_size = UGETW(edesc->wMaxPacketSize);
|
||||
xfer->max_packet_count = 1;
|
||||
/* make a shadow copy: */
|
||||
xfer->flags_int.usb2_mode = parm->udev->flags.usb2_mode;
|
||||
xfer->flags_int.usb_mode = parm->udev->flags.usb_mode;
|
||||
|
||||
parm->bufsize = setup->bufsize;
|
||||
|
||||
@ -858,8 +858,8 @@ usb2_transfer_setup(struct usb2_device *udev,
|
||||
if ((pipe == NULL) || (pipe->methods == NULL)) {
|
||||
if (setup->flags.no_pipe_ok)
|
||||
continue;
|
||||
if ((setup->usb_mode != USB_MODE_MAX) &&
|
||||
(setup->usb_mode != udev->flags.usb2_mode))
|
||||
if ((setup->usb_mode != USB_MODE_DUAL) &&
|
||||
(setup->usb_mode != udev->flags.usb_mode))
|
||||
continue;
|
||||
parm.err = USB_ERR_NO_PIPE;
|
||||
goto done;
|
||||
@ -1256,7 +1256,7 @@ usb2_start_hardware_sub(struct usb2_xfer *xfer)
|
||||
xfer->flags_int.control_hdr = 0;
|
||||
|
||||
/* setup control transfer */
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
usb2_control_transfer_init(xfer);
|
||||
}
|
||||
}
|
||||
@ -1275,7 +1275,7 @@ usb2_start_hardware_sub(struct usb2_xfer *xfer)
|
||||
goto error;
|
||||
}
|
||||
/* check USB mode */
|
||||
if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
|
||||
|
||||
/* check number of frames */
|
||||
if (xfer->nframes != 1) {
|
||||
@ -2241,7 +2241,7 @@ usb2_pipe_start(struct usb2_xfer_queue *pq)
|
||||
udev = info->udev;
|
||||
pipe->is_stalled = 1;
|
||||
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
(udev->bus->methods->set_stall) (
|
||||
udev, NULL, pipe);
|
||||
} else if (udev->default_xfer[1]) {
|
||||
@ -2574,7 +2574,7 @@ repeat:
|
||||
((xfer->address == udev->address) &&
|
||||
(udev->default_ep_desc.wMaxPacketSize[0] ==
|
||||
udev->ddesc.bMaxPacketSize));
|
||||
if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
|
||||
if (udev->flags.usb_mode == USB_MODE_DEVICE) {
|
||||
if (no_resetup) {
|
||||
/*
|
||||
* NOTE: checking "xfer->address" and
|
||||
|
@ -411,7 +411,7 @@ rum_match(device_t self)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(self);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != 0)
|
||||
return (ENXIO);
|
||||
|
@ -329,7 +329,7 @@ uath_match(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != UATH_CONFIG_INDEX)
|
||||
return (ENXIO);
|
||||
|
@ -232,7 +232,7 @@ upgt_match(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != UPGT_CONFIG_INDEX)
|
||||
return (ENXIO);
|
||||
|
@ -414,7 +414,7 @@ ural_match(device_t self)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(self);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != 0)
|
||||
return (ENXIO);
|
||||
|
@ -320,7 +320,7 @@ zyd_match(device_t dev)
|
||||
{
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(dev);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
if (uaa->usb_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != ZYD_CONFIG_INDEX)
|
||||
return (ENXIO);
|
||||
|
Loading…
x
Reference in New Issue
Block a user