Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add agent module, resource and driver for Dedidec Relais 8 device #432

Merged
merged 10 commits into from May 28, 2019

Conversation

Projects
None yet
2 participants
@jluebbe
Copy link
Member

commented May 16, 2019

Description

This PR first adds an agent module to control the device remotely. Then it adds a resource and driver to allow local and remote control via the agent. An example for both variants is also included

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • CHANGES.rst has been updated
  • PR has been tested

jluebbe and others added some commits Apr 29, 2019

util/agent: redirect stdout to stderr on agent
This makes it possible to see simple prints and other log output on the
host, while also avoiding possible RPC channel corruption when writing
to the original stdout by mistake.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
util/agents: add deditec relais8 agent
This adds supports setting the outputs on the relais module via PyUSB.
The agent code is based on a driver originally written by Rouven
Czerwinski <r.czerwinski@pengutronix.de>.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
tests/agent: import all agent modules
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
util/agentwrapper: fix cleanup on connection error
If the SSH connection failed, the AgentWrapper object was missing the
agent attribute, which meant that in __del__() it fell back to
constructing a MethodProxy in its place, leading to a further exception.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
resource/udev: add DeditecRelais8 resource
This is a resource for the Deditec Relais8 USB board.

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
driver: add DeditecRelaisDriver
This adds support to use Deditec Relais8 USB board.

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
[refactored to use the agent]
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
driver/deditecrelaisdriver: add network support
Add the usual network resource and exporter helper class to support
remote access.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
remote/client: add support for the Deditec Relais8
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
examples: add DeditecRelaisDriver example
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>

@jluebbe jluebbe added the enhancement label May 16, 2019

@jluebbe jluebbe requested a review from Emantor May 16, 2019

@jluebbe jluebbe referenced this pull request May 16, 2019

Open

Add a GpioDigitalOutputDriver #407

4 of 5 tasks complete
@codecov

This comment has been minimized.

Copy link

commented May 16, 2019

Codecov Report

Merging #432 into master will decrease coverage by 0.6%.
The diff coverage is 30.5%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #432     +/-   ##
========================================
- Coverage    58.1%   57.4%   -0.7%     
========================================
  Files         114     116      +2     
  Lines        7108    7267    +159     
========================================
+ Hits         4132    4177     +45     
- Misses       2976    3090    +114
Impacted Files Coverage Δ
labgrid/remote/client.py 40.4% <0%> (-0.4%) ⬇️
labgrid/driver/deditecrelaisdriver.py 0% <0%> (ø)
labgrid/util/agentwrapper.py 97.7% <100%> (ø) ⬆️
labgrid/util/agent.py 75.9% <100%> (+1.6%) ⬆️
labgrid/util/agents/deditec_relais8.py 24% <24%> (ø)
labgrid/resource/udev.py 53.2% <53.8%> (ø) ⬆️
labgrid/remote/exporter.py 36.2% <71.4%> (+0.8%) ⬆️
labgrid/resource/remote.py 83.5% <71.4%> (-0.6%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d12dd7...487703a. Read the comment docs.

@Emantor Emantor changed the title Add resource and driver for Dedidec Relais 8 device Add agentwrapper, resource and driver for Dedidec Relais 8 device May 24, 2019

@Emantor Emantor changed the title Add agentwrapper, resource and driver for Dedidec Relais 8 device Add agent module, resource and driver for Dedidec Relais 8 device May 24, 2019

@Emantor
Copy link
Member

left a comment

While reviewing this I noticed that the AgentWrapper does not make use of attrs. Is this intended? Should we port this to attrs as well?



def handle_get(busnum, devnum, number):
relais8 = Relais8(bus=busnum, address=devnum)

This comment has been minimized.

Copy link
@Emantor

Emantor May 24, 2019

Member

This will run the initialization sequence for the board each time, but I think there is no other choice with the current design.

This comment has been minimized.

Copy link
@jluebbe

jluebbe May 28, 2019

Author Member

Yes, otherwise there can't be multiple clients talking to different outputs on the same device.

@jluebbe jluebbe merged commit 9091a77 into labgrid-project:master May 28, 2019

2 of 4 checks passed

codecov/patch 30.5% of diff hit (target 58.1%)
Details
codecov/project 57.4% (-0.7%) compared to 2d12dd7
Details
DCO DCO
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jluebbe jluebbe deleted the jluebbe:topic/relais8 branch May 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.