RE: [linux-usb-devel] [PATCH 01/02] Sierra Wireless - Add TRU-Install (c) Support

2007-07-11 Thread Kevin Lloyd
Unfortunately I can not myself comment on the feature at this point,
however the code is pretty obvious :).

I'll go ahead and change it so that it returns the result of
sierra_set_ms_mode.

Also, I realized that the second patch (02/02) fixes a bug in the first
patch (01/02), particularly the dev_dbg messages are implemented
incorrectly in the first patch. I'll move that fix up to the first
patch.

I'll wait another day for other comments and then resubmit with those
changes.

- Kevin

-Original Message-
From: Oliver Neukum [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 11, 2007 3:37 PM
To: [EMAIL PROTECTED]
Cc: Kevin Lloyd; [EMAIL PROTECTED]; Linux Development Group;
[EMAIL PROTECTED]; linux-kernel@vger.kernel.org
Subject: Re: [linux-usb-devel] [PATCH 01/02] Sierra Wireless - Add
TRU-Install (c) Support

Am Donnerstag, 12. Juli 2007 schrieb Kevin Lloyd:
> From: Kevin Lloyd <[EMAIL PROTECTED]>
> 
> This patch adds compatibility with Sierra Wireless' new TRU-Install
feature. Future devices that use this feature will not work unless this
patch has been applied.

Is this some type of CD-ROM simulation to provide drivers?

> +int sierra_probe(struct usb_interface *iface, const struct 
> +usb_device_id *id) {
> + int result; 
> + struct usb_device *udev;
> +
> + udev = usb_get_dev(interface_to_usbdev(iface));
> +
> + /* Check if in installer mode */
> + if (id->driver_info == DEVICE_INSTALLER){
> + dev_dbg("FOUND DEVICE(SW)\n");
> + result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
> + return 0;

This is not a good idea in the long run. If you don't return an error
here,
disconnect() will be called for your driver and will have to deal with a
semiinitialized device.

Regards
Oliver

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/02] Sierra Wireless - Add TRU-Install (c) Support

2007-07-11 Thread Kevin Lloyd

From: Kevin Lloyd <[EMAIL PROTECTED]>

This patch adds compatibility with Sierra Wireless' new TRU-Install feature. 
Future devices that use this feature will not work unless this patch has been 
applied.

This patch was tested on the 2.6.21.1 kernel source patched with the following 
patches (found at 
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/usb/):
   usb-sierra-cleanup-urb-startup.patch
   usb-sierra-fix-status-usage.patch
   usb-sierra-status.patch

There were two previous submissions for similar support (6/6/2007 & 6/5/2007) 
they were however rejected so please disregard those.

Signed-off-by: Kevin Lloyd <[EMAIL PROTECTED]>

---

diff -uprN a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
--- a/drivers/usb/serial/sierra.c   2007-07-10 16:53:07.0 -0700
+++ b/drivers/usb/serial/sierra.c   2007-07-10 16:35:48.0 -0700
@@ -1,7 +1,7 @@
/*
  USB Driver for Sierra Wireless

-  Copyright (C) 2006  Kevin Lloyd <[EMAIL PROTECTED]>
+  Copyright (C) 2007  Kevin Lloyd <[EMAIL PROTECTED]>

  IMPORTANT DISCLAIMER: This driver is not commercially supported by
  Sierra Wireless. Use at your own risk.
@@ -12,10 +12,9 @@

  Portions based on the option driver by Matthias Urlichs <[EMAIL PROTECTED]>
  Whom based his on the Keyspan driver by Hugh Blemings <[EMAIL PROTECTED]>
-
*/

-#define DRIVER_VERSION "v.1.0.6"
+#define DRIVER_VERSION "v.1.2.4"
#define DRIVER_AUTHOR "Kevin Lloyd <[EMAIL PROTECTED]>"
#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"

@@ -28,6 +27,70 @@
#include 
#include 

+#define SWIMS_USB_REQUEST_SetMode  0x0B
+#define SWIMS_USB_REQUEST_TYPE_SetMode 0x40
+#define SWIMS_USB_INDEX_SetMode0x
+#define SWIMS_SET_MODE_Modem   0x0001
+
+/* per port private data */
+#define N_IN_URB   4
+#define N_OUT_URB  4
+#define IN_BUFLEN  4096
+
+static int debug;
+
+enum devicetype {
+   DEVICE_3_PORT = 0,
+   DEVICE_1_PORT = 1,
+   DEVICE_INSTALLER =  2,
+};
+
+int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
+{
+   int result;
+   dev_dbg("SET POWER STATE");
+   result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   0x00,   /* __u8 request  */
+   0x40,   /* __u8 request type */
+   swiState,   /* __u16 value   */
+   0,  /* __u16 index   */
+   NULL,   /* void *data*/
+   0,  /* __u16 size*/
+   USB_CTRL_SET_TIMEOUT);  /* int timeout   */
+   return result;
+}
+
+int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
+{
+   int result;
+   dev_dbg("DEVICE MODE SWITCH");
+   result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   SWIMS_USB_REQUEST_SetMode,  /* __u8 request  */
+   SWIMS_USB_REQUEST_TYPE_SetMode, /* __u8 request type */
+   eSocMode,   /* __u16 value   */
+   SWIMS_USB_INDEX_SetMode,/* __u16 index   */
+   NULL,   /* void *data*/
+   0,  /* __u16 size*/
+   USB_CTRL_SET_TIMEOUT);  /* int timeout   */
+   return result;
+}
+
+int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
+{
+   int result; 
+   struct usb_device *udev;
+
+   udev = usb_get_dev(interface_to_usbdev(iface));
+
+   /* Check if in installer mode */
+   if (id->driver_info == DEVICE_INSTALLER){
+   dev_dbg("FOUND DEVICE(SW)\n");
+   result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
+   return 0;
+   }
+
+   return usb_serial_probe(iface, id); 
+}

