Implement TIOCGSERIAL for acm_tty_ioctl (rhbz 787607)
This commit is contained in:
parent
c93c7e5a02
commit
aef732d8e5
|
@ -0,0 +1,58 @@
|
|||
From http://permalink.gmane.org/gmane.linux.usb.general/9236
|
||||
|
||||
attempt to diagnose https://bugzilla.redhat.com/show_bug.cgi?id=787607
|
||||
|
||||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
|
||||
index 9543b19..6dcc3a3 100644
|
||||
--- a/drivers/usb/class/cdc-acm.c
|
||||
+++ b/drivers/usb/class/cdc-acm.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <linux/serial.h>
|
||||
#include <linux/tty_driver.h>
|
||||
#include <linux/tty_flip.h>
|
||||
+#include <linux/serial.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/uaccess.h>
|
||||
@@ -734,15 +734,40 @@ static int acm_tty_tiocmset(struct tty_s
|
||||
return acm_set_control(acm, acm->ctrlout = newctrl);
|
||||
}
|
||||
|
||||
+static int get_serial_info(struct acm *acm, struct serial_struct __user *info)
|
||||
+{
|
||||
+ struct serial_struct tmp;
|
||||
+
|
||||
+ if (!info)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ memset(&tmp, 0, sizeof(tmp));
|
||||
+ tmp.flags = ASYNC_LOW_LATENCY;
|
||||
+ tmp.xmit_fifo_size = acm->writesize;
|
||||
+ tmp.baud_base = le32_to_cpu(acm->line.dwDTERate);
|
||||
+
|
||||
+ if (copy_to_user(info, &tmp, sizeof(tmp)))
|
||||
+ return -EFAULT;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int acm_tty_ioctl(struct tty_struct *tty,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct acm *acm = tty->driver_data;
|
||||
+ int rv = -ENOIOCTLCMD;
|
||||
|
||||
if (!ACM_READY(acm))
|
||||
return -EINVAL;
|
||||
|
||||
- return -ENOIOCTLCMD;
|
||||
+ switch (cmd) {
|
||||
+ case TIOCGSERIAL: /* gets serial port data */
|
||||
+ rv = get_serial_info(acm, (struct serial_struct __user *) arg);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return rv;
|
||||
}
|
||||
|
||||
static const __u32 acm_tty_speed[] = {
|
|
@ -653,6 +653,8 @@ Patch12303: dmar-disable-when-ricoh-multifunction.patch
|
|||
Patch13002: revert-efi-rtclock.patch
|
||||
Patch13003: efi-dont-map-boot-services-on-32bit.patch
|
||||
|
||||
Patch14000: cdc-acm-tiocgserial.patch
|
||||
|
||||
Patch20000: utrace.patch
|
||||
|
||||
# Flattened devicetree support
|
||||
|
@ -1258,6 +1260,9 @@ ApplyPatch dmar-disable-when-ricoh-multifunction.patch
|
|||
ApplyPatch revert-efi-rtclock.patch
|
||||
ApplyPatch efi-dont-map-boot-services-on-32bit.patch
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=787607
|
||||
ApplyPatch cdc-acm-tiocgserial.patch
|
||||
|
||||
# utrace.
|
||||
ApplyPatch utrace.patch
|
||||
|
||||
|
@ -1950,6 +1955,9 @@ fi
|
|||
# and build.
|
||||
|
||||
%changelog
|
||||
* Fri Feb 10 2012 Dave Jones <davej@redhat.com>
|
||||
- Implement TIOCGSERIAL for acm_tty_ioctl (rhbz 787607)
|
||||
|
||||
* Thu Feb 09 2012 Dave Jones <davej@redhat.com>
|
||||
- bsg: fix sysfs link remove warning (#787862)
|
||||
|
||||
|
|
Loading…
Reference in New Issue