summaryrefslogtreecommitdiff
path: root/kvmd/apps/otg/__init__.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-04-18 12:15:43 +0300
committerMaxim Devaev <[email protected]>2022-04-18 12:15:43 +0300
commite83764c501ee64a2ba513d071031b7d2320d7b10 (patch)
tree89a06a8534a6ced6e81286915072dbdcdceff477 /kvmd/apps/otg/__init__.py
parentae4509f23425e7c7c2f36c5e4895fe57c6662e46 (diff)
optional serial number
Diffstat (limited to 'kvmd/apps/otg/__init__.py')
-rw-r--r--kvmd/apps/otg/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py
index 11058a7b..44b1bd84 100644
--- a/kvmd/apps/otg/__init__.py
+++ b/kvmd/apps/otg/__init__.py
@@ -195,7 +195,7 @@ class _GadgetConfig:
_write(join(self.__meta_path, f"{func}@meta.json"), json.dumps({"func": func, "name": name}))
-def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements
+def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements,too-many-branches
# https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
# https://www.isticktoit.net/?p=1383
@@ -231,7 +231,8 @@ def _cmd_start(config: Section) -> None: # pylint: disable=too-many-statements
_mkdir(lang_path)
_write(join(lang_path, "manufacturer"), config.otg.manufacturer)
_write(join(lang_path, "product"), config.otg.product)
- _write(join(lang_path, "serialnumber"), config.otg.serial)
+ if config.otg.serial is not None:
+ _write(join(lang_path, "serialnumber"), config.otg.serial)
profile_path = join(gadget_path, usb.G_PROFILE)
_mkdir(profile_path)