---
author: einar
comments: true
date: 2013-05-01 19:33:17+00:00
layout: post
slug: accessing-casio-ex-word-%e9%9b%bb%e5%ad%90%e8%be%9e%e6%9b%b8-from-linux
title: Accessing Casio EX-WORD 電子辞書 from Linux
wordpress_id: 1176
categories:
- Anime
- General
- Linux
tags:
- exword
- featured
- Japanese
- Linux
---

I'm a (happy!) owner of a [Casio EX-WORD Dataplus 5 XD-A4700](http://casio.jp/exword/products/model/dic/?code=XD-A7400), a Japanese electronic dictionary. Recently I looked into updating the Japanese-English dictionary (currently the Shogakukan PROGRESSIVE dictionary) installed, because it's not good enough: too often when looking up odd sentences (like the ones in Fate/Extra CCC) I do not find any matches.

[EDICT](http://www.csse.monash.edu.au/~jwb/edict.html‎) is adequate, and while I can use it on my phone and tablet, I like the fact that the EX-WORD has a physical keyboard along with the stylus, and a very nice kanji handwriting recognition. After a bit of looking, I found the [5th Edition of the New Kenkyusha dictionary](http://en.wikipedia.org/wiki/Kenky%C5%ABsha), offered [as microSD card](http://casio.jp/exword/soft/detail/#n04),  to be what I needed (but a bit pricey, [10,500 yen on Amazon](http://www.amazon.co.jp/%E3%82%AB%E3%82%B7%E3%82%AA-%E9%9B%BB%E5%AD%90%E8%BE%9E%E6%9B%B8EX-word%E7%94%A8%E8%BF%BD%E5%8A%A0%E3%82%B3%E3%83%B3%E3%83%86%E3%83%B3%E3%83%84%E3%80%90%E3%83%87%E3%83%BC%E3%82%BF%E3%82%AB%E3%83%BC%E3%83%89%E7%89%88%E3%80%91%E6%96%B0%E8%8B%B1%E5%92%8C%E5%A4%A7%E8%BE%9E%E5%85%B8%E3%80%90%E7%AC%AC%E5%85%AD%E7%89%88%E3%80%91-%E6%96%B0%E5%92%8C%E8%8B%B1%E5%A4%A7%E8%BE%9E%E5%85%B8%E3%80%90%E7%AC%AC%E4%BA%94%E7%89%88%E3%80%91-%E3%83%AA%E3%83%BC%E3%83%80%E3%83%BC%E3%82%BA%E8%8B%B1%E5%92%8C%E8%BE%9E%E5%85%B8%E3%80%90%E7%AC%AC%E4%BA%8C%E7%89%88%E3%80%91-%E6%96%B0%E7%B7%A8-%E8%8B%B1%E5%92%8C%E6%B4%BB%E7%94%A8%E5%A4%A7%E8%BE%9E%E5%85%B8/dp/B007GUY8JG), and that's heavily discounted!).

There's of course one _little_ problem. Although these products have accompanying software, it is in Windows format only.And I'm using Linux. Of course I could just plug in the microSD, but what if I wanted to to move the dictionaries to the main internal memory?  What to do? Although there's an USB port, the EX-WORD does not operate like a USB mass storage device: communicaation is done through OBEX and specific commands to load, view and install dictionaries (along with listing, download and upload files to the SD card and the internal memory).

Looking through the Internet led me to the [libexword project](https://github.com/brijohn/libexword), a library which provides a way to access these electronic dictionaries and a command-line application, and this post deals on how I made it work for me (but notice, it may not work for _you_).

First of all we needed a checkout of the sources:

{% highlight bash %}git clone https://github.com/brijohn/libexword.git{% endhighlight %}

Then we need to switch branches, because most of the ongoing work is not in the master branch, but instead in the 2.0-dev branch.

{% highlight bash %}
cd libexword
git checkout -b 2.0-dev origin/2.0-dev
{% endhighlight %}

To this point onwards you'll need autotools (autoconf, automake) and the libusb development headers installed, along with Python and SWIG (a bindings generator). Run then




{% highlight bash %}
./autogen.sh
./configure --prefix=<prefix> # I used /usr for system wide install
{% endhighlight %}

If you don't specify a prefix, the library and the application will be installed to /usr/local. autogen.sh may complain about a missing AM_PROG_AR (it did on my openSUSE system), so edit configure.ac and add AM_PROG_AR around line 15, then rerun autogen.sh.

After this, issue

{% highlight bash %}
make
sudo make install
{% endhighlight %}

Or become root and issue make install (assuming you're installing to a system prefix).

Next, you need to get your 電子辞書 and connect it via USB. The kernel will **not** seem to find it, but it's normal. Hit the お気に入り/ライブラリー key twice on the dictionary, then move with the arrows until you highlight 通信 (aka "transmission"). After that, push the translate button (訳) and you'll see the Linux kernel identifying our dictionary (strings may change depending on the model):

{% highlight bash %}
usb 2-1.6.1: USB disconnect, device number 8
usb 2-1.6.1: new high-speed USB device number 9 using ehci-pci
usb 2-1.6.1: New USB device found, idVendor=07cf, idProduct=6101
usb 2-1.6.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1.6.1: Product: CESG502
usb 2-1.6.1: Manufacturer: CESG502
{% endhighlight %}

Now we need to access the dictionary. However, unless you set up specific rules in udev, only root will be able to access the device. You can create a file in /etc/udev/rules.d called 99-exword.rules with the following:

{% highlight bash %}SUBSYSTEM=="usb", ATTR{idVendor}=="07cf",ATTR{idProduct}=="6101",  MODE="0666"{% endhighlight %}

and then refresh the rules with

{% highlight bash %}udevadm control --reload-rules{% endhighlight %}

After all of this is done, run exword and connect to the device:

{% highlight bash %}
$ exword
Exword dictionary tool.
Type 'help' for a list of commands.
>> connect
connecting to device...done
\_INTERNAL_00\ >>
{% endhighlight %}

"connect" takes different options: check with "help connect" for what you need specifically.

We can change between paths using the setpath command:

{% highlight bash %}
setpath drv0:/// # Root of internal memory
setpath crd0:/// # Root of SD
setpath drv0:///CASIOTXT # Move to the CASIOTXT directory in the internal memory
{% endhighlight %}

Notice however that some directories can't be accessed.

You can list files with the list command (a truncated output shown below):

{% highlight bash %}
\_INTERNAL_00\ >> list
<sys_bak>
maintch.wrk
fav.inf
line3.inf
linecd.inf
<SOUND>
<CASIOTXT>
drvvewer.inf
lngfile.inf
<data>
{% endhighlight %}

There are also other commands: use "help" to see them all. Issue "disconnect" when you are done, and "exit" to exit the program.

There's also a Python binding made using SWIG: I've yet to play with it.

The libexword developer has also created some GUI tools to mimic the Windows EX-WORD tools (which, it must be noted, work only with the Japanese dictionaries). You can get them at the [exword-tools git repo](https://github.com/brijohn/exword_tools). The procedure for installing them is the same as above (including the modification to configure.ac). You'll need the development headers of wxWidgets, however, as this is a GUI application.

After installing, you can launch ExwordLibrary, ExwordTextLoader and ExwordLibraryInstaller. The latter is required to install new dictionaries, and unfortunately involves getting a [Windows executable](http://github.com/downloads/brijohn/libexword/exword_decrypt.zip) and placing it under PREFIX/share/exword, where PREFIX is the path you gave to the libexword configure script. This also means you need wine to run it.[
](http://www.dennogumi.org/wp-content/uploads/2013/05/exwordlib.png)


Once that is done, you can use the library application:







[![exwordlib](http://www.dennogumi.org/wp-content/uploads/2013/05/exwordlib-300x286.png)](http://www.dennogumi.org/wp-content/uploads/2013/05/exwordlib.png)




or the installer to install dictionaries:

[![exword-dict](http://www.dennogumi.org/wp-content/uploads/2013/05/exword-dict-300x206.png)](http://www.dennogumi.org/wp-content/uploads/2013/05/exword-dict.png)

And that's all. I hope this has been useful for using your electronic dictionary with Linux!
