Welcome, Guest. Please login or register.
Did you miss your activation email?
April 25, 2014, 01:30:16 AM
Home Help Search Login Register
News: Added OBDLink MX forum board.

ScanTool.net Forum  |  Software  |  ScanTool.net Software  |  Topic: Building ScanTool Version 1.11 on Fedora Core 4 « previous next »
Pages: [1] Go Down Print
Author Topic: Building ScanTool Version 1.11 on Fedora Core 4  (Read 7780 times)
jpsmith
Newbie
*
Posts: 2


My motto here...


View Profile
« on: January 25, 2006, 09:52:55 AM »

This is how I got ScanTool to work.  It works for me.  
It may or may not work for you and I do not guarantee that you will not destroy your system.  Follow these instructions at your own risk.

First, I assume that you have all the programing and development tools installed, including dos2unix, and know how to use them.  Open a terminal and create a suitable working directory. (I am using
Code:
tags to indicate code or terminal input.  Unfortunately, they do not appear to be in YaBBC)

[CODE]
Applications->System Tools->Terminal
[username@localhost ~]$ mkdir car
[username@localhost ~]$ cd car

Second, install Allegro from the extras repository

Code:
[username@localhost car]$ su root
Password:
[root@localhost car]# yum install allegro allegro-devel allegro-tools
[root@localhost car]# exit

The current version of Allegro in the repository is 4.0.3.  The latest version of Allegro is 4.2.0.  The repository will eventually catch up but, at present, ScanTool 1.11 makes a call to a routine not in 4.0.3 and so must be patched; more later.

Third, install dzcomm

This is not in the official repositories so you have to get the source zip file from http://dzcomm.sourceforge.net/.  Just follow the links and download the latest release, 0.9.9i, to the file dz099i.zip in a directory of your choice.

Create a build directory, for example:-

Code:
[username@localhost car]$ mkdir eobd
[username@localhost car]$ cd eobd

Now download dz099i.zip to it and unzip the file.  This creates a directory to contain the package.

Code:
[username@localhost eobd]$ unzip dz099i.zip
[username@localhost eobd]$ cd dz099i

Now build dzcomm according to the instructions in readme.uni

Code:
[username@localhost dz099i]$ chmod +x fixunix.sh
[username@localhost dz099i]$ ./fixunix.sh
[username@localhost dz099i]$ ./configure -help
[username@localhost dz099i]$ ./configure
[username@localhost dz099i]$ make depend
[username@localhost dz099i]$ make

Installing requires root privileges.  The default installation path for the package is /usr/local which should be perfectly safe on Fedora Core 4.

Code:
[username@localhost ~]$ su root
Password:
[root@localhost dz099i]# make install
[root@localhost dz099i]# exit
[username@localhost dz099i]$ cd ..

Fourth, install ScanTool

Get the source zip file from http://www.scantool.net/index.htm.  Again, just follow the links and download the latest release, v1.11, to the file scantool111src.zip in a directory of your choice.

Create a build directory for ScanTool, for example:-

Code:
[username@localhost eobd]$ mkdir scantool111

Now download scantool111src.zip to it and unzip the file.  Be more carefull this time, as the files in the package are expanded into the current directory.

Code:
[username@localhost eobd]$ cd scantool111
[username@localhost scantool111]$ unzip scantool111src.zip

If you now try and make the package, make will fail.  You will have to edit four files first.  These are; makefile, serial.c, sensors.c and custom_gui.c.

serial.c makes a call to a routine in dzcomm with an incorrect number of arguments. You can check this by doing:-

Code:
[username@localhost scantool111]$ grep -R _add_exit_func .
[username@localhost scantool111]$ grep -R _add_exit_func /usr/local/include

sensors.c and custom_gui.c make calls to a routine in Allegro 4.2.0 which is not present in version 4.0.3. Try doing:-

Code:
[username@localhost scantool111]$ grep -R gui_textout_ex .
[username@localhost scantool111]$ grep -R gui_textout /usr/include/allegro

