]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpib: Suppress setting END on error from NI_USB dongle
authorDave Penkler <dpenkler@gmail.com>
Wed, 22 Apr 2026 07:48:07 +0000 (09:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 May 2026 11:47:33 +0000 (13:47 +0200)
The NI USB adapter sets the END bit in the status word when an error
occurs such as a read being interrupted by the setting of ATN. This
happens for example when a device clear is received from the
controller in charge during a read.

The common driver changes the error return to 0 whenever the END bit
is set in order to avoid errors such as timeout or interrupt to be
reported after the full message has actually been read. The behaviour
of the NI USB adapter in setting the END bit on errors was causing
actual errors (-EINTR, -ETIMEDOUT) not to be reported.

We avoid setting the END bit in the ni_usb_gpib driver when an error
is reported in error_code of the status from the adaptor.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Link: https://patch.msgid.link/20260422074807.3194-1-dpenkler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpib/ni_usb/ni_usb_gpib.c

index 0bbc13ecebf910f65fb8aa57d5bd9da0b7493a7f..28de1d543ad6d9cfa69489d52a36f7ccf38f1d20 100644 (file)
@@ -720,7 +720,7 @@ static int ni_usb_read(struct gpib_board *board, u8 *buffer, size_t length,
                break;
        }
        ni_usb_soft_update_status(board, status.ibsta, 0);
-       if (status.ibsta & END)
+       if ((status.ibsta & END) && (status.error_code == NIUSB_NO_ERROR))
                *end = 1;
        else
                *end = 0;