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

Update UUUDriver #1587

Open
wants to merge 2 commits 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
24 changes: 20 additions & 4 deletions labgrid/driver/usbloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ def load(self, filename=None):
@target_factory.reg_driver
@attr.s(eq=False)
class UUUDriver(Driver, BootstrapProtocol):
"""
This is a driver for NXPs uuu tool.
https://github.com/nxp-imx/mfgtools

It uses the -m parameter of uuu to lock in the specific usb device.
Everything specified in the script attribute will be executed with '-b'
parameter.
"""
bindings = {
"loader": {"IMXUSBLoader", "NetworkIMXUSBLoader", "MXSUSBLoader", "NetworkMXSUSBLoader"},
}
Expand All @@ -163,9 +171,9 @@ def __attrs_post_init__(self):
super().__attrs_post_init__()
# FIXME make sure we always have an environment or config
if self.target.env:
self.tool = self.target.env.config.get_tool('uuu-loader')
self.tool = self.target.env.config.get_tool('uuu')
else:
self.tool = 'uuu-loader'
self.tool = 'uuu'

def on_activate(self):
pass
Expand All @@ -181,10 +189,18 @@ def load(self, filename=None):
mf = ManagedFile(filename, self.loader)
mf.sync_to_resource()

cmd = ['-b', self.script] if self.script else []
# Convert usb path to the format the uuu-tool expects
# 1-1.2.1 -> 1:121
usb_device = str(self.loader.path).replace('.', '').replace('-', ':')

cmd = (
[self.tool, '-v', '-m', usb_device]
+ (['-b', self.script] if self.script else [])
+ [mf.get_remote_path()]
)

processwrapper.check_output(
self.loader.command_prefix + [self.tool] + cmd + [mf.get_remote_path()],
self.loader.command_prefix + cmd,
print_on_silent_log=True
)

Expand Down
4 changes: 2 additions & 2 deletions man/labgrid-device-config.5
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ Path to the usbmuxctl tool, used by the LXAUSBMuxDriver.
Path to the usbsdmux tool, used by the USBSDMuxDriver.
See: <https://github.com/linux\-automation/usbsdmux>
.TP
.B \fBuuu\-loader\fP
Path to the uuu\-loader binary, used by the UUUDriver.
.B \fBuuu\fP
Path to the uuu binary, used by the UUUDriver.
See: <https://github.com/nxp\-imx/mfgtools>
.TP
.B \fBykushcmd\fP
Expand Down
4 changes: 2 additions & 2 deletions man/labgrid-device-config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ TOOLS KEYS
Path to the usbsdmux tool, used by the USBSDMuxDriver.
See: https://github.com/linux-automation/usbsdmux

``uuu-loader``
Path to the uuu-loader binary, used by the UUUDriver.
``uuu``
Path to the uuu binary, used by the UUUDriver.
See: https://github.com/nxp-imx/mfgtools

``ykushcmd``
Expand Down