Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

Fixing digitemp with LinkUSB on kernels after 2.6.32-24 Linux

Posted by Admin • Tuesday, January 11. 2011 • Category: Linux

As many people have discovered, kernels after 2.6.32-24 changed the USB-RS232 serial driver to not set hardware flow control (RTS/DTS) flags. No doubt there was a good reason. Unfortunately, digitemp and owfs don't enable it either, also probably for a good reason - at least when applied to older devices. What this means is that now when you try to use a LinkUSB (and probably other DS9097U type hardware behind USB to Serial converters), digitemp and owfs no longer work.

Let's apply a time-tested hackish approach.

The error looks like this:

$ ./digitemp_DS9097U -s /dev/ttyUSB0 -w DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane GNU Public License v2.0 - http://www.digitemp.com Error 5: DS2480B Adapter Not Detected Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed Error 10: Read COM Failed

After some reading I found a reference to the offending commit to the ftdi_sio.c driver

This is great and all, but to me this is basically gibberish. "use TIOCMSET/TIOCMBI[SC] after port open" ? What this means to us is that if you run minicom -s /dev/ttyUSB0 with normal settings (hardware flow control enabled), you can talk to the LinkUSB just fine.

Good news is, someone has already solved this issue in owfs code. Fortunately, patching digitemp is exactly the same:


  1. Download the latest digitemp (3.6.0 at this time, though when compiled it reports 3.5.0).
  2. Edit userial/ds9097u/linuxlnk.c
  3. Make the change as per diff below
  4. run make ds9097u
  5. You should have a hacked up version that enables flow control now

@@ -161,8 +161,8 @@
    t.c_iflag |= IGNBRK|IGNPAR;
    t.c_oflag &= ~(OPOST);
-   t.c_cflag &= ~(CRTSCTS|CSIZE|HUPCL|PARENB);
-   t.c_cflag |= (CLOCAL|CS8|CREAD);
+   t.c_cflag &= ~(CSIZE|HUPCL|PARENB);
+   t.c_cflag |= (CRTSCTS|CLOCAL|CS8|CREAD);
    t.c_cc[VMIN] = 0;
    t.c_cc[VTIME] = 3;</blockquote></pre>

(Of course you will need a normal build env on your system)

I'm thinking that the proper way to fix this would either be to add a runtime flag to digitemp, or to introduce yet another diigtemp variant (digitemp_linkusb?)

0 Trackbacks

  1. No Trackbacks


Display comments as (Linear | Threaded)
  1. No comments

Add Comment

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

What is the primary language of this blog? (Anti-SPAM question)

Submitted comments will be subject to moderation before being displayed.