[ltp] IR (SIR) success!

Thomas Hood linux-thinkpad@www.bm-soft.com
Mon, 26 Feb 2001 23:44:14 +0000 (GMT)


I've been looking more closely at the code.  Although
my earlier criticism holds, it wasn't the cause of
the problem.  The bug is the "i++" in the for loop
descriptor at line 163 of nsc-ircc.c .  It shouldn't
be there.  Because it is there, you need to add the
irq and io arguments twice.  Here's how /etc/modules.conf
should look:
# To use the NSC driver on a Thinkpad laptop: uncomment the following:
options nsc-ircc dongle_id=0x09 irq=4,4 io=0x3e8,0x3e8
alias irda0 nsc-ircc

With this, the nsc-ircc module should be able to see
the chip properly.  I can't test it (nsc-ircc) because
my serial driver has already reserved ioaddr 0x3e8
which keeps nsc-ircc from grabbing the same ioaddr.
It seems I will have to recompile my kernel with the
serial driver as a module in order to do this.  Or
is there some way of making the serial driver release
some of the standard io addresses?

Why doesn't nsc-ircc find the chip itself, without
"io=0x3e8,0x3e8" option?  Because there's another bug
in nsc-ircc.c in the nsc_ircc_probe_338() function at
line 600: the shift should not be 4 but 3.  This is the
reason why the module thinks (wrongly) that the chip
is in legacy mode.

I guess I should submit these bug reports to someone.
I'll send an e-mail to the maintainer.

Thomas

> Since I last wrote I have taken a look at 
> /usr/src/linux-2.4.2/drivers/net/irda/nsc-ircc.c .
> The chip probing code is really brain dead.  It reads
> a series of addresses and if it gets back anything other
> than 0xff it thinks it has found a natsemi pc87338.
> The code is "finding" a pc87338 at a spurious address.
> Here's a quick fix:
> 
> jdthood@thanatos:/usr/src/linux-2.4.2/drivers/net/irda$ diff -Naur
> nsc-ircc.c_2.4.2 nsc-ircc.c
> --- nsc-ircc.c_2.4.2	Tue Feb 13 16:15:05 2001
> +++ nsc-ircc.c	Mon Feb 26 17:17:02 2001
> @@ -90,7 +90,7 @@
>  static nsc_chip_t chips[] = {
>  	{ "PC87108", { 0x150, 0x398, 0xea }, 0x05, 0x10, 0xf0, 
>  	  nsc_ircc_probe_108, nsc_ircc_init_108 },
> -	{ "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf0, 
> +	{ "PC87338", { 0x2e, 0x398, 0x15c }, 0x08, 0xb0, 0xf0, 
>  	  nsc_ircc_probe_338, nsc_ircc_init_338 },
>  	{ NULL }
>  };
> 
> This will make the driver probe address 0x2e first.  Try it and
> see if this fixes the problem for you.
> 
> It would be nice if I could see the debugging output from this
> module, but in my case the module loader can't resolve the
> ircc_debug variable.  There is a bug in the Makefiles somewhere.
> 
> Thomas
> 
> 
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
> 
> ----- The Linux ThinkPad mailing list -----
> The linux-thinkpad mailing list home page is at:
> http://www.bm-soft.com/~bm/tp_mailing.html


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html