speedtch speedtch.c,1.78,1.79
Duncan Sands
duncan at infradead.org
Wed Oct 4 16:38:01 EDT 2006
Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv15365
Modified Files:
speedtch.c
Log Message:
If no value is supplied for ModemOption, then num_ModemOption is 0, causing
us to set instance->params->ModemOption to all zeros, wiping out the default
value. Fix this, and introduce MODEM_OPTION_LENGTH (=16) while there.
Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- speedtch.c 4 Oct 2006 08:35:33 -0000 1.78
+++ speedtch.c 4 Oct 2006 20:37:58 -0000 1.79
@@ -80,12 +80,14 @@
#define DEFAULT_B_MAX_DSL 8128
#define DEFAULT_MODEM_MODE 11
+#define MODEM_OPTION_LENGTH 16
+static const unsigned char DEFAULT_MODEM_OPTION[MODEM_OPTION_LENGTH] = {
+ 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
static unsigned int BMaxDSL = DEFAULT_B_MAX_DSL;
static unsigned char ModemMode = DEFAULT_MODEM_MODE;
-static unsigned char ModemOption[16] = {
- 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
+static unsigned char ModemOption[MODEM_OPTION_LENGTH];
static int num_ModemOption;
module_param(altsetting, uint, S_IRUGO | S_IWUSR);
@@ -132,7 +134,7 @@
unsigned int altsetting;
unsigned int BMaxDSL;
unsigned char ModemMode;
- unsigned char ModemOption[16];
+ unsigned char ModemOption[MODEM_OPTION_LENGTH];
};
struct speedtch_instance_data {
@@ -228,7 +230,9 @@
rate -- it does require the new firmware too, although it works OK
with older firmware */
ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
- 0x01, 0x40, 0x14, 0x00, instance->params.ModemOption, 0x10, CTRL_TIMEOUT);
+ 0x01, 0x40, 0x14, 0x00,
+ instance->params.ModemOption,
+ MODEM_OPTION_LENGTH, CTRL_TIMEOUT);
if (ret < 0)
usb_warn(usbatm, "%s failed on URBext2: %d\n", __func__, ret);
@@ -803,7 +807,7 @@
instance->params.altsetting = altsetting;
instance->params.BMaxDSL = BMaxDSL;
instance->params.ModemMode = ModemMode;
- memset(instance->params.ModemOption, 0, sizeof(instance->params.ModemOption));
+ memcpy(instance->params.ModemOption, DEFAULT_MODEM_OPTION, MODEM_OPTION_LENGTH);
memcpy(instance->params.ModemOption, ModemOption, num_ModemOption);
use_isoc = enable_isoc;
More information about the Usbatm-commits
mailing list