BT747 MTK GPS Utility under Fedora 16/17

Picture of my BT-Q1000XTI have a QStarz BT-Q1000XT gps travel recorder/datalogger; It’s a great bit of kit but rather Windows-centric..

However! it should work using BT747 on Linux. BT747 is a Java tool designed to manipulate all of the poular MTKII chipset based dataloggers out there, not Just QStarz units, but Holux and others too.

While there are many instructions for getting this working with Ubuntu I could not find any recent info for Fedora; so I thought I’d write up my experience of getting this going on my Fedora system. I have tested this on both Fedora 16 and 17.

(Note; the MS Windows software that came with the QStarz unit is Ok these days; the latest release of their travelplanner software is, in my opinion, not too bad. And much more suitable than BT747 for, say, my dad or sister.)

When I connect the BT-Q1000XT and watch /var/log/messages I see:

$ sudo tail /var/log/messages
Apr 12 15:43:12 myhost kernel: [  741.660046] usb 5-1: new full-speed USB device number 4 using uhci_hcd
Apr 12 15:43:12 myhost kernel: [  741.815122] usb 5-1: New USB device found, idVendor=0e8d, idProduct=3329
Apr 12 15:43:12 myhost kernel: [  741.815126] usb 5-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
Apr 12 15:43:12 myhost kernel: [  741.815129] usb 5-1: Product: GPS Receiver
Apr 12 15:43:12 myhost kernel: [  741.815131] usb 5-1: Manufacturer: MTK
Apr 12 15:43:12 myhost kernel: [  741.823171] cdc_acm 5-1:1.1: ttyACM0: USB ACM device
Apr 12 15:43:12 myhost mtp-probe: checking bus 5, device 4: "/sys/devices/pci0000:00/0000:00:1a.2/usb5/5-1"
Apr 12 15:43:12 myhost mtp-probe: bus: 5, device: 4 was not an MTP device

Look at the 6th line, this tells us the device is appearing on /dev/ttyACM0

From the BT747 site I ignored the non-functional Java Web Start stuff and followed the link to SourceForge where I downloaded the latest Development Release version (v2.1.4 the last time I checked) and saved it in my downloads folder. This package contains all the various versions, Windows/Mac/Linux desktop, plus the J2ME and PDA versions all in one package.

You can use the standard Java for Fedora; and it works fine on both 32 and 64 bit systems (I use it on my 64-bit desktop and my 32-bit netbook, the developers have done a great job of getting all this stuff working in the latest releases and many of the old caveats about using Sun Java etc. seem to have been resolved. Here is my environment on my desktop:

$ uname -a
Linux myhost.local.net 3.3.1-3.fc16.x86_64 #1 SMP Wed Apr 4 18:08:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/fedora-release 
Fedora release 16 (Verne)
$ java -version
java version "1.7.0_b147-icedtea"
OpenJDK Runtime Environment (fedora-2.1.fc16.1-x86_64)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)

Unzip the downloaded package into a suitable folder:

$ mkdir ~/bt747 ; cd ~/bt747/ ; unzip [path.to.downloaded.folder]/[download].zip

On Fedora 16 You also need to install the Fedora RXTX package, however I did not need to do this with Fedora 17:

$ sudo yum install rxtx

As is commonly documented BT747 wont work as standard due to permissions on the lockfile folder:
* You can enable access with (I do this in the script that starts BT747):

$ sudo chmod a+x /var/run/lock

Having done this I then tried to run:

$ ./run_j2se.sh
$ ./lib/rxtx-2.2pre2-bins/Linux/x86_64-unknown-linux-gnu
PATH = /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/ocarter/.local/bin:/home/ocarter/bin

1994 - BT747 2.1.0 Build:BT747_mdeweerd.0.20120411231431933
1995 - Initial: 1019x575  Screen: 1920x1080 Final: 1019x575
1995 - Linux
1995 - amd64
1995 - 3.3.1-3.fc16.x86_64
1995 - 1.7.0_b147-icedtea
1995 - 64
1995 - Fail com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Fail com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel
Success com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
javax.swing.plaf.metal.MetalLookAndFeel
javax.swing.plaf.nimbus.NimbusLookAndFeel
com.sun.java.swing.plaf.motif.MotifLookAndFeel
com.sun.java.swing.plaf.gtk.GTKLookAndFeel

