HOWTO linux & Sony Ericsson T300 mobile phone
=============================================

I - HowTo IrDA GPRS - Gericom linux laptop <-> Sony Ericsson T300 phone
-----------------------------------------------------------------------

DESCRIPTION

This text describes the steps needed to enable connection between a Gericom
laptop and a Sony Ericsson T300 phone, and its connection through GPRS
modem to internet.

HARDWARE

Laptop: Gericom Laptop Webshox Per4mance (Celeron 1700 MHz, integrated
	IR port) BIOS enabled SIR port: enabled as IrDA

$ dmesg | less

RedHat 8.0:

Serial driver version 5.05c (2001-07-08) with MANY_PORTS MULTIPORT SHARE_IRQ
	SERIAL_PCI ISAPNP enabled
ttyS0 at 0x03f8 (irq = 4) is a 16550A

SuSE 8.2:
Serial driver version 5.05c (2001-07-08) with HUB-6 MANY_PORTS MULTIPORT
	SHARE_IRQ SERIAL_PCI enabled
ttyS00 at 0x03f8 (irq = 4) is a 16550A

$ setserial -a /dev/ttyS0

RedHat 8.0:
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
    Baud_base: 115200, close_delay: 256, divisor: 0
    closing_wait: 15360
    Flags: spd_normal skip_test

SuSE 8.2:
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test


SOFTWARE

RedHat 8.0:
* RedHat Linux 8.0 (fully up2dated as of 08.02.2003)
# uname -a
Linux localhost 2.4.18-19.8.0 #1 Thu Dec 12 05:39:29 EST 2002 i686 i686
	i386 GNU/Linux
* irda-utils-0.9.15
* openobex 1.0.0 (not needed for ppp internet)

SuSE 8.2:
* SuSE Linux 8.2 (i586) Kernel 2.4.20-4GB / i686
# uname -a
Linux airmanNT 2.4.20-4GB #1 Mon Mar 17 17:54:44 UTC 2003 i686 unknown
	unknown GNU/Linux
* irda-utils-0.9.16-pre3
* openobex-1.0.0 (not needed for ppp internet)


CONFIG FILES

RedHat 8.0:
/etc/modules.conf:
    ...
    # GSM/GPRS IrDA settings
    alias tty-ldisc-11 irtty
    alias char-major-161 ircomm-tty
    options ppp_async flag_time=0
    ...
/etc/wvdial.conf:
    ...
    [Dialer mobitel]
    Username = mobitel
    Password = internet
    Phone = *99***1#
    Stupid Mode = 1
    Modem = /dev/ircomm0
    Baud = 115200
    Dial Command = ATDT
    Init1 = ATZ
    FlowControl = NOFLOW
    Auto DNS = 1
    ...
/etc/sysconfig/networking/profiles/default/resolv.conf
    ; generated by /sbin/dhclient-script
    nameserver      193.189.160.11
    nameserver      193.2.1.66

SuSE 8.2:
/etc/modules.conf - default from installation
/etc/wvdial.conf
    [Modem0]
    Modem = /dev/ircomm0
    Baud = 115200
    SetVolume = 3
    Dial Command = ATDT
    Init1 = ATZ
    Stupid Mode = on
    FlowControl = CRTSCTS
    Auto DNS = on
    Carrier Check = off
    Idle Seconds = 0

    [Dialer mobitel]
    Username = mobitel
    Password = internet
    Phone = *99***1#
    Inherits = Modem0
/etc/ppp/options
    ...
    #lcp-echo-interval 30
    ...
    #lcp-echo-failure 4
    ...

PROCEDURE
* enable ir port in BIOS on laptop as SIR ("IrDA" in Gericom BIOS)
	port (115200 bps)
* activate ir port on your Sony Ericsson T300
* align ports of your mobile phone and laptop
* execute following two scripts (sure it can be done better or more
	automated... :-))

