Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Serial Port Autodetection 0.7.2

danbim edited this page Jan 3, 2012 · 1 revision

It's nicer to not having to edit config files Testbed Runtime implements means to auto-detect the sensor nodes serial port (e.g. /dev/ttyUSB0 or COM1) so that you don't have to update configuration files if you unplug and plug in again any sensor node.

Please note that the current implementation seems to be not working on Windows 7. Linux, Mac OS X and Windows XP seem to work fine, though.

The implementation works as follows: as Java is unbelievable bad with USB we're using native code here, i.e. on Linux we use a Perl-Script, on Windows there's an .exe file and on MAC OS X there's be a Perl script, too. The "devicelist" module of wsn-device-utils ships a jar that contains all dependencies and the native script/exe. At runtime this script/exe will be copied on some temporary folder like /tmp, executed and it's output will be parsed. The script delivers the following information (that is basically a CSV file):

        , /dev/ttyUSB0, isense
XBQTBYH2, /dev/ttyUSB1, telosb
        , /dev/ttyUSB2, isense
XBQTO21W, /dev/ttyUSB3, telosb
        , /dev/ttyUSB4, isense
XBQTCNPG, /dev/ttyUSB5, telosb
0001    , /dev/ttyUSB6, pacemate
0001    , /dev/ttyUSB7, pacemate
0001    , /dev/ttyUSB8, pacemate

So, as you can see it is easy to identify Telos B nodes as they have a unique ID in the first column. Pacemates and iSense node are also easy to identify as our device drivers (see [3]) can query the MAC address of the node by using hardware functionality. Unfortunately, this does not work for Telos B nodes. So, you can configure your tr.iwsn-testbed.xml file as follows:

<ns2:testbed xmlns:ns2="http://itm.uniluebeck.de/tr/xml"
    xmlns:ns4="http://itm.uniluebeck.de/tr/runtime/wsnapp/xml"
    xmlns:ns3="http://itm.uniluebeck.de/tr/runtime/portalapp/xml">
  <nodes id="testbeduzl01.itm.uni-luebeck.de">
    // ...
    <applications>
      <application factoryclass="de.uniluebeck.itm.tr.runtime.wsnapp.WSNDeviceAppFactory" name="WSNDeviceApp">
        <ns4:device>
          <urn>urn:wisebed:uzl1:0x1bb3</urn>
          <type>isense</type>
        </ns4:device>
      </application>
      <application factoryclass="de.uniluebeck.itm.tr.runtime.wsnapp.WSNDeviceAppFactory" name="WSNDeviceApp">
        <ns4:device>
          <urn>urn:wisebed:uzl1:510</urn>
          <type>pacemate</type>
        </ns4:device>
      <application factoryclass="de.uniluebeck.itm.tr.runtime.wsnapp.WSNDeviceAppFactory" name="WSNDeviceApp">
        <ns4:device>
          <urn>urn:wisebed:uzl1:0xfee3</urn>
          <type>telosb</type>
          <usbchipid>XBQTO21W</usbchipid>
        </ns4:device>
      </application>
      </application>
    </applications>
    // ...
  </nodes>
</testbed>

As you can see the iSense and Pacemate nodes can be configured by simple configuring the URN and the type of the node. The MAC address will be derived from the URN suffix that has to be identical to the nodes' MAC address. For Telos B we need this piece of extra information that is contained in <usbchipid> to let the implementation know which ID belongs to which MAC address.