Remove devinfo junk.
Remove bogus bzero/memset Expand USB_ATTACH_SETUP Minor nits
This commit is contained in:
parent
07f51bab6d
commit
a5b1cb0cd0
@ -311,7 +311,6 @@ USB_ATTACH(ufoma)
|
|||||||
struct ucom_softc *ucom = &sc->sc_ucom;
|
struct ucom_softc *ucom = &sc->sc_ucom;
|
||||||
const char *devname,*modename;
|
const char *devname,*modename;
|
||||||
int ctl_notify;
|
int ctl_notify;
|
||||||
char *devinfo;
|
|
||||||
int i,err;
|
int i,err;
|
||||||
int elements;
|
int elements;
|
||||||
uByte *mode;
|
uByte *mode;
|
||||||
@ -328,12 +327,9 @@ USB_ATTACH(ufoma)
|
|||||||
sc->sc_ctl_iface_no = id->bInterfaceNumber;
|
sc->sc_ctl_iface_no = id->bInterfaceNumber;
|
||||||
|
|
||||||
devname = device_get_nameunit(self);
|
devname = device_get_nameunit(self);
|
||||||
devinfo = malloc(1024, M_USBDEV, M_WAITOK);
|
device_printf(self, "iclass %d/%d ifno:%d\n",
|
||||||
usbd_devinfo(dev, 0, devinfo);
|
|
||||||
printf("%s: %s, iclass %d/%d ifno:%d\n", devname, devinfo,
|
|
||||||
id->bInterfaceClass, id->bInterfaceSubClass, sc->sc_ctl_iface_no);
|
id->bInterfaceClass, id->bInterfaceSubClass, sc->sc_ctl_iface_no);
|
||||||
|
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
ctl_notify = -1;
|
ctl_notify = -1;
|
||||||
for (i = 0; i < id->bNumEndpoints; i++) {
|
for (i = 0; i < id->bNumEndpoints; i++) {
|
||||||
ed = usbd_interface2endpoint_descriptor(sc->sc_ctl_iface, i);
|
ed = usbd_interface2endpoint_descriptor(sc->sc_ctl_iface, i);
|
||||||
@ -413,14 +409,10 @@ USB_ATTACH(ufoma)
|
|||||||
SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "openmode",
|
SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "openmode",
|
||||||
CTLFLAG_RW|CTLTYPE_STRING, sc, 0, ufoma_sysctl_open,
|
CTLFLAG_RW|CTLTYPE_STRING, sc, 0, ufoma_sysctl_open,
|
||||||
"A", "Mode to transit when port is opened");
|
"A", "Mode to transit when port is opened");
|
||||||
|
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
free(devinfo, M_USBDEV);
|
if(sc->sc_modetable)
|
||||||
if(sc->sc_modetable){
|
|
||||||
free(sc->sc_modetable, M_USBDEV);
|
free(sc->sc_modetable, M_USBDEV);
|
||||||
}
|
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,14 +229,10 @@ ugen_attach(device_t self)
|
|||||||
struct ugen_softc *sc = device_get_softc(self);
|
struct ugen_softc *sc = device_get_softc(self);
|
||||||
struct usb_attach_arg *uaa = device_get_ivars(self);
|
struct usb_attach_arg *uaa = device_get_ivars(self);
|
||||||
usbd_device_handle udev;
|
usbd_device_handle udev;
|
||||||
char devinfo[1024];
|
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
int conf;
|
int conf;
|
||||||
|
|
||||||
usbd_devinfo(uaa->device, 0, devinfo);
|
|
||||||
sc->sc_dev = self;
|
sc->sc_dev = self;
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
|
|
||||||
sc->sc_udev = udev = uaa->device;
|
sc->sc_udev = udev = uaa->device;
|
||||||
|
|
||||||
memset(sc->sc_endpoints, 0, sizeof sc->sc_endpoints);
|
memset(sc->sc_endpoints, 0, sizeof sc->sc_endpoints);
|
||||||
|
@ -214,13 +214,11 @@ USB_ATTACH(uhid)
|
|||||||
void *desc;
|
void *desc;
|
||||||
const void *descptr;
|
const void *descptr;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
char devinfo[1024];
|
|
||||||
|
|
||||||
|
sc->sc_dev = self;
|
||||||
sc->sc_udev = uaa->device;
|
sc->sc_udev = uaa->device;
|
||||||
sc->sc_iface = iface;
|
sc->sc_iface = iface;
|
||||||
id = usbd_get_interface_descriptor(iface);
|
id = usbd_get_interface_descriptor(iface);
|
||||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
|
||||||
USB_ATTACH_SETUP;
|
|
||||||
|
|
||||||
ed = usbd_interface2endpoint_descriptor(iface, 0);
|
ed = usbd_interface2endpoint_descriptor(iface, 0);
|
||||||
if (ed == NULL) {
|
if (ed == NULL) {
|
||||||
|
@ -102,6 +102,7 @@ static bus_child_pnpinfo_str_t uhub_child_pnpinfo_str;
|
|||||||
* Every other driver only connects to hubs
|
* Every other driver only connects to hubs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* XXX driver_added needs special care */
|
||||||
USB_DECLARE_DRIVER_INIT(uhub,
|
USB_DECLARE_DRIVER_INIT(uhub,
|
||||||
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str),
|
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str),
|
||||||
DEVMETHOD(bus_child_location_str, uhub_child_location_str),
|
DEVMETHOD(bus_child_location_str, uhub_child_location_str),
|
||||||
@ -114,6 +115,7 @@ USB_DECLARE_DRIVER_INIT(uhub,
|
|||||||
/* Create the driver instance for the hub connected to usb case. */
|
/* Create the driver instance for the hub connected to usb case. */
|
||||||
devclass_t uhubroot_devclass;
|
devclass_t uhubroot_devclass;
|
||||||
|
|
||||||
|
/* XXX driver_added needs special care */
|
||||||
static device_method_t uhubroot_methods[] = {
|
static device_method_t uhubroot_methods[] = {
|
||||||
DEVMETHOD(bus_child_location_str, uhub_child_location_str),
|
DEVMETHOD(bus_child_location_str, uhub_child_location_str),
|
||||||
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str),
|
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str),
|
||||||
@ -155,7 +157,6 @@ uhub_attach(device_t self)
|
|||||||
struct uhub_softc *sc = device_get_softc(self);
|
struct uhub_softc *sc = device_get_softc(self);
|
||||||
struct usb_attach_arg *uaa = device_get_ivars(self);
|
struct usb_attach_arg *uaa = device_get_ivars(self);
|
||||||
usbd_device_handle dev = uaa->device;
|
usbd_device_handle dev = uaa->device;
|
||||||
char *devinfo;
|
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
struct usbd_hub *hub = NULL;
|
struct usbd_hub *hub = NULL;
|
||||||
usb_device_request_t req;
|
usb_device_request_t req;
|
||||||
@ -165,15 +166,9 @@ uhub_attach(device_t self)
|
|||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
struct usbd_tt *tts = NULL;
|
struct usbd_tt *tts = NULL;
|
||||||
|
|
||||||
devinfo = malloc(1024, M_TEMP, M_NOWAIT);
|
|
||||||
if (devinfo == NULL)
|
|
||||||
return (ENXIO);
|
|
||||||
DPRINTFN(1,("uhub_attach\n"));
|
DPRINTFN(1,("uhub_attach\n"));
|
||||||
sc->sc_hub = dev;
|
sc->sc_hub = dev;
|
||||||
usbd_devinfo(dev, 1, devinfo);
|
|
||||||
sc->sc_dev = self;
|
sc->sc_dev = self;
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
free(devinfo, M_TEMP);
|
|
||||||
|
|
||||||
if (dev->depth > 0 && UHUB_IS_HIGH_SPEED(sc)) {
|
if (dev->depth > 0 && UHUB_IS_HIGH_SPEED(sc)) {
|
||||||
device_printf(sc->sc_dev, "%s transaction translator%s\n",
|
device_printf(sc->sc_dev, "%s transaction translator%s\n",
|
||||||
|
@ -152,7 +152,6 @@ uipaq_attach(device_t self)
|
|||||||
usbd_interface_handle iface;
|
usbd_interface_handle iface;
|
||||||
usb_interface_descriptor_t *id;
|
usb_interface_descriptor_t *id;
|
||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
char *devinfop;
|
|
||||||
int i;
|
int i;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
struct ucom_softc *ucom = &sc->sc_ucom;
|
struct ucom_softc *ucom = &sc->sc_ucom;
|
||||||
@ -177,17 +176,6 @@ uipaq_attach(device_t self)
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
devinfop = malloc (1024, M_USBDEV, M_WAITOK);
|
|
||||||
if (devinfop == NULL) {
|
|
||||||
err = ENOMEM;
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
usbd_devinfo(dev, 0, devinfop);
|
|
||||||
ucom->sc_dev = self;
|
|
||||||
device_set_desc_copy(self, devinfop);
|
|
||||||
device_printf(ucom->sc_dev, "%s\n", devinfop);
|
|
||||||
free(devinfop, M_USBDEV);
|
|
||||||
|
|
||||||
sc->sc_flags = uipaq_lookup(uaa->vendor, uaa->product)->uv_flags;
|
sc->sc_flags = uipaq_lookup(uaa->vendor, uaa->product)->uv_flags;
|
||||||
id = usbd_get_interface_descriptor(iface);
|
id = usbd_get_interface_descriptor(iface);
|
||||||
ucom->sc_iface = iface;
|
ucom->sc_iface = iface;
|
||||||
|
@ -154,20 +154,18 @@ USB_ATTACH(ukbd)
|
|||||||
USB_ATTACH_START(ukbd, sc, uaa);
|
USB_ATTACH_START(ukbd, sc, uaa);
|
||||||
usbd_interface_handle iface = uaa->iface;
|
usbd_interface_handle iface = uaa->iface;
|
||||||
usb_interface_descriptor_t *id;
|
usb_interface_descriptor_t *id;
|
||||||
char devinfo[1024];
|
|
||||||
|
|
||||||
keyboard_switch_t *sw;
|
keyboard_switch_t *sw;
|
||||||
keyboard_t *kbd;
|
keyboard_t *kbd;
|
||||||
void *arg[2];
|
void *arg[2];
|
||||||
int unit = device_get_unit(self);
|
int unit = device_get_unit(self);
|
||||||
|
|
||||||
|
sc->sc_dev = self;
|
||||||
sw = kbd_get_switch(DRIVER_NAME);
|
sw = kbd_get_switch(DRIVER_NAME);
|
||||||
if (sw == NULL)
|
if (sw == NULL)
|
||||||
USB_ATTACH_ERROR_RETURN;
|
USB_ATTACH_ERROR_RETURN;
|
||||||
|
|
||||||
id = usbd_get_interface_descriptor(iface);
|
id = usbd_get_interface_descriptor(iface);
|
||||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
|
||||||
USB_ATTACH_SETUP;
|
|
||||||
|
|
||||||
arg[0] = (void *)uaa;
|
arg[0] = (void *)uaa;
|
||||||
arg[1] = (void *)ukbd_intr;
|
arg[1] = (void *)ukbd_intr;
|
||||||
|
@ -49,14 +49,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
||||||
#include <sys/device.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
#include <sys/ioccom.h>
|
#include <sys/ioccom.h>
|
||||||
#include <sys/module.h>
|
#include <sys/module.h>
|
||||||
#include <sys/bus.h>
|
#include <sys/bus.h>
|
||||||
#endif
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/conf.h>
|
#include <sys/conf.h>
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
@ -129,26 +124,10 @@ struct ulpt_softc {
|
|||||||
int sc_refcnt;
|
int sc_refcnt;
|
||||||
u_char sc_dying;
|
u_char sc_dying;
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
struct cdev *dev;
|
struct cdev *dev;
|
||||||
struct cdev *dev_noprime;
|
struct cdev *dev_noprime;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
|
||||||
dev_type_open(ulptopen);
|
|
||||||
dev_type_close(ulptclose);
|
|
||||||
dev_type_write(ulptwrite);
|
|
||||||
dev_type_read(ulptread);
|
|
||||||
dev_type_ioctl(ulptioctl);
|
|
||||||
|
|
||||||
const struct cdevsw ulpt_cdevsw = {
|
|
||||||
ulptopen, ulptclose, ulptread, ulptwrite, ulptioctl,
|
|
||||||
nostop, notty, nopoll, nommap, nokqfilter,
|
|
||||||
};
|
|
||||||
#elif defined(__OpenBSD__)
|
|
||||||
cdev_decl(ulpt);
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
static d_open_t ulptopen;
|
static d_open_t ulptopen;
|
||||||
static d_close_t ulptclose;
|
static d_close_t ulptclose;
|
||||||
static d_write_t ulptwrite;
|
static d_write_t ulptwrite;
|
||||||
@ -166,7 +145,6 @@ static struct cdevsw ulpt_cdevsw = {
|
|||||||
.d_ioctl = ulptioctl,
|
.d_ioctl = ulptioctl,
|
||||||
.d_name = "ulpt",
|
.d_name = "ulpt",
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
void ulpt_disco(void *);
|
void ulpt_disco(void *);
|
||||||
|
|
||||||
@ -217,14 +195,12 @@ USB_ATTACH(ulpt)
|
|||||||
usb_interface_descriptor_t *id, *iend;
|
usb_interface_descriptor_t *id, *iend;
|
||||||
usb_config_descriptor_t *cdesc;
|
usb_config_descriptor_t *cdesc;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
char devinfo[1024];
|
|
||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
u_int8_t epcount;
|
u_int8_t epcount;
|
||||||
int i, altno;
|
int i, altno;
|
||||||
|
|
||||||
DPRINTFN(10,("ulpt_attach: sc=%p\n", sc));
|
DPRINTFN(10,("ulpt_attach: sc=%p\n", sc));
|
||||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
sc->sc_dev = self;
|
||||||
USB_ATTACH_SETUP;
|
|
||||||
|
|
||||||
/* XXX
|
/* XXX
|
||||||
* Stepping through the alternate settings needs to be abstracted out.
|
* Stepping through the alternate settings needs to be abstracted out.
|
||||||
@ -347,13 +323,11 @@ USB_ATTACH(ulpt)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
sc->dev = make_dev(&ulpt_cdevsw, device_get_unit(self),
|
sc->dev = make_dev(&ulpt_cdevsw, device_get_unit(self),
|
||||||
UID_ROOT, GID_OPERATOR, 0644, "ulpt%d", device_get_unit(self));
|
UID_ROOT, GID_OPERATOR, 0644, "ulpt%d", device_get_unit(self));
|
||||||
sc->dev_noprime = make_dev(&ulpt_cdevsw,
|
sc->dev_noprime = make_dev(&ulpt_cdevsw,
|
||||||
device_get_unit(self)|ULPT_NOPRIME,
|
device_get_unit(self)|ULPT_NOPRIME,
|
||||||
UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self));
|
UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self));
|
||||||
#endif
|
|
||||||
|
|
||||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
|
||||||
USBDEV(sc->sc_dev));
|
USBDEV(sc->sc_dev));
|
||||||
@ -361,37 +335,13 @@ USB_ATTACH(ulpt)
|
|||||||
USB_ATTACH_SUCCESS_RETURN;
|
USB_ATTACH_SUCCESS_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
||||||
int
|
|
||||||
ulpt_activate(device_t self, enum devact act)
|
|
||||||
{
|
|
||||||
struct ulpt_softc *sc = (struct ulpt_softc *)self;
|
|
||||||
|
|
||||||
switch (act) {
|
|
||||||
case DVACT_ACTIVATE:
|
|
||||||
return (EOPNOTSUPP);
|
|
||||||
|
|
||||||
case DVACT_DEACTIVATE:
|
|
||||||
sc->sc_dying = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
USB_DETACH(ulpt)
|
USB_DETACH(ulpt)
|
||||||
{
|
{
|
||||||
USB_DETACH_START(ulpt, sc);
|
USB_DETACH_START(ulpt, sc);
|
||||||
int s;
|
int s;
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
||||||
int maj, mn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
||||||
DPRINTF(("ulpt_detach: sc=%p flags=%d\n", sc, flags));
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
DPRINTF(("ulpt_detach: sc=%p\n", sc));
|
DPRINTF(("ulpt_detach: sc=%p\n", sc));
|
||||||
#endif
|
|
||||||
|
|
||||||
sc->sc_dying = 1;
|
sc->sc_dying = 1;
|
||||||
if (sc->sc_out_pipe != NULL)
|
if (sc->sc_out_pipe != NULL)
|
||||||
@ -407,23 +357,8 @@ USB_DETACH(ulpt)
|
|||||||
}
|
}
|
||||||
splx(s);
|
splx(s);
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
||||||
/* locate the major number */
|
|
||||||
#if defined(__NetBSD__)
|
|
||||||
maj = cdevsw_lookup_major(&ulpt_cdevsw);
|
|
||||||
#elif defined(__OpenBSD__)
|
|
||||||
for (maj = 0; maj < nchrdev; maj++)
|
|
||||||
if (cdevsw[maj].d_open == ulptopen)
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Nuke the vnodes for any open instances (calls close). */
|
|
||||||
mn = self->dv_unit;
|
|
||||||
vdevgone(maj, mn, mn, VCHR);
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
destroy_dev(sc->dev);
|
destroy_dev(sc->dev);
|
||||||
destroy_dev(sc->dev_noprime);
|
destroy_dev(sc->dev_noprime);
|
||||||
#endif
|
|
||||||
|
|
||||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
|
||||||
USBDEV(sc->sc_dev));
|
USBDEV(sc->sc_dev));
|
||||||
@ -520,7 +455,7 @@ ulptopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p)
|
|||||||
sc->sc_flags = flags;
|
sc->sc_flags = flags;
|
||||||
DPRINTF(("ulptopen: flags=0x%x\n", (unsigned)flags));
|
DPRINTF(("ulptopen: flags=0x%x\n", (unsigned)flags));
|
||||||
|
|
||||||
#if defined(USB_DEBUG) && defined(__FreeBSD__)
|
#if defined(USB_DEBUG)
|
||||||
/* Ignoring these flags might not be a good idea */
|
/* Ignoring these flags might not be a good idea */
|
||||||
if ((flags & ~ULPT_NOPRIME) != 0)
|
if ((flags & ~ULPT_NOPRIME) != 0)
|
||||||
printf("ulptopen: flags ignored: %b\n", flags,
|
printf("ulptopen: flags ignored: %b\n", flags,
|
||||||
@ -851,6 +786,4 @@ ieee1284_print_id(char *str)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, usbd_driver_load, 0);
|
DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, usbd_driver_load, 0);
|
||||||
#endif
|
|
||||||
|
@ -164,26 +164,17 @@ USB_ATTACH(umct)
|
|||||||
usb_config_descriptor_t *cdesc;
|
usb_config_descriptor_t *cdesc;
|
||||||
usb_interface_descriptor_t *id;
|
usb_interface_descriptor_t *id;
|
||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
char *devinfo;
|
|
||||||
const char *devname;
|
const char *devname;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dev = uaa->device;
|
dev = uaa->device;
|
||||||
devinfo = malloc(1024, M_USBDEV, M_NOWAIT | M_ZERO);
|
|
||||||
if (devinfo == NULL)
|
|
||||||
return (ENOMEM);
|
|
||||||
bzero(sc, sizeof(struct umct_softc));
|
bzero(sc, sizeof(struct umct_softc));
|
||||||
ucom = &sc->sc_ucom;
|
ucom = &sc->sc_ucom;
|
||||||
ucom->sc_dev = self;
|
ucom->sc_dev = self;
|
||||||
ucom->sc_udev = dev;
|
ucom->sc_udev = dev;
|
||||||
ucom->sc_iface = uaa->iface;
|
ucom->sc_iface = uaa->iface;
|
||||||
|
|
||||||
usbd_devinfo(dev, 0, devinfo);
|
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
devname = device_get_nameunit(ucom->sc_dev);
|
|
||||||
printf("%s: %s\n", devname, devinfo);
|
|
||||||
|
|
||||||
ucom->sc_bulkout_no = -1;
|
ucom->sc_bulkout_no = -1;
|
||||||
ucom->sc_bulkin_no = -1;
|
ucom->sc_bulkin_no = -1;
|
||||||
sc->sc_intr_number = -1;
|
sc->sc_intr_number = -1;
|
||||||
@ -274,12 +265,9 @@ USB_ATTACH(umct)
|
|||||||
ucom->sc_callback = &umct_callback;
|
ucom->sc_callback = &umct_callback;
|
||||||
ucom_attach(ucom);
|
ucom_attach(ucom);
|
||||||
TASK_INIT(&sc->sc_task, 0, umct_notify, sc);
|
TASK_INIT(&sc->sc_task, 0, umct_notify, sc);
|
||||||
|
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
USB_ATTACH_SUCCESS_RETURN;
|
USB_ATTACH_SUCCESS_RETURN;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
USB_ATTACH_ERROR_RETURN;
|
USB_ATTACH_ERROR_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,6 @@ USB_ATTACH(ums)
|
|||||||
int size;
|
int size;
|
||||||
void *desc;
|
void *desc;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
char devinfo[1024];
|
|
||||||
u_int32_t flags;
|
u_int32_t flags;
|
||||||
int i;
|
int i;
|
||||||
struct hid_location loc_btn;
|
struct hid_location loc_btn;
|
||||||
@ -204,8 +203,7 @@ USB_ATTACH(ums)
|
|||||||
sc->sc_disconnected = 1;
|
sc->sc_disconnected = 1;
|
||||||
sc->sc_iface = iface;
|
sc->sc_iface = iface;
|
||||||
id = usbd_get_interface_descriptor(iface);
|
id = usbd_get_interface_descriptor(iface);
|
||||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
sc->sc_dev = self;
|
||||||
USB_ATTACH_SETUP;
|
|
||||||
ed = usbd_interface2endpoint_descriptor(iface, 0);
|
ed = usbd_interface2endpoint_descriptor(iface, 0);
|
||||||
if (!ed) {
|
if (!ed) {
|
||||||
printf("%s: could not read endpoint descriptor\n",
|
printf("%s: could not read endpoint descriptor\n",
|
||||||
|
@ -345,27 +345,16 @@ USB_ATTACH(uplcom)
|
|||||||
usb_config_descriptor_t *cdesc;
|
usb_config_descriptor_t *cdesc;
|
||||||
usb_interface_descriptor_t *id;
|
usb_interface_descriptor_t *id;
|
||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
char *devinfo;
|
|
||||||
const char *devname;
|
const char *devname;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
devinfo = malloc(1024, M_USBDEV, M_WAITOK);
|
|
||||||
ucom = &sc->sc_ucom;
|
ucom = &sc->sc_ucom;
|
||||||
|
|
||||||
bzero(sc, sizeof (struct uplcom_softc));
|
|
||||||
|
|
||||||
usbd_devinfo(dev, 0, devinfo);
|
|
||||||
/* USB_ATTACH_SETUP; */
|
|
||||||
ucom->sc_dev = self;
|
ucom->sc_dev = self;
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
/* USB_ATTACH_SETUP; */
|
|
||||||
|
|
||||||
ucom->sc_udev = dev;
|
ucom->sc_udev = dev;
|
||||||
ucom->sc_iface = uaa->iface;
|
ucom->sc_iface = uaa->iface;
|
||||||
|
|
||||||
devname = device_get_nameunit(ucom->sc_dev);
|
devname = device_get_nameunit(ucom->sc_dev);
|
||||||
printf("%s: %s\n", devname, devinfo);
|
|
||||||
|
|
||||||
DPRINTF(("uplcom attach: sc = %p\n", sc));
|
DPRINTF(("uplcom attach: sc = %p\n", sc));
|
||||||
|
|
||||||
@ -549,12 +538,9 @@ USB_ATTACH(uplcom)
|
|||||||
|
|
||||||
TASK_INIT(&sc->sc_task, 0, uplcom_notify, sc);
|
TASK_INIT(&sc->sc_task, 0, uplcom_notify, sc);
|
||||||
ucom_attach(&sc->sc_ucom);
|
ucom_attach(&sc->sc_ucom);
|
||||||
|
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
USB_ATTACH_SUCCESS_RETURN;
|
USB_ATTACH_SUCCESS_RETURN;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
USB_ATTACH_ERROR_RETURN;
|
USB_ATTACH_ERROR_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,6 @@ USB_MATCH(urio)
|
|||||||
USB_ATTACH(urio)
|
USB_ATTACH(urio)
|
||||||
{
|
{
|
||||||
USB_ATTACH_START(urio, sc, uaa);
|
USB_ATTACH_START(urio, sc, uaa);
|
||||||
char devinfo[1024];
|
|
||||||
usbd_device_handle udev;
|
usbd_device_handle udev;
|
||||||
usbd_interface_handle iface;
|
usbd_interface_handle iface;
|
||||||
u_int8_t epcount;
|
u_int8_t epcount;
|
||||||
@ -191,9 +190,7 @@ USB_ATTACH(urio)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
DPRINTFN(10,("urio_attach: sc=%p\n", sc));
|
DPRINTFN(10,("urio_attach: sc=%p\n", sc));
|
||||||
usbd_devinfo(uaa->device, 0, devinfo);
|
sc->sc_dev = self;
|
||||||
USB_ATTACH_SETUP;
|
|
||||||
|
|
||||||
sc->sc_udev = udev = uaa->device;
|
sc->sc_udev = udev = uaa->device;
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
|
@ -316,15 +316,11 @@ USB_ATTACH(uscanner)
|
|||||||
USB_ATTACH_START(uscanner, sc, uaa);
|
USB_ATTACH_START(uscanner, sc, uaa);
|
||||||
usb_interface_descriptor_t *id = 0;
|
usb_interface_descriptor_t *id = 0;
|
||||||
usb_endpoint_descriptor_t *ed, *ed_bulkin = NULL, *ed_bulkout = NULL;
|
usb_endpoint_descriptor_t *ed, *ed_bulkin = NULL, *ed_bulkout = NULL;
|
||||||
char devinfo[1024];
|
|
||||||
int i;
|
int i;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
|
|
||||||
usbd_devinfo(uaa->device, 0, devinfo);
|
sc->sc_dev = self;
|
||||||
USB_ATTACH_SETUP;
|
|
||||||
|
|
||||||
sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags;
|
sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags;
|
||||||
|
|
||||||
sc->sc_udev = uaa->device;
|
sc->sc_udev = uaa->device;
|
||||||
|
|
||||||
err = usbd_set_config_no(uaa->device, 1, 1); /* XXX */
|
err = usbd_set_config_no(uaa->device, 1, 1); /* XXX */
|
||||||
|
@ -269,25 +269,17 @@ USB_ATTACH(uvisor)
|
|||||||
usbd_interface_handle iface;
|
usbd_interface_handle iface;
|
||||||
usb_interface_descriptor_t *id;
|
usb_interface_descriptor_t *id;
|
||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
char *devinfo;
|
|
||||||
const char *devname;
|
const char *devname;
|
||||||
int i;
|
int i;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
struct ucom_softc *ucom;
|
struct ucom_softc *ucom;
|
||||||
|
|
||||||
devinfo = malloc(1024, M_USBDEV, M_WAITOK);
|
|
||||||
ucom = &sc->sc_ucom;
|
ucom = &sc->sc_ucom;
|
||||||
bzero(sc, sizeof (struct uvisor_softc));
|
|
||||||
usbd_devinfo(dev, 0, devinfo);
|
|
||||||
ucom->sc_dev = self;
|
ucom->sc_dev = self;
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
|
|
||||||
ucom->sc_udev = dev;
|
ucom->sc_udev = dev;
|
||||||
ucom->sc_iface = uaa->iface;
|
ucom->sc_iface = uaa->iface;
|
||||||
|
|
||||||
devname = device_get_nameunit(ucom->sc_dev);
|
devname = device_get_nameunit(ucom->sc_dev);
|
||||||
printf("%s: %s\n", devname, devinfo);
|
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
|
|
||||||
DPRINTFN(10,("\nuvisor_attach: sc=%p\n", sc));
|
DPRINTFN(10,("\nuvisor_attach: sc=%p\n", sc));
|
||||||
|
|
||||||
@ -306,8 +298,6 @@ USB_ATTACH(uvisor)
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: %s\n", devname, devinfo);
|
|
||||||
|
|
||||||
sc->sc_flags = uvisor_lookup(uaa->vendor, uaa->product)->uv_flags;
|
sc->sc_flags = uvisor_lookup(uaa->vendor, uaa->product)->uv_flags;
|
||||||
|
|
||||||
id = usbd_get_interface_descriptor(iface);
|
id = usbd_get_interface_descriptor(iface);
|
||||||
|
@ -318,27 +318,16 @@ USB_ATTACH(uvscom)
|
|||||||
usb_config_descriptor_t *cdesc;
|
usb_config_descriptor_t *cdesc;
|
||||||
usb_interface_descriptor_t *id;
|
usb_interface_descriptor_t *id;
|
||||||
usb_endpoint_descriptor_t *ed;
|
usb_endpoint_descriptor_t *ed;
|
||||||
char *devinfo;
|
|
||||||
const char *devname;
|
const char *devname;
|
||||||
usbd_status err;
|
usbd_status err;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
devinfo = malloc(1024, M_USBDEV, M_WAITOK);
|
|
||||||
ucom = &sc->sc_ucom;
|
ucom = &sc->sc_ucom;
|
||||||
|
|
||||||
bzero(sc, sizeof (struct uvscom_softc));
|
|
||||||
|
|
||||||
usbd_devinfo(dev, 0, devinfo);
|
|
||||||
/* USB_ATTACH_SETUP; */
|
|
||||||
ucom->sc_dev = self;
|
ucom->sc_dev = self;
|
||||||
device_set_desc_copy(self, devinfo);
|
|
||||||
/* USB_ATTACH_SETUP; */
|
|
||||||
|
|
||||||
ucom->sc_udev = dev;
|
ucom->sc_udev = dev;
|
||||||
ucom->sc_iface = uaa->iface;
|
ucom->sc_iface = uaa->iface;
|
||||||
|
|
||||||
devname = device_get_nameunit(ucom->sc_dev);
|
devname = device_get_nameunit(ucom->sc_dev);
|
||||||
printf("%s: %s\n", devname, devinfo);
|
|
||||||
|
|
||||||
DPRINTF(("uvscom attach: sc = %p\n", sc));
|
DPRINTF(("uvscom attach: sc = %p\n", sc));
|
||||||
|
|
||||||
@ -439,13 +428,10 @@ USB_ATTACH(uvscom)
|
|||||||
|
|
||||||
TASK_INIT(&sc->sc_task, 0, uvscom_notify, sc);
|
TASK_INIT(&sc->sc_task, 0, uvscom_notify, sc);
|
||||||
ucom_attach(&sc->sc_ucom);
|
ucom_attach(&sc->sc_ucom);
|
||||||
|
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
USB_ATTACH_SUCCESS_RETURN;
|
USB_ATTACH_SUCCESS_RETURN;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ucom->sc_dying = 1;
|
ucom->sc_dying = 1;
|
||||||
free(devinfo, M_USBDEV);
|
|
||||||
USB_ATTACH_ERROR_RETURN;
|
USB_ATTACH_ERROR_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user