diff mbox

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

Message ID 20180718084602.10568-9-guido@kiener-muenchen.de (mailing list archive)
State New, archived
Headers show

Commit Message

Guido Kiener July 18, 2018, 8:45 a.m. UTC
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 <guido.kiener@rohde-schwarz.com>
Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
---
 drivers/usb/class/usbtmc.c   | 151 +++++++++++++++++++++++++++++++++++
 include/uapi/linux/usb/tmc.h |  15 ++++
 2 files changed, 166 insertions(+)

Comments

Greg Kroah-Hartman July 21, 2018, 6:27 a.m. UTC | #1
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 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 <guido.kiener@rohde-schwarz.com>
> Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
> ---
>  drivers/usb/class/usbtmc.c   | 151 +++++++++++++++++++++++++++++++++++
>  include/uapi/linux/usb/tmc.h |  15 ++++
>  2 files changed, 166 insertions(+)
> 
> diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
> index d685db78b80b..846599dd0c84 100644
> --- a/drivers/usb/class/usbtmc.c
> +++ b/drivers/usb/class/usbtmc.c
> @@ -5,6 +5,7 @@
>   * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
>   * Copyright (C) 2008 Novell, Inc.
>   * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
> + * Copyright (C) 2018 IVI Foundation, Inc.
>   */
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> @@ -36,6 +37,9 @@
>  /* Default USB timeout (in milliseconds) */
>  #define USBTMC_TIMEOUT		5000
>  
> +/* I/O buffer size used in generic read/write functions */
> +#define USBTMC_BUFSIZE		(4096)
> +
>  /*
>   * Maximum number of read cycles to empty bulk in endpoint during CLEAR and
>   * ABORT_BULK_IN requests. Ends the loop if (for whatever reason) a short
> @@ -126,6 +130,17 @@ struct usbtmc_file_data {
>  	bool           term_char_enabled;
>  };
>  
> +#ifdef CONFIG_COMPAT
> +
> +struct compat_usbtmc_ctrlrequest {
> +	struct usbtmc_request req;
> +	compat_uptr_t data;
> +} __packed;

Wait, why?  You are creating a new api here, why do you need a 32bit
compat layer?  Just create it in a way that works for both layouts.
Just make your pointer a 64bit value and cast it to the pointer when
using it.  Other ioctls do this in lots of places, making things simpler
overall.  That way you don't need an ioctl compat call at all.

Please rework the code that way, don't create new apis that have to add
"old" 32bit compatibility support to them.  That's just extra work you
don't need to do here.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guido Kiener July 21, 2018, 11:11 a.m. UTC | #2
Zitat von Greg KH <gregkh@linuxfoundation.org>:

> 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 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 <guido.kiener@rohde-schwarz.com>
>> Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
>> ---
>>  drivers/usb/class/usbtmc.c   | 151 +++++++++++++++++++++++++++++++++++
>>  include/uapi/linux/usb/tmc.h |  15 ++++
>>  2 files changed, 166 insertions(+)
>>
>> diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
>> index d685db78b80b..846599dd0c84 100644
>> --- a/drivers/usb/class/usbtmc.c
>> +++ b/drivers/usb/class/usbtmc.c
>> @@ -5,6 +5,7 @@
>>   * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
>>   * Copyright (C) 2008 Novell, Inc.
>>   * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
>> + * Copyright (C) 2018 IVI Foundation, Inc.
>>   */
>>
>>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>> @@ -36,6 +37,9 @@
>>  /* Default USB timeout (in milliseconds) */
>>  #define USBTMC_TIMEOUT		5000
>>
>> +/* I/O buffer size used in generic read/write functions */
>> +#define USBTMC_BUFSIZE		(4096)
>> +
>>  /*
>>   * Maximum number of read cycles to empty bulk in endpoint during CLEAR and
>>   * ABORT_BULK_IN requests. Ends the loop if (for whatever reason) a short
>> @@ -126,6 +130,17 @@ struct usbtmc_file_data {
>>  	bool           term_char_enabled;
>>  };
>>
>> +#ifdef CONFIG_COMPAT
>> +
>> +struct compat_usbtmc_ctrlrequest {
>> +	struct usbtmc_request req;
>> +	compat_uptr_t data;
>> +} __packed;
>
> Wait, why?  You are creating a new api here, why do you need a 32bit
> compat layer?  Just create it in a way that works for both layouts.
> Just make your pointer a 64bit value and cast it to the pointer when
> using it.  Other ioctls do this in lots of places, making things simpler
> overall.  That way you don't need an ioctl compat call at all.
>
> Please rework the code that way, don't create new apis that have to add
> "old" 32bit compatibility support to them.  That's just extra work you
> don't need to do here.
>
> thanks,
>
> greg k-h

Maybe I'm still missing something. You wanted us that the driver supports
32 bit applications on 64 bit systems. Therefore we added the patch
[PATCH v2 07/29] usb: usbtmc: Add support for 32 bit compat applications
I do not know any other way to make ioctl functions working for
32 bit application, except adding the line .compat_ioctl =  
usbtmc_compat_ioctl.
Please note that all other ioctl calls like USBTMC_IOCTL_CLEAR etc. do not
work for 32 applications as well when we omit patch 07.

Please let us first agree on patch 07 and then we can continue to  
discuss patch 08.

Regards,

-Guido


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman July 21, 2018, 11:21 a.m. UTC | #3
On Sat, Jul 21, 2018 at 11:11:55AM +0000, guido@kiener-muenchen.de wrote:
> 
> Zitat von Greg KH <gregkh@linuxfoundation.org>:
> 
> > 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 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 <guido.kiener@rohde-schwarz.com>
> > > Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
> > > ---
> > >  drivers/usb/class/usbtmc.c   | 151 +++++++++++++++++++++++++++++++++++
> > >  include/uapi/linux/usb/tmc.h |  15 ++++
> > >  2 files changed, 166 insertions(+)
> > > 
> > > diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
> > > index d685db78b80b..846599dd0c84 100644
> > > --- a/drivers/usb/class/usbtmc.c
> > > +++ b/drivers/usb/class/usbtmc.c
> > > @@ -5,6 +5,7 @@
> > >   * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
> > >   * Copyright (C) 2008 Novell, Inc.
> > >   * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
> > > + * Copyright (C) 2018 IVI Foundation, Inc.
> > >   */
> > > 
> > >  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > > @@ -36,6 +37,9 @@
> > >  /* Default USB timeout (in milliseconds) */
> > >  #define USBTMC_TIMEOUT		5000
> > > 
> > > +/* I/O buffer size used in generic read/write functions */
> > > +#define USBTMC_BUFSIZE		(4096)
> > > +
> > >  /*
> > >   * Maximum number of read cycles to empty bulk in endpoint during CLEAR and
> > >   * ABORT_BULK_IN requests. Ends the loop if (for whatever reason) a short
> > > @@ -126,6 +130,17 @@ struct usbtmc_file_data {
> > >  	bool           term_char_enabled;
> > >  };
> > > 
> > > +#ifdef CONFIG_COMPAT
> > > +
> > > +struct compat_usbtmc_ctrlrequest {
> > > +	struct usbtmc_request req;
> > > +	compat_uptr_t data;
> > > +} __packed;
> > 
> > Wait, why?  You are creating a new api here, why do you need a 32bit
> > compat layer?  Just create it in a way that works for both layouts.
> > Just make your pointer a 64bit value and cast it to the pointer when
> > using it.  Other ioctls do this in lots of places, making things simpler
> > overall.  That way you don't need an ioctl compat call at all.
> > 
> > Please rework the code that way, don't create new apis that have to add
> > "old" 32bit compatibility support to them.  That's just extra work you
> > don't need to do here.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Maybe I'm still missing something. You wanted us that the driver supports
> 32 bit applications on 64 bit systems. Therefore we added the patch
> [PATCH v2 07/29] usb: usbtmc: Add support for 32 bit compat applications
> I do not know any other way to make ioctl functions working for
> 32 bit application, except adding the line .compat_ioctl =
> usbtmc_compat_ioctl.
> Please note that all other ioctl calls like USBTMC_IOCTL_CLEAR etc. do not
> work for 32 applications as well when we omit patch 07.
> 
> Please let us first agree on patch 07 and then we can continue to discuss
> patch 08.

"patch 07" was about 300 patches ago in the number of patches I have
reviewed today, sorry, I don't reallhy remember what it looked like but
I think it was something like adding a custom compat_ioctl handler,
right?

If so, no, that's not correct, your compat_ioctl function should be the
same as your "normal" ioctl function.  You do not need a separate
function for 32 vs. 64 bits if you do everything correctly.

So yes, you are right, 32bit applications will not work until you set
compat_ioctl, but just be sure to set it to the correct thing.

So feel free to resend this type of change, but just do not make any
special ioctl handlers for 32bits.  If you do that, you have not
designed your ioctls correctly.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guido Kiener July 24, 2018, 6:45 a.m. UTC | #4
Zitat von Greg KH <gregkh@linuxfoundation.org>:

> On Sat, Jul 21, 2018 at 11:11:55AM +0000, guido@kiener-muenchen.de wrote:
>>
>> Zitat von Greg KH <gregkh@linuxfoundation.org>:
>>
>> > 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 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 <guido.kiener@rohde-schwarz.com>
>> > > Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
>> > > ---
>> > >  drivers/usb/class/usbtmc.c   | 151 +++++++++++++++++++++++++++++++++++
>> > >  include/uapi/linux/usb/tmc.h |  15 ++++
>> > >  2 files changed, 166 insertions(+)
>> > >
>> > > diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
>> > > index d685db78b80b..846599dd0c84 100644
>> > > --- a/drivers/usb/class/usbtmc.c
>> > > +++ b/drivers/usb/class/usbtmc.c
>> > > @@ -5,6 +5,7 @@
>> > >   * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
>> > >   * Copyright (C) 2008 Novell, Inc.
>> > >   * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
>> > > + * Copyright (C) 2018 IVI Foundation, Inc.
>> > >   */
>> > >
>> > >  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>> > > @@ -36,6 +37,9 @@
>> > >  /* Default USB timeout (in milliseconds) */
>> > >  #define USBTMC_TIMEOUT		5000
>> > >
>> > > +/* I/O buffer size used in generic read/write functions */
>> > > +#define USBTMC_BUFSIZE		(4096)
>> > > +
>> > >  /*
>> > >   * Maximum number of read cycles to empty bulk in endpoint  
>> during CLEAR and
>> > >   * ABORT_BULK_IN requests. Ends the loop if (for whatever  
>> reason) a short
>> > > @@ -126,6 +130,17 @@ struct usbtmc_file_data {
>> > >  	bool           term_char_enabled;
>> > >  };
>> > >
>> > > +#ifdef CONFIG_COMPAT
>> > > +
>> > > +struct compat_usbtmc_ctrlrequest {
>> > > +	struct usbtmc_request req;
>> > > +	compat_uptr_t data;
>> > > +} __packed;
>> >
>> > Wait, why?  You are creating a new api here, why do you need a 32bit
>> > compat layer?  Just create it in a way that works for both layouts.
>> > Just make your pointer a 64bit value and cast it to the pointer when
>> > using it.  Other ioctls do this in lots of places, making things simpler
>> > overall.  That way you don't need an ioctl compat call at all.
>> >
>> > Please rework the code that way, don't create new apis that have to add
>> > "old" 32bit compatibility support to them.  That's just extra work you
>> > don't need to do here.
>> >

Ok. I found some places where in_compat_syscall() or u64_to_uptr() is used
to solve the 32/64 bit pointer problem. This makes the usbtmc kernel driver
much easier, however the user needs to call something like this with
double type casts to assign a 32/64 bit pointer to a __u64 value:
request.data = (__u64)(uintptr_t)buf
We agreed to accept this drawback and I will send a v3 patch series.

Regards,

Guido

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index d685db78b80b..846599dd0c84 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -5,6 +5,7 @@ 
  * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
  * Copyright (C) 2008 Novell, Inc.
  * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
+ * Copyright (C) 2018 IVI Foundation, Inc.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -36,6 +37,9 @@ 
 /* Default USB timeout (in milliseconds) */
 #define USBTMC_TIMEOUT		5000
 
