Hi Randy,

I'm sorry I wasted your time like this. The set-econotag.py script uses some modifications I made to the lowpan-tools-0.3.tar.gz a while ago (so long that I forgot about it).
I attached my patches to this email.

I haven't submitted these patches upstream for now is because they probably would need some cleanup (and as you can see very few people actually need them).

Let me know if it fixes the issue for you.

Regards,
Tony

Le 2013-12-30 18:33, Randy Graham a écrit :
Hi Tony,

I apologize if this is a repost, my previous post may have been
rejected due to excessive length, so I'll keep this short :)

I have flashed my econotag and patched and installed the serial
driver per this thread but am seeing this error when I run
set-serial.sh.

Traceback (most recent call last):
   File "/sbin/set-econotag.py", line 75, in <module>
    cn = DQ(sys.argv[1],baudrate=921600)
TypeError: __init__() got an unexpected keyword argument 'baudrate'

Hopefully this points to an obvious issue with my setup, do you have
any thoughts ?

I can attach logs of my terminal session and dmesg output if that helps.

Thanks for any insights you may have into this.

-Randy
From eab69733431dc337a6a182e49e4cf1514da41301 Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.chen...@amnesiak.org>
Date: Wed, 17 Apr 2013 17:39:32 -0400
Subject: [PATCH 1/2] Enable baudrate selection in the DQ class

---
 test-serial/test_DQ.py | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/test-serial/test_DQ.py b/test-serial/test_DQ.py
index 2271fe7..9a58ad1 100644
--- a/test-serial/test_DQ.py
+++ b/test-serial/test_DQ.py
@@ -18,7 +18,7 @@
 #  with this program; if not, write to the Free Software Foundation, Inc.,
 #  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-import sys,os,time
+import sys,os
 from termios import *
 
 cmd_open="zb\x01"
@@ -34,8 +34,19 @@ IDLE_MODE = 0
 RX_MODE = 2
 TX_MODE = 3
 
+baudrate_to_speed = {
+	9600: B9600,
+	19200: B19200,
+	38400: B38400,
+	57600: B57600,
+	115200: B115200,
+	230400: B230400,
+	460800: B460800,
+    921600: 0010007,
+}
+
 class DQ:
-	def __init__(self, port):
+	def __init__(self, port, baudrate=115200):
 		try:
 			print "Openning " + port
 			self.file = os.open(port, os.O_RDWR|os.O_NOCTTY)
@@ -45,8 +56,9 @@ class DQ:
 
 		try:
 			self.oldattrs = tcgetattr(self.file)
-			attrs = [IGNPAR, self.oldattrs[1], 0, 0, B115200, B115200, self.oldattrs[6]]
-			attrs[2] = B115200 | CS8 | CLOCAL | CREAD
+			speed = baudrate_to_speed[baudrate]
+			attrs = [IGNPAR, self.oldattrs[1], 0, 0, speed, speed, self.oldattrs[6]]
+			attrs[2] = 0010007 | CS8 | CLOCAL | CREAD
 			attrs[6][VTIME] = 0
 			attrs[6][VMIN] = 1
 			tcflush(self.file, TCIFLUSH)
-- 
1.8.2

From 9da79f868dd56a639bfd454bfaafb91008cbf7cf Mon Sep 17 00:00:00 2001
From: Tony Cheneau <tony.chen...@amnesiak.org>
Date: Wed, 17 Apr 2013 23:17:23 -0400
Subject: [PATCH 2/2] Extend the python script to handle additional serial
 driver commands.

New commands are for setting PANID, short address and long address in
the hardware.
---
 test-serial/Makefile.am  |  2 +-
 test-serial/test_DQ.py   | 11 +++++++++++
 test-serial/test_addr.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
 test-serial/test_trx.py  |  4 ++--
 4 files changed, 65 insertions(+), 3 deletions(-)
 create mode 100755 test-serial/test_addr.py

