Linux IR HOWTO Werner Heuser, v1.2, 24 August 1998 An introduction to Linux and infrared devices and how to use the soft­ ware provided by the Linux/IR project. This package uses IrDA (TM) compliant standards. Because IrDA (TM) is a trademark the project is named Linux/IR. IrDA (TM) is an industrial standard for infrared wire­ less communication, and most laptops sold today are equipped with an IrDA compliant infrared transceiver. IrDA serial ports let you commu­ nicate with devices such as printers, modems, fax, LAN, and other lap­ tops. Speed ranges from 2400bps to 4Mbps. ______________________________________________________________________ Table of Contents 1. Introduction 2. Prerequisites 3. Compilation 4. Configuration 4.1 General Configuration 4.2 Printer Connection Setup 4.3 LAN Connection Setup 4.4 Dongle Connection Setup 4.5 Palm III Connection Setup 4.6 Window$95 and Linux/IR 4.7 Fast InfraRed (FIR) 4.8 Miscellaneous Devices 4.9 Configuration Tool 5. GUI (by Dag Brattli) 6. Troubleshooting 7. FAQ 8. Known Bugs 9. Hardware Overview (Link) 10. Revision History 11. Copyright and Disclaimer ______________________________________________________________________ 1. Introduction This document was written depending on the "How to use" part of the Linux/IR project homepage http://www.cs.uit.no/~dagb/irda/howto.html. The information is updated to the ``linux-irda-1998-08-20'' snapshot. What is the part of the author? Since I am not a programmer, I try to be a compilator of the material provided by the Linux/IR core team, the Linux/IR mailing list and other sources. Also I try to add some work of my own, e.g. a ``configuration tool''. For those which would like to follow the cutting edge of the Linux/IR Project there is a CVS repository at http://www.cs.uit.no/~dagb/irda/linux/irda/ Companies and developers who are interested in joining this efforts should contact the Linux/IR project at http://www.cs.uit.no/~dagb/irda/howto.html or me at . This document is included in the LINUX DOCUMENTATION PROJECT http://sunsite.unc.edu/LDP. The latest version of this document is available at http://userpage.fu-berlin.de/~r2d2c3po/ir_howto.cgi Thanks to: · The Linux/IR core team. · The members of the Linux/IR mailing list. · The writers of the other HOWTOs which give me many inspirations. · The developers of the SGML-Tools. Please feel free to contact me for comments or questions. I know this material is not finished or perfect, but I hope you find it useful anyway. 2. Prerequisites · BIOS Make sure your IrDA-Port is enabled in the BIOS and what irq and port it uses, depending on the specification of your machine. · Kernel - Make sure you use kernel 2.0.x (at the moment there is no support for 2.1.x). If unsure try ``uname -r''. - You should have proc file system support in the kernel. - Also serial support. - I am not sure wether there has to be parallel port support for using a printer with IR. - Networking support for use with IR ethernet devices. - Make sure you have module support in your kernel! Test it e.g. with ``lsmod''. - Matt Francis wrote: "I notice that some of the modules appear to want not only module support (as noted on the webpage), but also misc user device support.". · modutils Make sure you use modutils 2.x.x by ``insmod --version''. · Shared Library The shared library libc.so.5 and the loader ld-linux.so.1 has to be available. · Security Most important, you must 'sync' your disks!!! (have you read the disclaimer ?). · Miscellaneous Other useful progs: APSFILTER, EZ-Magic, MagicFilter or some like this for the printer configuration. 3. Compilation · Use the latest source snapshot available at http://www.cs.uit.no/~dagb/irda/snapshots · Untar the package with ``tar xvzf linux-irda-''. I recommend to do this in /usr/src. · Edit the Makefile if you are using module versions, want proc file system support (2.0.x only), and if you want printer server or LAN server support. · Uncomment #USE_PROC. This is optional but highly recommended for debugging purposes. · Do a ``make depend''. · Do a ``make clean'' (only necessary if you compile more than one time). · Do a ``make install'' (brings all the modules and irattach into the right place). · For latest improvements look into the FAQ section below. · What Makefile options are available: · MODVERSIONS: You will only need this if you have defined CONFIG_MODVERSIONS=y in /usr/src/linux/.config (Loadable module support). · USE_PROC: If you want proc filesystem support (2.0.x only). · USE_SYSCTL: No description available. · ESI_DONGLE: For use with Extended System Inc. dongle (experimental). · PRINTER_SERVER: No description available. · LAN_SERVER: No description available. · Both PRINTER_SERVER and LAN_SERVER are mutually exlusive !!! 4. Configuration 4.1. General Configuration · First you should put your IR devices in range. Though it is maybe possible that the IR service detects every new device automagically I only have good experience with the devices in range during the configuration process. · Keep your IR devices together in a range below one meter and an angle of 30°. There has to be a direct connection. If this is not possible, you may use a mirror (an unused M$ CD should work quite good). · Remove any current print jobs with ``lprm "*"''. · Add "alias tty-ldisc-8 irtty" to /etc/conf.modules. · Run ``depmod -a''. · If it is not in the specs, ``setserial -g -a /dev/ttyS?'' should give you an overview about which devices may include the IrDA-Port. Probably this is one with a 16550 UART. · Use ``setserial /dev/ttyS<0-2> irq 0xNNNN port M'' to set the values for your IR serial port (if you need it, especially when the IR port is at a separate serial line you usually don't need to change the values). For further info look into the FAQ section below. · Run ``irattach /dev/ttyS<0-2>''. If kerneld is running this will load the proper modules. There are eight modules: · irda.o, main module controls the IR connections in general · irport.o, "You should not use irport.o, this is a FIR replacement for irtty.o. irport is not finished and should probably not be used by anyone yet! Dag Brattli" · irtty.o, I suppose this supports the IrTTP layer · irlan_client.o, network module (client) · irlan_server.o, network module (server) · irlpt_client.o for printer connections (client) · irlpt_server.o for printer connections (server) · irobex.o Palm III support · If you don't use ``kerneld'' insert irda.o with ``modprobe irda.o''. · Do ``lsmod''. It should show the irda.o module. · Give irattach some time, e.g. seven seconds, to detect other IR devices. Then watch the output from the kernel hopefully, you get it in /var/log/messages. It should look like the following: Apr 5 06:42:12 ZAPPEL kernel: Linux IrDA v0.1 Sat Dec 13 14:54:04 1997 (Dag Brattli) Apr 5 06:42:12 ZAPPEL kernel: IrLPT, $Revision: 1.20 $/$Date: 1998/03/08 15:52:10 $ (Thomas Davis) Apr 5 06:42:12 ZAPPEL syslog: Serial connection established. Apr 5 06:42:19 ZAPPEL kernel: IrDA Discovered: HP LaserJet 6P Apr 5 06:42:19 ZAPPEL kernel: Services: PnP Compatible Printer <7>Informing LPT service user 4.2. Printer Connection Setup · If you don't use ``kerneld'' do a ``modprobe irtty.o''. · Do a ``modprobe irlpt_client.o''. · Check the modules with ``lsmod''. This should show: irda.o, irtty.o and irlpt_client.o · ``cat /proc/misc''. Gives you the "minor device-number" . It is the first number in the line with irlpt0. · ``su'' to root, and do ``mknod /dev/irlpt0 c 10 ''. Note: Something like ``./MAKEDEV irlpt0'' is not possible yet. · Try to write a small file to /dev/irlpt0 by ``cat FILE >/dev/irlpt0'' (do not wonder about a bad format this is just a first check). For me this doesn't not always work, but I couldn't find out why not. · The better way is to change your /etc/printcap to use /dev/irlpt0 in addition or instead of /dev/lp0. See Printing-HOWTO for detailed information. · For easy printer setup you may use such a printing software like APSFILTER, MagicFilter EZ-Magic (with RedHat there should also be a GUI for this purpose). Make a copy of /etc/printcap before. · Example for APSFILTER with a HP 6P (non-postscript, HP 6MP is with postscript). The two relevant questions are: "Do you have a (s)serial or a (p)arallel printer interface?" answer "p". "What's the device name for your parallel printer interface?" answer with /dev/irlpt0. · Restart the print daemon with ``kill -HUP . If you use another print daemon choose the according command. · Watch wether the connection indicator of your printer shows activity, e.g. the green light above the IR port of a HP 6P/MP comes on (lower left hand corner, near the paper tray). · I couldn't get to manage printjobs larger than approximately 10 pages yet. But maybe this depends on the memory size of my hardware, which is 16MB. There seems to be a problem with the software too, Thomas Davis wrote: I will "... limiting the irlpt, so it won't eat memory when you send a large print file.". 4.3. LAN Connection Setup · The following I couldn't test yet because I don't have a HP-NetBeam or something like that. If you can make suggestions please let me know. · Dag Brattli wrote: "If you want to use IrLAN you must ``modprobe irlan_client'' before ``ifup irlan0''. I had to remove the request_module() stuff since that needed a process context which I don't have in the kernel. " · Run ``ifconfig irlan0 up netmask '' to configure it with IP-address and other parameters. If the protocol is still running you may start communicating. It is possible to use RedHat's netcfg to do this, since it makes it very easy. Next time you only need to do ``/sbin/ifup irlan0''. · Test the network device by pinging to it. For detailed information about further setup see the NET3-HOWTO. · Do not forget to add a route, e.g. ``route add default gw '' or ``route add -host irlan0''. · Ping to another IP now. · For testing reasons I recommend only to use one laptop and one IR ethernet device in the same room. If there are problems look which different modes for the IR ethernet device are possible. Try them. 4.4. Dongle Connection Setup The only supported dongle (serial motherboard adapter) now is the Extended Systems Inc. ESI JetEye. For the Tekram IRmate dongle, technical information is strongly needed. Make sure you have the define ESI_DONGLE uncommented in the Makefile. This couldn't be tested yet, because I don't have an ESI JetEye. So please send me your experiences. 4.5. Palm III Connection Setup · Palm III -> Linux 1) Terminal 1> ``irattach /dev/ttyS'' 2) Terminal 2> ``load_misc irobex'' 3) Terminal 3> Start ``irobex_app'' in the irobex directory. 4) Beam something from your Palm III. 5) If everything is successful, you can take a look at a new file that has been created in the directory you started irobex_app. This file will be named after the object you just transfered. · Linux -> Palm III This should be also possible. · Linux < -- > Linux Dag Brattli wrote: "The awakened reader may wonder what prevents the beaming of files from Linux to Linux? Well, nothing!! (but I haven't tried that yet). This means that we now have a "simple" way of beaming files between Linux laptops. I think that this may be the "killer app" we all have been waiting for!" Try to "``load_misc irobex'' in both ends, and then try ``iroabex_app get'' on one of the machines and ``irobex put '' on the other.". 4.6. Window$95 and Linux/IR Why this? Unfortenately Linux users are not always supported with necessary hardware information. Sometimes it is possible to look at this informations in Window$95. Where to get? At http://www.microsoft.com/windows95/info/irda.htm you will find a support pack "Infrared Transfer 2.0". It is a self- extracting archive ``W95IR.EXE'' with 331KB. With some machines e.g. a HP Omnibook 800 it is neccessary to use a vendor specific version of this package (e.g. for the HP Omnibook 800 you may find it at the recovery CD). Especially the ..\windows\inf\*.inf files and the device manager are of interest to look for configuration details. There are also some non M$ products available. Note: Some of them use proprietary IR protocols: · CounterPoint: QuickBeam 1.15 · LapLink 7.5 · CarbonCopy 32 4.0 · pc ANYWHERE 7.5 · Puma Technology: TRANXIT pro 4.0 Connection between Linux/IR and Window$95 IrDA For the moment it should only be possible to get a network connection between to PC's (e.g. no ``getty''). If you have setup Infrared Transfer 2.0, you will find an IrDA network device in the . But I couldn't get a working connection yet. Maybe it is also possible to use the IrOBEX protocol. But I guess the necessary software is only provided with a Palm III. Takahide Higuchi provided an experimental patch for IrCOMM support. It is available for download from http://www.pluto.dti.ne.jp/ thiguchi/irda/ With this patch you can send or receive short messages between a linux box and a terminal program on a win95 laptop! But he thinks that some programs (like pppd) would fail because many ioctls are not implemented at this time. 4.7. Fast InfraRed (FIR) The IrDA(TM) standard knows three kinds of speeds: - SIR = Standard up to 115kbps IrDA, - MIR = Medium Speed IrDA, - FIR = Fast IrDA (4mbps) Up to 115.200bps usually the IrDA controller works like a serial port. Up to 4Mbps it works in "FIR mode". But note: "SIR is used to negotiate the session. No SIR, no session. " (Thomas Davis). Linux/IR doesn't officially support FIR yet. Thomas Davis wrote: "The irport module is currently used for FIR support; the only chipsets to be supported at this time are SMC and TI. SMC is currently in CVS; TI is not. ". For latest improvements see Linux/IR homepage http://www.cs.uit.no/~dagb/irda/irda.html , the Linux/IR mailing list archiv at http://bolowsky.ita.chalmers.se/linux-ir/ and in my hardware overview http:/userpage.fu-berlin.de/~r2d2c3po/ir_misc.cgi. 4.8. Miscellaneous Devices IrDA(TM) capable devices you may not only find in the above mentioned machines, but in digital cameras, phones, PDA's and others too. The support by Linux/IR is still under development. You may see the latest status at the Linux/IR homepage http://www.cs.uit.no/~dagb/irda/irda.html , in the Linux/IR mailing list archive at http://bolowsky.ita.chalmers.se/linux-ir/ and in my hardware overview http:/userpage.fu-berlin.de/~r2d2c3po/ir_misc.cgi. 4.9. Configuration Tool If you like you may use my configuration tool for these steps: · General Configuration · Printer Connection Setup · LAN Connection Setup · Dongle Connection Setup, not yet ready · Palm III Configuration, not yet ready How to use the configuration tool: · Download the text file irconfig from http://userpage.fu- berlin.de/~r2d2c3po/irconfig. · Put it in the same directory as all the other Linux/IR programms. · Do a ``chmod a+x irconfig''. · Maybe you have to edit the first line #!/bin/sh according to your system. · You have to be "root" to use the script. · Start the script with ``./irconfig''. · You may edit the first part of the script if necessary. · You have also this options ``./irconfig [ start|stop|test ]''. 5. GUI (by Dag Brattli) If you want to try out a little GUI, you can try to run "ircp.pl". You will need the Perl-GTK+ module ( http://www.gnome.org) to make it run. The GUI is far from finished, so don't expect to much :-) 6. Troubleshooting If you encounter problems. Try the following: · Read the FAQ section below. · Look into /var/log/messages and /var/log/kern. · Do a ``dmesg''. · Look into the different files in /proc/irda. · Look into the mailing list archiv at http://bolowsky.ita.chalmers.se/linux-ir/, wether your problem is already known. · Ask in the Linux/IR mailing list. · It is also possible to debug the code. But I don't know how to do this. If you want to use SKB debug code, you may edit irda.h and change /include/linux/skbuff.h (see revision history 10-2-98). · For problems with the irda.o module there is maybe an utility in the modules package ``kdstat'' helpful. But I was not able to try this. 7. FAQ · Q1 - Question: I do not know anything about ports and irqs. What should I do? · Answer: PART A: Hardware settings - 1 Have a look into your specs !!! If not available look at the support page of your vendor, or contact the support hotline. Or maybe you find the information in the hardware overview mentioned below. - 2 Use a current BIOS. Usually available at the support page of your vendor. - 3 Try ``setserial /dev/ttyS? -g -a | egrep 16550A''. One of the shown devices is probably the one you are looking for. Usually it is the second one, but with no guarantee. - 4 Note: What seems like an UART is physically the IrDA controller. For my HP Omnibook 800 this is the VLSI VL82C147 PCI - IrDA controller. These controllers should behave up to 115 200 bps like UART's. But sometimes it is very difficult to get the right configuration. PART B: How to tell the hardware settings to the kernel -4 ``cat /dev/ioports'' to see which ports are already in use. -5 ``cat /dev/interrupts'' to see which interrupts are already in use. -6 Make ports and interrupts available for use with IR device, e.g. stop the pcmcia service or include a line like this in /etc/sysconfig/pcmcia: PCIC_OPTS="irq_list=3,4,5,7,9,10,12,14,15" -7 Now try to guess what the right interrupt and port is. Use ``setserial /dev/ttySx irq M port 0xNNNN'' to tell the kernel. If there is more then one possible chance try them all (Note: As mentioned in the Serial-HOWTO you should not try irq 0, 1, 6, 8, 13, 14). -8 If you were successful please send the useful parameters to the author, because I would like to include them into the hardware overview. -9 Good luck. P.S. : You may also try my little ``configuration script''. But it is still not perfect yet. Also it is maybe necessary to finetune the IR serial port with setserial , e.g. ``setserial /dev/ttyS0 spd_dvi'' (speed rate 115200). · Q2 - Question: Where to get more information? · Answer: To join the Linux-IrDA mailing list, send a mail to linux- irda-request@list.uit.no with "subscribe" in the email body. Use linux-irda@list.uit.no to post a message. You are welcome to use this mailing list for posting questions, answers, bug-reports, patches, suggestions and comments. · Q3 - Question: Is there a mailing list archive? · Answer: Svante Soermark put up an archive of this list at http://bolowsky.ita.chalmers.se/linux-ir/. Right now it only includes messages from 16 march 1998 when he signed on, but if someone sends him a more complete archive he will put it up. · Q4 - Question: For me, ``irattach'' hangs, but recognizes the printer. /var/log/messages shows that irattach found my HP LaserJet 6P. · Answer: The "hang" is normal for irattach. Everything is working right if you see the HP Laserjet show up in the log. "hang" means irattach is polling the IrDA-Devices for incoming connections. If you kill it with the irattach program crashes and /dev/ttySx does not work anymore. The problem is within the irda module, and not with the irattach program. Rebooting is the only thing to do! Next time put irattach in the background by using ``irattach &''. Stop it if necessary with ``killall irattach''. · Q5 - Question: I get a message like tcsetattr read/write error in /var/log/messages. · Answer: Caused probably by wrong /dev/ttyS* or wrong irq or port. · Q6 - Question: Every setting seems alright, because I get the appropriate messages. But it still does not work. · Answer: Move the devices to within about .5 meter (1.5 feet). Check that only one application is using the infrared port. Check that both devices are using the same protocol, such as IrDA. · Q7 - Question: "... It appears that after about 30 seconds or so, the irda module is removed (or at least the cleanup code is called). Is this the expected behavior? " · Thomas Davis wrote: "It's kerneld removing the irda module, thinking it's idle ... " To solve the problem " ... uncomment the #include place the following line in front of the #include: #define __NO_VERSION__ so you should see: #define __NO_VERSION__ #include and find the line: /* MOD_INC_USE_COUNT */ remove the comments; find /* MOD_DEC_USE_COUNT */ and remove the comments. Recompile, and kerneld will now leave the module in memory for you, while you have irattach running." - I suppose it is the file irlpt.c which has to be edited. · Q8 - Question: I have downloaded the latest snapshot, and compiled it successfully under Linux 2.0.33 running on an IBM Thinkpad 560E. In the absence of any other IrDA machines to test with, is it safe to assume that once the module has been inserted and the syslog reports "irattach: Serial connection established.", is the IR really working, and will it start to respond once there is another machine with which to talk? · Answer by Dag Brattli: Sorry, this only means that irattach has done its part of the job, which is just to start the irda-tty. Maybe the message should have been different, but as I said, it tells that the serial connection between the irda-chip and the irda-driver is established. · Q9 - Question: At startup-time ``modprobe -a'' checks /lib/modules//net/irda.o and causes the messages: "IrLAP; Missing IrTTY /IrLMP Error no IrLAP connection" (in /var/log/messages and on the console). · Answer by Werner Heuser: Workaround for SYSTEM V style systems: Put a script named for example "ir_rmmod" containing ______________________________________________________________________ #!/bin/sh echo "$0 : remove irda module" rmmod irport.o rmmod irtty.o rmmod irda.o ______________________________________________________________________ in the startup process (/etc/init.d and a symbolic link name for exam­ ple "S100ir_rmmod" in /etc/rc3.d to "ir_rmmod"). Note the place for "sh". For BSD style systems try the corresponding approach. · Q10 - Question by Ho Chin Keong: I have commented MODVERSIONS in the Makefile, else doing "make" will give me complains. Is this alright? · Answer by Dag Brattli: Yes, you will only need the MODVERSIONS flag if you have defined CONFIG_MODVERSIONS=y in /usr/src/linux/.config: ______________________________________________________________________ # Loadable module support # CONFIG_MODULES=y CONFIG_MODVERSIONS=y CONFIG_KMOD=y ______________________________________________________________________ · Q11 - Question by Ho Chin Keong: Is there other way of setting up communication between the 2 laptops besides setting up a LAN route between the two? · Answer by Dag Brattli: Yes and no! One of the IrDA standard, IrCOMM permits you to emulate a serial cable between two laptops, so you can use any application written for serial ports (terminals, ppp, slip, etc.). This is however not yet implemented in Linux/IR. The IrLPT (printer) support is actually a subset of IrCOMM, so some of it is working! · Q12 - Question by Ho Chin Keong: If I block the infra red path deliberately for more than 10 seconds, the connection could not re- establish. I have to kill the irattach and restart the whole procedure to start the infrared route. The connection could be maintained, however, if the blocking is less than 10 seconds. Is this part of the design or a bug? Is there any way whereby we can lengthen this time limit from 10 s to longer or infinitely? · Answer by Thomas Davis: This is seems to be a bug in the primary side of the IrLAP/IrLMP code. It appears not to send the reset/disconnect notice all the way back up the stack.You'll notice it when IrLPT gets stuck in the query mode, and you was trying to talk to a printer, and disconnected/interrupted it when it was handshaking. (and now, it shows up in the IrLAN portion) · Q13 - Question by Paul VanderSpek: What success has anyone had with getting a Linux <--> Linux application working? · Answer by Dag Brattli: Yes, but that is some time ago, and I know that the IrLAN <--> IrLAN setup is broken when you want to use Linux in both ends. I will try to fix this in the next snapshot. If you would really like to try this out now, you could to fix the "static" code in functions: irlmp_get_discovery_response() and irlmp_discovery_request() in irlmp.c so that LAN support is published to the peer (change the - line into the + line) in both functions. ___________________________________________________________________ -irlmp->discovery_rsp.hint[0] = COMPUTER | EXTENSION; +irlmp->discovery_rsp.hint[0] = COMPUTER | LAN | EXTENSION; irlmp->discovery_rsp.hint[1] = OBEX; ___________________________________________________________________ Insert irlan_client on the first machine and irlan_server on the second. 8. Known Bugs If you find a bug, please send a bug-rapport to the mailing list, including dmesg(8) output, and which linux version, and hardware you are using. Thank you! 1.The remote device suddenly stops accepting frames, and the link goes down. If the link does not come back up again, the only thing to do is to break irattach, rmmod irda, and start all over again. 2.The machine suddenly freezes! (deallocation of non-allocated memory, forgotten timers, non valid pointers etc ...). Haven't had this problem in a long time, so maybe the problem is gone? 3.The irattach program crashes when you break it with ctrl-c, and /dev/cuaX does not work anymore. The problem is within the irda module, and not with the irattach program. Rebooting is the only thing to do! 9. Hardware Overview (Link) I put together an overview about IR capable hardware (laptops, PDAs, printers, cameras, phones, adapters, dongles and others) and how it is working with Linux, at http:/userpage.fu- berlin.de/~r2d2c3po/ir_misc.cgi 10. Revision History · v0.1 to v0.4a, 19 March 1998 to 4 August 1998, drafts, not included in the LDP · v1.0, 14 August 1998, release to the LDP · v1.1, 18 August 1998, added info about IrCOMM patch by Takahide Higuchi, minor changes · v1.2, 24 August 1998, updated to ``linux-irda-1998-08-20'' snapshot, added FIR section and revision history, minor changes 11. Copyright and Disclaimer Copyright © 1998 by Werner Heuser This document may be distributed under the terms set forth in the LDP license at http://sunsite.unc.edu/LDP/COPYRIGHT.html . The information in this document is correct to the best of my knowledge, but there's a always a chance I've made some mistakes, so don't follow everything too blindly, especially if it seems wrong. Nothing here should have a detrimental effect on your computer, but just in case I take no responsibility for any damages incurred from the use of the information contained herein.