Skip to content

Commit

Permalink
resource/udev: warn on initializing USBNetworkInterface with ifname
Browse files Browse the repository at this point in the history
Similar to USBSerialPort's `port` attribute, USBNetworkInterface's
`ifname` attribute is overwritten by udev. Add a warning to make that
clear.

Signed-off-by: Bastian Krause <[email protected]>
  • Loading branch information
Bastian-Krause committed Jul 28, 2023
1 parent 3e1c0df commit 4228d2a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions labgrid/resource/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ class USBNetworkInterface(USBResource, NetworkInterface):
def __attrs_post_init__(self):
self.match['SUBSYSTEM'] = 'net'
self.match['@SUBSYSTEM'] = 'usb'
if self.ifname:
warnings.warn(
"USBNetworkInterface: The ifname attribute will be overwritten by udev.\n"
"Please use udev matching as described in http://labgrid.readthedocs.io/en/latest/configuration.html#udev-matching" # pylint: disable=line-too-long
)
super().__attrs_post_init__()

def update(self):
Expand Down

0 comments on commit 4228d2a

Please sign in to comment.