• Faizel K B's avatar
    usb: testusb: Fix for showing the connection speed · f81c08f8
    Faizel K B authored
    testusb' application which uses 'usbtest' driver reports 'unknown speed'
    from the function 'find_testdev'. The variable 'entry->speed' was not
    updated from  the application. The IOCTL mentioned in the FIXME comment can
    only report whether the connection is low speed or not. Speed is read using
    the IOCTL USBDEVFS_GET_SPEED which reports the proper speed grade.  The
    call is implemented in the function 'handle_testdev' where the file
    descriptor was availble locally. Sample output is given below where 'high
    speed' is printed as the connected speed.
    
    sudo ./testusb -a
    high speed      /dev/bus/usb/001/011    0
    /dev/bus/usb/001/011 test 0,    0.000015 secs
    /dev/bus/usb/001/011 test 1,    0.194208 secs
    /dev/bus/usb/001/011 test 2,    0.077289 secs
    /dev/bus/usb/001/011 test 3,    0.170604 secs
    /dev/bus/usb/001/011 test 4,    0.108335 secs
    /dev/bus/usb/001/011 test 5,    2.788076 secs
    /dev/bus/usb/001/011 test 6,    2.594610 secs
    /dev/bus/usb/001/011 test 7,    2.905459 secs
    /dev/bus/usb/001/011 test 8,    2.795193 secs
    /dev/bus/usb/001/011 test 9,    8.372651 secs
    /dev/bus/usb/001/011 test 10,    6.919731 secs
    /dev/bus/usb/001/011 test 11,   16.372687 secs
    /dev/bus/usb/001/011 test 12,   16.375233 secs
    /dev/bus/usb/001/011 test 13,    2.977457 secs
    /dev/bus/usb/001/011 test 14 --> 22 (Invalid argument)
    /dev/bus/usb/001/011 test 17,    0.148826 secs
    /dev/bus/usb/001/011 test 18,    0.068718 secs
    /dev/bus/usb/001/011 test 19,    0.125992 secs
    /dev/bus/usb/001/011 test 20,    0.127477 secs
    /dev/bus/usb/001/011 test 21 --> 22 (Invalid argument)
    /dev/bus/usb/001/011 test 24,    4.133763 secs
    /dev/bus/usb/001/011 test 27,    2.140066 secs
    /dev/bus/usb/001/011 test 28,    2.120713 secs
    /dev/bus/usb/001/011 test 29,    0.507762 secs
    Signed-off-by: default avatarFaizel K B <faizel.kb@dicortech.com>
    Link: https://lore.kernel.org/r/20210902114444.15106-1-faizel.kb@dicortech.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    f81c08f8
testusb.c 12.1 KB