IMote2Howto

From University of Washington - Ubicomp Research Page
Revision as of 23:51, 1 March 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>if [ ! -f /etc/btMACAddress ]; then

  rm -f /tmp/btAddrCmd
  echo "Setting Bluetooth hostname"
  sed -i -e 's/name \".*/name \"iMote2-'`hcitool dev | grep hci0 | cut -f 3| cut -f 5-6 -d ":"`'\"/g' /etc/bluetooth/hcid.conf
  echo "iMote2 -" `hcitool dev | grep hci0 | cut -f 3| cut -f 5-6 -d ":"` > /etc/HOSTNAME
  hcitool dev | grep hci > /etc/btMACAddress

fi</bash>


Old Method

    <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 -f /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 -f /tmp/btAddrCmd fi fi</bash>

Useful mknod commands

<bash>mknod /dev/ppp c 108 0 mknod /dev/mtdblock0 b 31 0 mknod /dev/mtdblock1 b 31 1 mknod /dev/mtdblock2 b 31 2 mknod /dev/rfcomm0 c 216 0 mknod /dev/rfcomm1 c 216 1 mknod /dev/rfcomm2 c 216 2 mknod /dev/rfcomm3 c 216 3</bash>


Build a fs.jffs2 image from a root directory

<bash>./SG2Release-1_0/buildTree/platx/util/mkfs.jffs2 -o fs.jffs2 --root=./rootfs/ -p 0x1DC0000 -e 0x20000</bash>


Copy the jffs2 image from a running system

<bash>mknod /dev/mtdblock2 b 31 2 umount / dd if=/dev/mtdblock2 of=/mnt/mmc/fs.img bs=131072</bash>