Subject: IrDA (was: Nokia GSM phones and pkgsrc? kernel?)
To: None <current-users@netbsd.org>
From: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
List: current-users
Date: 03/29/2000 15:56:10
On Tue, Mar 28, 2000 at 12:19:15PM +0300, Jukka Marin wrote:
> On Tue, Mar 28, 2000 at 07:14:07PM +1000, Daniel Carosone wrote:
> > If you have a new enough phone that supports the at emulation, via
> > either IrDA (no good for netbsd) or the serial dongle, then it's
> > simple - it looks like a modem.
> > 

The question of IrDA support keeps coming up, and a couple of weeks ago
there was discussion about incorporating GPL-ed code.  I'd like clarification
of one point: could GPL-ed code be used in an LKM, and provided as a package?
Or even as part of the base distribution, as long as the code wasn't compiled
into the supplied kernel binaries?

I'm asking about this because I'm thinking about having a go at porting
the Linux IrDA driver.  Last year I got a second-user laptop, and just before
Christmas I got a Siemens S25 mobile phone, which has IrDA.  I had been
running NetBSD on the laptop, but when I got the phone, I installed SuSE
Linux and managed to get IrDA working to the point where I could get a ppp
connection going.  However, not having done much with Linux before, I hadn't
realised how much disk space it takes, and can barely fit what I need on the
laptop's 1.4 GB disk.  On top of that, Linux feels slow compared to NetBSD,
and if it weren't for the IrDA support, I'd switch back.

So I'm wondering about porting the Linux IrDA code.  It's about 40,000
lines of kernel and headers plus about 7,000 lines of userland stuff,
so I'm not about to sit down and write a fresh implementation from scratch
if some of the Linux code might be reusable.  So I'd appreciate advice
as to the forms in which it might be possible to incorporate it in a
NetBSD release.

Does the "No GPLed code in the kernel" rule mean that it can't be included
in syssrc.tgz?  Or just that it can't be compiled into any binary kernel
in the distribution sets?  Could a binary LKM be included in the distribution?
In any case, on a laptop (with possibly limited memory) there are obvious
advantages to an LKM for something like IrDA which might only be used
occasionally (provided it could be repeatedly loaded and unloaded
without causing memory leaks).

I think my preferred route would be to work with the sources under
/usr/src/sys.  If it wouldn't be acceptable to include them in syssrc.tgz,
they could be in a separate saveset.  During development, I think producing
a driver compiled into the kernel would be simpler, particularly if I'm
correct in thinking that it isn't currently possible for kgdb to access
the symbol table of an LKM.  If necessary for the release version,
the IrDA code could be hidden from config, so that it could only be built
as an LKM.

Is anyone else interested in this?  One problem is that I don't have any
FIR (Fast Infra-Red, 4MB/s) hardware.  I have the laptop, the GSM phone and
an IrDA transceiver to connect to the motherboard of a desktop machine.
Linux IrDA does have drivers for a couple of FIR chips (Toshiba Oboe and
a Winbond something-or-other), but I've no way to test these.
My intention is to leave the laptop running Linux for the present, and
work on the NetBSD code on a desktop machine.  This way I can turn on
diagnostics on the Linux system to find out what's happening.

I think this is probably the sort of thing where I'm not going to know
how difficult it is until I've done it (or given up!), but if I go ahead
there are a few issues which may involve taking LKMs into new ground.
Can an LKM expose tuning parameters through sysctl?
Also, can it add "files" to kernfs?  The Linux implementation has a
discovery log in /proc which shows the other IrDA devices which have been
seen recently (it's sort of like a combination of netstat -i and netstat -a).


Roger

------------------------------------------------------------------------------
Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
Computing Services Dept,                    |  Tel:   +44 151 794 4441
The University of Liverpool,                |  Fax:   +44 151 794 4442
PO Box 147, Liverpool L69 3BX, UK           | 
------------------------------------------------------------------------------