dt9812.c comedi driver loading issues

20 views
Skip to first unread message

fred brooks

unread,
Mar 29, 2025, 4:45:38 PMMar 29
to Comedi: Linux Control and Measurement Device Interface

Trying to get this to work with a DT9812 but am having some strange problems. The first thing is the returned product ID is sort of reversed from the device model.
 usb 4-1: New USB device found, idVendor=0867, idProduct=1298, bcdDevice= 0.00

The driver dt9812_usb_table in dt9812.c was changed to match that number.

static const struct usb_device_id dt9812_usb_table[] = {
        { USB_DEVICE(0x0867, 0x1298) },
        { }
};

The original value inthe driver struct was  (0x0867, 0x9812)

Now the recompiled  dt9812 module actually loads and tried to run but this is the result:

[240608.280804] comedi: version 0.7.76 - http://www.comedi.org
[240608.298984] comedi comedi0: Wrong number of endpoints
[240608.298990] dt9812 3-9.3:1.0: driver 'dt9812' failed to auto-configure device.
[240608.299072] usbcore: registered new interface driver dt9812

The number of end points returned is zero. 


The VM110N driver (also USB) works fine.

[ 3251.595450] usb 1-1.4: new full-speed USB device number 9 using ehci-platform
[ 3251.702245] usb 1-1.4: New USB device found, idVendor=10cf, idProduct=5501, bcdDevice= 0.02
[ 3251.702285] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3251.702302] usb 1-1.4: Product: K8055N/VM110N USB Experiment Board
[ 3251.702315] usb 1-1.4: Manufacturer: Velleman Instruments
[ 3251.736447] comedi comedi0: driver 'vmk80xx' has successfully auto-configured 'K8055 (VM110)'.
[ 3251.736675] usbcore: registered new interface driver vmk80xx

Running Debian 6.12.20-amd64 and I also tried with an Orange PI arm64 machine with the same result after the driver modifications to match the idProduct=1298

