[PATCH] Driver for MaxLinear/Exar USB (UART) Serial Adapters

2018-07-24 Thread Patong Yang
The original driver/patch was submitted on April 4, 2018. This is the second version based on the feedback received on the original patch. v2: Removed custom IOCTLs, as suggested by Greg KH Using standard Linux GPIO APIs, as suggested by Greg KH Removed file reads/writes as suggested by

Re: [PATCH] usbip: Fix misuse of strncpy()

2018-07-24 Thread Shuah Khan
On 07/20/2018 08:12 PM, Ben Hutchings wrote: > gcc 8 reports: > > usbip_device_driver.c: In function ‘read_usb_vudc_device’: > usbip_device_driver.c:106:2: error: ‘strncpy’ specified bound 256 equals > destination size [-Werror=stringop-truncation] > strncpy(dev->path, path, SYSFS_PATH_MAX); >

libusbip: error: udev_device_new_from_subsystem_sysname failed

2018-07-24 Thread Channabasappa K
Dear Sir/Madam, ​ ​we are trying to share physical USB connection through IP . *Raspberry pi zero w as Server -* sudo modprobe usbip-core sudo modprobe usbip-host sudo usbipd -D​ sudo usbip list -l - busid 1-1 (1a2c:0002) China Resource Semico Co., Ltd : unknown product

Re: [PATCH v3 02/23] usb: usbtmc: Add ioctl for generic requests on control

2018-07-24 Thread guido
Zitat von Greg KH : On Tue, Jul 24, 2018 at 11:05:29AM +0200, Guido Kiener wrote: +struct usbtmc_ctrlrequest { + struct usbtmc_request req; + __u64 data; /* pointer to user space */ +} __attribute__ ((packed)); Hint, this structure could just be: struct

Re: [PATCH v3 02/23] usb: usbtmc: Add ioctl for generic requests on control

2018-07-24 Thread guido
Zitat von Greg KH : On Tue, Jul 24, 2018 at 11:05:29AM +0200, Guido Kiener wrote: 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

Re: [PATCH v3 02/23] usb: usbtmc: Add ioctl for generic requests on control