Unfortunately, the old routine, gui_textout, assumes a black background and so cannot be substituted.

Before editing these files, it might be preferable to convert them from dos files to unix files.  Although this may not be essential, depending on which editor you use.

Code:
[username@localhost scantool111]$ dos2unix makefile
[username@localhost scantool111]$ dos2unix serial.c
[username@localhost scantool111]$ dos2unix sensors.c
[username@localhost scantool111]$ dos2unix custom_gui.c

Now edit makefile

change the lines containing:-
Code:
   AL_LIBS = -lalld
or:-
Code:
   AL_LIBS = -lalleg
to:-
Code:
   AL_LIBS = `allegro-config --libs`
(Note the back ticks.)
change the line containing:-
Code:
BIN = ScanTool.exe
to :-
Code:
BIN = ScanTool

Next, edit serial.c

change the line containing:-
Code:
  _add_exit_func(serial_module_shutdown, "serial_module_shutdown");
to:-
Code:
  _add_exit_func(serial_module_shutdown);

Next edit sensors.c

replace the two consecutive lines containing:-
Code:
           gui_textout_ex(screen, sensor->label, d->x + SENSOR_LABEL_MARGIN - gui_strlen(sensor->label), d->y, d->fg, d->bg, FALSE);
            gui_textout_ex(screen, sensor->screen_buf, d->x + SENSOR_LABEL_MARGIN + SENSOR_VALUE_INDENT, d->y, ((d->flags & D_DISABLED) ? gui_mg_color : d->fg), d->bg, FALSE);
with:-
Code:
           int x = d->x ;
            int fg = d->fg ;
            void *dp = d->dp ;

            d->x = x + SENSOR_LABEL_MARGIN - gui_strlen(sensor->label) ;
            d->dp = sensor->label ;
            d_text_proc ( msg, d, c ) ;
            d->x = x + SENSOR_LABEL_MARGIN + SENSOR_VALUE_INDENT ;
            d->fg = (d->flags & D_DISABLED) ? gui_mg_color : fg ;
            d->dp = sensor->screen_buf ;
            d_text_proc ( msg, d, c ) ;

            d->dp = dp ;
            d->fg = fg ;
            d->x = x ;

and finally, edit custom_gui.c

replace the consecutive lines containing:-
Code:
     int fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
      FONT *oldfont = font;

      if (d->dp2)
        font = d->dp2;

      gui_textout_ex(screen, d->dp, d->x, d->y, fg, d->bg, TRUE);

      font = oldfont;
with:-
Code:
     FONT *oldfont = font;
      int fg = d->fg ;

      if ( d->dp2 ) font = d->dp2 ;
      d->fg = (d->flags & D_DISABLED) ? gui_mg_color : fg ;
      d_ctext_proc ( msg, d, c ) ;

      d->fg = fg ;
      font = oldfont;

Now it should compile.

Code:
[username@localhost scantool111]$ make

If you now try to run ScanTool it will segfault when trying to open the serial port.  It would be better if it returned an error message to the user and then exited gracefully.  You need root privileges to access serial ports.

Code:
[username@localhost scantool111]$ su root
Password:
[root@localhost scantool111]# ./ScanTool&

ScanTool defaults to opening in Full Screen mode but changing to Windowed mode in the Options menu gives more sensible behaviour.

I have tried using ScanTool with an ELM327MS from SK Pang on a 2003 Honda Civic with a D14Z6 engine.  Initially, it was not able to identify the protocol being used.  On accessing the ELM327MS through a terminal emulator (minicom) I discovered that the protocol was set to SAE J1850 VPW. I reset it to ISO 9141-2, using the command ATSP 3, and ScanTool worked thereafter.

If you need to use minicom do:-

Code:
[root@localhost scantool111]# cat > /etc/minirc.elmscan << "EOF"
# Machine-generated file - use "minicom -s" to change parameters.
pr port             /dev/ttyS0
pu baudrate         9600
pu bits             8
pu parity           N
pu stopbits         1
pu minit            ^M~ATI^M~
pu mreset           ^M~ATZ^M~
pu rtscts           No

