IMote2Howto

From University of Washington - Ubicomp Research Page
Revision as of 02:18, 28 February 2007 by Jonathan Lester (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Change the Bluetooth name

The name that shows up during discovery is stored in /etc/bluetooth/hcid.conf

Typically this just says "Imote2"; however, if there are 6 iMote2's around this is somewhat annoying since you need to then figure out the mac address since Windows and the phones typically don't show the MAC address by default. To make this a bit easier we use the following: <bash>hcitool dev | grep hci | awk '{printf "sed -i -e \"s/\"Imote2\"/iMote2 - "$2"/g\" /etc/bluetooth/hcid.conf "}'</bash>

If hcitool doesn't return a dev this should output anything, and if it returns something unexpected the name should still at least say iMote2 - "something". Since I'm not sure of how to make the shell execute this directly we'll just cat it to a file and execute it: <bash># If our btMACAddress file doesn't exist create one and set the mac: if [ ! -f /etc/btMACAddress ]; then

   rm /tmp/btAddrCmd
   echo "Setting Bluetooth hostname"
   hcitool dev | grep hci | awk '{printf "sed -i -e \"s/name \\\".*/name \\\"iMote2 - "$2"\\\"/g\" /etc/bluetooth/hcid.conf "}' > /tmp/btAddrCmd
   hcitool dev | grep hci > /etc/btMACAddress
   # if the file exists execute, and remove it
   if [ -e /tmp/btAddrCmd ]; then
       sh /tmp/btAddrCmd
       rm /tmp/btAddrCmd
   fi

fi </bash>