Linux-IrDA quick tutorial
Linux-IrDA
The Linux IrDA project is
an Open Source projects to develop an generic IrDA stack for
Linux that has many contributors all over the world. I did
contribute many bug fixes and enhancement to it since 1999 thanks to
Hewlett Packard sponsoring my
work. The list of patches is too long to put here ;-)
Let's face it, one of the main roadblock to the use of e-Squirt is getting the IrDA stack up and
running, whatever the platform is. We had our share of horror stories
on all the OSes involved.
When it come to Linux, I've been hacking the stack often enough to
have a few words of advices. Here are a few instructions on how to get
it working enough to be able to use e-Squirt or IrNET...
The instructions presented here should work for Linux Kernel
2.4.X and Kernel 2.6.X. And they may work equally well for
later kernels and kernel 2.2.15, and maybe others. Some other
documentations on the web, like the Linux-IrDA Howto are
more generic and complete but not totally up to date, so beware...
Linux-IrDA current status
Willing or not, it seem that I'm the one responsible of making sure
the Linux-IrDA stack work properly. Here is a quick status report...
- The archive of the mailing list at SourceForge is
erratic, some post disapear, which mean that I sometimes misses some
e-mail. The new archive at Gmane may
behave better. The archive for the old mailing list at pasta no
longer exist (a shame).
- It is my belief that all known issue regarding the IrDA
stack are resolved (I'm not talking here about drivers and
installation, which are know to be problematic). Don't prove me
wrong ;-)
- What's the latest version ? Things are always
evolving, so I recommend to get a very recent kernel 2.6.X
(like the latest one) and optionally apply some patches from this page
(see below). Kernel 2.4.21 and later are also good
choices. Versions prior to kernel 2.4.21 have various known
bugs, therefore I don't even want to hear about those. And don't
mention 2.2.X ;-)
- The latest essential update of 2.4.X was in kernel 2.4.21,
which fixed various race conditions and connection issues. Kernel
2.4.22 fixes some IrCOMM problems with chat, add workarounds
for interoperability with buggy devices and fix a common memory
leak. Note the the development of Linux-IrDA in 2.4.X is
stopped, and I will no longer accept major patches for it.
- The IrDA stack in 2.6.X contains a large number of fixes
and improvement over what is available in 2.4.X, and this is where new
development is happening, so you are welcome to try it. Usually later
version are better. Some of the changes are non-trivial and require
your testing, because I can't test all hardwares and configurations.
- This is a short list of fixes available in 2.6.X and not in
2.4.X :
- Non-modular compilation was fixed.
- SMP locking was fixed, and many race condition were fixed.
- Internal database (HashBin) use was made safer, especially with
the IAS database.
- Many SKB memory leaks and were fixed.
- /proc filesystem was fixed.
- SIR frame wrapping was CPU optimised.
- Performance at SIR was dramatically improved.
- IrTTY driver was rewritten to work with the new serial driver,
along with new dongle drivers. Dongle driver have been simplified, and
dongle driver removal is much safer.
- VIA driver was added.
- SMC driver was rewritten.
- IrPORT driver was fixed.
- NSC driver add support for PC8739x chipset and speed change fixes.
- VLSI and IrDA-USB driver were improved.
- New SigmaTel stir4200 USB driver.
- This is a short list of things that need to be fixed in
2.6.X :
- Test and finish fixing new SMC driver
- Get rid of internal use of driver ioctls
- My changes to IrTTP and the addition of the Socket scheduler in
2.4.21 are pretty big changes. I've tested those changes and
measured the performance with irtty+actisys and
the performance with nsc-ircc. You can see
that unidirectional small packet performance has increased by a factor
3 at 4Mb/s. Also, the maximum number of Tx buffers queued in the IrDA
stack decreased from 21 to 10, which improves latency. Lastly, it
seems that the TTY layer is becoming a bottleneck.
- The fixes for the dynamic window pf bit marking and the f-timer
expiry calculation in 2.6.2 were smaller changes but fixed the
remaining protocol performance bottlenecks. I've tested those changes
and measured the performance with
irtty+actisys. You can see a performance increase of up to 40% for
large packets at SIR, and overall make performance more predictable
and even (no more pathologic cases for some packet sizes).
- The new irtty-sir driver in kernel 2.6.X replace the
old irtty driver. It fixes some architectural issue in the interaction
with the serial driver. The downside is that all dongle drivers
need to be updated to the new dongle infrastructure. Martin has
documented that.
- irda-utils 0.9.15 is out. Don't use anything older than
that. I don't want to look at bug reports using old irdadump, because
they don't show some common problems, I really want irdadump
0.9.15 or later.
New version of irda-utils :
- irda-utils-0.9.15 :
add new dongles drivers, new irdadump formating options, fix irdadump
TTP and IrCOMM decoding, add LAP QoS decoding, fix irattach error
detection, and add new socket samples. With this version, you can't
use the incorrect form irattach irda0 -s 1 any longer, you must
use irattach irda0 -s instead.
- irda-utils-0.9.16 :
fixes a few irdadump bugs and allow to disable irdadump parsing, fix a
bug with irattach over usb-serial, adds irnetd, and improve man pages.
- irda-utils-0.9.17-pre5 :
add libpcap raw capture support to irdadump (read/write), add patch
for IrDA support in Ethereal.
Linux-IrDA patches included in 2.4.20-pre2 :
- Max-Tx sysctl : Fix a
contradiction in IrDA spec regarding max frame size, necessary for
FIR operation using IrComm or some socket applications.
- IrNET disconnect fix
: Fix IrNET to re-enable passive mode and retries (bug added in latest
kernel patches).
- Very important fixes :
fix a race condition in IrLAP, fix "unkillable" application in IrSock,
and fix transmit before ready in ircomm.
- Discovery fixes : ignore
passive discoveries in IrComm and IrLAN (to avoid simultaneous
connections, mostly useful as server) and force log expiry on LAP
disconnect.
- NSC OB6100 : Enable the
nsc-ircc driver to recognise the FIR chip on the HP OmniBook
6100. Contributed by Kevin Thayer.
- irtty stat fixes : increment
irtty tx counter at the right time. Contributed by Frank Becker.
- USB disconnect fixes :
fix race conditions in USB disconnect code. Allow you to unplug the
dongle even with heavy transfer going on.
- Discovery expiry fix :
Make discovery expiry work properly for non default discovery
period/timeout.
- MCP2120
driver, ActiSys 200L and MA600 driver for 2.4.X : MCP2120 dongle
driver contributed by Felix Tang, ActiSys 200L dongle driver
contributed by Shimizu Takuja (patch from Gerhard Bertelsmann) and
MA600 dongle driver contributed by Leung.
Linux-IrDA patches included in 2.4.21-pre3 :
- Socket scheduler :
add socket packet scheduler for fairness between socket, add LAP flow
control to minimse LAP Tx buffer queue (10 => 2). Need IrTTP fixes.
- IrTTP big fixes : fix
3 race conditions (start timer, give credit, flow ind), fix Rx queue
flow control (could become infinite), protect Rx credit update, fix
TTP flow control, implement packet scheduler, reduce Tx queue max size
(11 => 8), reduce latency (by skipping timer), optimise threshold and
flow parameters. Need socket scheduler. This seem to have fixed my all
my IrNET Oopses and weirdness...
- Fix dongle autoloading :
avoid loading dongle modules with irq disabled in irtty.
- Minor fixes : Always
close LAP on LSAP closure, disable LAP timer on accept socket, and
header fix for Alpha (by Felix Tang).
- Simultaneous IrNET
race : fix race condition when the two peer simultaneously create
an IrNET connection to each other (thanks to Martin Diehl for
reporting this race). As opposed to the IrCOMM/IrLAN discovery
workaround, this fixes the race properly and cleanly.
- SMC small fixes : Fix SMC
driver removal code and various messages. Patch from Jeff Snyder.
- Donauboe driver : new
driver for Toshiba IrDA chip. Patch from Christian Gennerat & Martin
Lucina. Updated version.
- Four small bugs in /proc :
fix four cases where interrupts would not be re-enabled on
failure. Found by the Stanford checker.
Linux-IrDA patches included in 2.4.22-pre2 :
- Fixes chat over IrCOMM
problem : workaround a bug in the kernel (TTY layer)
triggered by chat brokeness by accepting data before IrCOMM is
initialised. Also remove the IrCOMM-IAS entry to accept multiple
incomming connections.
- Handle invalid QoS
parameter : handle better case where the peer feed us invalid
or oversized parameters. Also add various warning so that users knows
when the IrDA peer is buggy (and doesn't start blaming
Linux-IrDA). Also add a new sysctl, max_tx_window.
- LMP timer race
condition : fix a race condition when starting the IrLMP
watchdog timer, and improve the debugging messages.
- Export CRC-16 routine :
export to drivers the routine doing CRC calculations. Original patch
from Martin Diehl.
- Fix secondary nack
code : fix the secondary function to send RR and frames
without the poll bit when it detect packet losses.
- IrIAP SKB leak : fix
an obvious SKB leak in IrIAP. This is only a localised fix, and the
same fix need to be applied to all Linux-IrDA state machines. Original
patch from Jan Kiszka.
- USB driver cleanup :
Handle properly failure of URB with new speed settings, fix endianess
and various other cleanups.
- caddr fix : ignore the
C/R bit in the LAP connection address. Patch from Jan Kiszka.
- static driver fix : fix
some obvious static init bugs.
Linux-IrDA patches included in 2.4.25-pre6 :
- NSC '39x support : Add
support for NSC PC8739x chipset, such as found in IBM R31/A30/A31
laptops. Original patch from Jan Frey.
- VIA FIR driver : driver
for the IrDA module of some VIA chipsets. Written by Frank Liu (VIA).
Experimental Linux-IrDA patches for 2.4.22 and later :
Other Linux-IrDA patches included in 2.5.13 :
- Fix races waiting for
events : use proper logic to wait for events instead of obsoleted
kernel calls, to avoid race conditions. Most of those races were
theoretical or had workaround. Original patch from Martin Diehl.
- IrCOMM export rules for 2.5.X :
Add proper export rules to IrCOMM modules to make it work properly in
kernel 2.5.10 and later. Patch from Kai Germaschews.
Other Linux-IrDA patches included in 2.5.16 :
- set_bit fixes : change all
arguments of set_long to "unsigned long". Patch from Paul Mackerras.
- LSAP cache fix : replace
the global LSAP cache with LSAP caches private to each LAP. Fix a bug
where two simultaneous connections from two devices using the same
LSAPs would get mixed up. Should also improve performance in similar
cases. Patch from Christoph Bartelmus.
Other Linux-IrDA patches included in 2.5.24 :
- USB driver cleanup :
Handle properly failure of URB with new speed settings, and various
other cleanups.
- Init & Headers cleanup for
2.5.X : Cleanup the header includes (should speed up
dependancies & compile) and module init (should enable static
compiles). new version for 2.5.22 (use "patch -l" if needed).
- LSAP cache and socket
receive fixes : fix one instance were we forgot to clear LSAP
cache, and fix a bogus conversion to wait_event() where the socket
closure would never propagate to the app waiting on a socket. This
fixes bugs introduced in 2.5.13 and 2.5.16. Also reserve enough skb
header space in IrSOCK so that drivers don't complain. new version
for 2.5.22 (use "patch -l" if needed).
Other Linux-IrDA patches included in 2.5.39 :
- HashBins fixes : fix
kernel crash after removal of IAS object or IAS attribute with
duplicated name, simplify LMP registration to avoid using random
generator in static init, and make all hashbin uses 64 bit safe.
- Unique LAP
address : Make sure LAP address is sane, which mean not NULL,
not BROADCAST and not already in use by another link.
- NSC speed fix : try
to fix the NSC driver so that it changes speed back to 9600
properly. Aggregate of both original patches.
- Hashbin locking
fixes : Fix locking for 2.5.32. Final patch. Apply after two
first patches above.
- IrCOMM/IrLAN locking
fixes : Fix locking for 2.5.32. Final patch. Apply after
locking hashbin fixes.
- Driver locking
fixes : Fix locking for 2.5.32. Final patch. Apply after
locking hashbin fixes & nsc speed patch.
- ALI locking
fixes : Fix locking for 2.5.32. Final patch. Apply after
locking hashbin fixes.
Other Linux-IrDA patches included in 2.5.42 :
- VLSI driver v0.4 : major
update of the VLSI driver. Patch from Martin Diehl.
- Donauboe driver : new
driver for Toshiba IrDA chip. Patch from Christian Gennerat & Martin
Lucina. Updated version.
- Export CRC-16 routine :
export to drivers the routine doing CRC calculations. Original patch
from Martin Diehl.
- Fixes chat over IrCOMM
problem : workaround a bug in the kernel (TTY layer)
triggered by chat brokeness by accepting data before IrCOMM is
initialised. Also remove the IrCOMM-IAS entry to accept multiple
incomming connections.
- Handle invalid QoS
parameter : handle better case where the peer feed us invalid
or oversized parameters. Also add various warning so that users knows
when the IrDA peer is buggy (and doesn't start blaming
Linux-IrDA). Also add a new sysctl, max_tx_window. new
patch, complete fix.
- LMP timer race
condition : fix a race condition when starting the IrLMP
watchdog timer, and improve the debugging messages.
Other Linux-IrDA patches included in 2.5.47 :
- Fix packet type :
migrate the IrDA stack to the multithreaded receive path of the
networking stack and cleanup the packet type definition. This should
fix an annoying warning on SMP.
- Fix donauboe init :
fix donauboe driver function names to avoid clashes with toshoboe
driver.
- New irtty driver
(2.5.44) : new IrTTY driver to go with the new serial driver
in 2.5.X. Original patch from Martin Diehl.
- New irtty driver
(2.5.45) : new IrTTY driver to go with the new serial driver
in 2.5.X. Patch from Martin Diehl.
Linux-IrDA patches included in 2.5.61 :
Linux-IrDA patches included in 2.5.67 :
- Discovery fixes and
cleanup : fix the last locking problems in discovery and
expiry, simplify, cleanup and optimise the discovery/expiry code
(i.e. smaller and faster).
- Dynamic window fixes :
fix the dynamic window code to properly send the pf bit. Up to 40%
improvement from large packets at SIR (i.e. most bulk transfer at
SIR). Performance unchanged for FIR or small packet. More complete
performance analysis later on.
- IrDA-USB cleanups :
cleanup the Rx path, the USB registration and others in the IrDA-USB
driver.
- Sir-dev ZeroCopy :
Enable ZeroCopy Rx in irtty-sir (provided by the new SIR wrapper).
- Minor timer optimisation :
make IrDA timers use mod_timer (safer & faster).
- IrNET update : Fix
module refcounting and add hints to discovery.
Linux-IrDA patches included in 2.5.70 :
- skb leak audit : Fix many
real and potential skb (packet buffer) memory leaks in the IrDA
stack. This patch is so good that over time the number of skb used
decrease ;-) Thanks to Jan Kiszka for pointing out the issue.
- IrNET context fix : fix
IrNET locking to be compatible with PPP, fix a couple of crash in
2.5.67+.
- caddr fix : ignore the
C/R bit in the LAP connection address. Patch from Jan Kiszka.
- sir_kthread
comment : add comment to explain task state, new module stuff
in irtty-sir.
- irport fixes #3 : various
fixes and optimisation for irport.
- New SMSC driver #6 :
new SMSC driver, this one works, even in FIR (but still need
testing). Original patch from Daniele Peri. Improved version, for
2.5.69
- trans_start fixes :
minor fix in various drivers.
- TTY API fix : Add an
extra call to the TTY API so that irtty-sir can work again. Russell
eventually implemented something similar.
Linux-IrDA patches included in 2.6.0-test1 :
- IrDA-USB endian
fixes : Trivial fix for irda-usb to make it work on big
endian boxes (such as PPC). Original patch from Jacek Jakubowski. Add
new USB device ID.
- NSC '39x support : Add
preliminary support for NSC PC8739x chipset, such as found in IBM
R31/A30/A31 laptops. This patch needs more work. Original patch from
Jan Frey.
- Header cleanup :
cleanup the <linux/irda.h> header.
- IrNET cast fix : remove
pointer casting in IrNET debug code. Patch suggested by David
S. Miller.
- More skb leaks : fix two
additional potential skb leaks in IrTTP. Found by the Stanford
checker.
- setup_dma fix : mark
all drivers that need setup_dma() as requiring CONFIG_ISA. Mark new
dongle driver as needing sir-dev.
- Verify structs : verify
the size of packed structures. Patch suggested by Russell King.
- IrCOMM devfs fix : make
sure that the devfs name for IrCOMM devices are not bogus. Original
patch suggested by Martin Diehl.
- sir-dev cleanup :
various cleanups in irtty-sir and sir-dev drivers. Patch from Martin
Diehl.
- refrigerator support : support
software suspend in irtty-sir. Patch from Neil Brown.
Linux-IrDA patches included in 2.6.0-test3 :
- Donauboe probe :
disable the probe in Donauboe driver by default and minor
cleanups. Patch from Christian Gennerat.
- irda-usb probe : minor
fix to the probe failure path of irda-usb. Merge of patches from
Oliver Neukum and Daniele Bellucci.
- IrLAP retry count :
add interoperability workaround for a bug in 2.4.X IrDA stacks : 2.4.X
secondary forget to set pf bit when reaching window byte capacity
without sending the max number of packets (ex: 115 kb/s, max packet
size, window=7), and we would eventually close the connection. This
bug was fixed in 2.5.67 (Dynamic window fixes).
- VIA FIR driver : driver
for the IrDA module of some VIA chipsets. Improved version. Written by
Frank Liu (VIA).
- tekram-sir driver fix :
update tekram-sir to latest sir-dev changes. Patch from Martin Diehl.
- vlsi driver update : update
VLSI driver to version 0.5. Patch from Martin Diehl.
Linux-IrDA patches included in 2.6.0-test5 :
- IrCOMM module fix :
fix some comments.
- NSC '39x fixes : Make
support for NSC PC8739x chipset really work. Patch from Jan Frey.
- irtty cleanup :
Finish removing irtty driver from the kernel.
- LAP close race
fix : Fix a race condition when closing the LAP, prevent the
stack to open new LSAPs while we are killing them.
- Connect watchdog
fix : Fix problem with the connect watchdog, where we would
dup an invalid TSAP. May happen is a IrDA server is suspended.
- Init cleanups : Fix
various minor problems whith initialisation. Based on a patch from
Guennadi Liakhovetski.
- Module aliases :
Add module aliases to dongle drivers. Patch from Rusty Russell.
Linux-IrDA patches included in 2.6.0-test10 :
Linux-IrDA patches included in 2.6.2-rc1 :
- IrCOMM detach Opps :
fix locking problems in IrCOMM.
- F-timer expiry
fix : F-timer is calculated from end of window, however we
set it at start of window. Add the window transmision time to the
timer setting. This increase performance for bidirectional large
packets at SIR by 10%.
- Sir-Dev locking : Fix
sir-dev locking problems and make it compatible with irport. Patch
from Martin Diehl.
- Sir-Dev raw mode :
Fix sir-dev raw mode support (necessary for some SIR dongles - ma600
and tekram). Patch from Martin Diehl.
- IrCOMM module alias :
add module alias for IrCOMM pseudo serial device. Patch from Martin
Diehl.
- IAS max string :
fix a stupid compiler warning.
- SMSC release region :
fix a stupid cut'n'paste error.
- Socket API cleanup :
Convert IrDA sockets to unsigned length for send/recv msg. Patch from
Stephen Hemminger.
- TTY API fixes :
Update IrCOMM to the new TTY API for tiocmget/tiocmset. Patch from
Russell King.
- More Socket API
cleanup : Properly check return from memcpy_fromiovec and
exit. Patch from Chris Wright.
Linux-IrDA patches included in 2.6.2-rc2 :
- sir-dev update :
change dongle api such that raw r/w and modem line helpers are
directly called, not virtual callbacks. Patch from Martin Diehl.
- actisys-sir update :
convert to de-virtualized sirdev helpers. Patch from Martin Diehl.
- esi-sir update :
convert to de-virtualized sirdev helpers. Patch from Martin Diehl.
- tekram-sir
update : convert to de-virtualized sirdev helpers. Cleanup
the tekram-sir dongle driver and make speed change faster. Patch from
Martin Diehl.
- litelink-sir
driver : convert Parallax Litelink driver to the new irtty
dongle API. Patch from Eugene Crosser. Convert to de-virtualized
sirdev helpers. Patch from Martin Diehl.
- act200l-sir driver :
converted for new api from old driver. Patch from Martin Diehl.
- act200l-sir driver :
converted for new api from old driver. Patch from Martin Diehl.
- girbil-sir driver :
converted for new api from old driver. Patch from Martin Diehl.
- ma600-sir driver :
converted for new api from old driver. Patch from Martin Diehl.
- mcp2120 driver :
converted for new api from old driver. Patch from Martin Diehl.
- old_belkin-sir driver :
converted for new api from old driver. Patch from Martin Diehl.
- Makefile
update : include build information for new style
dongle. Patch from Martin Diehl.
Linux-IrDA patches included in 2.6.3 :
- Ultra sendto support :
Don't require bind on ultra sockets, and prevent use of unbound
sockets if no address given. Original patch from Stephen Hemminger.
- Notifier cleanup : Remove
unused IrDA device notify handler. Patch from Stephen Hemminger.
- IrLAP disconnect
race : Cancel IrLAP disconnect is a new connection request
arrived before we had time to disconnect. Bug found by Christoph
Bartelmus.
- Shared IRQ for
nsc-ircc : Return proper IRQ status in IRQ handler of
nsc-ircc driver. Patch from Stephen Hemminger.
- Shared IRQ for
ali-ircc : Return proper IRQ status in IRQ handler of
ali-ircc driver. Patch from Stephen Hemminger.
- Shared IRQ for
smsc-ircc2 : Return proper IRQ status in IRQ handler of
smsc-ircc2 driver. Patch from Stephen Hemminger.
- Shared IRQ for
via-ircc : Return proper IRQ status in IRQ handler of
via-ircc driver. Patch from Stephen Hemminger.
- Shared IRQ for
w83977af_ir : Return proper IRQ status in IRQ handler of
w83977af_ir driver. Patch from Stephen Hemminger.
Linux-IrDA patches included in 2.6.4 :
Linux-IrDA patches included in 2.6.6 :
- VLSI /proc update :
Convert VLSI driver to use seq_file functions. Patch from Stephen
Hemminger.
- Donauboe crc fix : Make
donauboe driver use the standard CRC table instead of its own. Patch
from Stephen Hemminger.
- RD:RSP fix : Fix
handling of RD:RSP frames to properly retry them. Patch from Martin
Diehl.
- IrLAN print_ret
optimisation : Move print_ret to minimise namespace polution
and allow inlining. Patch from Stephen Hemminger.
- IrLAN handle_filter
rename : Rename handle_filter to minimise namespace
polution. Patch from Stephen Hemminger.
- IrLAN cleanup :
Cleanup IrLAN module. Patch from Stephen Hemminger.
- IrLAN race condition :
Remove a potential race condition in IrLAN. Patch from Stephen
Hemminger.
- IrLAN flow
control : Fix IrLAN flow control and other cleanup. Original
patch from Stephen Hemminger.
Linux-IrDA patches included in 2.6.10-rc1 :
- Fix LSAP
allocation : Fix locking in error path in IrLMP, found by the
Stanford checker. Don't reuse unconnected LSAPs, they belong to server
sockets. Make sure the LSAP we are picking has just not been
grabed. And wrap around the LSAP space properly.
- NSC dongle-id check :
Make sure the nsc-ircc don't Oops on invalid dongle-id. Original patch
from Maik Broemme.
- IrNET module alias : Add
module alias for IrNET char dev.
- IAS delete
clarification : Clarify and make optional the destruction of
an IAS object when the last attribute is removed.
- Adaptive passive
discovery : Adapt to the rate of the peer discovery and add
some extra safety margin. Allow to interoperate properly with device
performing slow discovery. Bug found by Nokia.
- IrCOMM IAS
restore : Restore properly the IAS object when IrCOMM gets
disconnected. Allow "pppd passive persist" to work properly. Bug found
by Jan Kiszka.
- VIA speed change
fixes : various changes to make the VIA driver really work on
speed changes, and various other cleanups. Patch untested (port from
2.4.X). Original patch from Sancho Dauskard.
- Fix module info :
Fix the module parameter info for irda_debug. Patch from Stephen
Hemminger.
- stir4200 - no USB reset :
Get rid of usb-reset on speed change because the Sigmatel 4200 doesn't
accept the new address setting. Patch from Stephen Hemminger.
- stir4200 - suspend
fix : The suspend/resume code only needs to be compiled in if
power management is enabled. Patch from Stephen Hemminger.
- stir4200 - use netdev_priv :
Use netdev_priv and various message cleanups. Patch from Stephen
Hemminger.
Linux-IrDA patches included in 2.6.10 :
- Fix via_ircc pci init code :
Try to make the via-ircc driver usable again and comment on all the problem in the PCI init code. Suggested by Arkadiusz Miskiewicz.
- stir4200 - use kill_urb() :
Use usb_kill_urb() instead of usb_unlink_urb. Patch from Stephen
Hemminger.
- irda-usb - use
kill_urb() : Use usb_kill_urb() instead of usb_unlink_urb
plus other cleanups. Patch from Stephen Hemminger.
Linux-IrDA patches included in 2.6.12-rc1 :
- IrNET poll fix :
fix the poll method of IrNET so that it properly blocks if the initial
discovery log is empty.
- irda-usb sysfs fix :
add minimal sysfs support to the irda-usb driver. Patch from John
K. Luebs.
- stir4200 turnaround fix :
fix invalid turnaround calculations in the stir4200 driver. Patch from
John K. Luebs.
- VIA devexit fix : mark
properly the exist code in the VIA driver. Patch from Randy Dunlap.
- LSAP socket connect :
allow IrDA socket to connect on arbitrary LSAPs. Original patch from
Iavor Fetvadjie.
- NSC PC8738x support : Add
support for the NSC PC8738x chipset as found in the IBM X40. Patch
from Steffen Pingel.
- IrCOMM write
cleanup : cleanup some obsolete construct.
Linux-IrDA patches pending for 2.6.12 :
- ASSERT fixes : fix the
DEBUG and ASSERT macro to be safer, rename ASSERT, MESSAGE and WARNING
with an IRDA_ prefix to minimise namespace pollution. Huge patch.
Experimental Linux-IrDA patches for 2.6.X :
More information and links
Our work on IrDA :
More IrDA links :
Random Linux-IrDA links that should be on the Linux-IrDA web page :
- The OpenObex web
page, where you will find the latest version of the Obex
code. Obex is the protocol that allow to exchange objects (vCard,
vCal) with your Palm or cellular phone over IrDA or BlueTooth.
- ObexFTP, an implementation
of FTP over OpenObex, with a nice graphical interface. Also
include a working implementation of OpenObex over Serial
cable. Can be used to browse some cellular phones.
-
ObexTool, an graphical front end for ObexFTP,
including plug-in capability.
- MultiSync
allow you to synchrnonise data over OBEX with your cell phone.
- Gnokii, a package to communicate
with your cellular phone over IrDA.
- GIrDA, an
IrDA monitor that display devices in range and support
OpenObex.
- Felix
Tang has a page on how to build a cheap SIR dongle.
- Daniele Peri has some
utility to help configure the IrDA port on Toshiba 1800 laptops
and is the maintainer of the new SMC driver.
- Rob
Miller has some utility to help configure the IrDA port on
Toshiba 2400, 4600 and 5100 laptops.
- James McKenzie
and Christian Gennerat have done a rewrite of the toshoboe
driver called donauboe.
- Paul Stewart
is the original author of the stir4200 USB Dongle FIR driver,
and is maintaining the version for kernel 2.4.X.
- Stephen
Hemminger has an improved version of the stir4200 USB
Dongle FIR driver for 2.6.X.
- Martin Diehl has written a document on the new dongle driver interface he has created
in kernel 2.5.X.
- Martin Diehl has written some notes about the MA 620 USB dongle.
- Ben Moore
has created a Window Maker dockapp for managing the Hewlett-Packard
CapShare document scanner (boy, that does bring some
memories !).
- Jan Kiszka has created
IrCOMM2k to provide improved IrCOMM support in W2k and
Wxp. IrCOMM2k version 2.0 and later is based on a port of
the Linux-IrDA stack to the WinNT architecture, version
2.0alphaX was based on the stack in Kernel 2.4.20 (with known
bugs), version 2.0betaX is based on my latest version (2.5.67 +
updates). Jan has provided me many useful bugfixes and
suggestions as the result of this work, thanks...
- Cambridge
University has some instruction on how to make GPRS connections
using Linux-IrDA (of course, assuming you have a GPRS phone).
- Tor-Ake
Fransson have some instructions on how to use a Linux iPaq with a
IrDA enabled cell phone.
- Arthur
Tyde and Bryan Abshier have some instructions on how to connect a
WinCE device to Linux.
- Andy
has instructions on how to do Telnet from a Palm to Linux over
IrDA.
- David
Desrosiers have some instructions on how to connect a Palm to
Linux over IrDA via PPP over IrCOMM.
- Rev
has instructions on how to exchange Obex objects with an Ericsson
phone.
- Ian
Barry explain how to set up network connections between various
handhelds and Linux.
- Alan
J. McFarlane maintains a short FAQ on Windows IrDA support and has
instructions on Win32 IrDA programming (which is very similar
to Linux-IrDA programming).
- Howard has
various instructions and link on Windows IrDA support.
More stuff on my web site :
Tutorial : How to use Linux-IrDA
The remaining of this document will give you some tips on how to
configure Linux-IrDA.
A lot of IrDA novices mix up the low level and high level of the IrDA
stack. A few words...
- Low level of Linux-IrDA : this is the part of the IrDA
stack dealing with the IrDA hardware on your computer and managing
it. The key words are IrDA driver, IrDA ports (either
SIR or FIR), IrDA dongles and TTY/serial
port.
- High level of Linux-IrDA : this is the part of the
IrDA stack dealing with communicating with the other IrDA device and
exchanging the data (the protocol). The key words are protocol,
IrCOMM, IrLPT, OBEX, IrLAN and
IrNET.
The low level and high level are totally independant of each other,
however each need to be configured properly for what you want to do.
The procedure to get IrDA working looks usually like this :
I also offer various debugging tips at the end of
this document.
Common configuration
Most Linux kernels don't come with IrDA enabled, and most
distributions come with very approximate config scripts. I don't trust
those and I always do things by myself.
- Get kernel of your choice, unpack the source in /usr/src
- Compile yourself a fresh kernel and make it boot properly.
- Configure the IrDA stack as a module, enable all options (as
module if possible) and the driver/protocols you need (as modules).
- Configure serial port as a module. Static is ok as well, except
for the NSC or FIR setup.
- Recompile the modules and install them :
> make modules ; make modules_install
- Install irda-utils-0.9.15 or later
- Add the following stuff in /etc/modules.conf :
# IrDA stuff...
alias tty-ldisc-11 irtty
alias char-major-161 ircomm-tty # if you want IrCOMM support
# These values are hard-coded in irattach (not instance order)
alias irda-dongle-0 tekram # Tekram IrMate IR-210B
alias irda-dongle-1 esi # ESI JetEye
alias irda-dongle-2 actisys # ACTiSYS IR-220L
alias irda-dongle-3 actisys # ACTiSYS IR-220L+
alias irda-dongle-4 girbil # Greenwich GIrBIL
alias irda-dongle-5 litelink # Parallax LiteLink/ESI JetEye
alias irda-dongle-6 airport # Adaptec Airport 1000 and 2000
alias irda-dongle-7 old_belkin # Belkin (old) SmartBeam dongle
alias irda-dongle-8 ep7211_ir # Cirrus Logic EP7211 Processor (ARM)
alias irda-dongle-9 mcp2120 # MCP2120 (Microchip) based
alias irda-dongle-10 act200l # ACTiSYS Ir-200L
alias irda-dongle-11 ma600 # Mobile Action ma600
# IrNET module...
alias char-major-10-187 irnet # Official allocation of IrNET
- Create the IrDA devices :
> mknod /dev/ircomm0 c 161 0
> mknod /dev/ircomm1 c 161 1
> mknod /dev/irlpt0 c 161 16
> mknod /dev/irlpt1 c 161 17
> mknod /dev/irnet c 10 187
> chmod 666 /dev/ir*
- Reboot
Now, it's time to check which hardware you want to make run...
Kernel 2.6.X differences
Kernel 2.6.X drivers are slightly different from kernel 2.4.X
described above. The main driver differences are listed below. This
list is known to not be final.
- Driver irtty-sir replaces irtty for SIR mode
- Dongles drivers for irtty-sir have the -sir prefix
added to their name (to distinguish them from old style dongle
drivers).
- Driver donauboe replaces toshoboe
- Driver smsc-ircc2 may replace smc-ircc
Module configuration is also different, you need to add the following
in /etc/modules.conf :
alias tty-ldisc-11 irtty-sir
alias char-major-161 ircomm-tty
alias irda-dongle-0 tekram-sir
alias irda-dongle-1 esi-sir
alias irda-dongle-2 actisys-sir
alias irda-dongle-3 actisys-sir
alias char-major-10-187 irnet
Low level drivers
This really depend on the IrDA hardware that you have. I describe a
few of the options below. The two safest options are Laptop in SIR mode and Serial
dongle.
Serial dongle (using irtty driver)
For all serial dongles, you need an IrDA driver, which is
irtty, and a dongle driver. The dongle I use if the
Actisys 220L+, and the dongle driver is called actisys (see
list above). The setup for other dongles should be very similar. I'm
also using the first serial port in this example (ttyS0), you may need
to adapt to your case.
- Attach dongle to the serial port, and check which serial port it
is.
- Check if the serial config is ok :
> setserial /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
- If it say UART: unknown, your serial configuration is invalid.
- Start the IrDA stack :
> irattach /dev/ttyS0 -d actisys -s
- If you want to unload/stop the IrDA stack just kill all the IrDA
applications and do :
> killall irattach
> rmmod irtty actisys
> rmmod irda
Note : all the modern ESI dongles work better with the
litelink driver.
Laptop port in SIR mode (using irtty driver)
SIR (Serial Infrared) is not fast but almost always work and is easy
to set-up, so it's a safe bet. It will work only if the BIOS is set
to SIR mode, so don't bother otherwise. Some BIOS don't offer the
setting and try to be clever and autodetect the proper setting, but it
doesn't always works.
Note that some laptops (Toshiba) need special magic for their IrDA
port to be enabled, see link section above.
The irtty driver will use the standard Linux serial driver.
Now, you just need to figure out on which side of the laptop if the
IrDA port...
HP Omnibook 6000 in FIR mode
It seems that each laptop has its quirk when it come to FIR mode. I've
managed to get my OB6000 to work (great laptop BTW). Other laptops
will be different (different driver, different settings).
The NSC driver gives me some pretty good performance.
Other laptops in FIR mode
There is different FIR hardwares included in the various
laptops. Linux-IrDA support some of them (not all) in various degrees
(from good to bad). Moreover, it seems that each laptop has its quirk,
so it's difficult to list everything here.
For this reason, I recommend to make it work first in SIR
mode. After that, you can experiment, check the Howto and query
the mailing list...
THe setup for most FIR drivers will follow the same pattern as the
Omnibook 6000 example above. You will need to find the proper
value of the modules parameters, set the BIOS properly,
take care of conflicting hardware (serial, Pcmcia cards and
other interrupt conflicts) and start the stack with irattach.
As a rule of thumb, the NSC driver seems to be the most
functional (if you set the proper dongle_id, which most likely
0x9, but sometimes 0x8), and the old SMC driver the most
problematic.
USB FIR dongles
This driver is included in recent kernel. It's not as efficient as
other FIR hardware, but at least is supported and is relatively easy
to get working. Also, all the current products are based on the same
hardware, and we know most of its bugs.
The latest version of the driver has been tested with usb-uhci
and usb-ohci.
If you have already some other IrDA hardware configured on the PC, the
driver won't load as irda0, so check the message log with
dmesg. Also, the driver can manage up to 4 IrDA-USB dongles per
PC (that can be increased in the source).
Recently a new type of USB dongle from SigmaTel has appeared on
the market which is not compliant with the IrDA-USB
specification, and therefore doesn't work with this driver. On the
other hand, SigmaTel has made available the full
technical specification, so writing a driver for it is
possible. There is a alpha driver for 2.6.X in my patch list.
The MA 620 USB dongle is a SIR USB dongle, there is some howto for it written by Martin Diehl.
Important note : in recent kernels, the USB team has added
a driver called ir-usb. Not only this driver is not
compatible with the IrDA stack (the IrDA driver is called
irda-usb), but this driver will load automatically before
irda-usb, therefore preventing you to use
it. Solution : get rid of ir-usb. It may also be
possible to blacklist ir-usb in
/etc/hotplug/blacklist. I would like to thank warmly the
USB team for the confusion they created. For complains, please direct it to them.
SIR with irport
The standard SIR driver is irtty, which uses the standard
serial driver and tty layer. This is the easiest and safest way to get
IrDA working.
However, the tty layer adds some overhead and doesn't understand the
IrDA protocol, which make it unsuitable in some case (dongle without
echo cancelation) and less performant in others (small packets). That
is why there is a second driver, irport, which allow the IrDA
stack direct access to the serial port.
Unfortunately, the procedure to use irport is more complicated
and less well tested. Actually, I personally never managed to make
irport work reliably on any of my systems.
Checking that it work
The first test is to check if the discovery is happening
properly. If the IrDA driver is properly configured, the Linux-IrDA
will discover other IrDA devices in range. If the discover doesn't
work, this indicate that the low level is not configured properly (and
you don't need to go any further).
You can check if there is any device listed in the discovery log
with :
> cat /proc/net/irda/discovery
IrLMP: Discovery log:
nickname: Jean Tourrilhes, hint: 0x8220, saddr: 0x913b1bbc, daddr: 0x5619b45e
You can also check various other files in /proc, or use
irdadump, check the debugging section.
Then, you might want to use a simple aplication, such as
e-Squirt to verify that everything works fine. Or you can skip
directly to the next section.
The big advantage of e-Squirt is that it is a really simple protocol,
doesn't stress the IrDA stack too much and we have implementation for
various platforms,
so that you can test your setup with almost anything on the other side
(Linux, Win32, WinCE or Palm).
Compile the Linux e-Squirt library and the
test programs on all Linux computers, and go in the tests
directory. On other platforms, load and start the relevant the
e-Squirt application.
If you want to use Linux as a receiver, just do :
./squirt
To use Linux as a sender, you can do :
./ultra_beacon http://cooltown.hp.com/
./socket_squirt http://cooltown.hp.com/
With that, you should be able to exchange back and forth URLs and
check that your IrDA stack works. If not, continue to read below.
On caveat : Most implementations have two exclusive receiving
modes, IrDA and Ultra, and they switch between these (either as a
preference setting, or automatically triggerd by discovery
packets). Linux is an exception and can listen to both at the same
time. This means that unless you do a Linux-Linux test, only one of
the two sender tests listed above will work properly.
Apps and protocols on top of the IrDA stack
If you want to run e-Squirt applications, you are done, and you just
need to run the application themselves, they should work.
Other applications and protocols you may want to run :
Note that I don't use IrCOMM and IrLAN, so I can't help much with that...
Terminal over IrComm
This is a simple test to check that IrComm is working between
two PCs. After that, you can try more complex applications such as
PPP. The original instructions were sent
on the mailing list.
Server side :
Start the terminal server
> getty ircomm0 DT19200 vt100 # Red-Hat syntax
or
> getty -L ircomm0 19200 vt100 # Debian syntax
At this point, your text terminal should get reset and you
come back to a login prompt. That's normal. I don't know what happen
in X.
Client side with kermit :
Start the terminal emulator
> kermit
> > set line /dev/ircomm0
> > set speed 19200
> > connect
> > > stty sane # Get backspace to work ok
The prompt shouls appear after connect. Also, you need to
ignore the following message : "Warning: no access to tty
(Inappropriate ioctl for device). Thus, no job control enabled",
and "Can't open terminal /dev/tty"
Client side with minicom :
Minicom is a bit more problematic, and I'm still fighting with
it. I still don't understand how to connect. I managed to make it work
like this :
- start minicom
- Configure (^A O)
- sub-menu serial
- set to /dev/ircomm0
- set speed to 19200
- exit
- sub-menu "save as dft"
- exit
- Exit (^A X)
- restart minicom
TCP/IP over IrCOMM between two PCs
This simple example of PPP over IrCOMM is somewhat similar to
TCP/IP over IrNET, and is not much use,
except to verify the IrCOMM works properly. Real life PPP over IrCOMM
to a mobile phone will involve a much more complex configuration (to
configure the modem and dial).
Server side :
Start the ppp deamon
> pppd /dev/ircomm0 9600 local noauth passive
As you can see, the visible difference with IrNET is that we use
/dev/ircomm0 instead of /dev/irnet. Also, IrCOMM doesn't
have the advanced features of IrNET to specify IrDA peer.
Client side :
Start the ppp deamon
Start the terminal emulator
> pppd /dev/ircomm0 9600 local noauth
At this point, the IrDA stack should connect (check with
irdadump) and PPP should create a new network device (usually
ppp0) and configure IP and route. You should be able to ping
and connect to the other side using its IP address.
TCP/IP over IrLAN
I don't use IrLAN any longer, because I'm only using
IrNET. I just did a refresh on the original instructions that I
sent
on the mailing list (removing mentions of irmanager which no
longer exist).
IrLAN as an access option, which can be 1 (direct mode), 2 (peer to
peer) and 3 (hosted). Basically, you would use 2 if you connect to
another PC, 1 if you connect to a transparent access point, and 3 if
you are the access point (Dag, correct me if I'm wrong). The HP
Netbeamer is an access point, but it accept connections only if the PC
is in peer mode. Go figure...
PC -> HP NetBeamer :
Here is how to hook to the NetBeamer... After aligning the IrDA port
or after starting irattach, the light of the NetBeamer should
flash. If it doesn't, you may want to play with the slot_timeout
value.
> insmod irlan access=2
> ifconfig irlan0 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
At this point, the light goes solid green. Link is on, you can ping
and everybody is happy. You may want to add a gateway with "route add
default gw ...".
PC -> PC :
Not everybody has a NetBeamer, so here is a step by step on
how to create a link between two PCs.
On the first PC :
> insmod irlan access=2
> ifconfig irlan0 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
On the second PC :
> insmod irlan access=2
> ifconfig irlan0 10.0.0.2 netmask 255.255.255.0 broadcast 10.0.0.255
After that, you should be able to ping and telnet...
Automated ifconfig :
By default, /etc/irda/network.opts is not used. In the previous
example, we ifconfig-ure irlan by hand. If you have a Red-Hat/Mandrake
distribution, irmanager can do the job automatically at the condition
that you create a file /etc/sysconfig/network-scripts/ifcfg-irlan0 and
set the right values in there... There might be more needed, but I'm
not totally expert on this...
For other distribution (like Debian),
you need to replace the file /etc/irda/network with possibly something
from a Pcmcia package, and with some editing you might get it to load
network.opts...
You might also want to add in your /etc/conf.modules a "option irlan
access=2". So, if you use modprobe instead of insmod, you won't have
to specify access=2 on the command line.
IrDA and mobile phones or PDAs
I don't have any mobile phone, and I don't use IrCOMM,
so I can't help...
There is many people using IrDA to connect either to their mobile
phone or PDA, and lot's of them have put instructions in their web
pages. You may use OBEX to transfer simple objects, or PPP
over IrCOMM to establish connections, depending on the application
and the device. The people doing Gnokii are also quite knowledgeable in
this area, so you may ask advice on their mailing list, but please
report IrDA bugs in the IrDA mailing lists.
One of the most common gotcha is that applications need to be
configured to use the proper IrCOMM virtual port (which most
often is /dev/ircomm0).
If I can't reproduce your problem, I can't debug it, so I can't fix
it. If I can't see anything obvious in the irdadump log, I
won't bother. You may also want to try to reproduce the problem
between two Linux boxes (because I may be able to reproduce
that).
Checking Linux-IrDA state and debugging
Of course, I'm sure that you won't get things smooth the first
time. Actually, I'm pretty sure you will struggle a little bit.
If you get the Obex stuff out of the loop (so, using Ultra or Socket,
as described above), the e-Squirt stuff is so simple that if anything
doesn't work you can bet that it's the IrDA stack.
The first trick is to check is the modules are loaded :
> cat /proc/modules
actisys 1652 1 (autoclean)
irtty 7524 2 (autoclean)
irda 151905 11 (autoclean) [actisys irtty]
This is what a serial dongle setup would look like. If the modules
don't show up, check you modules configuration and check the error
messages in the log (with dmesg).
Then, check the bunch of files in /proc/net/irda :
> cat /proc/net/irda/discovery
IrLMP: Discovery log:
nickname: Jean Tourrilhes, hint: 0x8220, saddr: 0x913b1bbc, daddr: 0x5619b45e
> cat /proc/net/irda/irlap
irlap0 state: LAP_NDM
device name: irda0, hardware name: ttyS0
caddr: 0x52, saddr: 0x913b1bbc, daddr: 0x5619b45e
win size: 1, win: 1, line capacity: 4800, bytes left: 4800
tx queue len: 0 win queue len: 0 rbusy: FALSE mbusy: FALSE
retrans: 0 vs: 2 vr: 2 va: 0
qos bps maxtt dsize winsize addbofs mintt ldisc comp
tx 9600 0 64 1 12 0 0
rx 9600 0 64 1 12 0 0
> cat /proc/net/irda/irias
LM-IAS Objects:
name: hp:esquirt, id=76371435
- Attribute name: "IrDA:TinyTP:LsapSel", value[IAS_INTEGER]: 96
name: OBEX:ESquirt, id=76371435
- Attribute name: "IrDA:TinyTP:LsapSel", value[IAS_INTEGER]: 95
name: Device, id=0
- Attribute name: "IrLMPSupport", value[IAS_OCT_SEQ]: octet sequence
- Attribute name: "DeviceName", value[IAS_STRING]: "lagaffe"
name: hp:beacon, id=76371435
- Attribute name: "IrDA:TinyTP:LsapSel", value[IAS_INTEGER]: 97
There, you can see that the IrDA stack has discovered my Palm V, that
my IrDA port is ttyS0, that I'm not connected, and you can also see
that I have an e-Squirt application running that has opened a bunch of
server sockets (of course, if you haven't started e-Squirt, the IAS
won't contains all those sockets).
The ultimate debugging tool is irdadump (and remember that I
require you to use version 0.9.15 or later). You should run irdadump
while attempting to connect and check what's happening. A
normal irdadump log with a IrDA device in front of the port (not
connected) should show something like this :
> irdadump
22:04:48.000713 xid:cmd 6f1e8511 > ffffffff S=6 s=0 (14)
22:04:48.090705 xid:cmd 6f1e8511 > ffffffff S=6 s=1 (14)
22:04:48.180714 xid:cmd 6f1e8511 > ffffffff S=6 s=2 (14)
22:04:48.270734 xid:cmd 6f1e8511 > ffffffff S=6 s=3 (14)
22:04:48.270698 xid:rsp 6f1e8511 < fb48d412 S=6 s=2 Jean Tourrilhes hint=8220 [ PDA/Palmtop IrOBEX ] (32)
22:04:48.360742 xid:cmd 6f1e8511 > ffffffff S=6 s=4 (14)
22:04:48.450733 xid:cmd 6f1e8511 > ffffffff S=6 s=5 (14)
22:04:48.540762 xid:cmd 6f1e8511 > ffffffff S=6 s=* weblab10 hint=0400 [ Computer ] (24)
You see my Palm V answering the discoveries of Linux. The Palm shows
the infamous "Waiting for sender" pop-up.
On the other hand, if the stack is not properly configured (wrong
port, wrong driver), or if the device in front is not active, you will
get something like this :
22:02:47.988983 xid:cmd 6f1e8511 > ffffffff S=6 s=0 (14)
22:02:48.078981 xid:cmd 6f1e8511 > ffffffff S=6 s=1 (14)
22:02:48.168992 xid:cmd 6f1e8511 > ffffffff S=6 s=2 (14)
22:02:48.258995 xid:cmd 6f1e8511 > ffffffff S=6 s=3 (14)
22:02:48.349018 xid:cmd 6f1e8511 > ffffffff S=6 s=4 (14)
22:02:48.439035 xid:cmd 6f1e8511 > ffffffff S=6 s=5 (14)
22:02:48.529063 xid:cmd 6f1e8511 > ffffffff S=6 s=* weblab10 hint=0400 [ Computer ] (24)
As you can see, nobody answer us...
After that, send a good bug report to the Linux-IrDA mailing list.
The connection just "hang"
The first type of hang is a very classical problem, where the
connection hanging just after beeing negociated (after the
packets called SNRM and UA). The irdadump looks like the
following :
18:03:28.766071 xid:cmd ffffffff < af28ca67 S=6 s=0 (14)
18:03:28.856067 xid:cmd ffffffff < af28ca67 S=6 s=1 (14)
18:03:28.947685 xid:cmd ffffffff < af28ca67 S=6 s=2 (14)
18:03:29.037383 xid:cmd ffffffff < af28ca67 S=6 s=3 (14)
18:03:29.037549 xid:rsp 977f612c > af28ca67 S=6 s=3 lagaffe hint=4400 [ Computer LAN Access ] (23)
18:03:29.126099 xid:cmd ffffffff < af28ca67 S=6 s=4 (14)
18:03:29.216071 xid:cmd ffffffff < af28ca67 S=6 s=5 (14)
18:03:29.316257 xid:cmd ffffffff < af28ca67 S=6 s=* tanguy hint=4400 [ Computer LAN Access ] (22)
18:03:29.316433 snrm:cmd ca=fe pf=1 977f612c > af28ca67 new-ca=ba (32)
18:03:29.417508 ua:rsp ca=ba pf=1 977f612c < af28ca67 (31)
18:03:29.417646 rr:cmd > ca=ba pf=1 nr=0 (2)
18:03:29.666173 rr:cmd > ca=ba pf=1 nr=0 (2)
If you are on the primary, you will see a series of rr:cmd until it
times-out. On the secondary, you won't see anything after the
ua:rsp and it will eventually timeout.
What most likely happening is that the negociated connection
parameters don't match. Usually, one end doesn't implement properly
the speed that is beeing negociated, so the two nodes can't hear each
other after changing speed. And most likely it happens at FIR speeds.
Of course, it would be nice to fix the driver, but in the short term
the solution is to force the IrDA stack to negociate a lower
speed :
> echo 115200 > /proc/sys/net/irda/max_baud_rate
You can of course try lower values, and there is also other parameters
you can tweak in this directory.
There is second type of hang, that may look similar but is
not. You may see the IrDA stack "hanging" on transmitting a large
packet (the last number between parenthesis). This seems due to a
bug in the some FIR hardware.
18:03:30.458569 i:rsp < ca=ba pf=1 nr=6 ns=5 LM slsap=12 dlsap=10 CONN_CMD TTP credits=0(12)
18:03:30.458740 i:cmd > ca=ba pf=1 nr=6 ns=6 LM slsap=10 dlsap=12 CONN_RSP TTP credits=0(12)
18:03:30.466399 rr:rsp < ca=ba pf=1 nr=7 (2)
18:03:30.516548 rr:cmd > ca=ba pf=1 nr=6 (2)
18:03:30.537423 i:rsp < ca=ba pf=1 nr=7 ns=6 LM slsap=12 dlsap=10 TTP credits=0 (29)
18:03:30.537663 rr:cmd > ca=ba pf=1 nr=7 (2)
18:03:30.547328 rr:rsp < ca=ba pf=1 nr=7 (2)
18:03:30.555025 i:cmd > ca=ba pf=1 nr=7 ns=7 LM slsap=10 dlsap=12 TTP credits=1 (2050)
18:03:30.566804 i:cmd > ca=ba pf=1 nr=7 ns=7 LM slsap=10 dlsap=12 TTP credits=1 (2050)
18:03:30.596405 i:cmd > ca=ba pf=1 nr=7 ns=7 LM slsap=10 dlsap=12 TTP credits=1 (2050)
It may look a bit different for you, but you get the idea, the packet
doesn't goes through and is retried, and the communication just dies
there.
As we can't fix the hardware, the solution is to force the IrDA stack
to transmit smaller packets :
> echo 2000 > /proc/sys/net/irda/max_tx_data_size
Now, I've seen is a third type of hang which happen during
the connection, and not related to a large packet. This happens
with buggy phones, such as Ericsson phones (T39/T68/...).
14:53:57.741656 snrm:cmd ca=fe pf=1 2cc4b1b4 > 29c42130 new-ca=ae
LAP QoS: Baud Rate=4000000bps Max Turn Time=500ms Data Size=2048B
Window Size=7 Add BOFS=0 Min Turn Time=1000us Link Disc=12s (33)
14:53:57.877021 ua:rsp ca=ae pf=1 2cc4b1b4 < 29c42130
LAP QoS: Baud Rate=1152000bps Max Turn Time=500ms Data Size=256B Window
Size=3 Add BOFS=0 Min Turn Time=0us Link Disc=12s (31)
14:53:57.877622 rr:cmd > ca=ae pf=1 nr=0 (2)
14:53:57.889399 rr:rsp < ca=ae pf=1 nr=0 (2)
14:53:57.889468 i:cmd > ca=ae pf=1 nr=0 ns=0 LM slsap=11 dlsap=00 CONN_CMD (6)
14:53:57.895119 i:rsp < ca=ae pf=1 nr=1 ns=0 LM slsap=00 dlsap=11 CONN_RSP (6)
14:53:57.895264 i:cmd > ca=ae pf=1 nr=1 ns=1 LM slsap=11 dlsap=00
GET_VALUE_BY_CLASS: "IrDA:IrCOMM" "Parameters" (28)
14:53:57.899848 i:rsp < ca=ae pf=1 nr=2 ns=1 LM slsap=00 dlsap=11
GET_VALUE_BY_CLASS: Success
IrCOMM Parameters Service Type=NINE_WIRE THREE_WIRE Port Type=PARALLEL (19)
14:53:57.900690 i:cmd > ca=ae pf=0 nr=2 ns=2 LM slsap=11 dlsap=00 DISC (6)
14:53:57.900803 i:cmd > ca=ae pf=1 nr=2 ns=3 LM slsap=12 dlsap=00 CONN_CMD (6)
14:53:57.914408 rr:rsp < ca=ae pf=1 nr=4 (2)
14:53:57.914453 rr:cmd > ca=ae pf=1 nr=2 (2)
14:53:57.924388 rr:rsp < ca=ae pf=1 nr=4 (2)
14:53:57.965741 rr:cmd > ca=ae pf=1 nr=2 (2)
The first interesting part of the log above is the Min Turn
Time=0us. The peer says that it can turn the link around in 0us,
but I've never seen any device that fast.
The problem here is that the Linux-IrDA stack gives the peer exactly
what he ask for, and the Linux-IrDA stack can be very fast in turning
around. And of course the peer can't keep up and doesn't receive
properly the frames, and after that it usually goes downhill.
In those cases, you may want mandate that Linux uses a large
turnaround time :
> echo 1000 > /proc/sys/net/irda/min_tx_turn_time
The second interesting part of the log above is that it fails just
after the Linux-IrDA sends two consecutive packets. IrLAP is a
windowed protocol (up to 7 consecutive frames), but some devices have
trouble managing that (such as the Ericsson phones and USB dongles).
In those cases, you may want limit Linux to send one frame per IrLAP
window :
> echo 1 > /proc/sys/net/irda/max_tx_window
Note that the patch adding max_tx_window to the IrDA stack is
included only in kernel 2.4.22, for earlier kernel to fetch a
patch up here.
irattach print "tcsetattr" in the log
People using FIR drivers (nsc-ircc, smc-ircc...) are often confronted
to this simple problem. When they start irattach, it doesn't
work and the following message (or similar) is printed in the
log :
irattach: tcsetattr: Invalid argument
This is due to a conflict between the Linux-IrDA FIR driver and
the regular Linux serial driver. Both want to manage the same
hardware, the serial driver has registered the FIR port as a pseudo
serial port and is owning it, and the kernel rightly prevent
the FIR driver to get ownership of it (it's first come first serve).
The solution is simple. You need to tell the serial driver that it
should not manage this port.
The safest way is to remove the serial driver :
> rmmod serial
Unfortunately, the trick above doesn't always work (non-modular
driver, another serial port in use). Another way is to declare the
port invalid :
> setserial /dev/ttyS1 uart none
On the other hand, if you do that, you won't be able to use
irtty (SIR mode driver), because irtty uses the regular Linux
serial driver. If you change your mind and want to use the irtty
driver, you can reenable the serial port with :
> insmod serial
> setserial /dev/ttyS1 uart 16550A
Common pitfalls
There is many way to get the IrDA stack to not run properly. Not
following instructions seems to be one of the most guaranteed way to
reach that goal.
Here are mistakes I've seen user make :
- IrDA ports not properly aligned
- irmanager running (it's obsolete, get rid of it)
- Let the init scripts of the distribution do the job
- irdaping running (prevent the LAP connection)
- Obsolete irda-utils
- using the wrong driver (FIR/irtty/irport)
- using the wrong port (/dev/ttyS0 vs /dev/ttyS1)
- Wrong permissions on the serial port (irattach must run as root)
- Some other application (such as pppd) grabbing the serial port
- Some other driver (most likely a Pcmcia card) using the IRQ that
the IrDA driver needs (for Pcmcia drivers, play with "exclude"
directives in /etc/pcmcia/config.opts)
- Wrong irattach command (irattach /dev/ttySX for SIR vs
irattach irdaX for FIR)
- Multiple instances of irattach for the same port (staying
in background)
- Wrong modules names (should be ircomm-tty, not ircomm_tty)
- IrDA modules not loaded
- Mixing up /dev/ttySX and /dev/ircommX. The stack
runs on top of /dev/ttySX and provides serial emulation through
/dev/ircommX, so serial apps should run on top of
/dev/ircommX.
- Compiling the IrDA stack static (i.e. non module - it may work,
but this is not what the developpers work with)
- Compiling the IrDA stack without the IRDA_DEBUG option. This
option enable extra checks that prevent your kernel to crash.
- Mixing modules belonging to different versions of the IrDA stack
- Unclean IrDA source (failed patch)
- Mixing modules belonging to different kernel versions
- Trying to load an IrDA module on a stack wich has this code
compiled static (or loading module twice)
- Wrong version of modules tools (for kernel 2.4)
- Failed to do depmod -a (usually automatic at reboot)
- Using a version of the kernel which is not used and recommended by
developpers.
Compilation problems
Sometimes, when you compile the IrDA stack or some various IrDA
package, you may have the compiler complaining the things such as
IRLMP_HINT_MASK_SET or IRDAPROTO_ULTRA are not defined.
This is because of a mess related to kernel headers and the way most
distributions deal with it. If you have the 2.4.X kernel source lying
around, the fix is simple. Just copy the header irda.h from the
kernel to your include directory :
cp /usr/src/linux/include/linux/irda.h /usr/include/linux
That should fix it ;-)