#define BOARDNAME "usbdux"
// timeout for the USB-transfer
-#define EZTIMEOUT 3
+#define EZTIMEOUT 30
// constants for "firmware" upload and download
#define USBDUXSUB_FIRMWARE 0xA0
if (usbduxsub->probed) {
// 7f92 to zero
local_transfer_buffer[0]=0;
- errcode=usb_control_msg
+ errcode=USB_CONTROL_MSG
(usbduxsub->usbdev,
// create a pipe for a control transfer
usb_sndctrlpipe(usbduxsub->usbdev,0),
if (usbduxsub->probed) {
// 7f92 to one
local_transfer_buffer[0]=1;
- errcode=usb_control_msg
+ errcode=USB_CONTROL_MSG
(usbduxsub->usbdev,
usb_sndctrlpipe(usbduxsub->usbdev,0),
// bRequest, "Firmware"
startAddr,
local_transfer_buffer[0]);
#endif
- errcode=usb_control_msg
+ errcode=USB_CONTROL_MSG
(usbduxsub->usbdev,
usb_sndctrlpipe(usbduxsub->usbdev, 0),
// brequest, firmware
}
printk("\n");
#endif
- result = usb_bulk_msg(this_usbduxsub->usbdev,
+ result = USB_BULK_MSG(this_usbduxsub->usbdev,
usb_sndbulkpipe(this_usbduxsub->usbdev,
COMMAND_OUT_EP),
this_usbduxsub->dux_commands,
int i;
for(i=0;i<RETRIES;i++) {
- result = usb_bulk_msg(this_usbduxsub->usbdev,
+ result = USB_BULK_MSG(this_usbduxsub->usbdev,
usb_rcvbulkpipe(this_usbduxsub->usbdev,
COMMAND_IN_EP),
this_usbduxsub->insnBuffer,
#define BOARDNAME "usbduxfast"
// timeout for the USB-transfer
-#define EZTIMEOUT 3
+#define EZTIMEOUT 30
// constants for "firmware" upload and download
#define USBDUXFASTSUB_FIRMWARE 0xA0
}
printk("\n");
#endif
- result = usb_bulk_msg(this_usbduxfastsub->usbdev,
+ result = USB_BULK_MSG(this_usbduxfastsub->usbdev,
usb_sndbulkpipe(this_usbduxfastsub->usbdev,
CHANNELLISTEP),
this_usbduxfastsub->dux_commands,
SIZEOFDUXBUFFER,
&nsent,
- 10*HZ);
+ 10000);
if (result<0) {
printk("comedi%d: could not transmit dux_commands to the usb-device, err=%d\n",
this_usbduxfastsub->comedidev->minor,result);
if (usbduxfastsub->probed) {
// 7f92 to zero
local_transfer_buffer[0]=0;
- errcode=usb_control_msg
+ errcode=USB_CONTROL_MSG
(usbduxfastsub->usbdev,
// create a pipe for a control transfer
usb_sndctrlpipe(usbduxfastsub->usbdev,0),
if (usbduxfastsub->probed) {
// 7f92 to one
local_transfer_buffer[0]=1;
- errcode=usb_control_msg
+ errcode=USB_CONTROL_MSG
(usbduxfastsub->usbdev,
usb_sndctrlpipe(usbduxfastsub->usbdev,0),
// bRequest, "Firmware"
startAddr,
local_transfer_buffer[0]);
#endif
- errcode=usb_control_msg
+ errcode=USB_CONTROL_MSG
(usbduxfastsub->usbdev,
usb_sndctrlpipe(usbduxfastsub->usbdev, 0),
// brequest, firmware
(int)(usbduxfastsub->urbIn->dev));
#endif
for(i=0;i<PACKETS_TO_IGNORE;i++) {
- err=usb_bulk_msg(usbduxfastsub->usbdev,
+ err=USB_BULK_MSG(usbduxfastsub->usbdev,
usb_rcvbulkpipe(usbduxfastsub->usbdev,BULKINEP),
usbduxfastsub->transfer_buffer,
SIZEINBUF,
&actual_length,
- 10*HZ);
+ 10000);
if (err<0) {
printk("comedi%d: insn timeout. No data.\n",
dev->minor);
}
// data points
for(i=0;i<insn->n;) {
- err=usb_bulk_msg(usbduxfastsub->usbdev,
+ err=USB_BULK_MSG(usbduxfastsub->usbdev,
usb_rcvbulkpipe(usbduxfastsub->usbdev,BULKINEP),
usbduxfastsub->transfer_buffer,
SIZEINBUF,
&actual_length,
- 10*HZ);
+ 10000);
if (err<0) {
printk("comedi%d: insn data error: %d\n",
dev->minor,err);
#define __COMPAT_LINUX_USB_H_
#include <linux/version.h>
+#include <linux/time.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
#define USB_ALLOC_URB(x) usb_alloc_urb(x)
#include_next <linux/usb.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+static inline int USB_CONTROL_MSG(struct usb_device *dev, unsigned int pipe,
+ __u8 request, __u8 requesttype, __u16 value, __u16 index,
+ void *data, __u16 size, int millisec_timeout)
+{
+ return usb_control_msg(dev, pipe, request, requesttype, value, index,
+ data, size, msecs_to_jiffies(millisec_timeout));
+}
+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));
+}
+#else
+#define USB_CONTROL_MSG usb_control_msg
+#define USB_BULK_MSG usb_bulk_msg
+#endif
+
#endif