So I started off by plugging the thing in, and to my shock and surprise, Linux recognized it and loaded the right driver. Then something called "brltty" squashed it. I did this a few times and then I resorted to the simple solution of un-installing brltty (1).
Now we get ready to compile. You'll need to install build-essential and liballegro4.2-dev. Download the dzcomm source
and unzip it somewhere. Run fixunix.sh, configure and compile dzcomm. So far we haven't deviated from the path very much.
Unzip the scantool source, and try to compile it like this:
make DEFINES="-I ../dz099i/include -DDZCOMM_DJGPP -L../dz099i/lib/unix -lm -lXpm -lXxf86vm -lXcursor -lpthread"
This assumes your scantool directory and dzcomm "dz099i" directory are in the same place. I put mine in my "Desktop" folder. This will fail like this:
gcc -g -Wall -Werror -I ../dz099i/include -DDZCOMM_DJGPP -L../dz099i/lib/unix -lm -lXpm -lXxf86vm -lXcursor -lpthread -c main.c
In file included from ../dz099i/include/dzcomm.h:29,
../dz099i/include/dzcomm/dzconfig.h:53:1: error: "INLINE" redefined
In file included from /usr/include/allegro/base.h:40,
/usr/include/allegro/internal/alconfig.h:88:1: error: this is the location of the previous definition
make: *** [main.o] Error 1
Open up the file dz099i/include/dzcomm/dzconfig.h in your favorite editor and change line 53 from
#define INLINE inline
#define INLINE inline
Now run the long make line from above, and this time scantool will compile. I'm still out of luck, though, because scantool/dzcomm want to open a device called "/dev/ttySnum
" and my ElmScan USB is at /dev/ttyUSB0. No problem, as root do
ln -s ttyUSB0 ttyS4
"4" was the first non-existent ttyS device for me (I have 4 comm ports?!). This is "comm5" as far as the scantool software is concerned.
Launch Scantool as root (you have to be root to run scantool.) Still no dice. It turns out dzcomm doesn't play very nicely with USB serial ports, at least on Ubuntu. You will need to edit the file dz099i/src/linux/lcomm.c and change line 261 to look like this:
/*if (ioctl(port->fd, TIOCSERCONFIG) < 0) return 0;*/
And...it still didn't work. I gave up and used the AT commands method to read the code and clear the MIL. Fortunately (unfortunately?) the MIL light went back on and I decided to try scantool again on a lark. It worked! Now it works every time. Hopefully we'll get that evaporative system leak tracked down soonish.
(1) brltty has something to do with Braille terminals. Uninstalling it will not work for you if you use a Braille terminal.
(2) I think this is necessary because the dzcomm code was last updated in 2003, and Ubuntu uses a very new compiler (gcc 4.1..3). The code in question probably compiles fine with the 3.x line of gcc compilers.
(3) This code was borrowed from the setserial utility (the author says so in the comments.) If you look at the setserial source
you'll notice that particular ioctl is used to attempt auto-configuration of the serial port. I don't understand why the dzcomm code always attempts auto-configuration, even if you specifiy all of the port parameters, and dies if the auto-configuration fails. In any case, it looks like USB serial ports don't like to be auto-configured.