Skip to content

Commit

Permalink
USB: usbtmc: correct termination condition for reads.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steve Holland authored and Greg Kroah-Hartman committed Sep 23, 2009
1 parent 92d07e4 commit 4143d17
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/class/usbtmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4143d17

Please sign in to comment.