-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for RND power supplies
A very limited port of this: https://github.com/rumpelsepp/opennetzteil/blob/master/devices/rnd/rnd320.go However, these devices are so buggy that only switch on/off works reliably … (in most cases).
- Loading branch information
1 parent
17408d9
commit c13cb57
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5011", SYMLINK+="rnd-netzteil" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# SPDX-FileCopyrightText: AISEC Pentesting Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import asyncio | ||
from pathlib import Path | ||
from typing import Any | ||
|
||
from opennetzteil.exceptions import OperationNotSupportedError | ||
from opennetzteil.netzteil import BaseNetzteil | ||
|
||
|
||
class RND320(BaseNetzteil): | ||
PRODUCT_ID = "RND320" | ||
|
||
async def _send(self, data: str) -> None: | ||
with Path(self.target.path).open("w") as f: | ||
await asyncio.to_thread(f.write, data) | ||
|
||
async def get_ident(self) -> str: | ||
raise OperationNotSupportedError() | ||
|
||
async def get_master(self) -> bool: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_master(self, enabled: bool) -> None: | ||
cmd = "OUT1" if enabled else "OUT0" | ||
await self._send(cmd) | ||
|
||
async def get_channels(self) -> int: | ||
return 1 | ||
|
||
async def get_current(self, channel: int) -> float: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_current(self, channel: int, value: float) -> None: | ||
raise OperationNotSupportedError() | ||
|
||
async def get_voltage(self, channel: int) -> float: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_voltage(self, channel: int, value: float) -> None: | ||
raise OperationNotSupportedError() | ||
|
||
async def get_output(self, channel: int) -> bool: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_output(self, channel: int, enabled: bool) -> None: | ||
await self.set_master(enabled) | ||
|
||
async def status(self) -> dict[str, Any]: | ||
raise OperationNotSupportedError() | ||
|
||
async def get_ocp(self, channel: int) -> bool: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_ocp(self, channel: int, enabled: bool) -> None: | ||
raise OperationNotSupportedError() | ||
|
||
async def get_ovp(self, channel: int) -> bool: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_ovp(self, channel: int, enabled: bool) -> None: | ||
raise OperationNotSupportedError() | ||
|
||
async def set_beep(self, enabled: bool) -> None: | ||
raise OperationNotSupportedError() |
Empty file.