Skip to content

Commit b4ae46d

Browse files
committed
doc: How hardware managers ignore certain devices
Overriding or implementing `filter_device` activates filtering. Otherwise, GenericHardwareManager returns the device unchanged, effectively skipping filtering. Related-Bug: #2117234 Change-Id: Ifdda007e0c5001ab7df38c2c510e3f40c110d03c Signed-off-by: Afonne-CID <afonnepaulc@gmail.com>
1 parent 780cf36 commit b4ae46d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/source/contributor/hardware_managers.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ passed on to whatever dispatched the method. If the method is unable to run
2828
successfully on any hardware managers, ``HardwareManagerMethodNotFound`` is
2929
raised.
3030

31+
Some methods, such as ``filter_device``, are expected to return ``None`` to
32+
indicate a negative result (i.e., to exclude a device) which happens when
33+
one or more hardware managers override the method and at least one
34+
explicitly returns ``None``. If dispatch ever reaches the generic manager,
35+
the device is returned without filtering.
36+
37+
This design allows granular control over filtering. To avoid unintentionally
38+
excluding devices, hardware managers must either return the device (or a
39+
modified copy), raise ``IncompatibleHardwareMethodError``, or refrain from
40+
overriding the method at all.
41+
3142
Why build a custom HardwareManager?
3243
-----------------------------------
3344
Custom hardware managers allow you to include hardware-specific tools, files

0 commit comments

Comments
 (0)