Wednesday, September 30, 2009

Bluetooth GPS in Linux with gpsd


I have the following no-name bluetooth-only gps device. When I plug it into the USB port of my computer for a recharge, it is seen as :
$lsusb
Bus 003 Device 011: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I already have the bluetooth stack working on Ubuntu so I could make a bluetooth scan for it. The gadget presents itself as GT-750F :


$hcitool scan
Scanning ...
00:0B:0D:76:83:73 GT-750F

Following the instructions at http://gpsd.berlios.de/bt.html, I added the following section into /etc/bluetooth/rfcomm.conf :
rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device 00:0B:0D:76:83:73;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "GPS GT-750F";
}

I then launched gpsd with the following command :

sudo gpsd -D 2 -N /dev/rfcomm0

and using xgps and gpsdrive, I saw that it al worked fine.

Magellan Explorist 600 in Linux with gpsd

First, you need to setup the GPS. To do so, within th GPS unit, go :

Menu-Advanced Features-Communications-NMEA Data Comm

and select "V2.1 GSA"

When the GPS is connected to the USB port, a Linux system message appears. To see it, withing Linux command line, type :

sudo tail -f /var/log/messages

Sep 30 15:32:01 sac-laptop kernel: [65151.544586] usb 3-4: USB disconnect, address 6
Sep 30 15:46:34 sac-laptop -- MARK --
Sep 30 16:02:26 sac-laptop kernel: [66976.703565] usb 3-4: new full speed USB device using ohci_hcd and address 7
Sep 30 16:02:26 sac-laptop kernel: [66976.949095] usb 3-4: configuration #1 chosen from 1 choice
Sep 30 16:02:26 sac-laptop kernel: [66976.971345] cdc_acm 3-4:1.0: ttyACM0: USB ACM device

You could then manually launch the gpsd daemon :

sudo gpsd -D 2 -N -n /dev/ttyACM0&

and test it using xgps (shipped with gpsd) or gpsdrive.

If everything is working for you, you can omit the debugging option (-D 2) and the -N option that allows the program to run in the background mode.

Sunday, September 6, 2009

Can't import into Zotero a BibTeX file exported from JabRef

Instead of importing the contents into Zotero, Firefox tries to Open/Save it itself. The fix was found in Zotero forums :

This seems to be related to the character/mime encoding of the BibTeX file. Zotero produces UTF-8 files & can import them without spawning a new window:
$ file Exported\ Items.bib
Exported Items.bib: Unicode text, UTF-8
$ file -i Exported\ Items.bib
Exported Items.bib: text/plain; charset=utf-8
But not so with ascii files:$ file broken.bib
broken.bib: BibTeX text file
$ file -i broken.bib
broken.bib: text/plain; charset=us-ascii
Changing the file to UTF-8 w/ BOM:$ uconv --add-signature broken.bib >fixed.bib && file fixed.bib
fixed.bib: Unicode text, UTF-8
$ file -i fixed.bib
fixed.bib: text/plain; charset=utf-8
leads to successful import (as does importing from the clipboard).

But the fix did not work for me. So in JabRef, I had to export the same file into RIS from format. The RIS file imported successfully into Zotero.

Friday, September 4, 2009

How to recursively list and delete empty directories in linux?

To list empty directories below the current dir :
find ./ -type d -empty
to delete them :
find ./ -type d -empty -delete