+/* I/O buffer size used in generic read/write functions */
+#define USBTMC_BUFSIZE		(4096)
+
 /*
  * Maximum number of read cycles to empty bulk in endpoint during CLEAR and
  * ABORT_BULK_IN requests. Ends the loop if (for whatever reason) a short
@@ -126,6 +130,17 @@  struct usbtmc_file_data {
 	bool           term_char_enabled;
 };
 
+#ifdef CONFIG_COMPAT
+
+struct compat_usbtmc_ctrlrequest {
+	struct usbtmc_request req;
+	compat_uptr_t data;
+} __packed;
+
+#define USBTMC_IOCTL_CTRL_REQUEST32	_IOWR(USBTMC_IOC_NR, 8, struct compat_usbtmc_ctrlrequest)
+
+#endif
+
 /* Forward declarations */
 static struct usb_driver usbtmc_driver;
 
@@ -1250,6 +1265,127 @@  static int usbtmc_ioctl_indicator_pulse(struct usbtmc_device_data *data)
 	return rv;
 }
 
+#ifdef CONFIG_COMPAT
+static int usbtmc_ioctl_request32(struct usbtmc_device_data *data,
+				  void __user *arg)
+{
+	struct device *dev = &data->intf->dev;
+	struct compat_usbtmc_ctrlrequest request;
+	u8 *buffer = NULL;
+	int rv;
+	unsigned long res;
+
+	res = copy_from_user(&request, arg,
+			     sizeof(struct compat_usbtmc_ctrlrequest));
+	if (res)
+		return -EFAULT;
+
+	buffer = kmalloc(request.req.wLength, GFP_KERNEL);
+	if (!buffer)
+		return -ENOMEM;
+
+	if (request.req.wLength > USBTMC_BUFSIZE)
+		return -EMSGSIZE;
+
+	if (request.req.wLength) {
+		buffer = kmalloc(request.req.wLength, GFP_KERNEL);
+		if (!buffer)
+			return -ENOMEM;
+
+		if ((request.req.bRequestType & USB_DIR_IN) == 0) {
+			/* Send control data to device */
+			res = copy_from_user(buffer, compat_ptr(request.data),
+					     request.req.wLength);
+			if (res) {
+				rv = -EFAULT;
+				goto exit;
+			}
+		}
+	}
+
+	rv = usb_control_msg(data->usb_dev,
+			usb_rcvctrlpipe(data->usb_dev, 0),
+			request.req.bRequest,
+			request.req.bRequestType,
+			request.req.wValue,
+			request.req.wIndex,
+			buffer, request.req.wLength, USB_CTRL_GET_TIMEOUT);
+
+	if (rv < 0) {
+		dev_err(dev, "%s failed %d\n", __func__, rv);
+		goto exit;
+	}
+
+	if (rv && (request.req.bRequestType & USB_DIR_IN)) {
+		/* Read control data from device */
+		res = copy_to_user(compat_ptr(request.data), buffer, rv);
+		if (res)
+			rv = -EFAULT;
+	}
+
+ exit:
+	kfree(buffer);
+	return rv;
+}
+#endif
+
+static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
+				void __user *arg)
+{
+	struct device *dev = &data->intf->dev;
+	struct usbtmc_ctrlrequest request;
+	u8 *buffer = NULL;
+	int rv;
+	unsigned long res;
+
+	res = copy_from_user(&request, arg, sizeof(struct usbtmc_ctrlrequest));
+	if (res)
+		return -EFAULT;
+
+	if (request.req.wLength > USBTMC_BUFSIZE)
+		return -EMSGSIZE;
+
+	if (request.req.wLength) {
+		buffer = kmalloc(request.req.wLength, GFP_KERNEL);
+		if (!buffer)
+			return -ENOMEM;
+
+		if ((request.req.bRequestType & USB_DIR_IN) == 0) {
+			/* Send control data to device */
+			res = copy_from_user(buffer, request.data,
+					     request.req.wLength);
+			if (res) {
+				rv = -EFAULT;
+				goto exit;
+			}
+		}
+	}
+
+	rv = usb_control_msg(data->usb_dev,
+			usb_rcvctrlpipe(data->usb_dev, 0),
+			request.req.bRequest,
+			request.req.bRequestType,
+			request.req.wValue,
+			request.req.wIndex,
+			buffer, request.req.wLength, USB_CTRL_GET_TIMEOUT);
+
+	if (rv < 0) {
+		dev_err(dev, "%s failed %d\n", __func__, rv);
+		goto exit;
+	}
+
+	if (rv && (request.req.bRequestType & USB_DIR_IN)) {
+		/* Read control data from device */
+		res = copy_to_user(request.data, buffer, rv);
+		if (res)
+			rv = -EFAULT;
+	}
+
+ exit:
+	kfree(buffer);
+	return rv;
+}
+
 /*
  * Get the usb timeout value
  */