EOF
[root@localhost scantool111]# minicom -m -w elmscan

The AT commands can be found in the data sheet from ELM at http://www.elmelectronics.com/DSheets/ELM327DS.pdf
Logged
Art
Jr. Member
**
Posts: 59

If it aint broke you aint tryin hard enough


View Profile
« Reply #1 on: January 27, 2006, 10:04:56 PM »

Hi;
I tried to follow each of the steps in your proceedure and I thought all went well after clearing a couple of typos all went well except for the compile/link  error below..
allegro-config lives in /usr/bin (/usr/bin is in $PATH) and is +x

.log = output of ¨make >& make_scantool-1.11-1.log
  ____________________________________________
gcc -O -Wall -Werror -c main.c
gcc -O -Wall -Werror -c main_menu.c
gcc -O -Wall -Werror -c serial.c
gcc -O -Wall -Werror -c options.c
gcc -O -Wall -Werror -c sensors.c
gcc -O -Wall -Werror -c trouble_code_reader.c
gcc -O -Wall -Werror -c custom_gui.c
gcc -O -Wall -Werror -c error_handlers.c
gcc -O -Wall -Werror -c about.c
gcc -O -Wall -Werror -o ScanTool main.o main_menu.o serial.o options.o sensors.o trouble_code_reader.o custom_gui.o error_handlers.o about.o -ldzcom ´allegro-config --libs´
gcc: ´allegro-config: No such file or directory
make: *** [ScanTool] Error 1

First few lines of my makefile, the only place in all the source directory files where ´allegro-=config´ appears in lines 5, 10, and 13 after the patches to makefile were made.
____________________________________________________
CC = gcc

ifdef DEBUGMODE
   CFLAGS = -g -Wall
   AL_LIBS = ´allegro-config --libs´
   DEFINES = -DDEBUG
else
ifdef RELEASE
   CFLAGS = -Wall -Os -fexpensive-optimizations -s
   AL_LIBS = ´allegro-config --libs´
else
   CFLAGS = -O -Wall
   AL_LIBS = ´allegro-config --libs´

_____________________________________________________
I am not sure of the expected results of the following grep -R comnands;
so I did not /could not confirm that it worked as intended
i did patch serial.c and sensors.c after the greps and found thr original code as described in your ´before´ descriptions..
_____________________________________________________

If you now try and make the package, make will fail.  You will have to edit four files first.  These are; makefile, serial.c, sensors.c and custom_gui.c.

serial.c makes a call to a routine in dzcomm with an incorrect number of arguments. You can check this by doing:-

Code:
[username@localhost scantool111]$ grep -R _add_exit_func .
[username@localhost scantool111]$ grep -R _add_exit_func /usr/local/include

sensors.c and custom_gui.c make calls to a routine in Allegro 4.2.0 which is not present in version 4.0.3. Try doing:-

Code:
[username@localhost scantool111]$ grep -R gui_textout_ex .
[username@localhost scantool111]$ grep -R gui_textout /usr/include/allegro
_____________________________________________________

I hope you can give me a clue because I sure do not have one. Huh
« Last Edit: January 28, 2006, 12:44:14 AM by Art » Logged

Electronic Design Rule #1
"KISS"
¨Keep It Simple Stupid¨
Slim Fuller Chief Engineer
Broadcast Equipment Division
Sarkes-Tarzian Inc. Bloomington, Indiana 1959
jpsmith
Newbie
*
Posts: 2


My motto here...


View Profile
« Reply #2 on: January 28, 2006, 10:40:11 AM »

Hi Art

Look carefully at your makefile, you have:-

  AL_LIBS = ´allegro-config --libs´

and what you should have is:-

    AL_LIBS = `allegro-config --libs`

ASCII Back Ticks (single byte 60 Hex) not the non-ASCII byte pair c2 b4.  On my keyboard the backtick is the top-left most character of the main keyboard, but I have a UK keyboard.  I just checked wikipedia and it looks like the Back Tick is in the same place. See:-

