Novag Citrine on Debian GNU/Linux

This is my first blog entry and I’d like to explain the steps that I followed to play chess with my Novag Citrine connected to my Debian GNU/Linux wheezy box.
The main reason to connect Citrine with the PC is able to store my games against the machine and this way I can analyze all movements and learn what I did wrong. Moreover you could choose other engines installed in your PC (GNU Chess 4/5, Crafty, Sjeng, …) to play your games using citrine board as a simple interface, even play on with the board.

Really it’s not very difficult to achieve that Citrine “talk” with GNU/Linux, mainly because there is a user space driver developed by Maximiliano Pin here that works very well, so in this entry I only want to collect instructions, step by step, followed in my system.

1. Download novagdrv driver from here and its signature:

$ wget http://download.savannah.gnu.org/releases/novagdrv/novagdrv-0.3.tgz
$ wget http://download.savannah.gnu.org/releases/novagdrv/novagdrv-0.3.tgz.sig

2. In order to verify program which we just downloaded, it’s needed to download the project keyring from this link novagdrv-keyring.gpg.

3. Import project keyring (public keys from project members) into your public key store:

 $ gpg --import novagdrv-keyring.gpg
 gpg: key 6002A0BC: public key "Maximiliano Pin " imported
 gpg: Total number processed: 1
 gpg:               imported: 1  (RSA: 1)

4. Verify downloaded file:

$ gpg --verify novagdrv-0.3.tgz.sig novagdrv-0.3.tgz
 gpg: Good signature from ...

5. After verify successfully this file we are going to decompress and compile the driver:

$ tar xvzf novagdrv-0.3.tgz
 $ cd novagdrv-0.3
 $ make
 g++ -g   -c -o main.o main.cc
 g++ -g   -c -o novag.o novag.cc
 g++ -g   -c -o serial.o serial.cc
 g++ -g   -c -o game.o game.cccode>
 g++ -g   -c -o position.o position.cc
 g++ -g -o novagdrv main.o novag.o serial.o game.o position.o

6. When we take a look in current directory we discover that novagdrv binary file has been created, and we move binary file into a /usr/local/bin, for example (any place inside our PATH environment variable):

 # mv novagdrv /usr/local/bin

7. The driver uses /dev/ttyS0 as default COM device, so if we connect Citrine to other device we previously must create a text file $HOME/.novagdrvrc with this content:

device=/dev/ttyUSB0

We could use a USB to serial RS232 adapter if your computer hasn’t a COM device.

8. In order to test the driver you can connect Citrine and run the binary file and if all it’s OK you’ll see the movements made in the board written on the terminal:

$ novagdrv &
 e4-e5...

Once driver works we need applications to analyze and play games. In the first place we are going to install ChessDB.

CHESSDB

First of all we download its sources from here. We should get MD5 and SHA1 fingerprints from its download page:

MD5: 6aee2e4eca26576cbe6e63dc6b8d55db
SHA1: 456ff217ebdb0f6231a507ce737747c964f77f6e

1. Again we check downloaded file integrity:

$ echo "6aee2e4eca26576cbe6e63dc6b8d55db  ChessDB-3.6.18.tar.gz" > chessdb.md5
$ md5sum -c chessdb.md5
ChessDB-3.6.18.tar.gz: OK

Also we can check with SHA1 checksum, although obviously it’s not necessary verify twice downloaded file:

$ echo "456ff217ebdb0f6231a507ce737747c964f77f6e  ChessDB-3.6.18.tar.gz" > chessdb.sha1
$ sha1sum -c chessdb.sha1
ChessDB-3.6.18.tar.gz: OK

2. Decompress and apply patch found with novag user space driver:

$ tar xvzf ChessDB-3.6.18.tar.gz
$ patch -p1 < ../../driver/novagdrv-0.3/ChessDB-3.6.18-novagdrv.patch
patching file Makefile.conf
patching file Makefile.mingw
patching file tcl/file.tcl
patching file tcl/lang/english-basic.tcl
patching file tcl/menus.tcl
patching file tcl/start.tcl
patching file tcl/tools/novagdrv.tcl

Be sure that our system satisfies all software requirements to be able to compile sources files, in my case I had to install two packages:

# aptitude install tcl8.5-dev tk8.5-dev

If you want to test your Tcl/Tk version you can run:

