Sfoglia il codice sorgente

USB: usbtmc: correct termination condition for reads.

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>
Steve Holland 16 anni fa
parent
commit
4143d178e7
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      drivers/usb/class/usbtmc.c

+ 2 - 1
drivers/usb/class/usbtmc.c

@@ -485,7 +485,8 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
 		}
 		}
 
 
 		done += n_characters;
 		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;
 			remaining = 0;
 		else
 		else
 			remaining -= n_characters;
 			remaining -= n_characters;