http://en.wikipedia.org/wiki/Keyboard_layout#US

The greps are intended to indicate the difference between what ScanTool calls and the prototypes the libraries offer.  Thus confirming why the compile would fail.

[username@localhost scantool111]$ grep -R _add_exit_func .
./serial.c:   _add_exit_func(serial_module_shutdown, "serial_module_shutdown");
[username@localhost scantool111]$ grep -R _add_exit_func /usr/local/include
/usr/local/include/dzcomm/aintern.h:AL_FUNC(void, _add_exit_func, (void (*func)(void)));

[username@localhost scantool111]$ grep -R gui_textout_ex .
./sensors.c:            gui_textout_ex(screen, sensor->label, d->x + SENSOR_LABEL_MARGIN - gui_strlen(sensor->label), d->y, d->fg, d->bg, FALSE);
./sensors.c:            gui_textout_ex(screen, sensor->screen_buf, d->x + SENSOR_LABEL_MARGIN + SENSOR_VALUE_INDENT, d->y, ((d->flags & D_DISABLED) ? gui_mg_color : d->fg), d->bg, FALSE);
./custom_gui.c:      gui_textout_ex(screen, d->dp, d->x, d->y, fg, d->bg, TRUE);
[username@localhost scantool111]$ grep -R gui_textout /usr/include/allegro
/usr/include/allegro/gui.h:AL_FUNC(int, gui_textout, (struct BITMAP *bmp, AL_CONST char *s, int x, int y, int color, int centre));



« Last Edit: January 28, 2006, 10:57:56 AM by jpsmith » Logged
Art
Jr. Member
**
Posts: 59

If it aint broke you aint tryin hard enough


View Profile
« Reply #3 on: January 28, 2006, 12:54:03 PM »

Vola Shocked Wink Cheesy
A lowly forward tic migrates to  back tic and we have a *ScanTool
Many thanks first for the post and second for the help.

Art
Logged

Electronic Design Rule #1
"KISS"
¨Keep It Simple Stupid¨
Slim Fuller Chief Engineer
Broadcast Equipment Division
Sarkes-Tarzian Inc. Bloomington, Indiana 1959
Art
Jr. Member
**
Posts: 59

If it aint broke you aint tryin hard enough


View Profile
« Reply #4 on: February 09, 2006, 01:01:15 PM »

jp;
I am continuing my experiments. After upgrading to Allegro-4.2.0 I compile (make) after only patching the makefile as you suggested. All went well except  for a minor problem with Allegro failing to switch to "Windowed Mode" with a error of;
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  134 (XFree86-VidModeExtension)
  Minor opcode of failed request:  10 (XF86VidModeSwitchToMode)
  Value in failed request:  0x3000001
  Serial number of failed request:  12241
  Current serial number in output stream:  12246
Aborted
 
At that point it left my "X" screen in a much lower resolution, 640x400 ?, esaly fixed with (cntl  alt -). I am now investigating what screen resolution ScanTool is trying to set, and decoding the Allegro error message.

Art
I am now in the process of modifying ths main.c module and the makefile from "windows" notation to "Unix / Linux notation and updating to a more current video GUI level by increasing screen resolution from 640x480 to at least 800x600 and getting more buffer space by increasing minimun memory. Since I have not found any protocol scan initialization code (still hunting) I am thinking of adding that function. I intend to release my changes to the code here on this forum.  This could / should start a true "Open Source" GPM project.

Art
« Last Edit: February 11, 2006, 05:31:03 AM by Art » Logged

Electronic Design Rule #1
"KISS"
¨Keep It Simple Stupid¨
Slim Fuller Chief Engineer
Broadcast Equipment Division
Sarkes-Tarzian Inc. Bloomington, Indiana 1959
Pages: [1] Go Up Print 
ScanTool.net Forum  |  Software  |  ScanTool.net Software  |  Topic: Building ScanTool Version 1.11 on Fedora Core 4 « previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!