@@ -1366,6 +1502,16 @@  static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		retval = usbtmc_ioctl_abort_bulk_in(data);
 		break;
 
+	case USBTMC_IOCTL_CTRL_REQUEST:
+		retval = usbtmc_ioctl_request(data, (void __user *)arg);
+		break;
+
+#ifdef CONFIG_COMPAT
+	case USBTMC_IOCTL_CTRL_REQUEST32:
+		retval = usbtmc_ioctl_request32(data, (void __user *)arg);
+		break;
+#endif
+
 	case USBTMC_IOCTL_GET_TIMEOUT:
 		retval = usbtmc_ioctl_get_timeout(file_data,
 						  (void __user *)arg);
@@ -1428,6 +1574,11 @@  static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 static long usbtmc_compat_ioctl(struct file *file, unsigned int cmd,
 				unsigned long arg)
 {
+	switch (cmd) {
+	case USBTMC_IOCTL_CTRL_REQUEST:
+		return -EBADRQC;
+	}
+
 	return usbtmc_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
 }
 #endif
diff --git a/include/uapi/linux/usb/tmc.h b/include/uapi/linux/usb/tmc.h
index 729af2f861a4..86cb7be80106 100644
--- a/include/uapi/linux/usb/tmc.h
+++ b/include/uapi/linux/usb/tmc.h
@@ -4,6 +4,7 @@ 
  * Copyright (C) 2008 Novell, Inc.
  * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
  * Copyright (C) 2015 Dave Penkler <dpenkler@gmail.com>
