Generate usb events on attach and detach.
This commit is contained in:
parent
7a7a3bcfdf
commit
4b93911b25
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uaudio.c,v 1.16 2000/01/16 09:32:56 augustss Exp $ */
|
||||
/* $NetBSD: uaudio.c,v 1.17 2000/02/02 13:18:45 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -389,6 +389,9 @@ USB_ATTACH(uaudio)
|
||||
DPRINTF(("uaudio_attach: doing audio_attach_mi\n"));
|
||||
sc->sc_audiodev = audio_attach_mi(&uaudio_hw_if, sc, &sc->sc_dev);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
}
|
||||
|
||||
@ -428,6 +431,9 @@ uaudio_detach(self, flags)
|
||||
if (sc->sc_audiodev != NULL)
|
||||
rv = config_detach(sc->sc_audiodev, flags);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhid.c,v 1.31 2000/01/19 00:23:58 augustss Exp $ */
|
||||
/* $NetBSD: uhid.c,v 1.32 2000/02/02 13:18:45 augustss Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/uhid.c,v 1.22 1999/11/17 22:33:43 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -83,6 +83,7 @@ int uhiddebug = 0;
|
||||
|
||||
struct uhid_softc {
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_device_handle sc_udev;
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
|
||||
int sc_ep_addr;
|
||||
@ -180,6 +181,7 @@ USB_ATTACH(uhid)
|
||||
usbd_status err;
|
||||
char devinfo[1024];
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface = iface;
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
@ -241,6 +243,9 @@ USB_ATTACH(uhid)
|
||||
}
|
||||
#endif
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
}
|
||||
|
||||
@ -307,6 +312,9 @@ USB_DETACH(uhid)
|
||||
|
||||
free(sc->sc_repdesc, M_USBDEV);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uhub.c,v 1.37 2000/02/02 07:33:59 augustss Exp $ */
|
||||
/* $NetBSD: uhub.c,v 1.38 2000/02/02 13:18:46 augustss Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -291,11 +291,6 @@ uhub_init_port(up)
|
||||
/* First let the device go through a good power cycle, */
|
||||
usbd_delay_ms(dev, USB_PORT_POWER_DOWN_TIME);
|
||||
|
||||
#if 0
|
||||
usbd_clear_hub_feature(dev, UHF_C_HUB_OVER_CURRENT);
|
||||
usbd_clear_port_feature(dev, port, UHF_C_PORT_OVER_CURRENT);
|
||||
#endif
|
||||
|
||||
/* then turn the power on. */
|
||||
err = usbd_set_port_feature(dev, port, UHF_PORT_POWER);
|
||||
if (err)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ukbd.c,v 1.54 2000/01/19 00:23:58 augustss Exp $ */
|
||||
/* $NetBSD: ukbd.c,v 1.55 2000/02/02 13:18:46 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -168,6 +168,7 @@ static u_int8_t ukbd_trtab[256] = {
|
||||
|
||||
struct ukbd_softc {
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_device_handle sc_udev;
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
|
||||
int sc_ep_addr;
|
||||
@ -273,6 +274,7 @@ USB_ATTACH(ukbd)
|
||||
int i;
|
||||
#endif
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface = iface;
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
@ -349,6 +351,9 @@ USB_ATTACH(ukbd)
|
||||
|
||||
sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
}
|
||||
|
||||
@ -447,6 +452,10 @@ USB_DETACH(ukbd)
|
||||
/* No need to do reference counting of ukbd, wskbd has all the goo. */
|
||||
if (sc->sc_wskbddev != NULL)
|
||||
rv = config_detach(sc->sc_wskbddev, flags);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ulpt.c,v 1.30 1999/11/18 23:32:30 augustss Exp $ */
|
||||
/* $NetBSD: ulpt.c,v 1.31 2000/02/02 13:18:47 augustss Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
@ -263,6 +263,9 @@ USB_ATTACH(ulpt)
|
||||
UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self));
|
||||
#endif
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
|
||||
nobulk:
|
||||
@ -332,6 +335,9 @@ USB_DETACH(ulpt)
|
||||
destroy_dev(sc->dev_noprime);
|
||||
#endif
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: umass.c,v 1.23 1999/11/17 23:00:50 augustss Exp $ */
|
||||
/* $NetBSD: umass.c,v 1.24 2000/02/02 13:18:47 augustss Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -131,6 +131,7 @@ int umassdebug = /* UDMASS_SCSI|UDMASS_BULK|UDMASS_USB */ 0;
|
||||
|
||||
typedef struct umass_softc {
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_device_handle sc_udev;
|
||||
usbd_interface_handle sc_iface; /* the interface we use */
|
||||
|
||||
u_int8_t sc_subclass; /* our USB subclass */
|
||||
@ -251,6 +252,7 @@ USB_ATTACH(umass)
|
||||
u_int8_t maxlun;
|
||||
const char *subclass, *protocol;
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface = uaa->iface;
|
||||
sc->sc_bulkout_pipe = NULL;
|
||||
sc->sc_bulkin_pipe = NULL;
|
||||
@ -367,6 +369,9 @@ USB_ATTACH(umass)
|
||||
USB_ATTACH_ERROR_RETURN;
|
||||
}
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
}
|
||||
|
||||
@ -437,6 +442,9 @@ USB_DETACH(umass)
|
||||
sc->sc_bulkout_pipe = NULL;
|
||||
}
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: umodem.c,v 1.20 2000/01/25 08:12:58 augustss Exp $ */
|
||||
/* $NetBSD: umodem.c,v 1.21 2000/02/02 13:18:47 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -272,6 +272,9 @@ USB_ATTACH(umodem)
|
||||
DPRINTF(("umodem_attach: sc=%p\n", sc));
|
||||
sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
|
||||
bad:
|
||||
@ -602,12 +605,9 @@ umodem_activate(self, act)
|
||||
return (rv);
|
||||
}
|
||||
|
||||
int
|
||||
umodem_detach(self, flags)
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
USB_DETACH(umodem)
|
||||
{
|
||||
struct umodem_softc *sc = (struct umodem_softc *)self;
|
||||
USB_DETACH_START(umodem, sc);
|
||||
int rv = 0;
|
||||
|
||||
DPRINTF(("umodem_detach: sc=%p flags=%d\n", sc, flags));
|
||||
@ -617,5 +617,8 @@ umodem_detach(self, flags)
|
||||
if (sc->sc_subdev != NULL)
|
||||
rv = config_detach(sc->sc_subdev, flags);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ums.c,v 1.39 2000/01/19 00:23:58 augustss Exp $ */
|
||||
/* $NetBSD: ums.c,v 1.40 2000/02/02 13:18:48 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -88,6 +88,7 @@ int umsdebug = 0;
|
||||
|
||||
struct ums_softc {
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_device_handle sc_udev;
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
|
||||
int sc_ep_addr;
|
||||
@ -175,6 +176,7 @@ USB_ATTACH(ums)
|
||||
int i, wheel;
|
||||
struct hid_location loc_btn;
|
||||
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface = iface;
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
@ -305,6 +307,9 @@ USB_ATTACH(ums)
|
||||
|
||||
sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
USB_ATTACH_SUCCESS_RETURN;
|
||||
}
|
||||
|
||||
@ -344,6 +349,10 @@ USB_DETACH(ums)
|
||||
free(sc->sc_loc_btn, M_USBDEV);
|
||||
free(sc->sc_ibuf, M_USBDEV);
|
||||
}
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||
USBDEV(sc->sc_dev));
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user