RedHat 8.0:
 # cat /usr/local/bin/ir
    #!/bin/bash
    /sbin/modprobe -a irda
    /sbin/modprobe -a irtty
    /sbin/modprobe -a ircomm
    /sbin/modprobe -a ircomm-tty
    /usr/sbin/irattach /dev/ttyS0 -s

SuSE 8.2:
 # cat /usr/local/bin/ir
    #!/bin/bash
    /sbin/modprobe -a irda
    /sbin/modprobe -a irtty
    /sbin/modprobe -a ircomm
    /sbin/modprobe -a ircomm-tty
    /usr/sbin/irattach /dev/ttyS0 -s
    echo 115200 > /proc/sys/net/irda/max_baud_rate
    echo 1000 > /proc/sys/net/irda/min_tx_turn_time
    echo 1 > /proc/sys/net/irda/max_tx_window

RedHat 8.0 & SuSE 8.2:
 # cat /usr/local/bin/wv
    #!/bin/bash
    echo "deleting default eth0 route..."
    route del default eth0
    echo "dialing mobitel gprs..."
    wvdial mobitel
    echo "finishing..."
    echo "adding default eth0 route..."
    route add default eth0

* Check if everything is recognized and connected
    $ cat /proc/net/irda/discovery (should output something like this:
    "nickname: T300, hint: 0x9124, saddr: 0x50763e6b, daddr: 0x000050d5")
    $ irdadump (produces output containing name and daddr of connected
    	irda device and localhost)
    $ irdaping  (daddr can be get from irdadump (add 0x at front)
    	or from /proc/net/irda/discovery)

* If something is wrong reset serial port (if irdadump/ irdaping/discovery
	doesn't work - port is blocked) or try to stop apps that catch
	and steel the port (minicom, other wvdial, ...):
    $ killall irattach
* Reset/disable port
    $ setserial /dev/ttyS0 uart none
* Enable port again:
    $ setserial /dev/ttyS0 uart 16550A
* Try again the scripts. Maybe you'll need to remove modules to completely
	reset the situation


II - linux <--> Sony Ericsson T300 send & receive pictures/files/SMSs
	(IrDA, OBEX, OpenOBEX)
===========================================================================

irxfer is program wich comes with openobex-apps-1.0.0
	(http://openobex.sourceforge.net/)
ircp is package downloadable from the same place

LINUX --> T300
    $ irxfer 
        files could be:
        GIF picture (101x80x265)
        JPEG picture
        THM theme
        MID ring file
        VCF contact file
        ...
    $ ircp 

T300 --> LINUX
    $ irxfer (works only for small files for me (<8kB))
    $ ircp -r

You can send SMS to T300 with tsemger (http://tsemgr.sourceforge.net/)
GTK application.  tsemgr is an excellent program designed for the t68, but also
works to some extent with the t300.
The most important and working feature for me is the
send-SMS-to-phone-or-contact feature, which works excellently.

For KDE there is similar application - leif
	(http://www.tobias-bayer.de/en/leif.html).


FINAL NOTE

I was using (until 19.03.2003) RedHat 8.0 (upgraded and home build
lighter kernel 2.4.18-28.8).
Then I installed RedHat 9.0 which has 2.4.20 kernel with broken irrty
driver. it can be fixed using info and patches from Jean Tourrilhes's page
(http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/IrDA.html).
After that (29.05.2003) I found better and faster distribution - SuSE 8.2
professional. it does not need to patch the kernel in order irda to work
(guess it is prepatched). only some setting of max_baud_rate,
min_tx_turn_time and max_tx_window variables (as shown in ir script).
The main problem with GPRS is its big latency. overall it is slower than
average 56K modem. however it is mobile.
Everything described here is found on the internet. thanks to the linux
community. Our community.


DISCLAIMER (or something like it)

This worked with the hardware and software described. 2.4.20 kernel
is irda (irtty) broken. SuSE 8.2 ships prepatched (thus irda working)
2.4.20 kernel.  This may not work as described (or not work at all)
in your situation. There are no guarantees.


compiled by
Todor Tanevski
ttoshko@yahoo.com

last update 12.06.2003