mirror of
https://github.com/naruxde/revpimodio2.git
synced 2026-09-30 23:04:29 +02:00
fix: Update reset method to return a boolean indicating success
Signed-off-by: Sven Sager <akira@narux.de>
This commit is contained in:
1 parent
18773b0fa2
commit
a347620a58
1 file changed
+11
-2
+11
-2
@@ -1131,8 +1131,12 @@ class IntIOCounter(IntIO):
|
|||||||
# Load base class
|
# Load base class
|
||||||
super().__init__(parentdevice, valuelist, iotype, byteorder, signed)
|
super().__init__(parentdevice, valuelist, iotype, byteorder, signed)
|
||||||
|
|
||||||
def reset(self) -> None:
|
def reset(self) -> bool:
|
||||||
"""Resets the counter of the input."""
|
"""
|
||||||
|
Resets the counter of the input.
|
||||||
|
|
||||||
|
:return: True if reset was successful, False otherwise
|
||||||
|
"""
|
||||||
if self._parentdevice._modio._monitoring:
|
if self._parentdevice._modio._monitoring:
|
||||||
raise RuntimeError("can not reset counter, while system is in monitoring mode")
|
raise RuntimeError("can not reset counter, while system is in monitoring mode")
|
||||||
if self._parentdevice._modio._simulator:
|
if self._parentdevice._modio._simulator:
|
||||||
@@ -1146,6 +1150,7 @@ class IntIOCounter(IntIO):
|
|||||||
ioctl(self._parentdevice._modio._myfh, 19220, self.__ioctl_arg)
|
ioctl(self._parentdevice._modio._myfh, 19220, self.__ioctl_arg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._parentdevice._modio._gotioerror("iorst", e)
|
self._parentdevice._modio._gotioerror("iorst", e)
|
||||||
|
return False
|
||||||
|
|
||||||
elif hasattr(self._parentdevice._modio._myfh, "ioctl"):
|
elif hasattr(self._parentdevice._modio._myfh, "ioctl"):
|
||||||
# IOCTL over network
|
# IOCTL over network
|
||||||
@@ -1154,6 +1159,7 @@ class IntIOCounter(IntIO):
|
|||||||
self._parentdevice._modio._myfh.ioctl(19220, self.__ioctl_arg)
|
self._parentdevice._modio._myfh.ioctl(19220, self.__ioctl_arg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._parentdevice._modio._gotioerror("net_iorst", e)
|
self._parentdevice._modio._gotioerror("net_iorst", e)
|
||||||
|
return False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Simulate IOCTL in file
|
# Simulate IOCTL in file
|
||||||
@@ -1162,6 +1168,9 @@ class IntIOCounter(IntIO):
|
|||||||
self._parentdevice._modio._simulate_ioctl(19220, self.__ioctl_arg)
|
self._parentdevice._modio._simulate_ioctl(19220, self.__ioctl_arg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._parentdevice._modio._gotioerror("file_iorst", e)
|
self._parentdevice._modio._gotioerror("file_iorst", e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class IntIOReplaceable(IntIO):
|
class IntIOReplaceable(IntIO):
|
||||||
|
|||||||
Reference in new issue
Block a user