This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8046

-- gerrit

commit 18bde764badf4732268086e62d740ee2eeaa73e3
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sun Dec 10 21:35:10 2023 +0100

    doc: usb_adapters: update the script for unavailable reports
    
    When Linux HID driver binds the USB endpoints of the adapter,
    'lsusb' fails to read all the reports and prints
            ** UNAVAILABLE **
    
    Detect this case and alert the user, providing also the proper
    command to unbind the driver before running the script again.
    
    Change-Id: Iaca00040e666b62ceebe4b842a24932799bde56a
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>
    Reported-by: Tomas Vanek <van...@fbl.cz>

diff --git a/doc/usb_adapters/dump.sh b/doc/usb_adapters/dump.sh
index 1ecfb40f08..ce6f7d1240 100755
--- a/doc/usb_adapters/dump.sh
+++ b/doc/usb_adapters/dump.sh
@@ -1,6 +1,22 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 
+function hid_unavailable_report() {
+       a=$(echo $1 | tr '[:lower:]' '[:upper:]')
+       b=$(basename $(dirname $(ls -d /sys/bus/usb/drivers/usbhid/*/*:$a.*)))
+
+       echo ""
+       echo "ATTENTION!"
+       echo "Unable to read completely the USB descriptors."
+       echo "Please run the following command(s) and then run this script 
again"
+       for i in $b; do
+               echo "    sudo sh -c \"echo -n $i > 
/sys/bus/usb/drivers/usbhid/unbind\""
+       done
+       echo ""
+       echo "Please notice that the USB device will not function after the 
above"
+       echo "operations; you should unplug and replug it to get it working 
again."
+}
+
 devs=$(lsusb -d $1:$2 | wc -l)
 case "$devs" in
        0 )
@@ -16,6 +32,8 @@ case "$devs" in
                ;;
 esac
 
+lsusb -v -d $1:$2 2>&1 | grep -Fq '** UNAVAILABLE **' && 
(hid_unavailable_report $1:$2 > /dev/stderr)
+
 # 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 ''

-- 

Reply via email to