Skip to content

Commit

Permalink
agent: Make vhci-hcd Driver Optional
Browse files Browse the repository at this point in the history
Don't try to load the vhci-hcd Kernel module, when calling `not-my-board
status`. The Kernel module is only necessary when the user tries to
attach a USB device.
  • Loading branch information
holesch committed Aug 10, 2024
1 parent 5fc20ca commit e5f58b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions not_my_board/_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ async def get_places(self):
return [models.Place(**p) for p in response["places"]]

@staticmethod
async def usbip_refresh_status():
await usbip.refresh_vhci_status()
def usbip_refresh_status():
usbip.refresh_vhci_status()

@staticmethod
def usbip_is_attached(vhci_port):
Expand Down Expand Up @@ -231,7 +231,7 @@ async def list(self):
]

async def status(self):
await self._io.usbip_refresh_status()
self._io.usbip_refresh_status()

return [
{
Expand Down
7 changes: 4 additions & 3 deletions not_my_board/_usbip.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,12 @@ def detach(vhci_port):
detach_path.write_text(f"{vhci_port}")


async def refresh_vhci_status():
await _ensure_vhci_hcd_driver_available()
def refresh_vhci_status():
vhci_path = pathlib.Path("/sys/devices/platform/vhci_hcd.0")
if not vhci_path.exists():
return

def status_paths():
vhci_path = pathlib.Path("/sys/devices/platform/vhci_hcd.0")
# the first status path doesn't have a suffix
status_path = vhci_path / "status"
count = itertools.count(1)
Expand Down

0 comments on commit e5f58b3

Please sign in to comment.