Tweak the compatibility macros a little so that the device printing is
moved into them.
This commit is contained in:
parent
7a3bb5bd7e
commit
0c243144c1
@ -257,7 +257,6 @@ USB_ATTACH(ubser)
|
||||
devinfo = malloc(1024, M_USBDEV, M_WAITOK);
|
||||
usbd_devinfo(udev, 0, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
DPRINTFN(10,("\nubser_attach: sc=%p\n", sc));
|
||||
|
||||
|
@ -267,10 +267,8 @@ USB_ATTACH(udbp)
|
||||
/* fetch the interface handle for the first interface */
|
||||
(void) usbd_device2interface_handle(uaa->device, 0, &iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev),
|
||||
devinfo, id->bInterfaceClass, id->bInterfaceSubClass);
|
||||
|
||||
/* Find the two first bulk endpoints */
|
||||
for (i = 0 ; i < id->bNumEndpoints; i++) {
|
||||
|
@ -160,7 +160,6 @@ USB_ATTACH(ufm)
|
||||
DPRINTFN(10,("ufm_attach: sc=%p\n", sc));
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
sc->sc_udev = udev = uaa->device;
|
||||
|
||||
|
@ -215,7 +215,6 @@ USB_ATTACH(ugen)
|
||||
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
sc->sc_udev = udev = uaa->device;
|
||||
|
||||
|
@ -210,10 +210,8 @@ USB_ATTACH(uhid)
|
||||
sc->sc_udev = uaa->device;
|
||||
sc->sc_iface = iface;
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev),
|
||||
devinfo, id->bInterfaceClass, id->bInterfaceSubClass);
|
||||
|
||||
ed = usbd_interface2endpoint_descriptor(iface, 0);
|
||||
if (ed == NULL) {
|
||||
|
@ -180,7 +180,6 @@ USB_ATTACH(uhub)
|
||||
sc->sc_hub = dev;
|
||||
usbd_devinfo(dev, 1, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
err = usbd_set_config_index(dev, 0, 1);
|
||||
if (err) {
|
||||
|
@ -171,10 +171,8 @@ USB_ATTACH(ukbd)
|
||||
USB_ATTACH_ERROR_RETURN;
|
||||
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev),
|
||||
devinfo, id->bInterfaceClass, id->bInterfaceSubClass);
|
||||
|
||||
arg[0] = (void *)uaa;
|
||||
arg[1] = (void *)ukbd_intr;
|
||||
|
@ -226,10 +226,8 @@ USB_ATTACH(ulpt)
|
||||
int i, altno;
|
||||
|
||||
DPRINTFN(10,("ulpt_attach: sc=%p\n", sc));
|
||||
usbd_devinfo(dev, 0, devinfo);
|
||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev),
|
||||
devinfo, ifcd->bInterfaceClass, ifcd->bInterfaceSubClass);
|
||||
|
||||
/* XXX
|
||||
* Stepping through the alternate settings needs to be abstracted out.
|
||||
|
@ -875,7 +875,6 @@ USB_ATTACH(umass)
|
||||
(void) umass_match_proto(sc, sc->iface, uaa->device);
|
||||
|
||||
id = usbd_get_interface_descriptor(sc->iface);
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
#ifdef USB_DEBUG
|
||||
printf("%s: ", USBDEVNAME(sc->sc_dev));
|
||||
switch (sc->proto&UMASS_PROTO_COMMAND) {
|
||||
|
@ -214,10 +214,8 @@ USB_ATTACH(ums)
|
||||
sc->sc_disconnected = 1;
|
||||
sc->sc_iface = iface;
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
usbd_devinfo(uaa->device, USBD_SHOW_INTERFACE_CLASS, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s, iclass %d/%d\n", USBDEVNAME(sc->sc_dev),
|
||||
devinfo, id->bInterfaceClass, id->bInterfaceSubClass);
|
||||
ed = usbd_interface2endpoint_descriptor(iface, 0);
|
||||
if (!ed) {
|
||||
printf("%s: could not read endpoint descriptor\n",
|
||||
|
@ -200,7 +200,6 @@ USB_ATTACH(urio)
|
||||
DPRINTFN(10,("urio_attach: sc=%p\n", sc));
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
sc->sc_udev = udev = uaa->device;
|
||||
|
||||
|
@ -134,7 +134,8 @@ void __CONCAT(dname,_attach)(struct device *parent, struct device *self, void *a
|
||||
#define USB_ATTACH_ERROR_RETURN return
|
||||
#define USB_ATTACH_SUCCESS_RETURN return
|
||||
|
||||
#define USB_ATTACH_SETUP printf("\n")
|
||||
#define USB_ATTACH_SETUP
|
||||
printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
#define USB_DETACH(dname) \
|
||||
int __CONCAT(dname,_detach)(struct device *self, int flags)
|
||||
@ -301,7 +302,8 @@ __CONCAT(dname,_attach)(parent, self, aux) \
|
||||
#define USB_ATTACH_ERROR_RETURN return
|
||||
#define USB_ATTACH_SUCCESS_RETURN return
|
||||
|
||||
#define USB_ATTACH_SETUP printf("\n")
|
||||
#define USB_ATTACH_SETUP
|
||||
printf("\n%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
#define USB_DETACH(dname) \
|
||||
int \
|
||||
@ -474,8 +476,11 @@ __CONCAT(dname,_attach)(device_t self)
|
||||
#define USB_ATTACH_SUCCESS_RETURN return 0
|
||||
|
||||
#define USB_ATTACH_SETUP \
|
||||
sc->sc_dev = self; \
|
||||
device_set_desc_copy(self, devinfo)
|
||||
do { \
|
||||
sc->sc_dev = self; \
|
||||
device_set_desc_copy(self, devinfo); \
|
||||
device_printf(self, "%s\n", devinfo); \
|
||||
} while (0);
|
||||
|
||||
#define USB_DETACH(dname) \
|
||||
Static int \
|
||||
|
@ -321,15 +321,17 @@ void
|
||||
usbd_devinfo(usbd_device_handle dev, int showclass, char *cp)
|
||||
{
|
||||
usb_device_descriptor_t *udd = &dev->ddesc;
|
||||
usbd_interface_handle iface;
|
||||
char vendor[USB_MAX_STRING_LEN];
|
||||
char product[USB_MAX_STRING_LEN];
|
||||
int bcdDevice, bcdUSB;
|
||||
usb_interface_descriptor_t *id;
|
||||
|
||||
usbd_devinfo_vp(dev, vendor, product, 1);
|
||||
cp += sprintf(cp, "%s %s", vendor, product);
|
||||
if (showclass)
|
||||
if (showclass & USBD_SHOW_DEVICE_CLASS)
|
||||
cp += sprintf(cp, ", class %d/%d",
|
||||
udd->bDeviceClass, udd->bDeviceSubClass);
|
||||
udd->bDeviceClass, udd->bDeviceSubClass);
|
||||
bcdUSB = UGETW(udd->bcdUSB);
|
||||
bcdDevice = UGETW(udd->bcdDevice);
|
||||
cp += sprintf(cp, ", rev ");
|
||||
@ -337,6 +339,14 @@ usbd_devinfo(usbd_device_handle dev, int showclass, char *cp)
|
||||
*cp++ = '/';
|
||||
cp += usbd_printBCD(cp, bcdDevice);
|
||||
cp += sprintf(cp, ", addr %d", dev->address);
|
||||
if (showclass & USBD_SHOW_INTERFACE_CLASS)
|
||||
{
|
||||
/* fetch the interface handle for the first interface */
|
||||
(void)usbd_device2interface_handle(dev, 0, &iface);
|
||||
id = usbd_get_interface_descriptor(iface);
|
||||
cp += sprintf(cp, ", iclass %d/%d",
|
||||
id->bInterfaceClass, id->bInterfaceSubClass);
|
||||
}
|
||||
*cp = 0;
|
||||
}
|
||||
|
||||
|
@ -263,6 +263,9 @@ struct usb_attach_arg {
|
||||
|
||||
#endif
|
||||
|
||||
#define USBD_SHOW_DEVICE_CLASS 0x1
|
||||
#define USBD_SHOW_INTERFACE_CLASS 0x2
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
int usbd_driver_load(module_t mod, int what, void *arg);
|
||||
#endif
|
||||
|
@ -313,7 +313,6 @@ USB_ATTACH(uscanner)
|
||||
|
||||
usbd_devinfo(uaa->device, 0, devinfo);
|
||||
USB_ATTACH_SETUP;
|
||||
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
|
||||
|
||||
sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user