Skip to content
Permalink
Browse files

deditecrelaisdriver: add support for inverted signals

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
  • Loading branch information...
jluebbe authored and Emantor committed Oct 9, 2019
1 parent 53b4b34 commit 510ff3e2dd9bd25b92718bf1cd2537782d62f83b
Showing with 8 additions and 1 deletion.
  1. +6 −1 labgrid/driver/deditecrelaisdriver.py
  2. +1 −0 labgrid/resource/remote.py
  3. +1 −0 labgrid/resource/udev.py
@@ -38,9 +38,14 @@ def on_deactivate(self):
@Driver.check_active
@step(args=['status'])
def set(self, status):
if self.relais.invert:
status = not status
self.proxy.set(self.relais.busnum, self.relais.devnum, self.relais.index, status)

@Driver.check_active
@step(result=True)
def get(self):
return self.proxy.get(self.relais.busnum, self.relais.devnum, self.relais.index)
status = self.proxy.get(self.relais.busnum, self.relais.devnum, self.relais.index)
if self.relais.invert:
status = not status
return status
@@ -214,6 +214,7 @@ def __attrs_post_init__(self):
class NetworkDeditecRelais8(RemoteUSBResource):
"""The NetworkDeditecRelais8 describes a remotely accessible USB relais port"""
index = attr.ib(default=None, validator=attr.validators.instance_of(int))
invert = attr.ib(default=False, validator=attr.validators.instance_of(bool))
def __attrs_post_init__(self):
self.timeout = 10.0
super().__attrs_post_init__()
@@ -402,6 +402,7 @@ def path(self):
@attr.s(eq=False)
class DeditecRelais8(USBResource):
index = attr.ib(default=None, validator=attr.validators.instance_of(int))
invert = attr.ib(default=False, validator=attr.validators.instance_of(bool))

def __attrs_post_init__(self):
self.match['ID_VENDOR'] = 'DEDITEC'

0 comments on commit 510ff3e

Please sign in to comment.
You can’t perform that action at this time.