Source of the error message.
static int dt9812_find_endpoints(struct comedi_device *dev)
{              
        struct usb_interface *intf = comedi_to_usb_interface(dev);
        struct usb_host_interface *host = intf->cur_altsetting;
        struct dt9812_private *devpriv = dev->private;
        struct usb_endpoint_descriptor *ep;
        int i;  
                       
        if (host->desc.bNumEndpoints != 5) {
                dev_err(dev->class_dev, "Wrong number of endpoints\n");
                return -ENODEV;
        } 

Yes, the DT9812 works using the Windows driver  running Win11

ReplyForward

Ian Abbott

unread,
Mar 31, 2025, 7:48:48 AMMar 31
to comed...@googlegroups.com
Hi Fred,

On 2025-03-29 20:45, 'fred brooks' via Comedi: Linux Control and
Measurement Device Interface wrote:
>
> Trying to get this to work with a DT9812 but am having some strange
> problems. The first thing is the returned product ID is sort of reversed
> from the device model.
>  usb 4-1: New USB device found, idVendor=0867, idProduct=1298,
> bcdDevice= 0.00
>
> The driver dt9812_usb_table in dt9812.c was changed to match that number.
>
> static const struct usb_device_id dt9812_usb_table[] = {
>         { USB_DEVICE(0x0867, 0x1298) },
>         { }
> };
>
> The original value inthe driver struct was  (0x0867, 0x9812)
>
> Now the recompiled  dt9812 module actually loads and tried to run but
> this is the result:
>
> [240608.280804] comedi: version 0.7.76 - http://www.comedi.org <http://
> www.comedi.org/>
> [240608.298984] comedi comedi0: Wrong number of endpoints
> [240608.298990] dt9812 3-9.3:1.0: driver 'dt9812' failed to auto-
> configure device.
> [240608.299072] usbcore: registered new interface driver dt9812
>
> The number of end points returned is zero.
[snip]
> Running Debian 6.12.20-amd64 and I also tried with an Orange PI arm64
> machine with the same result after the driver modifications to match
> the idProduct=1298
>
> Source of the error message.
> static int dt9812_find_endpoints(struct comedi_device *dev)
> {
>         struct usb_interface *intf = comedi_to_usb_interface(dev);
>         struct usb_host_interface *host = intf->cur_altsetting;
>         struct dt9812_private *devpriv = dev->private;
>         struct usb_endpoint_descriptor *ep;
>         int i;
>
>         if (host->desc.bNumEndpoints != 5) {
>                 dev_err(dev->class_dev, "Wrong number of endpoints\n");
>                 return -ENODEV;
>         }
>
> Yes, the DT9812 works using the Windows driver  running Win11

Looking at the "DT9812_Kmdf.inf" file from the Windows drivers installed
by the "Omni-CD"
https://files.digilent.com/#downloads/DTSoftware/Omni-CD/
, in
C:\Program Files (x86)\Data Translation\DeviceDriversEV\DT9812
, the device ID USB\VID_0867&PID_1298 appears to be a "DT9812 Firmware
Loader" device. That .inf file also supports "DT9812" (PID 0x9812),
"DT9813" (PID 0x9813), and "DT9814" (PID 0x9814). The "DT9812 Firmware
Loader" device uses a different kernel driver (.sys) file than the others:

* DT9812 Firmware Loader: DT9812ld_x86.sys or dt9812ld_x64.sys
* DT9812, DT9813, DT9814: DT9812k.sys or DT9812k_x64.sys

Perhaps the ID changes after the firmware is updated? Or perhaps the
"DT9812 Firmware Loader" device is a hardware re-spin of the old device?
I don't really know, to be honest.

--
-=( Ian Abbott <abb...@mev.co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

fred brooks

unread,
Mar 31, 2025, 9:12:58 AMMar 31
to comed...@googlegroups.com
Thanks for the reply. I'm trying a few things to get more info on the device.

 lsusb
Bus 003 Device 005: ID 0867:1298 Data Translation, Inc. 

The alternative setting is zero on boot. That has zero endpoints.

 lsusb -D /dev/bus/usb/003/005 gives 4 alts with 6 endpoints from 1 to 3 and zero endpoints in alt 0.

The first port, rest in an attachment. lo.txt
Device: ID 0867:1298 Data Translation, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0x0867 Data Translation, Inc.
  idProduct          0x1298
  bcdDevice            0.00
  iManufacturer           0
  iProduct                0
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x00ab
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           6
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0

I'm using usb_set_interface in a modifieddt9812_find_endpoints in the  driver to check various alts and end-points combinations. 

static int dt9812_find_endpoints(struct comedi_device *dev)
{
        struct usb_interface *intf = comedi_to_usb_interface(dev);
        struct usb_host_interface *host = intf->cur_altsetting;
        struct dt9812_private *devpriv = dev->private;
        struct usb_endpoint_descriptor *ep;
        int i;

        usb_set_interface(comedi_to_usb_dev(dev), 0, 1);
        intf = comedi_to_usb_interface(dev);
        host = intf->cur_altsetting;

        if (host->desc.bNumEndpoints != 6) {
                dev_err(dev->class_dev, "Wrong number of endpoints %d, num alts %d\n", host->desc.bNumEndpoints,
                intf->num_altsetting);
                return -ENODEV;
        }

        dev_err(dev->class_dev, "Number of endpoints %d, num alts %d\n", host->desc.bNumEndpoints,
                intf->num_altsetting);

        for (i = 0; i < host->desc.bNumEndpoints; ++i) {
                int dir = -1;

                ep = &host->endpoint[i].desc;
                switch (i) {
                case 0:
                        dir = USB_DIR_OUT;
                        devpriv->cmd_wr.addr = ep->bEndpointAddress;
                        devpriv->cmd_wr.size = usb_endpoint_maxp(ep);
                        break;
                case 1:
                        dir = USB_DIR_IN;
                        devpriv->cmd_rd.addr = ep->bEndpointAddress;
                        devpriv->cmd_rd.size = usb_endpoint_maxp(ep);
                        break;
                case 2:
                        /* unused message pipe */
                        dir = USB_DIR_OUT;
                        break;
                case 3:
                        /* unused write stream */
                        dir = USB_DIR_OUT;
                        break;
                case 4:
                        /* unused read stream */
                        dir = USB_DIR_IN;
                        break;
                case 5:
                        /* unused write stream */
                        dir = USB_DIR_IN;
                        break;
                }
                if ((ep->bEndpointAddress & USB_DIR_IN) != dir) {
                        dev_err(dev->class_dev,
                                "Endpoint has wrong direction %d\n",i);
                        return -ENODEV;
                }
        }
        return 0;
}

[  242.024005] comedi: version 0.7.76 - http://www.comedi.org
[  242.028813] comedi comedi0: Number of endpoints 6, num alts 4
[  243.035601] comedi comedi0: unable to reset configuration
[  243.035620] dt9812 3-1.6:1.0: driver 'dt9812' failed to auto-configure device.
[  243.035773] dt9812: probe of 3-1.6:1.0 failed with error -22
[  243.035799] usbcore: registered new interface driver dt9812

--
You received this message because you are subscribed to the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this group and stop receiving emails from it, send an email to comedi_list...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/comedi_list/d63c20d2-71b6-4575-b46e-da442161bf05%40mev.co.uk.
lo.txt

fred brooks

unread,
Mar 31, 2025, 11:21:00 PMMar 31
to comed...@googlegroups.com
Yes, it looks like the dt1298 is for the firmware uploader function and dt9812 is for the actual DAQ device. I uploaded the latest firmware using windows while on the device driver screen. It doesn't need a download first to operate as it's already been installed.
Unsure how to make the DAQ dt9812  productID get detected when the DT9812 module is loaded. Using USB wireshark on windows to see what happens when the device is  started and operates to get some hints.

Looks like it's not seeing the proper configuration endpoint for dt9812. it sees the firmware upload interface first and only.

Mar 31 20:15:26 hpha kernel: usb 3-1.6: USB disconnect, device number 6
Mar 31 20:15:30 hpha kernel: usb 3-1.6: new full-speed USB device number 7 using ehci-pci
Mar 31 20:15:30 hpha kernel: usb 3-1.6: New USB device found, idVendor=0867, idProduct=1298, bcdDevice= 0.00
Mar 31 20:15:30 hpha kernel: usb 3-1.6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Mar 31 20:15:30 hpha kernel: comedi comedi0: Number of endpoints 6, num alts 4
Mar 31 20:15:30 hpha kernel: comedi comedi0: unable to reset configuration
Mar 31 20:15:30 hpha kernel: dt9812 3-1.6:1.0: driver 'dt9812' failed to auto-configure device.
Mar 31 20:15:30 hpha kernel: dt9812: probe of 3-1.6:1.0 failed with error -22
Mar 31 20:15:30 hpha mtp-probe[2022]: checking bus 3, device 7: "/sys/devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1.6"
Mar 31 20:15:30 hpha mtp-probe[2022]: bus: 3, device: 7 was not an MTP device
Mar 31 20:15:30 hpha mtp-probe[2024]: checking bus 3, device 7: "/sys/devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1.6"
Mar 31 20:15:30 hpha mtp-probe[2024]: bus: 3, device: 7 was not an MTP device

Thanks for your help again.

On Mon, Mar 31, 2025 at 4:48 AM Ian Abbott <abb...@mev.co.uk> wrote:

fred brooks

unread,
Apr 1, 2025, 1:17:51 PMApr 1
to Comedi: Linux Control and Measurement Device Interface
OK, you were right. It's been flashed with the latest firmware but it still wants something (the original firmware or some other file) downloaded at power-up startup to the dt1298 firmware loader, then it switches to the dt9812 normal id for status and operations.  For now I can hack a battery backup to the device  USB power to hopefully keep it loaded from the windows machine downloader as I move it to testing using the Linux driver that expects the dt9812 id. 

If that works then a load stage will be needed in the driver for cold boot startup and operation. Tks again.



fred brooks

unread,
Apr 1, 2025, 11:10:53 PMApr 1
to Comedi: Linux Control and Measurement Device Interface
Great, making some progress. Used windows to load the firmware on the battery powered (to the PCB) DT9812, unplugged from that and reconnected the normal USB plug to the Linux machine.  Driver loads to the correct product ID now on Linux dt9812. 
Now there are issues with dt9812_read_info (it does read the correct serial) but at least it's alive and able to be debugged.

[17404.053736] usb 1-1.3.4: new full-speed USB device number 25 using ehci-platform
[17404.246561] usb 1-1.3.4: New USB device found, idVendor=0867, idProduct=9812, bcdDevice= 0.04
[17404.246596] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[17404.246616] usb 1-1.3.4: Product: DT ECON DAQ
[17404.246632] usb 1-1.3.4: Manufacturer: Data Translation
[17404.264882] comedi: version 0.7.76 - http://www.comedi.org
[17404.270408] comedi comedi0: USB DT9812 (ffff.ffff.0000) #0x0117fcd4
[17404.270451] comedi comedi0: driver 'dt9812' has successfully auto-configured 'dt9812'.
[17404.272462] usbcore: registered new interface driver dt9812
Reply all
Reply to author
Forward
0 new messages