From: Marcel Holtmann <marcel@holtmann.org>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
Date: Tue, 10 Jul 2012 19:03:49 -0300 [thread overview]
Message-ID: <1341957829.31958.17.camel@aeonflux> (raw)
In-Reply-To: <1341957063-11989-1-git-send-email-gustavo@padovan.org>
Hi Gustavo,
> A lot of Broadcom Bluetooth devices provides vendor specific interface
> class and we are getting flooded by patches adding new device support.
> This change will help us enable support for any other Broadcom with vendor
> specific device that arrives in the future.
>
> Only the product id changes for those devices, so this macro would be
> perfect for us:
>
> { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> include/linux/usb.h | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/include/linux/usb.h b/include/linux/usb.h
> index dea39dc..dad156b 100644
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -829,6 +829,27 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
> .bInterfaceSubClass = (sc), \
> .bInterfaceProtocol = (pr)
>
> +/**
> + * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
> + * @vend: the 16 bit USB Vendor ID
> + * @cl: bInterfaceClass value
> + * @sc: bInterfaceSubClass value
> + * @pr: bInterfaceProtocol value
> + *
> + * This macro is used to create a struct usb_device_id that matches a
> + * specific vendor with a specific class of interfaces.
> + *
> + * This is especially useful when explicitly matching devices that have
> + * vendor specific bDeviceClass values, but standards-compliant interfaces.
> + */
> +#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
> + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
> + | USB_DEVICE_ID_MATCH_DEVICE, \
this should be USB_DEVICE_ID_MATCH_VENDOR.
> + .idVendor = (vend), \
> + .bInterfaceClass = (cl), \
> + .bInterfaceSubClass = (sc), \
> + .bInterfaceProtocol = (pr)
> +
> /* ----------------------------------------------------------------------- */
>
> /* Stuff for dynamic usb ids */
Regards
Marcel
prev parent reply other threads:[~2012-07-10 22:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 21:51 [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro Gustavo Padovan
2012-07-10 22:01 ` Greg Kroah-Hartman
2012-07-11 8:36 ` Bjørn Mork
2012-07-11 13:04 ` Greg Kroah-Hartman
2012-07-10 22:03 ` Marcel Holtmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341957829.31958.17.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=gustavo@padovan.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).