Commit b1498451 authored by Guido Kiener's avatar Guido Kiener Committed by Greg Kroah-Hartman

usb: usbtmc: Add ioctl USBTMC_IOCTL_WRITE_RESULT

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: default avatarGuido Kiener <guido.kiener@rohde-schwarz.com>
Reviewed-by: default avatarSteve Bayless <steve_bayless@keysight.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4ddc645f
...@@ -893,6 +893,26 @@ static ssize_t usbtmc_ioctl_generic_write(struct usbtmc_file_data *file_data, ...@@ -893,6 +893,26 @@ static ssize_t usbtmc_ioctl_generic_write(struct usbtmc_file_data *file_data,
return retval; return retval;
} }
/*
* Get the generic write result
*/
static ssize_t usbtmc_ioctl_write_result(struct usbtmc_file_data *file_data,
void __user *arg)
{
u32 transferred;
int retval;
spin_lock_irq(&file_data->err_lock);
transferred = file_data->out_transfer_size;
retval = file_data->out_status;
spin_unlock_irq(&file_data->err_lock);
if (put_user(transferred, (__u32 __user *)arg))
return -EFAULT;
return retval;
}
/* /*
* Sends a REQUEST_DEV_DEP_MSG_IN message on the Bulk-OUT endpoint. * Sends a REQUEST_DEV_DEP_MSG_IN message on the Bulk-OUT endpoint.
* @transfer_size: number of bytes to request from the device. * @transfer_size: number of bytes to request from the device.
...@@ -1748,6 +1768,11 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1748,6 +1768,11 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
(void __user *)arg); (void __user *)arg);
break; break;
case USBTMC_IOCTL_WRITE_RESULT:
retval = usbtmc_ioctl_write_result(file_data,
(void __user *)arg);
break;
case USBTMC488_IOCTL_GET_CAPS: case USBTMC488_IOCTL_GET_CAPS:
retval = copy_to_user((void __user *)arg, retval = copy_to_user((void __user *)arg,
&data->usb488_caps, &data->usb488_caps,
......
...@@ -86,6 +86,7 @@ struct usbtmc_message { ...@@ -86,6 +86,7 @@ struct usbtmc_message {
#define USBTMC_IOCTL_EOM_ENABLE _IOW(USBTMC_IOC_NR, 11, __u8) #define USBTMC_IOCTL_EOM_ENABLE _IOW(USBTMC_IOC_NR, 11, __u8)
#define USBTMC_IOCTL_CONFIG_TERMCHAR _IOW(USBTMC_IOC_NR, 12, struct usbtmc_termchar) #define USBTMC_IOCTL_CONFIG_TERMCHAR _IOW(USBTMC_IOC_NR, 12, struct usbtmc_termchar)
#define USBTMC_IOCTL_WRITE _IOWR(USBTMC_IOC_NR, 13, struct usbtmc_message) #define USBTMC_IOCTL_WRITE _IOWR(USBTMC_IOC_NR, 13, struct usbtmc_message)
#define USBTMC_IOCTL_WRITE_RESULT _IOWR(USBTMC_IOC_NR, 15, __u32)
#define USBTMC488_IOCTL_GET_CAPS _IOR(USBTMC_IOC_NR, 17, unsigned char) #define USBTMC488_IOCTL_GET_CAPS _IOR(USBTMC_IOC_NR, 17, unsigned char)
#define USBTMC488_IOCTL_READ_STB _IOR(USBTMC_IOC_NR, 18, unsigned char) #define USBTMC488_IOCTL_READ_STB _IOR(USBTMC_IOC_NR, 18, unsigned char)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment