提交 ea25371a 编写于 作者: B Bernd Porr 提交者: Greg Kroah-Hartman

Staging: comedi: fix usbdux timeout bug

I've fixed a bug in the USBDUX driver which caused timeouts while
sending commands to the boards. This was mainly because of one bulk
transfer which had a timeout of 1ms (!). I've now set all timeouts to
1000ms.

From: Bernd Porr <BerndPorr@f2s.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 26ac8785
#define DRIVER_VERSION "v2.2" #define DRIVER_VERSION "v2.3"
#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com"
#define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com" #define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"
/* /*
...@@ -80,6 +80,7 @@ sampling rate. If you sample two channels you get 4kHz and so on. ...@@ -80,6 +80,7 @@ sampling rate. If you sample two channels you get 4kHz and so on.
* 2.0: PWM seems to be stable and is not interfering with the other functions * 2.0: PWM seems to be stable and is not interfering with the other functions
* 2.1: changed PWM API * 2.1: changed PWM API
* 2.2: added firmware kernel request to fix an udev problem * 2.2: added firmware kernel request to fix an udev problem
* 2.3: corrected a bug in bulk timeouts which were far too short
* *
*/ */
...@@ -101,8 +102,8 @@ sampling rate. If you sample two channels you get 4kHz and so on. ...@@ -101,8 +102,8 @@ sampling rate. If you sample two channels you get 4kHz and so on.
#define BOARDNAME "usbdux" #define BOARDNAME "usbdux"
/* timeout for the USB-transfer */ /* timeout for the USB-transfer in ms*/
#define EZTIMEOUT 30 #define BULK_TIMEOUT 1000
/* constants for "firmware" upload and download */ /* constants for "firmware" upload and download */
#define USBDUXSUB_FIRMWARE 0xA0 #define USBDUXSUB_FIRMWARE 0xA0
...@@ -750,7 +751,7 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub) ...@@ -750,7 +751,7 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub)
/* Length */ /* Length */
1, 1,
/* Timeout */ /* Timeout */
EZTIMEOUT); BULK_TIMEOUT);
if (errcode < 0) { if (errcode < 0) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: control msg failed (start)\n"); "comedi_: control msg failed (start)\n");
...@@ -780,7 +781,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) ...@@ -780,7 +781,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub)
/* Length */ /* Length */
1, 1,
/* Timeout */ /* Timeout */
EZTIMEOUT); BULK_TIMEOUT);
if (errcode < 0) { if (errcode < 0) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: control msg failed (stop)\n"); "comedi_: control msg failed (stop)\n");
...@@ -810,7 +811,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub, ...@@ -810,7 +811,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub,
/* length */ /* length */
len, len,
/* timeout */ /* timeout */
EZTIMEOUT); BULK_TIMEOUT);
dev_dbg(&usbduxsub->interface->dev, "comedi_: result=%d\n", errcode); dev_dbg(&usbduxsub->interface->dev, "comedi_: result=%d\n", errcode);
if (errcode < 0) { if (errcode < 0) {
dev_err(&usbduxsub->interface->dev, "comedi_: upload failed\n"); dev_err(&usbduxsub->interface->dev, "comedi_: upload failed\n");
...@@ -1110,7 +1111,7 @@ static int send_dux_commands(struct usbduxsub *this_usbduxsub, int cmd_type) ...@@ -1110,7 +1111,7 @@ static int send_dux_commands(struct usbduxsub *this_usbduxsub, int cmd_type)
usb_sndbulkpipe(this_usbduxsub->usbdev, usb_sndbulkpipe(this_usbduxsub->usbdev,
COMMAND_OUT_EP), COMMAND_OUT_EP),
this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, this_usbduxsub->dux_commands, SIZEOFDUXBUFFER,
&nsent, 10); &nsent, BULK_TIMEOUT);
if (result < 0) if (result < 0)
dev_err(&this_usbduxsub->interface->dev, "comedi%d: " dev_err(&this_usbduxsub->interface->dev, "comedi%d: "
"could not transmit dux_command to the usb-device, " "could not transmit dux_command to the usb-device, "
...@@ -1130,7 +1131,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command) ...@@ -1130,7 +1131,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command)
usb_rcvbulkpipe(this_usbduxsub->usbdev, usb_rcvbulkpipe(this_usbduxsub->usbdev,
COMMAND_IN_EP), COMMAND_IN_EP),
this_usbduxsub->insnBuffer, SIZEINSNBUF, this_usbduxsub->insnBuffer, SIZEINSNBUF,
&nrec, 1); &nrec, BULK_TIMEOUT);
if (result < 0) { if (result < 0) {
dev_err(&this_usbduxsub->interface->dev, "comedi%d: " dev_err(&this_usbduxsub->interface->dev, "comedi%d: "
"insn: USB error %d while receiving DUX command" "insn: USB error %d while receiving DUX command"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册