[gnoduino] fix port detection when burning with arduino as programmer



commit 9f36f39df94ae785fe359d23142c5b2a4e571db9
Author: Lucian Langa <lucilanga gnome org>
Date:   Tue Mar 6 23:09:15 2012 +0100

    fix port detection when burning with arduino as programmer

 src/programmer.py |    6 ++++++
 src/uploader.py   |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/programmer.py b/src/programmer.py
index 9944b02..aa835f5 100644
--- a/src/programmer.py
+++ b/src/programmer.py
@@ -51,8 +51,14 @@ class Programmer(object):
 	def getProgrammers(self):
 		return self.programmers
 
+	def getCommunication(self, id):
+		return self.programmers[id-1]['communication']
+
 	def getProtocol(self, id):
 		return self.programmers[id-1]['protocol']
 
+	def getSpeed(self, id):
+		return self.programmers[id-1]['speed']
+
 	def getForce(self, id):
 		return  self.programmers[id-1]['force']
diff --git a/src/uploader.py b/src/uploader.py
index 0360354..a1f1c3f 100644
--- a/src/uploader.py
+++ b/src/uploader.py
@@ -60,6 +60,16 @@ def burnBootloader(serial, output, notify, id):
 	"""De-fuse and erase board"""
 	compline=[i for i in avr_bl]
 	compline.append("-c" + pgm.getProtocol(id))
+	if pgm.getCommunication(id) == 'serial':
+		port = serial.getConfigSerialPort(notify, output)
+		if port == -1:
+			notify.pop(context)
+			notify.push(context, _("Flashing error."))
+			return
+		compline.append("-P" + port)
+		compline.append("-b" + pgm.getSpeed(id))
+	elif pgm.getCommunication(id) == 'usb':
+		compline.append("-Pusb")
 	compline.append("-p" + b.getBoardMCU(b.getBoard()))
 	compline.append("-e")
 	if pgm.getForce(id) == 'true':



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]