Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/usb_hub.c
Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | static device_method_t uhub_methods[] = { | ||||
DEVMETHOD(device_attach, uhub_attach), | DEVMETHOD(device_attach, uhub_attach), | ||||
DEVMETHOD(device_detach, uhub_detach), | DEVMETHOD(device_detach, uhub_detach), | ||||
DEVMETHOD(device_suspend, uhub_suspend), | DEVMETHOD(device_suspend, uhub_suspend), | ||||
DEVMETHOD(device_resume, uhub_resume), | DEVMETHOD(device_resume, uhub_resume), | ||||
DEVMETHOD(bus_child_location, uhub_child_location), | DEVMETHOD(bus_child_location, uhub_child_location), | ||||
DEVMETHOD(bus_child_pnpinfo, uhub_child_pnpinfo), | DEVMETHOD(bus_child_pnpinfo, uhub_child_pnpinfo), | ||||
DEVMETHOD(bus_get_device_path, uhub_get_device_path), | |||||
DEVMETHOD(bus_driver_added, uhub_driver_added), | DEVMETHOD(bus_driver_added, uhub_driver_added), | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
driver_t uhub_driver = { | driver_t uhub_driver = { | ||||
.name = "uhub", | .name = "uhub", | ||||
.methods = uhub_methods, | .methods = uhub_methods, | ||||
.size = sizeof(struct uhub_softc) | .size = sizeof(struct uhub_softc) | ||||
▲ Show 20 Lines • Show All 1,492 Lines • ▼ Show 20 Lines | |||||
#if USB_HAVE_UGEN | #if USB_HAVE_UGEN | ||||
, res.udev->ugen_name | , res.udev->ugen_name | ||||
#endif | #endif | ||||
); | ); | ||||
done: | done: | ||||
mtx_unlock(&Giant); | mtx_unlock(&Giant); | ||||
return (0); | return (0); | ||||
} | |||||
int | |||||
uhub_get_device_path(device_t bus, device_t child, const char *locator, | |||||
struct sbuf *sb) | |||||
{ | |||||
struct uhub_softc *sc; | |||||
struct usb_hub *hub; | |||||
struct hub_result res; | |||||
int rv; | |||||
if (strcmp(locator, BUS_LOCATOR_UEFI) == 0) { | |||||
rv = bus_generic_get_device_path(device_get_parent(bus), bus, locator, sb); | |||||
sc = device_get_softc(bus); | |||||
hub = sc->sc_udev->hub; | |||||
mtx_lock(&Giant); | |||||
uhub_find_iface_index(hub, child, &res); | |||||
if (!res.udev) { | |||||
printf("device not on hub\n"); | |||||
goto done; | |||||
} | |||||
sbuf_printf(sb, "/USB(0x%x,0x%x)", res.portno - 1, res.iface_index); | |||||
done: | |||||
mtx_unlock(&Giant); | |||||
return (0); | |||||
} | |||||
/* For the rest, punt to the default handler */ | |||||
return (bus_generic_get_device_path(bus, child, locator, sb)); | |||||
} | } | ||||
static int | static int | ||||
uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb) | uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb) | ||||
{ | { | ||||
struct uhub_softc *sc; | struct uhub_softc *sc; | ||||
struct usb_hub *hub; | struct usb_hub *hub; | ||||
struct usb_interface *iface; | struct usb_interface *iface; | ||||
▲ Show 20 Lines • Show All 1,268 Lines • Show Last 20 Lines |