Date: Fri, 22 Oct 2010 20:13:45 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214221 - head/sys/dev/usb Message-ID: <201010222013.o9MKDjiO064995@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Oct 22 20:13:45 2010 New Revision: 214221 URL: http://svn.freebsd.org/changeset/base/214221 Log: Add possibility to generate devctl notifications regardless of UGEN presence. Submitted by: Nick Hibma Approved by: thompsa (mentor) Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_freebsd.h Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Oct 22 20:02:18 2010 (r214220) +++ head/sys/dev/usb/usb_device.c Fri Oct 22 20:13:45 2010 (r214221) @@ -98,8 +98,10 @@ static void usb_suspend_resume_sub(struc 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 @@ config_done: 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, 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 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, /* 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, "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 /* 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 "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_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 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 "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 sbuf_delete(sb); } } +#endif +#if USB_HAVE_UGEN /*------------------------------------------------------------------------* * usb_fifo_free_wrap * Modified: head/sys/dev/usb/usb_freebsd.h ============================================================================== --- head/sys/dev/usb/usb_freebsd.h Fri Oct 22 20:02:18 2010 (r214220) +++ head/sys/dev/usb/usb_freebsd.h Fri Oct 22 20:13:45 2010 (r214221) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010222013.o9MKDjiO064995>