So far so good; The ‘Fail‘ messages are really just a warning that it cannot use it’s preferred window style.

I get the GUI up and can use it, but when I enter the device in the connect box (/dev/ttyACM0) it fails to connect and I get errors:

65604 - Classgps.connection.GPSRxTxPort
WARNING:  RXTX Version mismatch
	Jar version = RXTX-2.2pre1
	native lib Version = RXTX-2.2pre2

gnu.io.NoSuchPortException
	at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:269)
	at gps.connection.GPSRxTxPort.openPort(Unknown Source)
        ...
       [snip many lines of tedious, pointless and distracting backtrace info]
	...
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
65622 - 
Listing known ports:
65623 - Port opened

Much searching around and I found this is due to 1) permissions on the USB device and 2) A need to explicitly add this USB device to the available devices of gnu.io.rxtx

To verify I could see that the USB serial device is connecting and producing data; but permissions are wrong and my user cannot read it.

$ cat /dev/ttyACM0
cat: /dev/ttyACM0: Permission denied

But the same command run as the root user works:

$ sudo cat /dev/ttyACM0 
$PMTK011,MTKGPS*08
$PMTK010,001*2E
00*79
$GPRMC,001255.799,V,,,,,0.00,0.00,060180,,,N*46
...
[data should pour out at high speed, 
hit CTRL-C to end..]

.. so the device is connected and sending data (yippee!), I just cannot see it yet.

Looking at the device file shows that it’s owner is root, but that it’s group is ‘dialout‘.

$ ls -l /dev/ttyACM0 
crw-rw----. 1 root dialout 166, 0 Apr 13 12:44 /dev/ttyACM0

Therefore I need to be in the group: dialout
Look at your current extended groups list:

$ sudo id [myuser]

Then use the usermod command to add ‘dialout‘ as a new extended group:
* due to the way usermod works you must specify ALL the extended groups in one go (separated by commas); which is why I get you the look at them in the step above.. you do not need to give the primary group.

$ sudo usermod -G [existing groups],dialout

eg:
$ id myuser
uid=1001(myuser) gid=1001(myuser) groups=1001(myuser),10(wheel),48(apache)
$ sudo usermod -G wheel,apache,dialout myuser
$ id myuser
uid=1001(myuser) gid=1001(myuser) groups=1001(myuser),10(wheel),48(apache),18(dialout)

You must log out/in to get the new group membership active in your default shells.
* Yes.. I know there are other ways to do that but logging out/in is easiest and fastest for real users..

Now we must pass the correct tty device to gnu.io.rxtx which we do by adding the option ‘-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0‘ to the Java invocation.

I combine this with the lockfile permissions setting by putting it all into a modified copy of the startup script:

Copy the script and make it executable:

$ cd ~/bt747/ ; cp run_j2se.sh bt747 ; chmod a+rx bt747

Then edit ‘bt747′ and replace the final line with two lines like this:

sudo chmod a+w /var/run/lock
"$JAVA" $MEM_HEAP_OPTION $DEBUG_OPTION $NOPROXY_OPTION -Djava.library.path="${RXTXLIBPATH}" -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 -Dbt747_prefix="/dev/ttyACM" bt747.j2se_view.BT747Main $* &

This runs the command to free up the lockdir, and passes the correct option to gnu.io.rxtx (plus I pass another option to help bt747 find the USB device.)

Having done that, and remembering to log out/in, it just works(tm).

I can now run BT747 with:

$ ~/bt747/bt747

The first time of running you might need to enter ‘/dev/ttyACM0‘ in the connect box at the bottom; although it works fine for me with the default ‘USB‘ entry.

The result:
Screenshot of BT747 connected to my gps deviceScreenshot of some tracks displayed on a map by BT747

[ Later I Also want to add a review/notes about BT747, which seems very good so far... ]

  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • Add to favorites

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>