]> asedeno.scripts.mit.edu Git - linux.git/commit
usb: usbtmc: Fix ioctl USBTMC_IOCTL_CLEAR
authorGuido Kiener <guido@kiener-muenchen.de>
Wed, 12 Sep 2018 08:51:03 +0000 (10:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Sep 2018 11:04:02 +0000 (13:04 +0200)
commitdfee02ac4bce6374c9769fe31f20794309341fa0
tree5f924c7ac748180382df93fcbd5e4c16f17e0e29
parentd7604ff0dc018f21d0363a8ebd424bf84cf41020
usb: usbtmc: Fix ioctl USBTMC_IOCTL_CLEAR

Remove calculation of max_size (=wMaxPacketSize) and wrong
condition (actual == max_size) in while loop. A device clear
should always flush the complete Bulk-IN FIFO.

Insert a sleep of 50 ms between subsequent CHECK_CLEAR_STATUS
control requests to avoid stressing the instrument with
repeated requests.

Some instruments need time to cleanup internal I/O buffers.
Polling and nonbraked requests slow down the response time of
devices.

Use USBTMC_BUFSIZE (4k) instead of USBTMC_SIZE_IOBUFFER (2k).
Using USBTMC_SIZE_IOBUFFER is deprecated.

Check only bit 0 (field bmClear) of the CHECK_CLEAR_STATUS
response, since other bits are reserved and can change in
future versions.

Signed-off-by: Guido Kiener <guido.kiener@rohde-schwarz.com>
Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/usbtmc.c