linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
@ 2012-07-10 21:51 Gustavo Padovan
  2012-07-10 22:01 ` Greg Kroah-Hartman
  2012-07-10 22:03 ` Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Gustavo Padovan @ 2012-07-10 21:51 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Gustavo Padovan, Greg Kroah-Hartman, open list:USB SUBSYSTEM,
	open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

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, \
+	.idVendor = (vend), \
+	.bInterfaceClass = (cl), \
+	.bInterfaceSubClass = (sc), \
+	.bInterfaceProtocol = (pr)
+
 /* ----------------------------------------------------------------------- */
 
 /* Stuff for dynamic usb ids */
-- 
1.7.10.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
  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-10 22:03 ` Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2012-07-10 22:01 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: linux-bluetooth, Gustavo Padovan, open list:USB SUBSYSTEM,
	open list

On Tue, Jul 10, 2012 at 06:51:03PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> 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) }

Two entries in the cdc_wdm driver can also be converted to use this
interface.  Do you want to send a patch doing that, or do you want me to
do it?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
  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-10 22:03 ` Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-07-10 22:03 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: linux-bluetooth, Gustavo Padovan, Greg Kroah-Hartman,
	open list:USB SUBSYSTEM, open list

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
  2012-07-10 22:01 ` Greg Kroah-Hartman
@ 2012-07-11  8:36   ` Bjørn Mork
  2012-07-11 13:04     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Bjørn Mork @ 2012-07-11  8:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Gustavo Padovan, linux-bluetooth, Gustavo Padovan,
	open list:USB SUBSYSTEM, open list

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> On Tue, Jul 10, 2012 at 06:51:03PM -0300, Gustavo Padovan wrote:
>
>> { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }
>
> Two entries in the cdc_wdm driver can also be converted to use this
> interface.  Do you want to send a patch doing that, or do you want me to
> do it?

Only if you decide to take this change in 3.4 and 3.5.  Those entries
are gone in 3.6.



Bjørn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
  2012-07-11  8:36   ` Bjørn Mork
@ 2012-07-11 13:04     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2012-07-11 13:04 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Gustavo Padovan, linux-bluetooth, Gustavo Padovan,
	open list:USB SUBSYSTEM, open list

On Wed, Jul 11, 2012 at 10:36:46AM +0200, Bjørn Mork wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> > On Tue, Jul 10, 2012 at 06:51:03PM -0300, Gustavo Padovan wrote:
> >
> >> { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }
> >
> > Two entries in the cdc_wdm driver can also be converted to use this
> > interface.  Do you want to send a patch doing that, or do you want me to
> > do it?
> 
> Only if you decide to take this change in 3.4 and 3.5.  Those entries
> are gone in 3.6.

Ah, the joys of looking at the wrong branch in git :)

Nevermind...

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-11 13:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).