2018-07-24 Thread Greg KH
On Tue, Jul 24, 2018 at 11:05:29AM +0200, Guido Kiener wrote: > +struct usbtmc_ctrlrequest { > + struct usbtmc_request req; > + __u64 data; /* pointer to user space */ > +} __attribute__ ((packed)); Hint, this structure could just be: struct usbtmc_ctrlreqest {

Re: [PATCH v3 02/23] usb: usbtmc: Add ioctl for generic requests on control

2018-07-24 Thread Greg KH
On Tue, Jul 24, 2018 at 11:05:29AM +0200, Guido Kiener wrote: > 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

Re: Requesting for Guidance | Mohammad Ali

2018-07-24 Thread Felipe Balbi
(keep linux-usb in Cc. Avoid top-posting) mohammad ali writes: > Thank Q soo much. But a small Request if you have any reference to go > through, please send to my mail Id What kind of references? Get a raspeberry pi, get it to boot the official release, then try to build your own kernel,

[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 +++

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

2018-07-24 Thread Guido Kiener
Remove calculation of max_size (=wMaxPacketSize) and wrong condition (actual == max_size) in while loop. A device clear should always flush the complete Bulk-IN FIFO. Insert a sleep of 50 ms between subsequent CHECK_CLEAR_STATUS control requests to avoid stressing the instrument with repeated

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

2018-07-24 Thread Guido Kiener
Add parameter 'tag' to function usbtmc_ioctl_abort_bulk_in_tag() for future versions. Remove calculation of max_size (=wMaxPacketSize) and wrong condition (actual == max_size) in while loop. An abort operation should always flush the complete Bulk-IN until a short packet is received. Return

[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
add ioctl USBTMC_IOCTL_MSG_IN_ATTR that returns the specific bmTransferAttributes field of the last DEV_DEP_MSG_IN Bulk-IN header. This header is received by the read() function. The meaning of the (u8) bitmap bmTransferAttributes is: Bit 0 = EOM flag is set when the last transfer of a USBTMC

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

2018-07-24 Thread Guido Kiener
The working group "VISA for Linux" of the IVI Foundation www.ivifoundation.org specifies common rules, shared libraries and drivers to implement the specification of "VPP-4.3: The VISA Library" on Linux to be compatible with implementations on other operating systems. The USBTMC protocol is part

[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
Add parameter 'tag' to function usbtmc_ioctl_abort_bulk_out_tag() for future versions. Use USBTMC_BUFSIZE (4k) instead of USBTMC_SIZE_IOBUFFER (2k). Using USBTMC_SIZE_IOBUFFER is deprecated. Insert a sleep of 50 ms between subsequent CHECK_ABORT_BULK_OUT_STATUS control requests to avoid

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

2018-07-24 Thread Guido Kiener
The new ioctl USBTMC_IOCTL_WRITE sends a generic message to bulk OUT. This ioctl is used for vendor specific or asynchronous I/O as well. The message is split into chunks of 4k (page size). Message size is aligned to 32 bit boundaries. With flag USBTMC_FLAG_ASYNC the ioctl is non blocking. With

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

2018-07-24 Thread Guido Kiener
Add ioctl USBTMC_IOCTL_API_VERSION to get current API version of usbtmc driver. This is to allow an instrument library to determine whether the driver API is compatible with the implementation. The API may change in future versions. Therefore the macro USBTMC_API_VERSION should be incremented

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

2018-07-24 Thread Guido Kiener
The ioctl USBTMC_IOCTL_CLEANUP_IO kills all submitted urbs to OUT and IN bulk, and clears all received data from IN bulk. Internal transfer counters and error states are reset. An application should use this ioctl after an asnychronous transfer was canceled and/or error handling has finished.

[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 +++

[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

[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

[PATCH v3 06/23] usb: usbtmc: Add ioctl USBTMC_IOCTL_CANCEL_IO

2018-07-24 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 v3 13/23] usb: usbtmc: Optimize usbtmc_read

2018-07-24 Thread Guido Kiener
Use new usbtmc_generic_read function to maximize bandwidth during long data transfer. Also fix reading of zero length packet (ZLP) or trailing short packet. The maximum input transfer size is limited to INT_MAX (=2GB). Also remove redundant return in send_request_dev_dep_msg_in(). Signed-off-by:

[PATCH v3 12/23] usb: usbtmc: Optimize usbtmc_write

2018-07-24 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 v3 09/23] usb: usbtmc: Add ioctl USBTMC488_IOCTL_WAIT_SRQ

2018-07-24 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 v3 04/23] usb: usbtmc: Add ioctl USBTMC_IOCTL_WRITE_RESULT

2018-07-24 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 v3 05/23] usb: usbtmc: Add ioctl for vendor specific read

2018-07-24 Thread Guido Kiener
The USBTMC_IOCTL_READ call provides for generic synchronous and asynchronous reads on bulk IN to implement vendor specific library routines. Depending on transfer_size the function submits one or more urbs (up to 16) each with a size of up to 4kB. The flag USBTMC_FLAG_IGNORE_TRAILER can be used

[PATCH v3 02/23] usb: usbtmc: Add ioctl for generic requests on control

2018-07-24 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

RE: Requesting for Guidance | Mohammad Ali

2018-07-24 Thread Felipe Balbi
Hi, Peter Chen writes: >> My name is Mohammad Ali. I'm very curious to learn USB DEVICE DRIVER. But I >> Just have knowledge of >> C-Programming and the Linux operating system very basic knowledge of Device >> driver(theory knowledge) i.e; how to >> insert a module, check the module, writer

RE: Requesting for Guidance | Mohammad Ali

2018-07-24 Thread Peter Chen
> My name is Mohammad Ali. I'm very curious to learn USB DEVICE DRIVER. But I > Just have knowledge of > C-Programming and the Linux operating system very basic knowledge of Device > driver(theory knowledge) i.e; how to > insert a module, check the module, writer simple device driver. can you

Re: [PATCH v2 08/29] usb: usbtmc: Add ioctl for generic requests on control

2018-07-24 Thread guido
Zitat von Greg KH : On Sat, Jul 21, 2018 at 11:11:55AM +, gu...@kiener-muenchen.de wrote: Zitat von Greg KH : > On Wed, Jul 18, 2018 at 10:45:41AM +0200, Guido Kiener wrote: > > Add USBTMC_IOCTL_CTRL_REQUEST to send arbitrary requests on the > > control pipe. Used by specific