improved otgbind

This commit is contained in:
Maxim Devaev
2022-03-30 23:37:10 +03:00
parent 2d4aa93f06
commit ed93f1f4d3
4 changed files with 21 additions and 21 deletions

View File

@@ -86,7 +86,7 @@ def main(argv: Optional[List[str]]=None) -> None:
),
info_manager=InfoManager(global_config),
log_reader=LogReader(),
user_gpio=UserGpio(config.gpio, global_config.otg.udc),
user_gpio=UserGpio(config.gpio, global_config.otg.udc, global_config.otg.gadget),
ocr=TesseractOcr(**config.ocr._unpack()),
hid=hid,

View File

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