+ * Copyright (C) 2018 IVI Foundation, Inc.
  *
  * This file holds USB constants defined by the USB Device Class
  * and USB488 Subclass Definitions for Test and Measurement devices
@@ -40,6 +41,19 @@ 
 #define USBTMC488_REQUEST_GOTO_LOCAL			161
 #define USBTMC488_REQUEST_LOCAL_LOCKOUT			162
 
+struct usbtmc_request {
+	__u8 bRequestType;
+	__u8 bRequest;
+	__u16 wValue;
+	__u16 wIndex;
+	__u16 wLength;
+} __attribute__ ((packed));
+
+struct usbtmc_ctrlrequest {
+	struct usbtmc_request req;
+	void __user *data;
+} __attribute__ ((packed));
+
 struct usbtmc_termchar {
 	__u8 term_char;
 	__u8 term_char_enabled;
@@ -53,6 +67,7 @@  struct usbtmc_termchar {
 #define USBTMC_IOCTL_ABORT_BULK_IN	_IO(USBTMC_IOC_NR, 4)
 #define USBTMC_IOCTL_CLEAR_OUT_HALT	_IO(USBTMC_IOC_NR, 6)
 #define USBTMC_IOCTL_CLEAR_IN_HALT	_IO(USBTMC_IOC_NR, 7)
+#define USBTMC_IOCTL_CTRL_REQUEST	_IOWR(USBTMC_IOC_NR, 8, struct usbtmc_ctrlrequest)
 #define USBTMC_IOCTL_GET_TIMEOUT	_IOR(USBTMC_IOC_NR, 9, __u32)
 #define USBTMC_IOCTL_SET_TIMEOUT	_IOW(USBTMC_IOC_NR, 10, __u32)
 #define USBTMC_IOCTL_EOM_ENABLE	        _IOW(USBTMC_IOC_NR, 11, __u8)