otgbind pseudo-gpio plugin

This commit is contained in:
Devaev Maxim
2020-12-26 04:55:40 +03:00
parent 77771bea55
commit 570dd04e29
5 changed files with 130 additions and 4 deletions

View File

@@ -81,7 +81,7 @@ def main(argv: Optional[List[str]]=None) -> None:
info_manager=InfoManager(global_config),
log_reader=LogReader(),
wol=WakeOnLan(**config.wol._unpack()),
user_gpio=UserGpio(config.gpio),
user_gpio=UserGpio(config.gpio, global_config.otg.udc),
hid=hid,
atx=get_atx_class(config.atx.type)(**config.atx._unpack(ignore=["type"])),

View File

@@ -231,7 +231,7 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
# =====
class UserGpio:
def __init__(self, config: Section) -> None:
def __init__(self, config: Section, udc: str) -> None:
self.__view = config.view
self.__notifier = aiotools.AioNotifier()
@@ -241,6 +241,7 @@ class UserGpio:
instance_name=driver,
notifier=self.__notifier,
**drv_config._unpack(ignore=["instance_name", "notifier", "type"]),
**({"udc": udc} if drv_config.type == "otgbind" else {}), # Hack
)
for (driver, drv_config) in tools.sorted_kvs(config.drivers)
}