mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Add possibility to generate devctl notifications regardless of UGEN presence.
Submitted by: Nick Hibma Approved by: thompsa (mentor)
This commit is contained in:
parent
8d5f71818f
commit
8bb77249db
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214221
@ -98,8 +98,10 @@ static void usb_suspend_resume_sub(struct usb_device *, device_t,
|
||||
static void usbd_clear_stall_proc(struct usb_proc_msg *_pm);
|
||||
static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t);
|
||||
static void usbd_set_device_strings(struct usb_device *);
|
||||
#if USB_HAVE_UGEN
|
||||
#if USB_HAVE_DEVCTL
|
||||
static void usb_notify_addq(const char *type, struct usb_device *);
|
||||
#endif
|
||||
#if USB_HAVE_UGEN
|
||||
static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t);
|
||||
static struct cdev *usb_make_dev(struct usb_device *, int, int);
|
||||
static void usb_cdev_create(struct usb_device *);
|
||||
@ -1858,7 +1860,9 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus,
|
||||
printf("%s: <%s> at %s\n", udev->ugen_name,
|
||||
usb_get_manufacturer(udev),
|
||||
device_get_nameunit(udev->bus->bdev));
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_DEVCTL
|
||||
usb_notify_addq("ATTACH", udev);
|
||||
#endif
|
||||
done:
|
||||
@ -2004,9 +2008,11 @@ usb_free_device(struct usb_device *udev, uint8_t flag)
|
||||
bus = udev->bus;
|
||||
usb_set_device_state(udev, USB_STATE_DETACHED);
|
||||
|
||||
#if USB_HAVE_UGEN
|
||||
#if USB_HAVE_DEVCTL
|
||||
usb_notify_addq("DETACH", udev);
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_UGEN
|
||||
printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name,
|
||||
usb_get_manufacturer(udev), device_get_nameunit(bus->bdev));
|
||||
|
||||
@ -2373,7 +2379,7 @@ usbd_get_device_index(struct usb_device *udev)
|
||||
return (udev->device_index);
|
||||
}
|
||||
|
||||
#if USB_HAVE_UGEN
|
||||
#if USB_HAVE_DEVCTL
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb_notify_addq
|
||||
*
|
||||
@ -2409,7 +2415,9 @@ usb_notify_addq_compat(const char *type, struct usb_device *udev)
|
||||
/* String it all together. */
|
||||
snprintf(data, buf_size,
|
||||
"%s"
|
||||
#if USB_HAVE_UGEN
|
||||
"%s "
|
||||
#endif
|
||||
"vendor=0x%04x "
|
||||
"product=0x%04x "
|
||||
"devclass=0x%02x "
|
||||
@ -2418,20 +2426,27 @@ usb_notify_addq_compat(const char *type, struct usb_device *udev)
|
||||
"release=0x%04x "
|
||||
"at "
|
||||
"port=%u "
|
||||
"on "
|
||||
"%s\n",
|
||||
#if USB_HAVE_UGEN
|
||||
"on %s\n"
|
||||
#endif
|
||||
"",
|
||||
ntype,
|
||||
#if USB_HAVE_UGEN
|
||||
udev->ugen_name,
|
||||
#endif
|
||||
UGETW(udev->ddesc.idVendor),
|
||||
UGETW(udev->ddesc.idProduct),
|
||||
udev->ddesc.bDeviceClass,
|
||||
udev->ddesc.bDeviceSubClass,
|
||||
usb_get_serial(udev),
|
||||
UGETW(udev->ddesc.bcdDevice),
|
||||
udev->port_no,
|
||||
udev->parent_hub != NULL ?
|
||||
udev->port_no
|
||||
#if USB_HAVE_UGEN
|
||||
, udev->parent_hub != NULL ?
|
||||
udev->parent_hub->ugen_name :
|
||||
device_get_nameunit(device_get_parent(udev->bus->bdev)));
|
||||
device_get_nameunit(device_get_parent(udev->bus->bdev))
|
||||
#endif
|
||||
);
|
||||
|
||||
devctl_queue_data(data);
|
||||
}
|
||||
@ -2451,7 +2466,9 @@ usb_notify_addq(const char *type, struct usb_device *udev)
|
||||
/* announce the device */
|
||||
sb = sbuf_new_auto();
|
||||
sbuf_printf(sb,
|
||||
"cdev=%s "
|
||||
#if USB_HAVE_UGEN
|
||||
"ugen=%s "
|
||||
#endif
|
||||
"vendor=0x%04x "
|
||||
"product=0x%04x "
|
||||
"devclass=0x%02x "
|
||||
@ -2460,8 +2477,13 @@ usb_notify_addq(const char *type, struct usb_device *udev)
|
||||
"release=0x%04x "
|
||||
"mode=%s "
|
||||
"port=%u "
|
||||
"parent=%s\n",
|
||||
#if USB_HAVE_UGEN
|
||||
"parent=%s\n"
|
||||
#endif
|
||||
"",
|
||||
#if USB_HAVE_UGEN
|
||||
udev->ugen_name,
|
||||
#endif
|
||||
UGETW(udev->ddesc.idVendor),
|
||||
UGETW(udev->ddesc.idProduct),
|
||||
udev->ddesc.bDeviceClass,
|
||||
@ -2469,10 +2491,13 @@ usb_notify_addq(const char *type, struct usb_device *udev)
|
||||
usb_get_serial(udev),
|
||||
UGETW(udev->ddesc.bcdDevice),
|
||||
(udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device",
|
||||
udev->port_no,
|
||||
udev->parent_hub != NULL ?
|
||||
udev->parent_hub->ugen_name :
|
||||
device_get_nameunit(device_get_parent(udev->bus->bdev)));
|
||||
udev->port_no
|
||||
#if USB_HAVE_UGEN
|
||||
, udev->parent_hub != NULL ?
|
||||
udev->parent_hub->ugen_name :
|
||||
device_get_nameunit(device_get_parent(udev->bus->bdev))
|
||||
#endif
|
||||
);
|
||||
sbuf_finish(sb);
|
||||
devctl_notify("USB", "DEVICE", type, sbuf_data(sb));
|
||||
sbuf_delete(sb);
|
||||
@ -2487,7 +2512,9 @@ usb_notify_addq(const char *type, struct usb_device *udev)
|
||||
|
||||
sb = sbuf_new_auto();
|
||||
sbuf_printf(sb,
|
||||
"cdev=%s "
|
||||
#if USB_HAVE_UGEN
|
||||
"ugen=%s "
|
||||
#endif
|
||||
"vendor=0x%04x "
|
||||
"product=0x%04x "
|
||||
"devclass=0x%02x "
|
||||
@ -2500,7 +2527,9 @@ usb_notify_addq(const char *type, struct usb_device *udev)
|
||||
"intclass=0x%02x "
|
||||
"intsubclass=0x%02x "
|
||||
"intprotocol=0x%02x\n",
|
||||
#if USB_HAVE_UGEN
|
||||
udev->ugen_name,
|
||||
#endif
|
||||
UGETW(udev->ddesc.idVendor),
|
||||
UGETW(udev->ddesc.idProduct),
|
||||
udev->ddesc.bDeviceClass,
|
||||
@ -2518,7 +2547,9 @@ usb_notify_addq(const char *type, struct usb_device *udev)
|
||||
sbuf_delete(sb);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USB_HAVE_UGEN
|
||||
/*------------------------------------------------------------------------*
|
||||
* usb_fifo_free_wrap
|
||||
*
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
/* Default USB configuration */
|
||||
#define USB_HAVE_UGEN 1
|
||||
#define USB_HAVE_DEVCTL 1
|
||||
#define USB_HAVE_BUSDMA 1
|
||||
#define USB_HAVE_COMPAT_LINUX 1
|
||||
#define USB_HAVE_USER_IO 1
|
||||
|
Loading…
Reference in New Issue
Block a user