mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-28 21:46:02 -04:00
Add ioctl to retrieve USBTMC-USB488 capabilities
This is a convenience function to obtain an instrument's capabilities from its file descriptor without having to access sysfs from the user program. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
eb6b92ecc0
commit
29779d89fd
@@ -102,6 +102,9 @@ struct usbtmc_device_data {
|
||||
u16 iin_wMaxPacketSize;
|
||||
atomic_t srq_asserted;
|
||||
|
||||
/* coalesced usb488_caps from usbtmc_dev_capabilities */
|
||||
__u8 usb488_caps;
|
||||
|
||||
u8 rigol_quirk;
|
||||
|
||||
/* attributes from the USB TMC spec for this device */
|
||||
@@ -993,6 +996,7 @@ static int get_capabilities(struct usbtmc_device_data *data)
|
||||
data->capabilities.device_capabilities = buffer[5];
|
||||
data->capabilities.usb488_interface_capabilities = buffer[14];
|
||||
data->capabilities.usb488_device_capabilities = buffer[15];
|
||||
data->usb488_caps = (buffer[14] & 0x07) | ((buffer[15] & 0x0f) << 4);
|
||||
rv = 0;
|
||||
|
||||
err_out:
|
||||
@@ -1168,6 +1172,14 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
retval = usbtmc_ioctl_abort_bulk_in(data);
|
||||
break;
|
||||
|
||||
case USBTMC488_IOCTL_GET_CAPS:
|
||||
retval = copy_to_user((void __user *)arg,
|
||||
&data->usb488_caps,
|
||||
sizeof(data->usb488_caps));
|
||||
if (retval)
|
||||
retval = -EFAULT;
|
||||
break;
|
||||
|
||||
case USBTMC488_IOCTL_READ_STB:
|
||||
retval = usbtmc488_ioctl_read_stb(data, (void __user *)arg);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user