$ tclsh
% info patchlevel
8.5.11
% exit

3. Edit configure script to add a new location for X11 libraries (I had forgotten to say that my Debian is 64 bits version):

$ find /usr -name "libX11*"
 ...
 set x11Path {
 /usr/lib/i386-linux-gnu # 32 bits
 /usr/lib/x86_64-linux-gnu
 ...
 }

 $ ./configure
 configure: Makefile configuration program for ChessDB
 Renaming "Makefile" to "Makefile.bak"
 Tcl/Tk version: 8.5
 Your operating system is: Linux 3.1.0-1-amd64
 Location of "tcl.h": /usr/include/tcl8.5
 Location of "tk.h": /usr/include/tcl8.5
 Location of Tcl 8.5 library: /usr/lib
 Location of Tk 8.5 library: /usr/lib
 Location of X11 library: /usr/lib/x86_64-linux-gnu
 The Makefile configured for your system was written.
 Now just type "make" to compile ChessDB.
 # make install

And that’s all to ChessDB Debian installation:

$ chessdb

Select this option: Tools -> Novag Chess Computer.

EBOARD

Installation procedure to Eboard is very similar to the previous one so we’re going to comment only some steps.
Download source code from here

1. Apply novag patch:

$ tar xvjf eboard-1.1.1.tar.bz2
$ cd eboard-1.1.1
$ patch -p1 < ../../driver/novagdrv-0.3/eboard-1.1.1-novagdrv.patch

2. Prepare to compilation process (note that previously I had to install libgtk2.0-dev Debian package):

$ ./configure
 configuring eboard 1.1.1...
 checking sanity of install... ok
 testing C++ compiler...
 trying g++ ... it works
 header verification:
 all headers found.
 header verification:
 sys/audioio.h       : no
 checking for IPPROTO_TCP in netinet/in.h... yes
 checking for TCP_NODELAY in netinet/in.h... no
 checking for SOL_TCP in netinet/in.h... no
 checking for IPPROTO_TCP in netinet/tcp.h... no
 checking for TCP_NODELAY in netinet/tcp.h... yes
 checking for SOL_TCP in netinet/tcp.h... yes
 net options: netinet/tcp.h required, IPPROTO_TCP present.
 looking for pkg-config... /usr/bin/pkg-config
 looking for GTK+ version... 2.24.8, ok
 looking for libpng... 1.2.46, ok
 header verification:
 all headers found.
 wrote config.h
 wrote config.make
 writing Makefile... ok
 creating eboard-config... ok
 creating eboard.spec... ok
Summary:
 eboard version 1.1.1
 binaries  will be installed to    /usr/local/bin
 man pages will be installed under /usr/local/man
 datafiles will be installed to    /usr/local/share/eboard
 NLS support: yes
 done.
 I found a problem compiling eboard patched sources, message printed out for g++ compiler was:
 Invalid conversion from `const char*' to `char*'

3. My dirty solution at this point to fix the problem was to remove ‘const’ restriction in append method editing two files ntext.h and ntext.cc:

$ vim ntext.h
//void append(const char *text, int len, int color);
void append(char *text, int len, int color);
$ vim ntext.cc
//void NText::append(const char *text, int len, int color) {
void NText::append(char *text, int len, int color) {
# make clean && make install

4. Now it’s time to install eboard-extras package to avoid eboard doesn’t find some resources:

<PieceSet::PieceSet> ** file not found: Cmf.png
...
$ tar xvzf eboard-extras-1pl2.tar.gz
$ ./configure
loading cache ./config.cache
checking for make... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking for eboard-config... (cached) /usr/local/bin/eboard-config
checking for eboard >= 0.3.1... yes
creating ./config.status
creating Makefile
Now become root and type 'make install' to install eboard-extras

# make install
...
-----------------------------------------------------------------
 eboard-extras pack 1 is installed
 22 new piece sets, 3 new sounds
 The files should be available in eboard next time
 you start it up. If you upgrade eboard in the future and
 these files "disappear" from the menus, reinstall the
 eboard-extras pack 1.
 -----------------------------------------------------------------
$ eboard -novagport /dev/ttyUSB0

Now it’s time to enjoy your Citrine!


“Man, the living creature, the creating individual, is always more important than any stablished style or system”
— Bruce Lee (Preserving the art and philosophy of Jeet Kune do)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s