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

driver/usbloader: rename RKUSBDriver to reflect rkdeveloptool usage #1542

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
7 changes: 6 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Other breaking changes include:
maintained vxi11 module which again uses the deprecated (and in Python 3.13
removed) xdrlib. See
`issue #1507 <https://github.com/labgrid-project/labgrid/issues/1507>`_.
- ``RKUSBDriver`` has been renamed to `RKDevelopToolUSBDriver` and its
``rk-usb-loader`` tool key is now called ``rkdeveloptool``.
This better reflects what is used under the hood and avoids conflation
with the unrelated barebox' ``rk-usb-loader``, which even Labgrid's own
docs got wrong.

Known issues in 24.1
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -524,7 +529,7 @@ New Features in 0.3.0
allowing custom configuration in the user's ``.ssh/config`` as needed.
Note that not all drivers have been updated to use the ProxyManager yet.
- Deditec RELAIS8 devices are now supported by the `DeditecRelaisDriver`.
- The `RKUSBDriver` was added to support the rockchip serial download mode.
- The ``RKUSBDriver`` was added to support the rockchip serial download mode.
- The `USBStorageDriver` gained support for BMAP.
- Flashrom support added, by hard-wiring e.g. an exporter to the DUT, the ROM
on the DUT can be written directly. The flashrom driver implements the
Expand Down
10 changes: 5 additions & 5 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ Arguments:
- match (dict): key and value pairs for a udev match, see `udev Matching`_

Used by:
- `RKUSBDriver`_
- `RKDevelopToolUSBDriver`_

NetworkMXSUSBLoader
~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -2445,9 +2445,9 @@ Implements:
Arguments:
- None

RKUSBDriver
~~~~~~~~~~~
An :any:`RKUSBDriver` is used to upload an image into a device in the *Rockchip
RKDevelopToolUSBDriver
~~~~~~~~~~~~~~~~~~~~~~
An :any:`RKDevelopToolUSBDriver` is used to upload an image into a device in the *Rockchip
USB loader state*.
This is useful to bootstrap a bootloader onto a device.

Expand All @@ -2464,7 +2464,7 @@ Implements:
targets:
main:
drivers:
RKUSBDriver:
RKDevelopToolUSBDriver:
image: 'mybootloaderkey'
usb_loader: 'myloaderkey'

Expand Down
2 changes: 1 addition & 1 deletion labgrid/driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DigitalOutputPowerDriver, YKUSHPowerDriver, \
USBPowerDriver, SiSPMPowerDriver, NetworkPowerDriver, \
PDUDaemonDriver
from .usbloader import MXSUSBDriver, IMXUSBDriver, BDIMXUSBDriver, RKUSBDriver, UUUDriver
from .usbloader import MXSUSBDriver, IMXUSBDriver, BDIMXUSBDriver, RKDevelopToolUSBDriver, UUUDriver
from .usbsdmuxdriver import USBSDMuxDriver
from .usbsdwiredriver import USBSDWireDriver
from .common import Driver
Expand Down
6 changes: 3 additions & 3 deletions labgrid/driver/usbloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def load(self, filename=None):

@target_factory.reg_driver
@attr.s(eq=False)
class RKUSBDriver(Driver, BootstrapProtocol):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually let the old RKUSBDriver raise a DeprecationWarning and instead use the new driver, i.e. see NetworkUSBStorageDriver.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work transparently, because I am changing the name of the tool key as well, but I can do this, so users are nudged into the right direction.

class RKDevelopToolUSBDriver(Driver, BootstrapProtocol):
bindings = {
"loader": {"RKUSBLoader", "NetworkRKUSBLoader"},
}
Expand All @@ -99,9 +99,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('rk-usb-loader')
self.tool = self.target.env.config.get_tool('rkdeveloptool')
else:
self.tool = 'rk-usb-loader'
self.tool = 'rkdeveloptool'

def on_activate(self):
pass
Expand Down
2 changes: 1 addition & 1 deletion labgrid/remote/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def bootstrap(self):
drv = OpenOCDDriver(target, name=name, **args)
drv.interface.timeout = self.args.wait
elif isinstance(resource, NetworkRKUSBLoader):
drv = self._get_driver_or_new(target, "RKUSBDriver", activate=False, name=name)
drv = self._get_driver_or_new(target, "RKDevelopToolUSBDriver", activate=False, name=name)
drv.loader.timeout = self.args.wait
if drv:
break
Expand Down
7 changes: 6 additions & 1 deletion labgrid/resource/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ class RKUSBLoader(USBResource):
def filter_match(self, device):
match = (device.properties.get('ID_VENDOR_ID'), device.properties.get('ID_MODEL_ID'))

if match not in [("2207", "110a")]:
if match not in [("2207", "110a"), ("2207", "301a"),
a3f marked this conversation as resolved.
Show resolved Hide resolved
("2207", "310c"), ("2207", "320b"),
("2207", "320a"), ("2207", "320c"),
("2207", "330a"), ("2207", "330c"),
("2207", "350a"), ("2207", "350b")
]:
Comment on lines +304 to +309
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): please comment on the SoC model those represents

This would make it easier to spot what's supported and what's not.

330c is RK3399
350b is RK3588

I also have:

330d for PX30 (but I can add myself, not an issue)

c.f. https://github.com/rockchip-linux/rkdeveloptool/blob/master/99-rk-rockusb.rules for some model ID

https://elixir.bootlin.com/u-boot/v2024.10/source/drivers/usb/gadget/Kconfig#L69 probably could help too :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do that before, because I didn't know what the original VID/PID was for, but I can annotate them now. Thanks!

return False

return super().filter_match(device)
Expand Down
6 changes: 3 additions & 3 deletions man/labgrid-device-config.5
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ See: <https://openocd.org/>
Path to the quartus_hps binary, used by the QuartusHPSDriver.
See: <https://www.intel.com/content/www/us/en/docs/programmable/683039/22\-3/hps\-flash\-programmer.html>
.TP
.B \fBrk\-usb\-loader\fP
Path to the rk\-usb\-loader binary, used by the RKUSBDriver.
See: <https://git.pengutronix.de/cgit/barebox/tree/scripts/rk\-usb\-loader.c>
.B \fBrkdeveloptool\fP
Path to the \fBrkdeveloptool\fP binary, used by the RKDevelopToolUSBDriver.
See: <https://github.com/rockchip\-linux/rkdeveloptool>
.TP
.B \fBsd\-mux\-ctrl\fP
Path to the sd\-mux\-ctrl binary, used by the USBSDWireDriver.
Expand Down
6 changes: 3 additions & 3 deletions man/labgrid-device-config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ TOOLS KEYS
Path to the quartus_hps binary, used by the QuartusHPSDriver.
See: https://www.intel.com/content/www/us/en/docs/programmable/683039/22-3/hps-flash-programmer.html

``rk-usb-loader``
Path to the rk-usb-loader binary, used by the RKUSBDriver.
See: https://git.pengutronix.de/cgit/barebox/tree/scripts/rk-usb-loader.c
``rkdeveloptool``
Path to the ``rkdeveloptool`` binary, used by the RKDevelopToolUSBDriver.
See: https://github.com/rockchip-linux/rkdeveloptool

``sd-mux-ctrl``
Path to the sd-mux-ctrl binary, used by the USBSDWireDriver.
Expand Down