12 October 2008

X-CTU with Linux

Update: There's been a few reports that digi's X-CTU has been targeted for a malware exploit.  I personally have had zero problems but wanted to share the warning.  Practice safe coding!

There is a Python X-CTU replacement that works well.  Read about it at the RoboSci Blog:

http://www.dudek.org/blog/180 

Gregory Dudek's download link for his xbee-gdxctu.py tool is midway down the article.  Also read the article comments for a list of required python libraries.

-----------------------------------------------------------------

X-CTU is the utility to use for setting up an Xbee. What the acronym stands for is a mystery. What isn't a mystery is that it's a Windows app.  

This quick post will explain how to run X-CTU with linux.  If you find this post useful, please consider leaving a comment.

From Digi's Knowledge Base:
X-CTU is a Windows-based application provided by Digi. This program was designed to interact with the firmware files found on Digi’s RF products and to provide a simple-to-use graphical user interface to them.

X-CTU operates strictly for Windows Platforms. The versions of Windows which are compatible with X-CTU are as follows:
Windows 98, 2K, ME, XP

X-CTU is NOT compatible with the following versions and Operating Systems:
Window 95, NT; Unix; Linux
Bummer. I ran the installer with Wine and the app seems to run but X-CTU can't find my USB COM port. I spent a few minutes on it and gave up.

For the past week, I've been booting into Windows XP to use X-CTU. That got old really quick so I went back to see if I could get X-CTU to work in Linux.

After running the X-CTU with Wine, the program is installed in

~/.wine/drive_c/Program Files/Digi-MaxStream/XCTU


Save up to 70% on Inkjet and Toner Supplies!
Just go there and run the X-CTU.exe program and it'll start right up. Except it won't recognize your USB serial port.
When I plug in the Xbee Explorer USB to my PC, it shows up as

/dev/ttyUSB0

A quick way to see your port name is to run this command:

ls -lt /dev/tty*

This will list all serial devices sorted by date with the newest at top.
I just needed a way for Wine to see that port.

While poking around in the .wine folder (see the above image), I noticed a folder called dosdevices. According to the Wine wiki, this folder holds device info.

For Wine to see a COM port, you simply have to create a soft link in the Wine dosdevices folder which is:

~/.wine/dosdevices

I created the soft link like this and randomly chose a high port (com10):
ln -s /dev/ttyUSB0 ~/.wine/dosdevice/com10

Then run X-CTU, go to the PC Settings Tab, User Com Ports Tab, type your new com soft link (in my example above, I used com10) in the Com Port Number box, and click Add.


Works great. Or at least it acts the same way as it does under Windows.
In the Select Com Port list, select your port, setup the correct serial params and click Test.

You should see a dialog that says "Communications with Modem .. OK". If not, make sure that your soft link points to the correct com device. Another occasional problem is the firmware version that is loaded on the Xbee.

If the API firmware is installed, you need to go to the PC Settings tab and click the Enable API checkbox.

My only problem now is that X-CTU doesn't remember the User Com Ports between runs so I have to re-enter it each time. Minor annoyance since it's easier the booting into Windows each time.

BTW - The X-CTU User Manual can be found here.

What do you think? Leave a comment.