Subject: Re: [Linux-IrDA]Re: ircomm problem

From: Dag Brattli <[email-masked]>
Date: Mon, 16 Jul 2001 10:32:06 +0200 (CEST)

Hi,

This looks to be the same kind of problem as the first one. Your
phone does not send any line settings like CTS or CD, so we
should probably just assume that everything is OK, and that the
default values are that they are set. I'll try to get this
clearified in IrCOMM spec. I'll still like to see the output of
your /proc/tty/driver/ircomm tho'

Anyway, thanks for helping us find this problem, I've been more
or less searching for it for a couple of years. But I've never
found it since I don't have any devices where this problem
appear, and nobody else have been able to pinpoint the excact
location of the problem in the code before ;-) 

Cheers

-- Dag

diff -urpN linux-2.4.6-ac2/net/irda/ircomm/ircomm_tty.c linux/net/irda/ircomm/ircomm_tty.c
--- linux-2.4.6-ac2/net/irda/ircomm/ircomm_tty.c	Fri Jul 13 22:26:11 2001
+++ linux/net/irda/ircomm/ircomm_tty.c	Mon Jul 16 10:04:48 2001
@@ -468,7 +468,8 @@ static int ircomm_tty_open(struct tty_st
 	/* Check if this is a "normal" ircomm device, or an irlpt device */
 	if (line < 0x10) {
 		self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE;
-		self->settings.service_type = IRCOMM_9_WIRE; /* Default */
+		self->settings.service_type = IRCOMM_9_WIRE; /* 9 wire as default */
+		self->settings.dce = IRCOMM_CTS | IRCOMM_CD; /* Default line settings */
 		IRDA_DEBUG(2, __FUNCTION__ "(), IrCOMM device\n");
 	} else {
 		IRDA_DEBUG(2, __FUNCTION__ "(), IrLPT device\n");
diff -urpN linux-2.4.6-ac2/net/irda/ircomm/ircomm_tty_attach.c linux/net/irda/ircomm/ircomm_tty_attach.c
--- linux-2.4.6-ac2/net/irda/ircomm/ircomm_tty_attach.c	Fri Jul 13 22:26:11 2001
+++ linux/net/irda/ircomm/ircomm_tty_attach.c	Sun Jul 15 18:01:38 2001
@@ -505,7 +505,7 @@ void ircomm_tty_link_established(struct 
 	 * will have to wait for the peer device (DCE) to raise the CTS
 	 * line.  
 	 */
-	if (self->flags & ASYNC_CTS_FLOW) {
+	if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) {
 		IRDA_DEBUG(0, __FUNCTION__ "(), waiting for CTS ...\n");
 		return;
 	} else {

On Sun, 15 Jul 2001 22:11:44 +0200, Andrea Arcangeli wrote:
> On Sun, Jul 15, 2001 at 09:45:19PM +0200, Andrea Arcangeli wrote:
> > Now the problem is that the open(/dev/ircomm0, O_RDWR) done by pppd
> > hangs in ircomm_tty_block_til_ready() (see the schedule call there).
> 
> This patch worked around it (probably wrong fix again but I'm sure it
> will give you a good hint to find out the right fix :)
> 
> --- 2.4.7pre6aa1/net/irda/ircomm/ircomm_tty.c.~1~	Sun Jul 15 21:48:17 2001
> +++ 2.4.7pre6aa1/net/irda/ircomm/ircomm_tty.c	Sun Jul 15 21:54:39 2001
> @@ -344,7 +344,9 @@
>  		 */
>   		if (!(self->flags & ASYNC_CALLOUT_ACTIVE) &&
>   		    !(self->flags & ASYNC_CLOSING) &&
> +#if 0
>   		    (do_clocal || (self->settings.dce & IRCOMM_CD)) &&
> +#endif
>  		    self->state == IRCOMM_TTY_READY)
>  		{
>   			break;
> 
> 
> And I can finally use the t39m with normal GSM data connection at 9600
> (like my preistoric sh888).
> 
> Now I only need to get it running on top of GPRS as first to get the
> completly flat rate and secondly to run at decent bandwith. What I get
> now with wvdial is:
> 
> root@inspiron:/home/andrea/devel/kernel/2.4.7pre6aa1 > wvdial GPRS
> --> WvDial: Internet dialer version 1.41
> --> Initializing modem.
> --> Sending: ATZ
> --> Sending: ATQ0
> ATQ0
> OK
> --> Re-Sending: ATZ
> ATZ
> OK
> --> Sending: AT+CGDCONT=1,"IP","uni.tim.it","0.0.0.0",1,1
> AT+CGDCONT=1,"IP","uni.tim.it","0.0.0.0",1,1
> OK
> --> Sending: AT+CGATT=1
> AT+CGATT=1
> OK
> --> Modem initialized.
> --> Idle Seconds = 180, disabling automatic reconnect.
> --> Sending: ATD*99#
> --> Waiting for carrier.
> ATD*99#
> CONNECT
> --> Carrier detected.  Starting PPP immediately.
> --> Starting pppd at Sun Jul 15 20:55:54 2001
> --> pid of pppd: 6056
> --> pppd: Authentication (PAP) started
> --> pppd: Authentication (PAP) successful
> --> pppd: Terminate Request (Message: "No network protocols running")
> --> pppd: Terminate Request (Message: "No network protocols running")
> --> pppd: Connect time 0.2 minutes.
> --> Disconnecting at Sun Jul 15 20:56:09 2001
> --> The PPP daemon has died: PPP negotiation failed (exit code = 10)
> --> man pppd explains pppd error codes in more detail.
> --> Try again and look into /var/log/messages and the wvdial and pppd
> --> man pages for more information.
> root@inspiron:/home/andrea/devel/kernel/2.4.7pre6aa1 > 
> 
> We have passed the problems in the irda layer methinks.
> 
> This is the configuration I wrote for it:
> 
> [Dialer GPRS]
> Modem = /dev/ircomm0
> Baud = 115200
> Init2 = AT+CGATT=1
> Init3 = AT+CGDCONT=1,"IP","uni.tim.it","0.0.0.0",1,1
> Area Code =
> Phone = *99#
> Username = 
> Password = 
> Dial Command = ATD
> Stupid Mode = 1
> Compuserve = 0
> Force Address =
> Idle Seconds = 180
> ISDN = 0
> Auto DNS = 1
> 
> The default looks like this:
> 
> [Dialer Defaults]
> Modem = /dev/ircomm0
> Baud = 115200
> Init1 = ATZ
> Area Code =
> Phone = XXXXX
> Username = XXXXXXXXX
> Password = XXXXXXXXX
> Dial Command = ATDT
> Stupid Mode = 1
> Compuserve = 0
> Force Address =
> Idle Seconds = 180
> ISDN = 0
> Auto DNS = 1
> 
> I start to suspect the "uni.tim.it" is just wrong.
> 
> Andrea
> _______________________________________________
> Linux-IrDA mailing list  -  [email-masked]
> http://www.pasta.cs.UiT.No/mailman/listinfo/linux-irda
> 
> 
> 
-- 
Dag Brattli,                     Mail:  [email-masked]
CEO, ObexCode AS                 Web:   http://www.obexcode.com
Tromsoe Science Park             Phone: +47 776 33 690 
Forskningsparken                 Fax:   +47 776 79 750
NO-9291 Tromsoe, NORWAY          Cell:  +47 481 06 352

_______________________________________________
Linux-IrDA mailing list  -  [email-masked]
http://www.pasta.cs.UiT.No/mailman/listinfo/linux-irda