To pair/connect a bluetooth device without a gui...
Scan for the device
$ hcitool scan
Pair the device
$ /usr/share/doc/bluez/examples/simple-agent hci0 XX:XX:XX:XX:XX:XX
List the devices
$ /usr/share/doc/bluez/examples/list-devices
Set the device as trusted
$ /usr/share/doc/bluez/examples/test-device XX:XX:XX:XX:XX:XX yes
Connect the device manually
$ dbus-send --system --dest=org.bluez --print-reply \ /org/bluez/.../hci0/dev_XX_XX_XX_XX_XX_XX org.bluez.Input.Connect
At this point, it should be connected, and will auto-connect later on.