Getting gnokii to work with a modern phone over IrDA under linux
================================================================

The following guide explains how to get a modern phone like a nokia 7110, 
nokia 6210, siemens s25, ericsson t39 etc to work with gnokii. The guide 
is divided into 3 parts: kernel configuration and setup, checking the
connection and gnokii configuration.

This guide is not for nokia 6110/6150. See gnokii-ir-howto instead.

Part 1 Kernel configuration and setup
=====================================

- Compile your kernel with IrDA support for your chipset.

For me on my VAIO this was:
CONFIG_IRDA=m
CONFIG_IRCOMM=m
CONFIG_IRDA_OPTIONS=y
CONFIG_IRDA_DEBUG=y

CONFIG_IRTTY_SIR=m
	Use the emulation of serial port part of your IrDA chipset or...
CONFIG_NSC_FIR=m
	Specify the one you have (I have a NSC 87338)

- Reboot onto new kernel etc.
- Check your serial devices don't conflict with the ioport/irq that your
  chipset driver will try to use:
  setserial /dev/ttySX (where X is 0 -> 3) should give you the information
  you need.
  If you have a device that conflicts with your ioport/irq then you will
  need to remove the serial driver's control over it with:
  setserial /dev/ttySX uart none port 0 irq 0
  (where X is there relevant port mine is /dev/ttyS2)
- I used the chipset way to get IrDA working.
  I needed:
  options nsc-ircc dongle_id=0x09
  alias irda0 nsc-ircc
  in /etc/modules.conf
  Then just irattach irda0 -s 1 which *should* load all the modules you need
  and start it doing irda discovery.
  The modules I have loaded at this point are: nsc-ircc and irda.

Part 2 Checking the connection
==============================

On some distributions irdadump is broken and segfaults. If this happens
skip the next two steps and go to discovery.

- Run irdadump to see that it is indeed attempting to discover something.
  You should see messages like:
15:24:07.380360 xid:cmd 0c57083d > ffffffff S=6 s=0 (14)
15:24:07.470333 xid:cmd 0c57083d > ffffffff S=6 s=1 (14)
15:24:07.560310 xid:cmd 0c57083d > ffffffff S=6 s=2 (14)
15:24:07.650283 xid:cmd 0c57083d > ffffffff S=6 s=3 (14)
15:24:07.740279 xid:cmd 0c57083d > ffffffff S=6 s=4 (14)
15:24:07.830279 xid:cmd 0c57083d > ffffffff S=6 s=5 (14)
15:24:07.920311 xid:cmd 0c57083d > ffffffff S=6 s=* langly hint=0400 [ Computer
] (22)
- Place the phone in front of it, enable the Infrared parts of it (Menu 90)
  then it should change to be like:
15:26:07.380336 xid:cmd 0c57083d > ffffffff S=6 s=0 (14)
15:26:07.470288 xid:cmd 0c57083d > ffffffff S=6 s=1 (14)
15:26:07.560284 xid:cmd 0c57083d > ffffffff S=6 s=2 (14)
15:26:07.650281 xid:cmd 0c57083d > ffffffff S=6 s=3 (14)
15:26:07.740280 xid:cmd 0c57083d > ffffffff S=6 s=4 (14)
15:26:07.847192 xid:rsp 0c57083d < d10e0000 S=6 s=4 Nokia 6210 hint=b125 [ PnP Modem Fax Telephony IrCOMM IrOBEX ] (27)
15:26:07.830293 xid:cmd 0c57083d > ffffffff S=6 s=5 (14)
15:26:07.920283 xid:cmd 0c57083d > ffffffff S=6 s=* langly hint=0400 [ Computer
] (22)
- With the phone still in front of your infrared port, check if the discovery
  of the infrared port works. Do a 
  bash-2.03$ cat /proc/net/irda/discovery

  a response could be:

  IrLMP: Discovery log:

  nickname: T39, hint: 0x9124, saddr: 0xe4fe8166, daddr: 0x48611661

  If this doesn't work try if discovery is on:
  bash-2.03$ cat /proc/sys/net/irda/discovery
  this should give:
  1
  if it returns:
  0
  check if irattach is running:
  bash-2.03$ ps aux|grep iratt
  a possible return is:
  root       271  0.0  0.0  1288  192 ?        S    20:49   0:00 irattach /dev/ttyS1
  if you don't see the irattach process, go back to kernel configuration.
- Now try using ircomm to talk to the phone.  Try minicom /dev/ircomm0 (you
  may need to setup a default profile for this port as the root user with
  minicom -s /dev/ircomm0).
- This depends on your distribution having the right lines in modules.conf
  for ircomm to be loaded:
alias tty-ldisc-11 irtty
alias char-major-160 irda0
alias char-major-161 ircomm-tty
  And your /dev/ircomm0 should be character device 161,0.
  Debian testing/unstable gets this right.
  If these don't work you may need to load ircomm and ircomm-tty manually.
- minicom /dev/ircomm0 should now work and AT commands should function.
  simply type the following in the terminal program:
  AT<CR>
  you get the response:
  OK
- If minicom blocks, try a different terminal program. On my box minicom works
  perfect with a serial cable but not with IrDA. seyon works with both, cable
  and IrDA.

Part 3 gnokii configuration
===========================

Depending on your phone, you need to set some gnokii options. for a nokia 6210
or a nokia 7110 you would set the following in .gnokiirc:
	port = /dev/ircomm0
	model = 6210
	connection = irda
For a siemens or a ericsson phone or any phone which supports the AT command
set directly, the following should work. Please pay attention to connection
which is set to "serial" instead of "irda":
        port = /dev/ircomm0
        model = AT
        connection = serial
gnokii --monitor should now function.

	[huggie@langly ~]$ gnokii --monitor
	Entering monitor mode...
	RFLevel: 100
	Battery: 100
	SIM: Used 5, Free 85
	etc.
  
  Not all the functions for 6210 work yet seemingly.

- If instead gnokii hangs then you may have a version of gnokii that still
  has recv() in irda_open of common/devices/unixirda.c.  Just comment out
  that line, recompile and try again.


Credits
=======

Initial version by:
Simon Huggins <huggie-gnokii@earth.li>
small enhancements by:
Manfred Jonsson	<manfred.jonsson@gmx.de>