diff --git a/test-serial/Makefile.am b/test-serial/Makefile.am
index 5553ded..aa036c4 100644
--- a/test-serial/Makefile.am
+++ b/test-serial/Makefile.am
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.common
 
 python_PYTHON = test_DQ.py
-tests = test_packets.py test_edscan.py test_recv.py test_trx.py
+tests = test_packets.py test_edscan.py test_recv.py test_trx.py test_addr.py
 zbtest_SCRIPTS = $(tests)
 EXTRA_DIST = $(tests)
diff --git a/test-serial/test_DQ.py b/test-serial/test_DQ.py
index 9a58ad1..1ea03d5 100644
--- a/test-serial/test_DQ.py
+++ b/test-serial/test_DQ.py
@@ -29,6 +29,9 @@ cmd_cca="zb\x06"
 cmd_set_state="zb\x07"
 data_xmit_block="zb\x09"
 resp_recv_block="zb\x0b"
+cmd_set_panid="zb\x0f"
+cmd_set_short_addr="zb\x10"
+cmd_set_long_addr="zb\x11"
 
 IDLE_MODE = 0
 RX_MODE = 2
@@ -178,4 +181,12 @@ class DQ:
 			else:
 				break
 		return self.status
+	
+	def set_panid(self, panid):
+		return self.__send_cmd(cmd_set_panid+panid)
 
+	def set_shortaddr(self, shortaddr):
+		return self.__send_cmd(cmd_set_short_addr+shortaddr)
+
+	def set_longaddr(self, longaddr):
+		return self.__send_cmd(cmd_set_long_addr+longaddr)
diff --git a/test-serial/test_addr.py b/test-serial/test_addr.py
new file mode 100755
index 0000000..54121bc
--- /dev/null
+++ b/test-serial/test_addr.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# Linux IEEE 802.15.4 userspace tools
+#
+# Copyright (C) 2008, 2009 Siemens AG
+#
+# Written-by: Dmitry Eremin-Solenikov
+# Written-by: Sergey Lapin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; version 2 of the License.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys,os,time
+from termios import *
+from test_DQ import *
+saddr = "\xde\xad\xbe\xaf\xca\xfe\xba\xbe"
+daddr = "\x6D\x77\x70\x61\x6E\x31\x00\x00"
+panaddr = "\xff\xff"
+
+packet = "\x21\xcc\xa5"
+packet += panaddr
+packet += daddr
+packet += saddr
+packet += "\x01\x80\xa5\x5a\x42\x7c"
+
+if len(sys.argv) < 3:
+	print "Bad arguments."
+	print "Usage: %s tty hardaddr" %(sys.argv[0])
+	sys.exit(2)
+
+if len(sys.argv[2]) != 8:
+	print "Address length must be 8 bytes"
+
+cn = DQ(sys.argv[1])
+print 'Result of close ' + hex(cn.close())
+print 'Result of open ' + hex(cn.open())
+try:
+		print 'Result of set_long_addr' +hex(cn.set_longaddr(sys.argv[2]))
+except KeyboardInterrupt:
+		cn.close()
+		sys.exit(2)
diff --git a/test-serial/test_trx.py b/test-serial/test_trx.py
index 5b6d06f..79bcfd6 100755
--- a/test-serial/test_trx.py
+++ b/test-serial/test_trx.py
@@ -44,9 +44,9 @@ print 'Result of open ' + hex(cn.open())
 try:
 	while 1:
 		print 'Result of set_channel' +hex(cn.set_channel(int(sys.argv[2])))
-		print 'Result of set_state' +hex(cn.set_state(TX_MODE))
+#		print 'Result of set_state' +hex(cn.set_state(TX_MODE))
 		print 'Result of send_block' +hex(cn.send_block(packet))
-		print 'Result of set_state' +hex(cn.set_state(RX_MODE))
+#		print 'Result of set_state' +hex(cn.set_state(RX_MODE))
 		time.sleep(1.0);
 except KeyboardInterrupt:
 		cn.close()
-- 
1.8.2

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to