Bluetooth on OS X

From GumstixDocsWiki

Jump to: navigation, search

For Gumstix boards with the -BT suffix, Bluetooth is one of the easiest ways to establish a console conneciton with a Mac OS X host. Follow these steps to make the initial connection:

Note: These settings may be outdated, I had more luck with the linux guide LinuxBluetooth.

Contents

Setting up the Gumstix board

Simply attach the antenna supplied with the -BT suffix board to the connnector on the board and power up the board. The default buildroot installed on the boad will have Bluetooth support enabled.

Setting up the Mac

These instructions apply to OS X version 10.4 (Tiger). The dialog boxes are arranged slightly differently in other versions.

  • Open System Preferences and select the Bluetooth preference pane
  • Select 'Devices' at the top and click the 'Set up new device...' button

Image:OSXBT1.png

  • The Bluetooth Setup Assistant will open. Select 'Any device', then continue.

Image:OSXBT2.png

  • You will see a device list screen; after a few seconds, your Gumstix device should appear, along with any other discoverable devices within range.

Image:OSXBT3.png

  • Before continuing, select 'Passkey options...', then select 'Use a specific passkey'

Image:OSXBT4.png

  • Click 'continue' until you are prompted for a passkey. Enter '1234', the default Gumstix passkey.

Image:OSXBT5.png

  • The Mac will pair with the Gumstix board and will then display the following error message. This is normal, and simply means that the Setup Assistant doesn't recognize the serial service as one of its supported Bluetooth services:

Image:OSXBT6.png

  • Click 'continue', then 'quit', then scroll down the list of devices in the setup pane to find the newly added Gumstix

Image:OSXBT7.png

  • Select 'Edit serial ports' and wait for the Mac to find the serial port service on the Gumstix. Select a name for your serial port (the default is usually fine), make sure that 'RS232' is selected, and select the 'Require pairing for security' check box.

With the default Bluetooth settings on some boards (notably the Verdex), you may find the serial connection does not work if the 'Require pairing for security' setting is selected. If this is a problem, open Bluetooth Preferences and turn the setting off.

Image: OSXBT8.png

Using the serial console

To use the Bluetooth serial link for a console, you'll need a serial terminal emulator on the Mac. A good option is ZTerm, or see a more complete list on the OS X serial communications page.

Simply select the Bluetooth virtual serial port you created in the previous step, press 'Return' a few times to get the board's attention, and you'll be presented with a login prompt.

You can also use 'screen' from Terminal to connect to the virtual serial port. Open Terminal and type the following command:

screen /dev/tty.Gumstix-1 921600

(Replace 'Gumstix-1' with the name of your Bluetooth serial port if you changed it from the default)

To end your 'screen' session, type <CTRL>-A, then the letter 'K'.

Setting up PAN

To connect your Mac OS X system to your Gumstix by setting up a Personal Area Network (PAN), you will need to make sure you are using Mac OS X 10.4.9 or later. Secondly, you will need to make some changes on your gumstix.

Open up /etc/default/bluetooth and find the PAND_OPTIONS line. Replace it with the following:

PAND_OPTIONS="--master --role NAP --listen"

(GN will also work in place of NAP with Leopard)

Secondly, you should assign a static IP to your bnep0 interface (which will be created automatically for you once the connection is made). To do this, you must edit the /etc/network/interfaces file and find this line:

iface bnep0 inet dhcp

and replace it with something like this:

iface bnep0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    network 192.168.0.0
    gateway 192.168.0.1
    broadcast 192.168.0.255

The next simplest step would be to reboot your gumstix, and wait about 10 seconds for it to come back up. Once it comes back up, check your bluetooth menu item in your toolbar (if you don't have it enabled, you can enable it in the Bluetooth system preference pane), and click on "Join network foo" where "foo" is representative of whatever you called your Gumstix connection when you did the previous setup of the device.

If you do not see a 'Join network on Gumstix' option on your Bluetooth menu, you may need to re-pair with your Gumstix. Open Bluetooth preferences, delete the entry for the Gumstix, and repeat the steps above for pairing with the Gumstix. At the end of the pairing process, the Bluetooth Setup Assistant should detect the presence of the PAN service, and the 'Join network' menu item will appear.

From here on, we set the gateway of your gumstix to 192.168.0.1 which is what IP we'll give your Mac. Go into the Network preference pane, and select "Bluetooth PAN" and click "Configure". Click the TCP/IP tab, and select "Manually" from the popup box under "Configure IPv4" and enter in 192.168.0.1. Verify the netmask is "255.255.255.0" and then click "Apply Now".

You can set up ipfw/natd to redirect any ports incoming to your Mac OS X box to redirect that traffic over to 192.168.0.2 (the gumstix) so it can serve up things like static web pages, or whatnot.

Personal tools