RE: Re: divide error in usbtmc_generic_read

2019-08-14 Thread Guido Kiener
Hi Oliver, Thanks for the fix. You need to set an invalid return code, too. Regards, Guido -Original Message- From: Andrey Konovalov Sent: Wednesday, August 14, 2019 3:52 PM To: syzbot Cc: Greg Kroah-Hartman ; Kiener Guido 1DS1 ; USB list ; Oliver Neukum ; steve_bayl...@keysight.co

[PATCH v3] usb: gadget: net2280: Fix overrun of OUT messages

2019-03-19 Thread Guido Kiener
ackets are appended to the last short packet. Signed-off-by: Guido Kiener --- drivers/usb/gadget/udc/net2280.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index f63f82450bf4..e0b413e9e532 100644 --- a/d

[PATCH v2 2/3] usb: gadget: net2280: Fix net2280_dequeue()

2019-03-18 Thread Guido Kiener
restoring the status ep->stopped. Thus the endpoint keeps blocked and does not receive any data anymore. This fix restores the status and does not issue an error message. Signed-off-by: Guido Kiener --- drivers/usb/gadget/udc/net2280.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --

[PATCH v2 3/3] usb: gadget: net2272: Fix net2272_dequeue()

2019-03-18 Thread Guido Kiener
ompile-tested, since we do not have a corresponding hardware. An analogous fix was tested in the sibling driver. See "usb: gadget: net2280: Fix net2280_dequeue()" Signed-off-by: Guido Kiener --- drivers/usb/gadget/udc/net2272.c | 1 + 1 file changed, 1 insertion(+) diff --git a/driver

[PATCH v2 1/3] usb: gadget: net2280: Fix overrun of OUT messages

2019-03-18 Thread Guido Kiener
packet now before new packets overrun the last short packet. Signed-off-by: Guido Kiener --- drivers/usb/gadget/udc/net2280.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index f63f82450bf4..e0b413e9e532

[PATCH 1/3] udc: net2280: Fix net2280_disable

2019-02-04 Thread Guido Kiener
From: Guido Kiener A reset e.g. calling ep_reset_338x() can happen while endpoints are enabled. The ep_reset_338x() sets ep->desc = NULL to mark endpoint being invalid. A subsequent call of net2280_disable will fail and return -EINVAL to parent function usb_ep_disable(), which will fail,

[PATCH 2/3] udc: net2280: Fix overrun of OUT messages

2019-02-04 Thread Guido Kiener
From: Guido Kiener The OUT endpoint normally blocks (NAK) subsequent packets when a short packet is received and returns an incomplete queue entry to the gadget driver. Thereby the gadget driver can detect a short packet when reading queue entries with a length that is not equal to a multiple of

[PATCH 3/3] udc: net2280: Fix typo

2019-02-04 Thread Guido Kiener
From: Guido Kiener Fix spelling of automatically. Signed-off-by: Guido Kiener --- drivers/usb/gadget/udc/net2280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 1cb58fd5d1c6..430d582d8b6e 100644

usb: gadget: net2280: Some fixes

2019-02-01 Thread Guido Kiener
Hi Felipe, We use the Netchip 228x and PLX 2380/338x family in our devices and I have some small patches that I can share with the community. Some patches are common and should be ok for all environments. However I also have 1-2 patches that are mandatory in our environment, but I cannot estimat

[PATCH 3/4] usb: usbtmc: uninitialized symbol 'actual' in usbtmc_ioctl_clear

