# Weird Sony Ericsson K800i Problem

## Ahri

I'm using udev to assign device names, and have been successfully using the rule:

BUS=="scsi", SYSFS{vendor}=="Sony Eri*", SYSFS{model}=="Memory Stick", KERNEL=="sd?1", SYMLINK+="sephone"

By "successfully" I mean it worked fine with my w800i, however now that I've moved to a k800i it's not working because the k800i supplies both access to its 64mb onboard memory and the extra 2gb card, so it may create (for example) /dev/sda and /dev/sdb when I plug it in. Now there's something a bit weird about this... the kernel doesn't automatically discover the partition numbers - this only happens if I do a `sudo mount /dev/sdb /mnt/temp' -- this fails but sdb1 is discovered and the above udev rule kicks in.

Great stuff, except that I have to do a bit of a dirty hack to get (for example) amarok to interface with it; I have to do something like: 

```
for d in d c b a; do sudo mount /dev/sd$d; done; mount /mnt/sephone
```

 in order to discover the partition numbers. I do it in reverse order so that the udev rule kicks in when sdb1 is discovered (as the 2gb memory card is more useful for putting mp3s on than the 64mb onboard memory!)

So, can anyone give me hints on how to do this in a cleaner manner?

Here's the dmesg output first for the w800i (which works quite seamlessly):

```

usb-storage: waiting for device to settle before scanning

  Vendor: Sony Eri  Model: Memory Stick      Rev: 0000

  Type:   Direct-Access                      ANSI SCSI revision: 00

SCSI device sda: 960512 512-byte hdwr sectors (492 MB)

sda: Write Protect is off

sda: Mode Sense: 00 6a 00 00

sda: assuming drive cache: write through

SCSI device sda: 960512 512-byte hdwr sectors (492 MB)

sda: Write Protect is off

sda: Mode Sense: 00 6a 00 00

sda: assuming drive cache: write through

 sda: sda1

sd 6:0:0:0: Attached scsi removable disk sda

sd 6:0:0:0: Attached scsi generic sg0 type 0

usb-storage: device scan complete
```

And the k800i which doesn't:

```
usb-storage: waiting for device to settle before scanning

scsi8 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 13

usb-storage: waiting for device to settle before scanning

  Vendor: Sony Eri  Model: Memory Stick      Rev: 0000

  Type:   Direct-Access                      ANSI SCSI revision: 00

  Vendor: Sony Eri  Model: Memory Stick      Rev: 0000

  Type:   Direct-Access                      ANSI SCSI revision: 00

sd 7:0:0:0: Attached scsi removable disk sda

sd 7:0:0:0: Attached scsi generic sg0 type 0

usb-storage: device scan complete

sd 8:0:0:0: Attached scsi removable disk sdb

sd 8:0:0:0: Attached scsi generic sg1 type 0

usb-storage: device scan complete
```

My only idea so far is to have 2 udev rules nearly exactly the same but one after the other (named 60- and 61-), so that I can have 2 devices; /dev/k800i_phone and /dev/k800i_card. Unfortunately this relies on me trying to mount /dev/sda and then /dev/sdb in that order. Which is crap.

Help!  :Smile: 

----------

## Ahri

No hints?  :Sad: 

----------

## mahdi1234

Same on my side, but it WORKED few days ago.

I have recently updated both phone firmware as well as my kernel, so don't know where's the problem.

Phone firimware - R1JG001

kernel:

```

$ uname -a

Linux mahdi 2.6.19-gentoo-r5 #1 SMP PREEMPT Sun Apr 8 16:22:17 CEST 2007 i686 Intel(R) Pentium(R) 4 CPU 2.66GHz GenuineIntel GNU/Linux

```

----------

## venquessa2

Locate the size of the SD card using udevinfo and replace the ATTR{size}=="3995273" below to match.

```

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"

```

Justification:  The internal 'memory stick' does not report *anything* consistently that differs from the SD expansion 'memory stick', it varys it's size on each insert.  The SD card appears to report it's size consistently however.  The rules above first match the SD card and tell udev that no more rules may change that device, then the more generic second rule matches the internal memory stick.

Tested:  For a day or two with a Sony Ericsson K800i + 2Gb SD Card

----------

