configurable ethernet driver

This commit is contained in:
Devaev Maxim
2020-09-30 08:29:12 +03:00
parent 1b62570466
commit 4bdb06f108
3 changed files with 10 additions and 3 deletions

View File

@@ -111,16 +111,16 @@ def _create_serial(gadget_path: str, config_path: str) -> None:
_symlink(func_path, join(config_path, "acm.usb0"))
def _create_ethernet(gadget_path: str, config_path: str, host_mac: str, kvm_mac: str) -> None:
def _create_ethernet(gadget_path: str, config_path: str, driver: str, host_mac: str, kvm_mac: str) -> None:
if host_mac and kvm_mac and host_mac == kvm_mac:
raise RuntimeError("Ethernet host_mac should not be equal to kvm_mac")
func_path = join(gadget_path, "functions/ecm.usb0")
func_path = join(gadget_path, f"functions/{driver}.usb0")
_mkdir(func_path)
if host_mac:
_write(join(func_path, "host_addr"), host_mac)
if kvm_mac:
_write(join(func_path, "dev_addr"), kvm_mac)
_symlink(func_path, join(config_path, "ecm.usb0"))
_symlink(func_path, join(config_path, f"{driver}.usb0"))
def _create_hid(gadget_path: str, config_path: str, instance: int, hid: Hid) -> None: