doc: usb_adapters: add container for lsusb dump of adapters 96/7296/3
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 22 Oct 2022 16:12:16 +0000 (18:12 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 15 Jan 2023 15:04:57 +0000 (15:04 +0000)
When extending an existing adapter driver, developer has to
carefully avoid to break backward compatibility.
But not all developers have access to many adapters for testing.

Prepare a folder aimed at containing 'lsusb -v' dumps of adapters
to be used as reference.
Add documentation and a simple dump script.

Change-Id: Ia3a9132d65ec8869734721f9605cebcebcf33608
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7296
Tested-by: jenkins
doc/usb_adapters/dump.sh [new file with mode: 0755]
doc/usb_adapters/readme.txt [new file with mode: 0644]

diff --git a/doc/usb_adapters/dump.sh b/doc/usb_adapters/dump.sh
new file mode 100755 (executable)
index 0000000..1ecfb40
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+devs=$(lsusb -d $1:$2 | wc -l)
+case "$devs" in
+       0 )
+               echo "Error: USB device $1:$2 not found" > /dev/stderr
+               exit 1
+               ;;
+       1 )
+               echo "Dumping $(lsusb -d $1:$2)" > /dev/stderr
+               ;;
+       * )
+               echo "Error: Multiple matches for 'lsusb -d $1:$2'" > /dev/stderr
+               exit 1
+               ;;
+esac
+
+# break SPDX tag to hide it to checkpatch
+echo '# SPDX-''License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later'
+echo ''
+echo '# Optional comment'
+
+lsusb -v -d $1:$2 | sed 's/ *$//'
diff --git a/doc/usb_adapters/readme.txt b/doc/usb_adapters/readme.txt
new file mode 100644 (file)
index 0000000..1d995e9
--- /dev/null
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later
+
+This folder contains a collection of dumps of USB descriptors, obtained through
+Linux lsusb command, of several USB adapters supported by OpenOCD.
+This collection should help maintaining adapter drivers even if the developer
+doesn't have access to all the devices supported by the driver.
+
+To add a new file, run:
+
+       ./doc/usb_adapters/dump.sh ${vid} ${pid} \
+               > doc/usb_adapters/${driver}/${vid}_${pid}_${short_description}.txt
+
+eventually edit the file to add some extra comment, then submit the file to
+OpenOCD gerrit, as explained in HACKING.
+
+The dumps are organized in subfolders corresponding to OpenOCD drivers:
+- cmsis_dap;
+- ft232r;
+- ftdi;
+- icdi;
+- jlink;
+- kitprog;
+- nulink;
+- stlink;
+- xds110.
+
+The script above assumes the user has granted access permissions to the USB
+device file in
+       /dev/bus/usb/<n>/<m>
+This is usually the case when the device is listed in
+       contrib/60-openocd.rules
+and this udev rules file is properly installed in the host machine.
+If the user has no proper access permissions, the script has to be run as
+root or through 'sudo'.
+
+Old versions of 'lsusb -v' dump cryptic errors like:
+       can't get device qualifier: Resource temporarily unavailable
+       can't get debug descriptor: Resource temporarily unavailable
+when some optional descriptor is not present.
+This is fixed in usbutils v014.
+If you get such messages simply ignore them. They are printed on stderr, so
+will not be included in the generated file as the redirection '>' does only
+redirects stdout.

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)