From 415bcdda48aaf9474342371c628ae2a3f0a117b5 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Thu, 10 Mar 2011 20:29:17 +0100 Subject: [PATCH] [flukso] configure flukso device and sensor ids at firstboot --- .../files/lib/firstboot/99_20_flukso_config | 23 +++++++++++++++++++ .../openwrt/package/flukso/config/flukso.uci | 1 + 2 files changed, 24 insertions(+) create mode 100644 mote/v2/openwrt/files/lib/firstboot/99_20_flukso_config diff --git a/mote/v2/openwrt/files/lib/firstboot/99_20_flukso_config b/mote/v2/openwrt/files/lib/firstboot/99_20_flukso_config new file mode 100644 index 0000000..ac95679 --- /dev/null +++ b/mote/v2/openwrt/files/lib/firstboot/99_20_flukso_config @@ -0,0 +1,23 @@ +#!/bin/sh + +# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2010 Vertical Communications +# Copyright (C) 2011 flukso.net + +flukso_config() { + uci set system.@system[0].key=$(hexdump -v -e '1/1 "%.2x"' -s $((0x11000)) -n 16 /dev/mtd6) + uci set system.@system[0].device=$(hexdump -v -e '1/1 "%.2x"' -s $((0x11020)) -n 16 /dev/mtd6) + uci set system.@system[0].hostname=flukso-$(hexdump -v -e '1/1 "%.2x"' -s $((0x11020)) -n 3 /dev/mtd6) + + for i in `seq 6`; + do + ADDRESS=0x110$((i+2))0 + uci set flukso.$i.id=$(hexdump -v -e '1/1 "%.2x"' -s $((ADDRESS)) -n 16 /dev/mtd6) + done + + uci commit + + echo 'configuring flukso device and sensor ids' +} + +boot_hook_add switch2jffs flukso_config diff --git a/mote/v2/openwrt/package/flukso/config/flukso.uci b/mote/v2/openwrt/package/flukso/config/flukso.uci index 4093b62..9f5bf3b 100644 --- a/mote/v2/openwrt/package/flukso/config/flukso.uci +++ b/mote/v2/openwrt/package/flukso/config/flukso.uci @@ -55,6 +55,7 @@ config sensor 5 option enable 1 config sensor 6 + option id 0123456789abcdef0123456789abcde6 option type uart list port 6 option enable 1