static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
@@ -43,8 +106,10 @@ static struct usb_device_id id_table [] 
	{ USB_DEVICE(0x1199, 0x6812) },	/* Sierra Wireless MC8775 */

{ USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */

-   { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
-   { USB_DEVICE(0x0F3D, 0x0112) }, /* AirPrime/Sierra PC 5220 */
+   { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra 
Wireless AirCard 580 */
+   { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* 
Airprime/Sierra PC 5220 */
+
+   { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER}, 
{ }
};
MODULE_DEVICE_TABLE(usb, id_table);
@@ -56,6 +121,7 @@ static struct usb_device_id id_table_1po
};

static struct usb_device_id id_table_3port [] = {
+   /* CDMA Devices */
{ 

Re: [linux-usb-devel] [PATCH 01/02] Sierra Wireless - Add TRU-Install (c) Support

2007-07-11 Thread Oliver Neukum
Am Donnerstag, 12. Juli 2007 schrieb Kevin Lloyd:
> From: Kevin Lloyd <[EMAIL PROTECTED]>
> 
> This patch adds compatibility with Sierra Wireless' new TRU-Install feature. 
> Future devices that use this feature will not work unless this patch has been 
> applied.

Is this some type of CD-ROM simulation to provide drivers?

> +int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
> +{
> + int result; 
> + struct usb_device *udev;
> +
> + udev = usb_get_dev(interface_to_usbdev(iface));
> +
> + /* Check if in installer mode */
> + if (id->driver_info == DEVICE_INSTALLER){
> + dev_dbg("FOUND DEVICE(SW)\n");
> + result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
> + return 0;

This is not a good idea in the long run. If you don't return an error here,
disconnect() will be called for your driver and will have to deal with
a semiinitialized device.

Regards
Oliver
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [linux-usb-devel] [PATCH 01/02] Sierra Wireless - Add TRU-Install (c) Support

2007-07-11 Thread Oliver Neukum
Am Donnerstag, 12. Juli 2007 schrieb Kevin Lloyd:
 From: Kevin Lloyd [EMAIL PROTECTED]
 
 This patch adds compatibility with Sierra Wireless' new TRU-Install feature. 
 Future devices that use this feature will not work unless this patch has been 
 applied.

Is this some type of CD-ROM simulation to provide drivers?

 +int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
 +{
 + int result; 
 + struct usb_device *udev;
 +
 + udev = usb_get_dev(interface_to_usbdev(iface));
 +
 + /* Check if in installer mode */
 + if (id-driver_info == DEVICE_INSTALLER){
 + dev_dbg(FOUND DEVICE(SW)\n);
 + result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
 + return 0;

This is not a good idea in the long run. If you don't return an error here,
disconnect() will be called for your driver and will have to deal with
a semiinitialized device.

Regards
Oliver
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/02] Sierra Wireless - Add TRU-Install (c) Support

2007-07-11 Thread Kevin Lloyd

From: Kevin Lloyd [EMAIL PROTECTED]

This patch adds compatibility with Sierra Wireless' new TRU-Install feature. 
Future devices that use this feature will not work unless this patch has been 
applied.

This patch was tested on the 2.6.21.1 kernel source patched with the following 
patches (found at 
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/usb/):
   usb-sierra-cleanup-urb-startup.patch
   usb-sierra-fix-status-usage.patch
   usb-sierra-status.patch

There were two previous submissions for similar support (6/6/2007  6/5/2007) 
they were however rejected so please disregard those.

Signed-off-by: Kevin Lloyd [EMAIL PROTECTED]

---

diff -uprN a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
--- a/drivers/usb/serial/sierra.c   2007-07-10 16:53:07.0 -0700
+++ b/drivers/usb/serial/sierra.c   2007-07-10 16:35:48.0 -0700
@@ -1,7 +1,7 @@
/*
  USB Driver for Sierra Wireless

-  Copyright (C) 2006  Kevin Lloyd [EMAIL PROTECTED]
+  Copyright (C) 2007  Kevin Lloyd [EMAIL PROTECTED]

  IMPORTANT DISCLAIMER: This driver is not commercially supported by
  Sierra Wireless. Use at your own risk.
@@ -12,10 +12,9 @@

  Portions based on the option driver by Matthias Urlichs [EMAIL PROTECTED]
  Whom based his on the Keyspan driver by Hugh Blemings [EMAIL PROTECTED]
-
*/

-#define DRIVER_VERSION v.1.0.6
+#define DRIVER_VERSION v.1.2.4
#define DRIVER_AUTHOR Kevin Lloyd [EMAIL PROTECTED]
#define DRIVER_DESC USB Driver for Sierra Wireless USB modems

@@ -28,6 +27,70 @@
#include linux/usb.h
#include linux/usb/serial.h

+#define SWIMS_USB_REQUEST_SetMode  0x0B
+#define SWIMS_USB_REQUEST_TYPE_SetMode 0x40
+#define SWIMS_USB_INDEX_SetMode0x
+#define SWIMS_SET_MODE_Modem   0x0001
+
+/* per port private data */
+#define N_IN_URB   4
+#define N_OUT_URB  4
+#define IN_BUFLEN  4096
+
+static int debug;
+
+enum devicetype {
+   DEVICE_3_PORT = 0,
+   DEVICE_1_PORT = 1,
+   DEVICE_INSTALLER =  2,
+};
+
+int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
+{
+   int result;
+   dev_dbg(SET POWER STATE);
+   result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   0x00,   /* __u8 request  */
+   0x40,   /* __u8 request type */
+   swiState,   /* __u16 value   */
+   0,  /* __u16 index   */
+   NULL,   /* void *data*/
+   0,  /* __u16 size*/
+   USB_CTRL_SET_TIMEOUT);  /* int timeout   */
+   return result;
+}
+
+int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
+{
+   int result;
+   dev_dbg(DEVICE MODE SWITCH);
+   result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   SWIMS_USB_REQUEST_SetMode,  /* __u8 request  */
+   SWIMS_USB_REQUEST_TYPE_SetMode, /* __u8 request type */
+   eSocMode,   /* __u16 value   */
+   SWIMS_USB_INDEX_SetMode,/* __u16 index   */
+   NULL,   /* void *data*/
+   0,  /* __u16 size*/
+   USB_CTRL_SET_TIMEOUT);  /* int timeout   */
+   return result;
+}
+
+int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
+{
+   int result; 
+   struct usb_device *udev;
+
+   udev = usb_get_dev(interface_to_usbdev(iface));
+
+   /* Check if in installer mode */
+   if (id-driver_info == DEVICE_INSTALLER){
+   dev_dbg(FOUND DEVICE(SW)\n);
+   result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
+   return 0;
+   }
+
+   return usb_serial_probe(iface, id); 
+}

static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
@@ -43,8 +106,10 @@ static struct usb_device_id id_table [] 
	{ USB_DEVICE(0x1199, 0x6812) },	/* Sierra Wireless MC8775 */

{ USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */

-   { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
-   { USB_DEVICE(0x0F3D, 0x0112) }, /* AirPrime/Sierra PC 5220 */
+   { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra 
Wireless AirCard 580 */
+   { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* 
Airprime/Sierra PC 5220 */
+
+   { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER}, 
{ }
};
MODULE_DEVICE_TABLE(usb, id_table);
@@ -56,6 +121,7 @@ static struct usb_device_id id_table_1po
};

static struct usb_device_id id_table_3port [] = {
+   /* CDMA Devices */
{ 

RE: [linux-usb-devel] [PATCH 01/02] Sierra Wireless - Add TRU-Install (c) Support

2007-07-11 Thread Kevin Lloyd
Unfortunately I can not myself comment on the feature at this point,
however the code is pretty obvious :).

I'll go ahead and change it so that it returns the result of
sierra_set_ms_mode.

Also, I realized that the second patch (02/02) fixes a bug in the first
patch (01/02), particularly the dev_dbg messages are implemented
incorrectly in the first patch. I'll move that fix up to the first
patch.

I'll wait another day for other comments and then resubmit with those
changes.

- Kevin

-Original Message-
From: Oliver Neukum [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 11, 2007 3:37 PM
To: [EMAIL PROTECTED]
Cc: Kevin Lloyd; [EMAIL PROTECTED]; Linux Development Group;
[EMAIL PROTECTED]; linux-kernel@vger.kernel.org
Subject: Re: [linux-usb-devel] [PATCH 01/02] Sierra Wireless - Add
TRU-Install (c) Support

Am Donnerstag, 12. Juli 2007 schrieb Kevin Lloyd:
 From: Kevin Lloyd [EMAIL PROTECTED]
 
 This patch adds compatibility with Sierra Wireless' new TRU-Install
feature. Future devices that use this feature will not work unless this
patch has been applied.

Is this some type of CD-ROM simulation to provide drivers?

 +int sierra_probe(struct usb_interface *iface, const struct 
 +usb_device_id *id) {
 + int result; 
 + struct usb_device *udev;
 +
 + udev = usb_get_dev(interface_to_usbdev(iface));
 +
 + /* Check if in installer mode */
 + if (id-driver_info == DEVICE_INSTALLER){
 + dev_dbg(FOUND DEVICE(SW)\n);
 + result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
 + return 0;

This is not a good idea in the long run. If you don't return an error
here,
disconnect() will be called for your driver and will have to deal with a
semiinitialized device.

Regards
Oliver

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/