2018-09-24 Thread Guido Kiener
From: Guido Kiener Fix uninitialized symbol 'actual' in function usbtmc_ioctl_clear. When symbol 'actual' is not initialized and usb_bulk_msg() fails, the subsequent kernel debug message shows a random value. Signed-off-by: Guido Kiener Fixes: dfee02ac4bce (&qu

[PATCH 1/4] usb: usbtmc: Fix memory leak in usbtmc_ioctl_request

2018-09-24 Thread Guido Kiener
From: Guido Kiener Kernel memory is allocated twice in new function usbtmc_ioctl_request and creates a memory leak. This fix removes the superfluous kmalloc(). Signed-off-by: Guido Kiener Fixes: 658f24f4523e ("usb: usbtmc: Add ioctl for generic requests on control") --- drivers

[PATCH 0/4] usb: usbtmc: Fix changes for compatible IVI/VISA library

2018-09-24 Thread Guido Kiener
Additionally the unitialized symbol 'actual' can cause similar problems and show wrong debug kernel messages in the other functions usbtmc_read() and usbtmc_ioctl_clear(). Guido Kiener (4): usb: usbtmc: Fix memory leak in usbtmc_ioctl_request usb: usbtmc: uninitialized symb

[PATCH 2/4] usb: usbtmc: uninitialized symbol 'actual' in usbtmc_read

2018-09-24 Thread Guido Kiener
From: Guido Kiener Fix uninitialized symbol 'actual' in function usbtmc_read. When symbol 'actual' is not initialized and usb_bulk_msg() fails, the subsequent kernel debug message shows a random value. Signed-off-by: Guido Kiener Fixes: d7604ff0dc01 ("usb: usb

[PATCH 4/4] usb: usbtmc: uninitialized symbol 'actual' in usbtmc_ioctl_abort_bulk_in_tag

2018-09-24 Thread Guido Kiener
From: Guido Kiener Fix uninitialized symbol 'actual' in function usbtmc_ioctl_abort_bulk_in_tag(). When symbol 'actual' is not initialized and usb_bulk_msg() fails, the subsequent kernel debug message shows invalid data. Signed-off-by: Guido Kiener Fixes: cbe743f1333b (&qu

[PATCH v6 16/22] usb: usbtmc: Replace USBTMC_TIMEOUT macros for control messages

2018-09-12 Thread Guido Kiener
Use common timeout macro USB_CTRL_GET_TIMEOUT (=5s) for all usb_control_msg() function calls. The macro USBTMC_TIMEOUT should only be used as default value for Bulk IN/OUT transfers. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 8 1 file

[PATCH v6 22/22] usb: usbtmc: Remove sysfs group TermChar and auto_abort

2018-09-12 Thread Guido Kiener
As all the properties of the usbtmc driver can now be controlled on a per file descriptor basis by ioctl functions the sysfs interface is of limited use. We are not aware about applications that are using the sysfs parameter TermChar, TermCharEnabled or auto_abort. Signed-off-by: Guido Kiener

[PATCH v6 12/22] usb: usbtmc: Optimize usbtmc_read

2018-09-12 Thread Guido Kiener
: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 222 ++--- 1 file changed, 105 insertions(+), 117 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index c476b53b6237..26a779d0c89b 100644 --- a/drivers/usb

[PATCH v6 06/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_CLEANUP_IO

2018-09-12 Thread Guido Kiener
. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 19 +++ include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 0d8aa4bc3fa7..dc6c04fdfdff 100644

[PATCH v6 13/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_CLEAR

2018-09-12 Thread Guido Kiener
CHECK_CLEAR_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 46 +++--- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/usb/class

[PATCH v6 11/22] usb: usbtmc: Optimize usbtmc_write

2018-09-12 Thread Guido Kiener
Use new usbtmc_generic_write function to maximize bandwidth during long data transfer. The maximum output transfer size is limited to INT_MAX (=2GB). Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 176 +++-- 1 file

[PATCH v6 14/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_IN

2018-09-12 Thread Guido Kiener
instead of USBTMC_TIMEOUT. Check only bit 0 (field bmAbortBulkIn) of the CHECK_ABORT_BULK_IN_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 139 ---

[PATCH v6 15/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_OUT

2018-09-12 Thread Guido Kiener
s to avoid stressing the instrument with repeated requests. Use common macro USB_CTRL_GET_TIMEOUT instead of USBTMC_TIMEOUT. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers

[PATCH v6 18/22] usb: usbtmc: Update ioctl-number.txt

2018-09-12 Thread Guido Kiener
Reserve a suitable range of ioctl numbers for USBTMC driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- Documentation/ioctl/ioctl-number.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl

[PATCH v6 07/22] usb: usbtmc: Fix suspend/resume

2018-09-12 Thread Guido Kiener
Submitted urbs are not allowed when system is suspended. Thus the submitted urb waiting at interrupt pipe is killed during suspend callback and submitted again when system resumes. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 +++- 1

[PATCH v6 09/22] usb: usbtmc: add ioctl USBTMC_IOCTL_MSG_IN_ATTR

2018-09-12 Thread Guido Kiener
message is received. Bit 1 = is set when the last byte is a termchar (e.g. '\n'). Note that this bit is always zero when the device does not support the termchar feature or when termchar detection is not enabled (see ioctl USBTMC_IOCTL_CONFIG_TERMCHAR). Signed-off-by: Guido Kiener Reviewed

[PATCH v6 17/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_API_VERSION

2018-09-12 Thread Guido Kiener
when changing tmc.h with new flags, ioctls or when changing a significant behavior of the driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 9 + include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb

[PATCH v6 19/22] usb: usbtmc: Remove redundant code

2018-09-12 Thread Guido Kiener
Remove redundant code and fix debug messages. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index

[PATCH v6 21/22] usb: usbtmc: Fix split quoted string in debug message

2018-09-12 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index ad3932ca4d8d..b9e505cbe6b4 100644 --- a/drivers/usb/class/usbtmc.c +++ b

[PATCH v6 08/22] usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ

2018-09-12 Thread Guido Kiener
Wait until an SRQ (service request) is received on the interrupt pipe or until the given period of time is expired. In contrast to the poll() function this ioctl does not return when other (a)synchronous I/O operations fail with EPOLLERR. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless

[PATCH v6 05/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_CANCEL_IO

2018-09-12 Thread Guido Kiener
ioctl USBTMC_IOCTL_CANCEL_IO stops and kills all flying urbs of last USBTMC_IOCTL_READ and USBTMC_IOCTL_WRITE function calls. A subsequent call to USBTMC_IOCTL_READ or USBTMC_IOCTL_WRITE_RESULT returns -ECANCELED with information about current transferred data. Signed-off-by: Guido Kiener

[PATCH v6 10/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_AUTO_ABORT

2018-09-12 Thread Guido Kiener
Add ioctl USBTMC_IOCTL_AUTO_ABORT to configure auto_abort for each specific file handle. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 23 --- include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 17 insertions(+), 7 deletions

[PATCH v6 01/22] usb: usbtmc: Add ioctl for generic requests on control

2018-09-12 Thread Guido Kiener
applications running on 64 bit systems. However all other convenient ioctls of the USBTMC driver can still be used in 32 bit applications as well. Note that 32 bit applications running on 32 bit target systems are not affected by this limitation. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless

[PATCH v6 00/22] usb: usbtmc: Changes needed for compatible IVI/VISA library

2018-09-12 Thread Guido Kiener
t/get usb timeout usb: usbtmc: use consistent timeout error usb: usbtmc: Support Read Status Byte with SRQ per file V1: usb: usbtmc: Remove rigol_quirk (accepted) https://patchwork.kernel.org/patch/10407097/ Guido Kiener, Dave Penkler, Steve Bayless (22): usb: usbtmc: Add ioctl for gen

[PATCH v6 03/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_WRITE_RESULT

2018-09-12 Thread Guido Kiener
ioctl USBTMC_IOCTL_WRITE_RESULT copies current out_transfer_size to given __u32 pointer and returns current out_status of the last (asnynchronous) USBTMC_IOCTL_WRITE call. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25

[PATCH v6 02/22] usb: usbtmc: Add ioctl for vendor specific write

2018-09-12 Thread Guido Kiener
bit applications running on 64 bit systems. However all other convenient ioctls of the USBTMC driver can still be used in 32 bit applications as well. Note that 32 bit applications running on 32 bit target systems are not affected by this limitation. Signed-off-by: Guido Kiener Reviewed-by: Steve

[PATCH v6 20/22] usb: usbtmc: Remove redundant macro USBTMC_SIZE_IOBUFFER

2018-09-12 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 5b6cdb1237ab..ad3932ca4d8d 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class

[PATCH v6 04/22] usb: usbtmc: Add ioctl for vendor specific read

2018-09-12 Thread Guido Kiener
applications as well. Note that 32 bit applications running on 32 bit target systems are not affected by this limitation. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 336 ++- include/uapi/linux/usb/tmc.h | 2 + 2 files

[PATCH v5 18/22] usb: usbtmc: Update ioctl-number.txt

2018-08-03 Thread Guido Kiener
Reserve a suitable range of ioctl numbers for USBTMC driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- Documentation/ioctl/ioctl-number.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl

[PATCH v5 21/22] usb: usbtmc: Fix split quoted string in debug message

2018-08-03 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 785eee3a6b89..6aef3447adcc 100644 --- a/drivers/usb/class/usbtmc.c +++ b

[PATCH v5 22/22] usb: usbtmc: Remove sysfs group TermChar and auto_abort

2018-08-03 Thread Guido Kiener
As all the properties of the usbtmc driver can now be controlled on a per file descriptor basis by ioctl functions the sysfs interface is of limited use. We are not aware about applications that are using the sysfs parameter TermChar, TermCharEnabled or auto_abort. Signed-off-by: Guido Kiener

[PATCH v5 20/22] usb: usbtmc: Remove redundant macro USBTMC_SIZE_IOBUFFER

2018-08-03 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 81144c0c4772..785eee3a6b89 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class

[PATCH v5 19/22] usb: usbtmc: Remove redundant code

2018-08-03 Thread Guido Kiener
Remove redundant code and fix debug messages. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index

[PATCH v5 16/22] usb: usbtmc: Replace USBTMC_TIMEOUT macros for control messages

2018-08-03 Thread Guido Kiener
Use common timeout macro USB_CTRL_GET_TIMEOUT (=5s) for all usb_control_msg() function calls. The macro USBTMC_TIMEOUT should only be used as default value for Bulk IN/OUT transfers. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 8 1 file

[PATCH v5 10/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_AUTO_ABORT

2018-08-03 Thread Guido Kiener
Add ioctl USBTMC_IOCTL_AUTO_ABORT to configure auto_abort for each specific file handle. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 23 --- include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 17 insertions(+), 7 deletions

[PATCH v5 09/22] usb: usbtmc: add ioctl USBTMC_IOCTL_MSG_IN_ATTR

2018-08-03 Thread Guido Kiener
message is received. Bit 1 = is set when the last byte is a termchar (e.g. '\n'). Note that this bit is always zero when the device does not support the termchar feature or when termchar detection is not enabled (see ioctl USBTMC_IOCTL_CONFIG_TERMCHAR). Signed-off-by: Guido Kiener Reviewed

[PATCH v5 11/22] usb: usbtmc: Optimize usbtmc_write

2018-08-03 Thread Guido Kiener
Use new usbtmc_generic_write function to maximize bandwidth during long data transfer. The maximum output transfer size is limited to INT_MAX (=2GB). Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 176 +++-- 1 file

[PATCH v5 03/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_WRITE_RESULT

2018-08-03 Thread Guido Kiener
ioctl USBTMC_IOCTL_WRITE_RESULT copies current out_transfer_size to given __u32 pointer and returns current out_status of the last (asnynchronous) USBTMC_IOCTL_WRITE call. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25

[PATCH v5 00/22] usb: usbtmc: Changes needed for compatible IVI/VISA library

2018-08-03 Thread Guido Kiener
usb: usbtmc: Add ioctls to set/get usb timeout usb: usbtmc: use consistent timeout error usb: usbtmc: Support Read Status Byte with SRQ per file V1: usb: usbtmc: Remove rigol_quirk (accepted) https://patchwork.kernel.org/patch/10407097/ Guido Kiener, Dave Penkler, Steve Bayless (22)

[PATCH v5 08/22] usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ

2018-08-03 Thread Guido Kiener
Wait until an SRQ (service request) is received on the interrupt pipe or until the given period of time is expired. In contrast to the poll() function this ioctl does not return when other (a)synchronous I/O operations fail with EPOLLERR. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless

[PATCH v5 04/22] usb: usbtmc: Add ioctl for vendor specific read

2018-08-03 Thread Guido Kiener
already available due to a previous non blocking call the ioctl will return -EINVAL when the message pointer is NULL. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 336 ++- include/uapi/linux/usb/tmc.h | 2 + 2 files

[PATCH v5 14/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_IN

2018-08-03 Thread Guido Kiener
instead of USBTMC_TIMEOUT. Check only bit 0 (field bmAbortBulkIn) of the CHECK_ABORT_BULK_IN_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 139 ---

[PATCH v5 02/22] usb: usbtmc: Add ioctl for vendor specific write

2018-08-03 Thread Guido Kiener
flag USBTMC_FLAG_APPEND additional urbs are queued and out_status/out_transfer_size is not reset. EPOLLOUT | EPOLLWRNORM is signaled when all submitted urbs are completed. Flush flying urbs when file handle is closed or device is suspended or reset. Signed-off-by: Guido Kiener Reviewed-by: Steve

[PATCH v5 01/22] usb: usbtmc: Add ioctl for generic requests on control

2018-08-03 Thread Guido Kiener
Add USBTMC_IOCTL_CTRL_REQUEST to send arbitrary requests on the control pipe. Used by specific applications of IVI Foundation, Inc. to implement VISA API functions: viUsbControlIn/Out. The maximum length of control request is set to 4k. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless

[PATCH v5 07/22] usb: usbtmc: Fix suspend/resume

2018-08-03 Thread Guido Kiener
Submitted urbs are not allowed when system is suspended. Thus the submitted urb waiting at interrupt pipe is killed during suspend callback and submitted again when system resumes. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 +++- 1

[PATCH v5 15/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_OUT

2018-08-03 Thread Guido Kiener
s to avoid stressing the instrument with repeated requests. Use common macro USB_CTRL_GET_TIMEOUT instead of USBTMC_TIMEOUT. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers

[PATCH v5 05/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_CANCEL_IO

2018-08-03 Thread Guido Kiener
ioctl USBTMC_IOCTL_CANCEL_IO stops and kills all flying urbs of last USBTMC_IOCTL_READ and USBTMC_IOCTL_WRITE function calls. A subsequent call to USBTMC_IOCTL_READ or USBTMC_IOCTL_WRITE_RESULT returns -ECANCELED with information about current transferred data. Signed-off-by: Guido Kiener

[PATCH v5 13/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_CLEAR

2018-08-03 Thread Guido Kiener
CHECK_CLEAR_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 46 +++--- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/usb/class

[PATCH v5 12/22] usb: usbtmc: Optimize usbtmc_read

2018-08-03 Thread Guido Kiener
: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 222 ++--- 1 file changed, 105 insertions(+), 117 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 6d5f514b3081..11225c6d6c69 100644 --- a/drivers/usb

[PATCH v5 17/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_API_VERSION

2018-08-03 Thread Guido Kiener
when changing tmc.h with new flags, ioctls or when changing a significant behavior of the driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 9 + include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb

[PATCH v5 06/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_CLEANUP_IO

2018-08-03 Thread Guido Kiener
. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 19 +++ include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index e78176ef0e42..b8a4140bd161 100644

[PATCH v4 22/22] usb: usbtmc: Remove sysfs group TermChar and auto_abort

2018-07-30 Thread Guido Kiener
As all the properties of the usbtmc driver can now be controlled on a per file descriptor basis by ioctl functions the sysfs interface is of limited use. We are not aware about applications that are using the sysfs parameter TermChar, TermCharEnabled or auto_abort. Signed-off-by: Guido Kiener

[PATCH v4 18/22] usb: usbtmc: Update ioctl-number.txt

2018-07-30 Thread Guido Kiener
Reserve a suitable range of ioctl numbers for USBTMC driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- Documentation/ioctl/ioctl-number.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl

[PATCH v4 21/22] usb: usbtmc: Fix split quoted string in debug message

2018-07-30 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 785eee3a6b89..6aef3447adcc 100644 --- a/drivers/usb/class/usbtmc.c +++ b

[PATCH v4 13/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_CLEAR

2018-07-30 Thread Guido Kiener
CHECK_CLEAR_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 46 +++--- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/usb/class

[PATCH v4 16/22] usb: usbtmc: Replace USBTMC_TIMEOUT macros for control messages

2018-07-30 Thread Guido Kiener
Use common timeout macro USB_CTRL_GET_TIMEOUT (=5s) for all usb_control_msg() function calls. The macro USBTMC_TIMEOUT should only be used as default value for Bulk IN/OUT transfers. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 8 1 file

[PATCH v4 11/22] usb: usbtmc: Optimize usbtmc_write

2018-07-30 Thread Guido Kiener
Use new usbtmc_generic_write function to maximize bandwidth during long data transfer. The maximum output transfer size is limited to INT_MAX (=2GB). Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 176 +++-- 1 file

[PATCH v4 19/22] usb: usbtmc: Remove redundant code

2018-07-30 Thread Guido Kiener
Remove redundant code and fix debug messages. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index

[PATCH v4 15/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_OUT

2018-07-30 Thread Guido Kiener
s to avoid stressing the instrument with repeated requests. Use common macro USB_CTRL_GET_TIMEOUT instead of USBTMC_TIMEOUT. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers

[PATCH v4 12/22] usb: usbtmc: Optimize usbtmc_read

2018-07-30 Thread Guido Kiener
: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 222 ++--- 1 file changed, 105 insertions(+), 117 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 6d5f514b3081..11225c6d6c69 100644 --- a/drivers/usb

[PATCH v4 17/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_API_VERSION

2018-07-30 Thread Guido Kiener
when changing tmc.h with new flags, ioctls or when changing a significant behavior of the driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 9 + include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb

[PATCH v4 20/22] usb: usbtmc: Remove redundant macro USBTMC_SIZE_IOBUFFER

2018-07-30 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 81144c0c4772..785eee3a6b89 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class

[PATCH v4 14/22] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_IN

2018-07-30 Thread Guido Kiener
instead of USBTMC_TIMEOUT. Check only bit 0 (field bmAbortBulkIn) of the CHECK_ABORT_BULK_IN_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 139 ---

[PATCH v4 09/22] usb: usbtmc: add ioctl USBTMC_IOCTL_MSG_IN_ATTR

2018-07-30 Thread Guido Kiener
message is received. Bit 1 = is set when the last byte is a termchar (e.g. '\n'). Note that this bit is always zero when the device does not support the termchar feature or when termchar detection is not enabled (see ioctl USBTMC_IOCTL_CONFIG_TERMCHAR). Signed-off-by: Guido Kiener Reviewed

[PATCH v4 03/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_WRITE_RESULT

2018-07-30 Thread Guido Kiener
ioctl USBTMC_IOCTL_WRITE_RESULT copies current out_transfer_size to given __u32 pointer and returns current out_status of the last (asnynchronous) USBTMC_IOCTL_WRITE call. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25

[PATCH v4 07/22] usb: usbtmc: Fix suspend/resume

2018-07-30 Thread Guido Kiener
Submitted urbs are not allowed when system is suspended. Thus the submitted urb waiting at interrupt pipe is killed during suspend callback and submitted again when system resumes. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 +++- 1

[PATCH v4 06/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_CLEANUP_IO

2018-07-30 Thread Guido Kiener
. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 19 +++ include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index e78176ef0e42..b8a4140bd161 100644

[PATCH v4 01/22] usb: usbtmc: Add ioctl for generic requests on control

2018-07-30 Thread Guido Kiener
Add USBTMC_IOCTL_CTRL_REQUEST to send arbitrary requests on the control pipe. Used by specific applications of IVI Foundation, Inc. to implement VISA API functions: viUsbControlIn/Out. The maximum length of control request is set to 4k. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless

[PATCH v4 10/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_AUTO_ABORT

2018-07-30 Thread Guido Kiener
Add ioctl USBTMC_IOCTL_AUTO_ABORT to configure auto_abort for each specific file handle. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 23 --- include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 17 insertions(+), 7 deletions

[PATCH v4 02/22] usb: usbtmc: Add ioctl for vendor specific write

2018-07-30 Thread Guido Kiener
flag USBTMC_FLAG_APPEND additional urbs are queued and out_status/out_transfer_size is not reset. EPOLLOUT | EPOLLWRNORM is signaled when all submitted urbs are completed. Flush flying urbs when file handle is closed or device is suspended or reset. Signed-off-by: Guido Kiener Reviewed-by: Steve

[PATCH v4 08/22] usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ

2018-07-30 Thread Guido Kiener
Wait until an SRQ (service request) is received on the interrupt pipe or until the given period of time is expired. In contrast to the poll() function this ioctl does not return when other (a)synchronous I/O operations fail with EPOLLERR. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless

[PATCH v4 00/22] usb: usbtmc: Changes needed for compatible IVI/VISA library

2018-07-30 Thread Guido Kiener
er. Improvements in the data transfer rate of over 130 MByte/s for usb 3.x connections have been measured. Guido Kiener, Dave Penkler, Steve Bayless (22): usb: usbtmc: Add ioctl for generic requests on control usb: usbtmc: Add ioctl for vendor specific write usb: usbtmc: Add ioctl USBTMC_IOCTL

[PATCH v4 05/22] usb: usbtmc: Add ioctl USBTMC_IOCTL_CANCEL_IO

2018-07-30 Thread Guido Kiener
ioctl USBTMC_IOCTL_CANCEL_IO stops and kills all flying urbs of last USBTMC_IOCTL_READ and USBTMC_IOCTL_WRITE function calls. A subsequent call to USBTMC_IOCTL_READ or USBTMC_IOCTL_WRITE_RESULT returns -ECANCELED with information about current transferred data. Signed-off-by: Guido Kiener

[PATCH v4 04/22] usb: usbtmc: Add ioctl for vendor specific read

2018-07-30 Thread Guido Kiener
already available due to a previous non blocking call the ioctl will return -EINVAL when the message pointer is NULL. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 336 ++- include/uapi/linux/usb/tmc.h | 2 + 2 files

[PATCH v3 22/23] usb: usbtmc: Fix split quoted string in debug message

2018-07-24 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index ddc2e4b78a3b..9a6312a49b55 100644 --- a/drivers/usb/class/usbtmc.c +++ b

[PATCH v3 14/23] usb: usbtmc: Fix ioctl USBTMC_IOCTL_CLEAR

2018-07-24 Thread Guido Kiener
CHECK_CLEAR_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 46 +++--- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/usb/class

[PATCH v3 15/23] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_IN

2018-07-24 Thread Guido Kiener
instead of USBTMC_TIMEOUT. Check only bit 0 (field bmAbortBulkIn) of the CHECK_ABORT_BULK_IN_STATUS response, since other bits are reserved and can change in future versions. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 139 ---

[PATCH v3 20/23] usb: usbtmc: Remove redundant code

2018-07-24 Thread Guido Kiener
Remove redundant code and fix debug messages. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index

[PATCH v3 10/23] usb: usbtmc: add ioctl USBTMC_IOCTL_MSG_IN_ATTR

2018-07-24 Thread Guido Kiener
message is received. Bit 1 = is set when the last byte is a termchar (e.g. '\n'). Note that this bit is always zero when the device does not support the termchar feature or when termchar detection is not enabled (see ioctl USBTMC_IOCTL_CONFIG_TERMCHAR). Signed-off-by: Guido Kiener Reviewed

[PATCH v3 00/23] usb: usbtmc: Changes needed for compatible IVI/VISA library

2018-07-24 Thread Guido Kiener
er. Improvements in the data transfer rate of over 130 MByte/s for usb 3.x connections have been measured. Guido Kiener, Dave Penkler, Steve Bayless (23): usb: usbtmc: Add support for 32 bit compat applications usb: usbtmc: Add ioctl for generic requests on control usb: usbtmc: Add ioctl for ve

[PATCH v3 17/23] usb: usbtmc: Replace USBTMC_TIMEOUT macros for control messages

2018-07-24 Thread Guido Kiener
Use common timeout macro USB_CTRL_GET_TIMEOUT (=5s) for all usb_control_msg() function calls. The macro USBTMC_TIMEOUT should only be used as default value for Bulk IN/OUT transfers. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 8 1 file

[PATCH v3 16/23] usb: usbtmc: Fix ioctl USBTMC_IOCTL_ABORT_BULK_OUT

2018-07-24 Thread Guido Kiener
s to avoid stressing the instrument with repeated requests. Use common macro USB_CTRL_GET_TIMEOUT instead of USBTMC_TIMEOUT. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers

[PATCH v3 03/23] usb: usbtmc: Add ioctl for vendor specific write

2018-07-24 Thread Guido Kiener
flag USBTMC_FLAG_APPEND additional urbs are queued and out_status/out_transfer_size is not reset. EPOLLOUT | EPOLLWRNORM is signaled when all submitted urbs are completed. Flush flying urbs when file handle is closed or device is suspended or reset. Signed-off-by: Guido Kiener Reviewed-by: Steve

[PATCH v3 18/23] usb: usbtmc: Add ioctl USBTMC_IOCTL_API_VERSION

2018-07-24 Thread Guido Kiener
when changing tmc.h with new flags, ioctls or when changing a significant behavior of the driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 9 + include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb

[PATCH v3 07/23] usb: usbtmc: Add ioctl USBTMC_IOCTL_CLEANUP_IO

2018-07-24 Thread Guido Kiener
. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 19 +++ include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 67cdf5df90d7..fe140d400e1d 100644

[PATCH v3 11/23] usb: usbtmc: Add ioctl USBTMC_IOCTL_AUTO_ABORT

2018-07-24 Thread Guido Kiener
Add ioctl USBTMC_IOCTL_AUTO_ABORT to configure auto_abort for each specific file handle. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 23 --- include/uapi/linux/usb/tmc.h | 1 + 2 files changed, 17 insertions(+), 7 deletions

[PATCH v3 08/23] usb: usbtmc: Fix suspend/resume

2018-07-24 Thread Guido Kiener
Submitted urbs are not allowed when system is suspended. Thus the submitted urb waiting at interrupt pipe is killed during suspend callback and submitted again when system resumes. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 16 +++- 1

[PATCH v3 23/23] usb: usbtmc: Remove sysfs group TermChar and auto_abort

2018-07-24 Thread Guido Kiener
As all the properties of the usbtmc driver can now be controlled on a per file descriptor basis by ioctl functions the sysfs interface is of limited use. We are not aware about applications that are using the sysfs parameter TermChar, TermCharEnabled or auto_abort. Signed-off-by: Guido Kiener

[PATCH v3 21/23] usb: usbtmc: Remove redundant macro USBTMC_SIZE_IOBUFFER

2018-07-24 Thread Guido Kiener
Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index a6482e850532..ddc2e4b78a3b 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class

[PATCH v3 19/23] usb: usbtmc: Update ioctl-number.txt

2018-07-24 Thread Guido Kiener
Reserve a suitable range of ioctl numbers for USBTMC driver. Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- Documentation/ioctl/ioctl-number.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl

[PATCH v3 01/23] usb: usbtmc: Add support for 32 bit compat applications

2018-07-24 Thread Guido Kiener
32 bit applications can only call ioctl functions on 64 bit systems when the field .compat_ioctl is defined for file operations. Tested-by: Dave Penkler Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 4 1 file changed, 4 insertions(+) diff --git

  1   2   >