-
Notifications
You must be signed in to change notification settings - Fork 232
driver/powerdriver: Add SerialPortPowerdriver #192
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
driver/powerdriver: Add SerialPortPowerdriver #192
Conversation
33973d8 to
3bfe23e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason why simultanuous use for communication will not work?
Review comments based on the assumption that there is none. Thinking further about this it might be even easier and more straightforward to extend the SerialDriver with the PowerProtocol and handle everything there.
labgrid/driver/powerdriver.py
Outdated
| Usable signals are DTR and RTS. | ||
| """ | ||
|
|
||
| port = attr.ib(validator=attr.validators.instance_of(str)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bind to a SerialPort Resource instead of taking the raw /dev/path here.
labgrid/driver/powerdriver.py
Outdated
| """ | ||
|
|
||
| port = attr.ib(validator=attr.validators.instance_of(str)) | ||
| signal= attr.ib(validator=attr.validators.instance_of(str)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO extending the existing resources with an optional power_signal is more straightforward.
|
I am not sure about the specific reason: I tested using the same port for both - and it did behave strange. I did not invest time to investigate the behavior. I will have a look at integrating a PowerProtocoll into the SerialPortDriver. |
|
@SmithChart We shouldn't make the normal SerialDriver implement the PowerProtocol, as this would require using named drivers for the common case of a separate power driver. You could make this a a ConsolePIODriver, which binds to a ConsoleProtocol to export a control line as a PIO, then use the existing DigitalOutputPowerDriver for power control. We'd need to add a method to set/get control lines to ConsoleProtocol for this to work though. What do you think? |
I am not sure if it is a good idea to actually dig this feature so deep into the labgrid infrastructure. Adding features to the ConsolePrrotocol just to support this featrue seems to softens the rather sharp outline of the architecture. This feature is meant to help a beginner to build a simple setup to start with labgrid. Maybe it would be a better idea to alter the driver to a DigitalOutput driver and use the DigitalOutputPowerDriver on top of that. |
14e81dc to
afaffb1
Compare
|
I had discusses this change with @jluebbe face-to-face. I splitted this driver into two parts. A DigitalOutputDriver and a DigitalOutputPowerSwitch. For more details see the commit messages. |
afaffb1 to
5afd410
Compare
5afd410 to
aaddc09
Compare
|
Ping I rebased my commits. Is there anything else missing? |
|
Ping Still waiting for feedback here. |
766209c to
1ce1f4e
Compare
The SerialDigitalOutoutDriver sits on top of a SerialDriver and uses the underlying pyserial object to control a flow control line of a serial port as if it were general-purpose outputs. With this driver a free serial port can be used to control a general purpose output for eg. choosing of a boot-target. Signed-off-by: Chris Fiege <chris@tinyhost.de>
This driver sits on top of a DigitalOutput and provides a PowerProtocol. An old version of this driver combined resetting a DUT via a GPIO and power-cycling via PowerSwitch and was removed when adding the ResetProtocol. This new driver only uses a switch controlled via the DigitalOutputProtocol. Signed-off-by: Chris Fiege <chris@tinyhost.de>
1ce1f4e to
82e94f2
Compare
Codecov Report
@@ Coverage Diff @@
## master #192 +/- ##
========================================
+ Coverage 54.8% 54.9% +0.1%
========================================
Files 97 98 +1
Lines 5424 5482 +58
========================================
+ Hits 2975 3013 +38
- Misses 2449 2469 +20
Continue to review full report at Codecov.
|
Adding a powerdriver that controls an external relais board connected to
the control signals of a USB-UART-dongle.
This is a poor-mans solution for a power switch that can be used for
desktops with only a single place.