Hello,

   Currently, the pl2303 driver doesn't support the TIOCINQ (or FIONREAD, same
thing) ioctl.  Following is a patch to resolve that problem.  Issuing an IOCTL
to the driver with one of the 2 proper requests will now place the number of
bytes waiting to be read into the ioctl argument and return 0 on success.  The
patch is against the 2.6.8.1 kernel.  Most of the other usb to serial
converters could probably use the same piece of code as most of their ioctl
handlers aren't handling TIOCINQ, but I don't have the hardware to test it so I
didn't patch it.

-Lee

ps - this is my first official patch, so if I screwed it up let me know and I'll
fix it :]

<snip>
--- drivers/usb/serial/pl2303.c.orig    2004-09-25 08:17:52.502859976 +0000
+++ drivers/usb/serial/pl2303.c 2004-09-25 08:44:36.588001968 +0000
@@ -12,6 +12,8 @@
  *     (at your option) any later version.
  *
  * See Documentation/usb/usb-serial.txt for more information on using this
driver
+ * 2004_Sep_20 Lee Smith
+ *      added support for the TIOCINQ ioctl
  *
  * 2002_Mar_26 gkh
  *     allowed driver to work properly if there is no tty assigned to a port
@@ -638,7 +640,10 @@
                case TIOCMIWAIT:
                        dbg("%s (%d) TIOCMIWAIT", __FUNCTION__,  port->number);
                        return wait_modem_info(port, arg);
-
+               case TIOCINQ:
+                       return copy_to_user((void __user *) arg, \
+                                       &port->tty->read_cnt, sizeof(int));
+                       break;
                default:
                        dbg("%s not supported = 0x%04x", __FUNCTION__, cmd);
                        break;





-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to