aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2019-03-30 14:40:08 +0100
committerMichael Buesch <m@bues.ch>2019-03-30 14:40:08 +0100
commit836e085a693a74d88e3b4f465c6230fa2685a8b7 (patch)
tree7bf4720a3937fa2277092a7eca87deb208a4f7e8
parent7746a90cdb0888f0976d4555ffd7a5475c6b281d (diff)
downloadpyprofibus-836e085a693a74d88e3b4f465c6230fa2685a8b7.zip
pyprofibus-836e085a693a74d88e3b4f465c6230fa2685a8b7.tar.xz
Fix crash in dummy phy config
Signed-off-by: Michael Buesch <m@bues.ch>
-rw-r--r--pyprofibus/conf.py12
-rw-r--r--pyprofibus/phy.py2
-rw-r--r--pyprofibus/phy_dummy.py4
-rw-r--r--pyprofibus/phy_serial.py7
4 files changed, 16 insertions, 9 deletions
diff --git a/pyprofibus/conf.py b/pyprofibus/conf.py
index 8a33375..133d28b 100644
--- a/pyprofibus/conf.py
+++ b/pyprofibus/conf.py
@@ -177,14 +177,18 @@ class PbConf(object):
if phyType == "serial":
import pyprofibus.phy_serial
phy = pyprofibus.phy_serial.CpPhySerial(
- debug = (self.debug >= 2),
- port = self.phyDev)
+ debug=(self.debug >= 2),
+ port=self.phyDev
+ )
elif phyType in {"dummyslave", "dummy_slave", "dummy-slave"}:
import pyprofibus.phy_dummy
phy = pyprofibus.phy_dummy.CpPhyDummySlave(
- debug = (self.debug >= 2))
+ debug=(self.debug >= 2)
+ )
else:
raise PbConfError("Invalid phyType parameter value: "
"%s" % self.phyType)
- phy.setConfig(baudrate = self.phyBaud, rtscts = self.phyRtsCts, dsrdtr = self.phyDsrDtr)
+ phy.setConfig(baudrate=self.phyBaud,
+ rtscts=self.phyRtsCts,
+ dsrdtr=self.phyDsrDtr)
return phy
diff --git a/pyprofibus/phy.py b/pyprofibus/phy.py
index 263f976..5b7837d 100644
--- a/pyprofibus/phy.py
+++ b/pyprofibus/phy.py
@@ -89,7 +89,7 @@ class CpPhy(object):
self.__txQueue.append((telegramData, srd, maxReplyLen))
self.__send()
- def setConfig(self, baudrate = BAUD_9600):
+ def setConfig(self, baudrate=BAUD_9600, *args, **kwargs):
"""Set the PHY configuration.
This method may be reimplemented in the PHY driver.
"""
diff --git a/pyprofibus/phy_dummy.py b/pyprofibus/phy_dummy.py
index 52eba51..2f33f1f 100644
--- a/pyprofibus/phy_dummy.py
+++ b/pyprofibus/phy_dummy.py
@@ -55,10 +55,10 @@ class CpPhyDummySlave(CpPhy):
self.__msg("Receiving %s" % bytesToHex(telegramData))
return telegramData
- def setConfig(self, baudrate = CpPhy.BAUD_9600):
+ def setConfig(self, baudrate=CpPhy.BAUD_9600, *args, **kwargs):
self.__msg("Baudrate = %d" % baudrate)
self.__pollQueue = []
- super(CpPhyDummySlave, self).setConfig(baudrate = baudrate)
+ super(CpPhyDummySlave, self).setConfig(baudrate=baudrate, *args, **kwargs)
def __mockSend(self, telegramData, srd):
if not srd:
diff --git a/pyprofibus/phy_serial.py b/pyprofibus/phy_serial.py
index 46f8d37..ea04b61 100644
--- a/pyprofibus/phy_serial.py
+++ b/pyprofibus/phy_serial.py
@@ -165,7 +165,7 @@ class CpPhySerial(CpPhy):
raise PhyError("PHY-serial: Failed to transmit "
"telegram:\n" + str(e))
- def setConfig(self, baudrate = CpPhy.BAUD_9600, rtscts = False, dsrdtr = False):
+ def setConfig(self, baudrate=CpPhy.BAUD_9600, rtscts=False, dsrdtr=False, *args, **kwargs):
wellSuppBaud = (9600, 19200)
if baudrate not in wellSuppBaud:
# The hw/driver might silently ignore the baudrate
@@ -190,7 +190,10 @@ class CpPhySerial(CpPhy):
raise PhyError("Failed to set CP-PHY "
"configuration:\n" + str(e))
self.__setConfigPiLC(baudrate)
- super(CpPhySerial, self).setConfig(baudrate = baudrate)
+ super(CpPhySerial, self).setConfig(baudrate=baudrate,
+ rtscts=rtscts,
+ dsrdtr=dsrdtr,
+ *args, **kwargs)
def __setConfigPiLC(self, baudrate):
"""Reconfigure the PiLC HAT, if available.
bues.ch cgit interface