Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource: Add generic USB port #1495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,23 @@ device available on a remote computer.
The NetworkUSBMassStorage can be used in test cases by calling the
``write_files()``, ``write_image()``, and ``get_size()`` functions.

GenericUSBPort
~~~~~~~~~~~~~~
A :any:`GenericUSBPort` resource describes a generic USB device, that has no
specific driver yet. Useful if your DUT creates its own USB endpoint, that you
want to test.

.. code-block:: yaml

GenericUSBPort:
match:
ID_PATH: pci-0000:3c:00.0-usb-0:1.2:1.0

NetworkGenericUSBPort
~~~~~~~~~~~~~~~~~~~
A :any:`NetworkGenericUSBPort` describes a `GenericUSBPort`_ available on a remote
computer.

SigrokDevice
~~~~~~~~~~~~
A :any:`SigrokDevice` resource describes a *Sigrok* device. To select a
Expand Down
1 change: 1 addition & 0 deletions labgrid/remote/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ def __attrs_post_init__(self):
exports["USBSDWireDevice"] = USBSDWireExport
exports["USBDebugger"] = USBGenericExport

exports["GenericUSBPort"] = USBGenericExport
exports["USBMassStorage"] = USBGenericExport
exports["USBVideo"] = USBGenericExport
exports["USBAudioInput"] = USBAudioInputExport
Expand Down
1 change: 1 addition & 0 deletions labgrid/resource/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
AndroidUSBFastboot,
DFUDevice,
DeditecRelais8,
GenericUSBPort,
HIDRelay,
IMXUSBLoader,
LXAUSBMux,
Expand Down
9 changes: 9 additions & 0 deletions labgrid/resource/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,15 @@ def __attrs_post_init__(self):
super().__attrs_post_init__()


@target_factory.reg_resource
@attr.s(eq=False)
class NetworkGenericUSBPort(RemoteUSBResource):
"""The NetworkGenericUSBPort describes a remotely accessible USB device"""
def __attrs_post_init__(self):
self.timeout = 10.0
super().__attrs_post_init__()


@target_factory.reg_resource
@attr.s(eq=False)
class NetworkUSBDebugger(RemoteUSBResource):
Expand Down
6 changes: 6 additions & 0 deletions labgrid/resource/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ def read_attr(self, attribute):
return None


@target_factory.reg_resource
@attr.s(eq=False)
class GenericUSBPort(USBResource):
pass


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