LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
@ 2011-02-05 19:04 Maciej Szmigiero
  2011-02-05 19:28 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Maciej Szmigiero @ 2011-02-05 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Johan Hovold, Joe Perches, Alan Cox,
	linux-usb, linux-kernel

[USB]Add Samsung SGH-I500/Android modem ID switch to visor driver

Samsung decided to reuse USB ID of its old CDMA phone SGH-I500 for the
modem part of some of their Android phones. At least Galaxy Spica
is affected.

This modem needs ACM driver and does not work with visor driver which
binds the conflicting ID for SGH-I500.
Because SGH-I500 is pretty an old hardware its best to add switch to visor
driver in cause somebody still wants to use that phone with Linux.

Note that this is needed only when using the Android phone as modem,
not in USB storage or ADB mode.

Signed-off-by: Maciej Szmigiero <mhej@o2.pl>

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 15a5d89..5e56ab3 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -52,6 +52,7 @@ static int palm_os_4_probe(struct usb_serial *serial,
 
 /* Parameters that may be passed into the module. */
 static int debug;
+static int enable_i500;
 static __u16 vendor;
 static __u16 product;
 
@@ -479,6 +480,10 @@ static int visor_probe(struct usb_serial *serial,
 
 	dbg("%s", __func__);
 
+	if ((!enable_i500) && (id->idVendor == SAMSUNG_VENDOR_ID) &&
+		(id->idProduct == SAMSUNG_SPH_I500_ID))
+		return -ENODEV;
+
 	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
 		dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
 			serial->dev->actconfig->desc.bConfigurationValue);
@@ -718,6 +723,11 @@ MODULE_LICENSE("GPL");
 module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
 
+module_param(enable_i500, bool, S_IRUGO);
+MODULE_PARM_DESC(enable_i500, "Enable support for Samsung SPH-I500. "
+				"Causes USBID conflict with modem in Samsung "
+				"Android phones");
+
 module_param(vendor, ushort, 0);
 MODULE_PARM_DESC(vendor, "User specified vendor ID");
 module_param(product, ushort, 0);



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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-05 19:04 [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver Maciej Szmigiero
@ 2011-02-05 19:28 ` Greg KH
  2011-02-05 19:40   ` Maciej Szmigiero
  2011-02-05 21:41   ` Maciej Szmigiero
  0 siblings, 2 replies; 8+ messages in thread
From: Greg KH @ 2011-02-05 19:28 UTC (permalink / raw)
  To: Maciej Szmigiero
  Cc: Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

On Sat, Feb 05, 2011 at 08:04:23PM +0100, Maciej Szmigiero wrote:
> [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
> 
> Samsung decided to reuse USB ID of its old CDMA phone SGH-I500 for the
> modem part of some of their Android phones. At least Galaxy Spica
> is affected.

Ick, no way, that's horrible.

> This modem needs ACM driver and does not work with visor driver which
> binds the conflicting ID for SGH-I500.
> Because SGH-I500 is pretty an old hardware its best to add switch to visor
> driver in cause somebody still wants to use that phone with Linux.
> 
> Note that this is needed only when using the Android phone as modem,
> not in USB storage or ADB mode.

If the phone switches to modem mode, does it show up as a ACM class
device?

> 
> Signed-off-by: Maciej Szmigiero <mhej@o2.pl>
> 
> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
> index 15a5d89..5e56ab3 100644
> --- a/drivers/usb/serial/visor.c
> +++ b/drivers/usb/serial/visor.c
> @@ -52,6 +52,7 @@ static int palm_os_4_probe(struct usb_serial *serial,
>  
>  /* Parameters that may be passed into the module. */
>  static int debug;
> +static int enable_i500;
>  static __u16 vendor;
>  static __u16 product;
>  
> @@ -479,6 +480,10 @@ static int visor_probe(struct usb_serial *serial,
>  
>  	dbg("%s", __func__);
>  
> +	if ((!enable_i500) && (id->idVendor == SAMSUNG_VENDOR_ID) &&
> +		(id->idProduct == SAMSUNG_SPH_I500_ID))
> +		return -ENODEV;
> +
>  	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
>  		dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
>  			serial->dev->actconfig->desc.bConfigurationValue);
> @@ -718,6 +723,11 @@ MODULE_LICENSE("GPL");
>  module_param(debug, bool, S_IRUGO | S_IWUSR);
>  MODULE_PARM_DESC(debug, "Debug enabled or not");
>  
> +module_param(enable_i500, bool, S_IRUGO);
> +MODULE_PARM_DESC(enable_i500, "Enable support for Samsung SPH-I500. "
> +				"Causes USBID conflict with modem in Samsung "
> +				"Android phones");
> +

Is there any way to dynamically detect this?  We don't want it to be a
module parameter, as we will never know to set it.

Surely the configuration of the device looks different somehow?  If it
reports itself as an ACM device, we should be able to detect that,
right?

thanks,

greg k-h

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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-05 19:28 ` Greg KH
@ 2011-02-05 19:40   ` Maciej Szmigiero
  2011-02-05 21:41   ` Maciej Szmigiero
  1 sibling, 0 replies; 8+ messages in thread
From: Maciej Szmigiero @ 2011-02-05 19:40 UTC (permalink / raw)
  To: Greg KH; +Cc: Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

W dniu 05.02.2011 20:28, Greg KH pisze:
> Surely the configuration of the device looks different somehow?  If it
> reports itself as an ACM device, we should be able to detect that,
> right?
> 
> thanks,
> 
> greg k-h

I will try to look at it, but the modem likes to reset itself (and the bus)
when poked (for example when trying to read configuration strings).

Best regards,
Maciej Szmigiero

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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-05 19:28 ` Greg KH
  2011-02-05 19:40   ` Maciej Szmigiero
@ 2011-02-05 21:41   ` Maciej Szmigiero
  2011-02-05 23:29     ` Sergei Shtylyov
  1 sibling, 1 reply; 8+ messages in thread
From: Maciej Szmigiero @ 2011-02-05 21:41 UTC (permalink / raw)
  To: Greg KH; +Cc: Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

New version of patch which autodetects devices with ACM class.
Tested on Galaxy Spica.

Signed-off-by: Maciej Szmigiero <mhej@o2.pl>

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 15a5d89..e1c4527 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -27,6 +27,7 @@
 #include <linux/uaccess.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
+#include <linux/usb/cdc.h>
 #include "visor.h"
 
 /*
@@ -479,6 +480,15 @@ static int visor_probe(struct usb_serial *serial,
 
 	dbg("%s", __func__);
 
+	/* some Samsung Android phones in modem mode have the same ID */
+	/* as SPH-I500, but they are ACM devices, so dont bind to them */
+	if ((id->idVendor == SAMSUNG_VENDOR_ID) &&
+		(id->idProduct == SAMSUNG_SPH_I500_ID) &&
+		(serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM) &&
+		(serial->dev->descriptor.bDeviceSubClass ==
+			USB_CDC_SUBCLASS_ACM))
+		return -ENODEV;
+
 	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
 		dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
 			serial->dev->actconfig->desc.bConfigurationValue);


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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-05 21:41   ` Maciej Szmigiero
@ 2011-02-05 23:29     ` Sergei Shtylyov
  2011-02-06 20:04       ` Maciej Szmigiero
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2011-02-05 23:29 UTC (permalink / raw)
  To: Maciej Szmigiero
  Cc: Greg KH, Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

Hello.

On 06.02.2011 0:41, Maciej Szmigiero wrote:

> New version of patch which autodetects devices with ACM class.
> Tested on Galaxy Spica.

> Signed-off-by: Maciej Szmigiero <mhej@o2.pl>

> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
> index 15a5d89..e1c4527 100644
> --- a/drivers/usb/serial/visor.c
> +++ b/drivers/usb/serial/visor.c
[...]
> @@ -479,6 +480,15 @@ static int visor_probe(struct usb_serial *serial,
>
>   	dbg("%s", __func__);
>
> +	/* some Samsung Android phones in modem mode have the same ID */
> +	/* as SPH-I500, but they are ACM devices, so dont bind to them */

    The preferred style for the multi-line comments is this:

/*
  * bla
  * bla
  */

> +	if ((id->idVendor == SAMSUNG_VENDOR_ID)&&
> +		(id->idProduct == SAMSUNG_SPH_I500_ID)&&
> +		(serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM)&&
> +		(serial->dev->descriptor.bDeviceSubClass ==
> +			USB_CDC_SUBCLASS_ACM))

    Parens around == not necessary...

WBR, Sergei

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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-05 23:29     ` Sergei Shtylyov
@ 2011-02-06 20:04       ` Maciej Szmigiero
  2011-02-07 11:25         ` Sergei Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Maciej Szmigiero @ 2011-02-06 20:04 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg KH, Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

W dniu 06.02.2011 00:29, Sergei Shtylyov pisze:
> Hello.
> 
> On 06.02.2011 0:41, Maciej Szmigiero wrote:
> 
>> New version of patch which autodetects devices with ACM class.
>> Tested on Galaxy Spica.
> 
>> Signed-off-by: Maciej Szmigiero <mhej@o2.pl>
> 
>> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
>> index 15a5d89..e1c4527 100644
>> --- a/drivers/usb/serial/visor.c
>> +++ b/drivers/usb/serial/visor.c
> [...]
>> @@ -479,6 +480,15 @@ static int visor_probe(struct usb_serial *serial,
>>
>>       dbg("%s", __func__);
>>
>> +    /* some Samsung Android phones in modem mode have the same ID */
>> +    /* as SPH-I500, but they are ACM devices, so dont bind to them */
> 
>    The preferred style for the multi-line comments is this:
> 
> /*
>  * bla
>  * bla
>  */
> 
>> +    if ((id->idVendor == SAMSUNG_VENDOR_ID)&&
>> +        (id->idProduct == SAMSUNG_SPH_I500_ID)&&
>> +        (serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM)&&
>> +        (serial->dev->descriptor.bDeviceSubClass ==
>> +            USB_CDC_SUBCLASS_ACM))
> 
>    Parens around == not necessary...
> 
> WBR, Sergei

Thanks for comments, new version of this patch with style fixes follows.

Best regards,
Maciej Szmigiero

Signed-off-by: Maciej Szmigiero <mhej@o2.pl>

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 15a5d89..0f75948 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -27,6 +27,7 @@
 #include <linux/uaccess.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
+#include <linux/usb/cdc.h>
 #include "visor.h"
 
 /*
@@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial,
 
 	dbg("%s", __func__);
 
+	/*
+	 * some Samsung Android phones in modem mode have the same ID
+	 * as SPH-I500, but they are ACM devices, so dont bind to them
+	*/
+	if (id->idVendor == SAMSUNG_VENDOR_ID &&
+		id->idProduct == SAMSUNG_SPH_I500_ID &&
+		serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM &&
+		serial->dev->descriptor.bDeviceSubClass ==
+			USB_CDC_SUBCLASS_ACM)
+		return -ENODEV;
+
 	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
 		dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
 			serial->dev->actconfig->desc.bConfigurationValue);



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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-06 20:04       ` Maciej Szmigiero
@ 2011-02-07 11:25         ` Sergei Shtylyov
  2011-02-07 11:42           ` Maciej Szmigiero
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2011-02-07 11:25 UTC (permalink / raw)
  To: Maciej Szmigiero
  Cc: Greg KH, Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

Hello.

On 06-02-2011 23:04, Maciej Szmigiero wrote:

>>> New version of patch which autodetects devices with ACM class.
>>> Tested on Galaxy Spica.

>>> Signed-off-by: Maciej Szmigiero<mhej@o2.pl>

>>> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
>>> index 15a5d89..e1c4527 100644
>>> --- a/drivers/usb/serial/visor.c
>>> +++ b/drivers/usb/serial/visor.c
>> [...]
>>> @@ -479,6 +480,15 @@ static int visor_probe(struct usb_serial *serial,
>>>
>>>        dbg("%s", __func__);
>>>
>>> +    /* some Samsung Android phones in modem mode have the same ID */
>>> +    /* as SPH-I500, but they are ACM devices, so dont bind to them */

>>     The preferred style for the multi-line comments is this:

>> /*
>>  * bla
>>  * bla
>>  */

>>> +    if ((id->idVendor == SAMSUNG_VENDOR_ID)&&
>>> +        (id->idProduct == SAMSUNG_SPH_I500_ID)&&
>>> +        (serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM)&&
>>> +        (serial->dev->descriptor.bDeviceSubClass ==
>>> +            USB_CDC_SUBCLASS_ACM))
>>
>>     Parens around == not necessary...

>> WBR, Sergei

> Thanks for comments, new version of this patch with style fixes follows.

> Best regards,
> Maciej Szmigiero

> Signed-off-by: Maciej Szmigiero<mhej@o2.pl>

> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
> index 15a5d89..0f75948 100644
> --- a/drivers/usb/serial/visor.c
> +++ b/drivers/usb/serial/visor.c
[...]
> @@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial,
>
>   	dbg("%s", __func__);
>
> +	/*
> +	 * some Samsung Android phones in modem mode have the same ID
> +	 * as SPH-I500, but they are ACM devices, so dont bind to them
> +	*/

    Space is missing. You were close. :-)

WBR, Sergei

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

* Re: [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver
  2011-02-07 11:25         ` Sergei Shtylyov
@ 2011-02-07 11:42           ` Maciej Szmigiero
  0 siblings, 0 replies; 8+ messages in thread
From: Maciej Szmigiero @ 2011-02-07 11:42 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg KH, Johan Hovold, Joe Perches, Alan Cox, linux-usb, linux-kernel

W dniu 07.02.2011 12:25, Sergei Shtylyov pisze:
> Hello.
> 
> On 06-02-2011 23:04, Maciej Szmigiero wrote:
> 
>>>> New version of patch which autodetects devices with ACM class.
>>>> Tested on Galaxy Spica.
> 
> 
>> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
>> index 15a5d89..0f75948 100644
>> --- a/drivers/usb/serial/visor.c
>> +++ b/drivers/usb/serial/visor.c
> [...]
>> @@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial,
>>
>>       dbg("%s", __func__);
>>
>> +    /*
>> +     * some Samsung Android phones in modem mode have the same ID
>> +     * as SPH-I500, but they are ACM devices, so dont bind to them
>> +    */
> 
>    Space is missing. You were close. :-)
> 
> WBR, Sergei
> 

Damn :)

Signed-off-by: Maciej Szmigiero<mhej@o2.pl>

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 15a5d89..1c11959 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -27,6 +27,7 @@
 #include <linux/uaccess.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
+#include <linux/usb/cdc.h>
 #include "visor.h"
 
 /*
@@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial,
 
 	dbg("%s", __func__);
 
+	/*
+	 * some Samsung Android phones in modem mode have the same ID
+	 * as SPH-I500, but they are ACM devices, so dont bind to them
+	 */
+	if (id->idVendor == SAMSUNG_VENDOR_ID &&
+		id->idProduct == SAMSUNG_SPH_I500_ID &&
+		serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM &&
+		serial->dev->descriptor.bDeviceSubClass ==
+			USB_CDC_SUBCLASS_ACM)
+		return -ENODEV;
+
 	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
 		dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
 			serial->dev->actconfig->desc.bConfigurationValue);

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

end of thread, other threads:[~2011-02-07 11:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-05 19:04 [USB]Add Samsung SGH-I500/Android modem ID switch to visor driver Maciej Szmigiero
2011-02-05 19:28 ` Greg KH
2011-02-05 19:40   ` Maciej Szmigiero
2011-02-05 21:41   ` Maciej Szmigiero
2011-02-05 23:29     ` Sergei Shtylyov
2011-02-06 20:04       ` Maciej Szmigiero
2011-02-07 11:25         ` Sergei Shtylyov
2011-02-07 11:42           ` Maciej Szmigiero

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).