Re: [PATCH] usb-option-add-huawei-k3765-k4505-no-bind-net-interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 23, 2010 at 05:19:40PM +0100, Andrew Bird (Sphere Systems) wrote:
> On Friday 23 July 2010, Andrew Bird wrote:
> > This patch adds the product IDs of Huawei's K3765 and K4505 mobile
> > broadband usb modems to option.c. It also adds a quirk to the option probe
> > function so that binding to the device's network interface(class 0xff) is
> > avoided. This is necessary to allow another driver to bind to that, and to
> > avoid programs like wvdial opening a nonfunctioning tty during modem
> > discovery.
> > 
> > Signed-off-by: Andrew Bird <ajb@xxxxxxxxxxxxxxxxxxx>
> > ---
> >  drivers/usb/serial/option.c |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > index e280ad8..ec6c2f6 100644
> > --- a/drivers/usb/serial/option.c
> > +++ b/drivers/usb/serial/option.c
> > @@ -145,6 +145,8 @@ static void option_instat_callback(struct urb *urb);
> >  #define HUAWEI_PRODUCT_E143D			0x143D
> >  #define HUAWEI_PRODUCT_E143E			0x143E
> >  #define HUAWEI_PRODUCT_E143F			0x143F
> > +#define HUAWEI_PRODUCT_K4505			0x1464
> > +#define HUAWEI_PRODUCT_K3765			0x1465
> >  #define HUAWEI_PRODUCT_E14AC			0x14AC
> > 
> >  #define QUANTA_VENDOR_ID			0x0408
> > @@ -480,6 +482,8 @@ static const struct usb_device_id option_ids[] = {
> >  	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D,
> > 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID,
> > HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, {
> > USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F,
> > 0xff, 0xff, 0xff) }, +	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID,
> > HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, +	{
> > USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765,
> > 0xff, 0xff, 0xff) }, { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC)
> > },
> >  	{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
> >  	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
> > /* Novatel Merlin V640/XV620 */ @@ -1013,6 +1017,13 @@ static int
> > option_probe(struct usb_serial *serial,
> > serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) return
> > -ENODEV;
> > 
> > +	/* Don't bind network interfaces on Huawei K3765 & K4505 */
> > +	if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID &&
> > +		(serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K3765 ||
> > +			serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4505) &&
> > +		serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
> > +		return -ENODEV;
> > +
> >  	data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private),
> > GFP_KERNEL);
> > 
> >  	if (!data)
> Greg
> 	I forgot to say this works correctly with K3765, K4505 in both CDC 
> compatible and nondescript network modes. Having the large 'if' and restoring 
> the match on class/subclass/protocol gives the expected interface bind 
> behaviour:
> 
> nondescript mode
> =============
> 0 - modem - bound to 'option'
> 1 - network
> 2 - diagnostics port - bound to 'option'
> 3 - secondary port  - bound to 'option'
> 4 - CDROM
> 5 - SDCARD
> 
> CDC compatible mode
> ================
> 0 - modem - bound to 'option'
> 1 - network CDC master
> 2 - network CDC slave
> 3 - diagnostics port - bound to 'option'
> 4 - secondary port - bound to 'option'
> 5 - CDROM
> 6 - SDCARD
> 
> 
> Thanks for listening

Looks good, I'll go queue it up.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux