Sony Ericsson K800i and Linux

From MalaWiki

Jump to: navigation, search


Contents

[edit] USB mass storage

It works by simply putting your phone into "File Transfer" mode once you have hooked the USB cable.
I have a nice udev rule to link the device node:

# sony ericsson k800i phone
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Sony Ericsson", ATTRS{idVendor}=="0fce" \
        ATTRS{idProduct}=="e039", KERNEL=="sd*", SYMLINK+="sonye%n"

NOTE: the phone will reboot itself before being available as a USB mass storage device.

[edit] SD card

Udev rules to correctly assign consitent symlinks to the internal and SD cards of the phone:

SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Sony Ericsson" \
   ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="e039", ATTR{size}=="3995273" \
   KERNEL=="sd*1", SYMLINK+="sonye-sd%n" OPTIONS="last_rule"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Sony Ericsson" \
   ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="e039" \
   KERNEL=="sd*1", SYMLINK+="sonye-int%n"

You need to replace ATTR{size}=="3995273" with the same attribute output from udevinfo for your SD card.

See http://forums.gentoo.org/viewtopic-t-540515.html

Thanks to Paul Campbell

[edit] Bluetooth connectivity

To be able to connect to the phone without using all the available gnome stuff for bluetooth management I had to connect from the laptop to the phone first:

rfcomm connect 0 aa:bb:cc:dd:ee:ff

with the support for a passkey-agent, you can find one in /usr/share/doc/bluez-utils/examples/ in the bluez-utils Debian package, build it and run it:

./passkey-agent "XXX" aa:bb:cc:dd:ee:ff

Now allow the connection on the phone and enter the above passkey when requested.


[edit] Dial-up Networking

This made me think: "Yeah, this phone is great!"
BEWARE: connecting (at least using Vodafone) will cost you an eye and a kidney.

[edit] Bind

Dial-up networking works by simply binding to the device:

rfcomm bind 0 aa:bb:cc:dd:ee:ff 2

where 0 is the rfcomm device number you want to assign and 2 is the Service Name: Dial-up Networking channel.
This will also create /dev/rfcomm0 if you're using udev.

[edit] PPP configuration

Next you need to setup PPP to connect through /dev/rfcomm:

  • /etc/ppp/peers/vodafone
/dev/rfcomm0
connect '/usr/sbin/chat -v -f /etc/chatscripts/vodafone-connect'
lock
modem
noauth
defaultroute
replacedefaultroute
noipdefault
usepeerdns
nopcomp
novj
# Connection speed. Maybe this should be something else.
115200
user anyusr
password anypass
  • /etc/chatscripts/vodafone-connect
ABORT BUSY
ABORT 'NO CARRIER'
ABORT VOICE
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
# ???
#"" "ATZ"
"" "AT&F"
OK 'AT+CGDCONT=1,"IP","web.omnitel.it"'
# doesn't make any difference
#OK 'AT+CGDCONT=1,"IP","internet"'
#OK "AT+CGDCONT=1,\042IP\042,\042internet\042"
SAY "Calling Vodafone UMTS\n"
TIMEOUT 60
OK "ATD*99***1#"
CONNECT \c

Note that the above configuration deals with the Italian Vodafone, by searching around the internet hopefully you'll be able to find the necessary configuration for your provider.
In particular:

  • web.omnitel.it is the APN [1]
  • ATD*99***1# access phone number (the D in ATD is for Dial)
  • you may also need to change user and password for different providers


[edit] OBEX Object Push

gnome-obex-send is fairly easy to use as well, e.g.:

gnome-obex-send -d aa:bb:cc:dd:ee:ff /some/file

j t pointed out that this program also helps: http://www.xmailserver.org/ussp-push.html

[edit] OBEX File Transfer

To receive files just run a OPUSH daemon bound to channel 7 (in the phone Service Name: OBEX File Transfer), I used obexpushd:

obexpushd -B7

then send your files from the phone. You may want to hook a script that moves the files around and/or changes permissions when transferring the file, for that see the -s option in the obexpushd(1) manpage.
I have this sample script but it looks like it doesn't get any data from STDIN as it should:

#!/usr/bin/perl

use strict;
my $filename = $ARGV[0];
my $filetype = $ARGV[1];

$filename || die ("missing filename");

open (OBXRECV, "> $filename") || die ("can't open file:  $!");
print OBXRECV $_ while (<STDIN>);
close (OBXRECV);

Cutomize the necessary bits (eg: prepend some path to $filename).


[edit] HID Mouse & Keyboard

Remote Control of PC applications and other devices.

  • enable hid and hidd in /etc/default/bluetooth (Debian):
HID2HCI_ENABLED=1
HIDD_ENABLED=1
HIDD_OPTIONS="--master --server"
  • restart the bluetooth stack:
/etc/init.d/bluetooth restart
  • connect hidd to your phone:
hidd --connect aa:bb:cc:dd:ee:ff
  • fire up the "Remote Control" application in the phone and choose the device you want to control (the phone should give you the right choice):
Menu > Entertainment > Remote control > Desktop

You should now be able to move the pointer and click all around. Have fun!

More info here:

[edit] sdptool browse

$ sdptool browse aa:bb:dd:ee:ff:gg 
Browsing aa:bb:dd:ee:ff:gg ...
Service Description: Sony Ericsson K800
Service RecHandle: 0x10000
Service Class ID List:
  "PnP Information" (0x1200)

Service Name: OBEX SyncML Client
Service RecHandle: 0x10001
Service Class ID List:
  UUID 128: 00000002-0000-1000-8000-0002ee000002
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
  "OBEX" (0x0008)

Service Name: Dial-up Networking
Service RecHandle: 0x10002
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Service Name: Serial Port
Service RecHandle: 0x10003
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3

Service Name: PAN Network Access Point
Service Description: NAP provides access to internet for one connecting PANu
Service RecHandle: 0x10008
Service Class ID List:
  "Network Access Point" (0x1116)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 15
  "BNEP" (0x000f)
    Version: 0x0100
    SEQ8: 0 6 dd
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Network Access Point" (0x1116)
    Version: 0x0100

Service Name: Hands-Free Gateway
Service RecHandle: 0x10009
Service Class ID List:
  "Handfree Audio Gateway" (0x111f)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0105

Service Name: Headset Gateway
Service RecHandle: 0x1000a
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 5
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100

Service Name: OBEX Object Push
Service RecHandle: 0x1000b
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 6
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x1000c
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 7
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0100

Service Name: OBEX IrMC Sync Server
Service RecHandle: 0x1000d
Service Class ID List:
  "IrMC Sync" (0x1104)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 8
  "OBEX" (0x0008)
Profile Descriptor List:
  "IrMC Sync" (0x1104)
    Version: 0x0100

Service Name: HID Mouse & Keyboard
Service Description: Remote Control of PC applications and other devices
Service Provider: Sony Ericsson
Service RecHandle: 0x1000e
Service Class ID List:
  "Human Interface Device" (0x1124)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 17
  "HIDP" (0x0011)
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Human Interface Device" (0x1124)
    Version: 0x0100

[edit] Resources

Personal tools