USB: usbtmc: correct termination condition for reads.
authorSteve Holland <sdh4@iastate.edu>
Thu, 18 Jun 2009 22:37:49 +0000 (17:37 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Sep 2009 13:46:35 +0000 (06:46 -0700)
Follow T&M convention of obeying EOM flag.  Avoid exception cases where
instrument response size matches a buffer size.

Signed-off-by: Steve Holland <sdh4@iastate.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/usbtmc.c

index 91d3a94eeaa0130dfea6a057c3a92551e95553c7..6395f22a58e15a5181b77235db262e44a69eae6a 100644 (file)
@@ -485,7 +485,8 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
                }
 
                done += n_characters;
-               if (n_characters < USBTMC_SIZE_IOBUFFER)
+               /* Terminate if end-of-message bit recieved from device */
+               if ((buffer[8] &  0x01) && (actual >= n_characters + 12))
                        remaining = 0;
                else
                        remaining -= n_characters;