On Thu, Mar 29, 2001 at 04:00:02PM +0800, Richard Shih-Ping Chan wrote:
> Hello, this patch is a small fix to acm.c CLOCAL handling.
>
> It sets the clocal member to unsigned int instead of unsigned
> char becase CLOCAL in <bits/termios.h> exceeds the size of 8-bits.
> This patch renables the "hangup if not CLOCAL" code and
> minicom now works again. With this patch if CLOCAL is not set read() returns
> 0 on lost of carrier and if CLOCAL is set read() continues to block or returns
> the number of chars read.
> I believe this behaviour more closely mimics the serial driver.
Richard: Thanks for finding the bug.
Johannes: please apply the attached patch - it makes hangup due to DCD
loss work correctly on ACM modems.
--
Vojtech Pavlik
SuSE Labs
diff -urN linux-2.4.2/drivers/usb/acm.c linux/drivers/usb/acm.c
--- linux-2.4.2/drivers/usb/acm.c Wed Mar 28 11:40:49 2001
+++ linux/drivers/usb/acm.c Thu Mar 29 16:19:08 2001
@@ -1,5 +1,5 @@
/*
- * acm.c Version 0.18
+ * acm.c Version 0.19
*
* Copyright (c) 1999 Armin Fuerst <[EMAIL PROTECTED]>
* Copyright (c) 1999 Pavel Machek <[EMAIL PROTECTED]>
@@ -21,6 +21,7 @@
* v0.16 - added code for modems with swapped data and control interfaces
* v0.17 - added new style probing
* v0.18 - fixed new style probing for devices with more configurations
+ * v0.19 - fixed CLOCAL handling (thanks to Richard Shih-Ping Chan)
*/
/*
@@ -195,13 +196,10 @@
newctrl = le16_to_cpup((__u16 *) data);
-#if 0
- /* Please someone tell me how to do this properly to kill pppd
and not kill minicom */
if (acm->tty && !acm->clocal && (acm->ctrlin & ~newctrl &
ACM_CTRL_DCD)) {
dbg("calling hangup");
tty_hangup(acm->tty);
}
-#endif
acm->ctrlin = newctrl;
@@ -458,7 +456,7 @@
(termios->c_cflag & PARODD ? 1 : 2) + (termios->c_cflag & CMSPAR ? 2 :
0) : 0;
newline.databits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
- acm->clocal = termios->c_cflag & CLOCAL;
+ acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
if (!newline.speed) {
newline.speed = acm->line.speed;