Skip to content

Commit

Permalink
Merge pull request #1548 from jluebbe/usbhub-resource
Browse files Browse the repository at this point in the history
add USBHub resource and export
  • Loading branch information
Emantor authored Dec 2, 2024
2 parents a718045 + 68e6fa3 commit 9923f40
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
21 changes: 21 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,27 @@ Arguments:
Used by:
- `HTTPVideoDriver`_

USBHub
~~~~~~

A :any:`USBHub` resource describes an USB hub.
There is no corresponding driver, as this resource is only useful to monitor
whether the expected USB hubs are detected by an exporter.
To control individual ports, use `USBPowerPort`_.

.. code-block:: yaml
USBHub:
match:
ID_PATH: 'pci-0000:02:00.0-usb-0:4:1.0'
Arguments:
- match (dict): key and value pairs for a udev match, see `udev Matching`_

Used by:
- none

Providers
~~~~~~~~~
Providers describe directories that are accessible by the target over a
Expand Down
2 changes: 1 addition & 1 deletion labgrid/remote/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ def __attrs_post_init__(self):
exports["USBSDMuxDevice"] = USBSDMuxExport
exports["USBSDWireDevice"] = USBSDWireExport
exports["USBDebugger"] = USBGenericExport

exports["USBHub"] = USBGenericRemoteExport
exports["USBMassStorage"] = USBGenericExport
exports["USBVideo"] = USBGenericExport
exports["USBAudioInput"] = USBAudioInputExport
Expand Down
14 changes: 14 additions & 0 deletions labgrid/resource/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,20 @@ def update(self):
def path(self):
return self.disk_path


@target_factory.reg_resource
@attr.s(eq=False)
class USBHub(USBResource):
"""The USBHub describes a USB hub.
This is mainly useful to monitor if all expected hubs are detected.
"""
def __attrs_post_init__(self):
self.match['DEVTYPE'] = 'usb_interface'
self.match['DRIVER'] = 'hub'
super().__attrs_post_init__()


@target_factory.reg_resource
@attr.s(eq=False)
class USBPowerPort(USBResource):
Expand Down

0 comments on commit 9923f40

Please sign in to comment.