History

USB: usbtmc: Add USBTMC_IOCTL_GET_STB

This new ioctl reads the status byte (STB) from the device and returns the STB unmodified to the application. The srq_asserted bit is not taken into account and not changed. This ioctl is useful to support non USBTMC-488 compliant devices.

Dave Penkler committed 5 years ago

Commit c9784e21 parent 3c1037e2 files · +8 −0Browse files

Unified · Split

2 files
  1. drivers/usb/class/usbtmc.c +6 −0
  2. include/uapi/linux/usb/tmc.h +2 −0
drivers/usb/class/usbtmc.c+6−0
@@ -2149,6 +2149,12 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 2148 unmodified lines
21492149 file_data->auto_abort = !!tmp_byte;
21502150 break;
21512151
2152+ case USBTMC_IOCTL_GET_STB:
2153+ retval = usbtmc_get_stb(file_data, &tmp_byte);
2154+ if (retval > 0)
2155+ retval = put_user(tmp_byte, (__u8 __user *)arg);
2156+ break;
2157+
21522158 case USBTMC_IOCTL_CANCEL_IO:
21532159 retval = usbtmc_ioctl_cancel_io(file_data);
21542160 break;
include/uapi/linux/usb/tmc.h+2−0
@@ -102,6 +102,8 @@ struct usbtmc_message { · 101 unmodified lines
102102 #define USBTMC_IOCTL_MSG_IN_ATTR _IOR(USBTMC_IOC_NR, 24, __u8)
103103 #define USBTMC_IOCTL_AUTO_ABORT _IOW(USBTMC_IOC_NR, 25, __u8)
104104
105+#define USBTMC_IOCTL_GET_STB _IOR(USBTMC_IOC_NR, 26, __u8)
106+
105107 /* Cancel and cleanup asynchronous calls */
106108 #define USBTMC_IOCTL_CANCEL_IO _IO(USBTMC_IOC_NR, 35)
107109 #define USBTMC_IOCTL_CLEANUP_IO _IO(USBTMC_IOC_NR, 36)