-#define DRIVER_VERSION "v2.2"
+#define DRIVER_VERSION "v2.3"
#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com"
#define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"
/*
* 2.0: PWM seems to be stable and is not interfering with the other functions
* 2.1: changed PWM API
* 2.2: added firmware kernel request to fix an udev problem
- *
+ * 2.3: fixed a timeout bug with newer kernels (>2.6.30)
*/
// generates loads of debug info
#define BOARDNAME "usbdux"
// timeout for the USB-transfer
-#define EZTIMEOUT 30
+#define BULK_TIMEOUT 1000 // ms
// constants for "firmware" upload and download
#define USBDUXSUB_FIRMWARE 0xA0
// Length
1,
// Timeout
- EZTIMEOUT);
+ BULK_TIMEOUT);
if (errcode < 0) {
printk("comedi_: usbdux_: control msg failed (start)\n");
return errcode;
// Length
1,
// Timeout
- EZTIMEOUT);
+ BULK_TIMEOUT);
if (errcode < 0) {
printk("comedi_: usbdux: control msg failed (stop)\n");
return errcode;
// length
len,
// timeout
- EZTIMEOUT);
+ BULK_TIMEOUT);
if (errcode < 0) {
printk("comedi_: usbdux: uppload failed\n");
return errcode;
result = USB_BULK_MSG(this_usbduxsub->usbdev,
usb_sndbulkpipe(this_usbduxsub->usbdev,
COMMAND_OUT_EP),
- this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, &nsent, 10 * HZ);
+ this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, &nsent, BULK_TIMEOUT);
if (result < 0) {
printk("comedi%d: could not transmit dux_command to the usb-device, err=%d\n", this_usbduxsub->comedidev->minor, result);
}
result = USB_BULK_MSG(this_usbduxsub->usbdev,
usb_rcvbulkpipe(this_usbduxsub->usbdev,
COMMAND_IN_EP),
- this_usbduxsub->insnBuffer, SIZEINSNBUF, &nrec, 1 * HZ);
+ this_usbduxsub->insnBuffer, SIZEINSNBUF, &nrec, BULK_TIMEOUT);
if (result < 0) {
printk("comedi%d: insn: USB error %d while receiving DUX command\n", this_usbduxsub->comedidev->minor, result);
return result;
void *data, __u16 size, int millisec_timeout)
{
return usb_control_msg(dev, pipe, request, requesttype, value, index,
- data, size, msecs_to_jiffies(millisec_timeout));
+ data, size,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+ msecs_to_jiffies(millisec_timeout)
+#else
+ millisec_timeout
+#endif
+ );
}
static inline int USB_BULK_MSG(struct usb_device *usb_dev, unsigned int pipe,
void *data, int len, int *actual_length, int millisec_timeout)
{
return usb_bulk_msg(usb_dev, pipe, data, len, actual_length,
- msecs_to_jiffies(millisec_timeout));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+ msecs_to_jiffies(millisec_timeout)
+#else
+ millisec_timeout
+#endif
+ );
}
#else
#define USB_CONTROL_MSG usb_control_msg