# automounting K800i via usb



## hedgehog (Jul 20, 2011)

Greetings. I cannot configure automountig of k800's memory stick under freebsd 8.2-release. According do thisthread, there is some issue with power_on delay, which is not enough for SE. After plugging in the phone dmesg says:

```
ugen0.2: <Sony Ericsson> at usbus0
cdce0: <Sony Ericsson Device 039 USB Ethernet Emulation (WDM)> on usbus0
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: ****
```

Then I choose file transfer mode:

```
ugen0.2: <Sony Ericsson> at usbus0 (disconnected)
cdce0: at uhub0, port 5, addr 2 (disconnected)
ugen0.2: <Sony Ericsson> at usbus0
umass0: <Sony Ericsson Memory Stick> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:2:0:-1: Attached to scbus2
umass1: <memory2> on usbus0
umass1:  SCSI over Bulk-Only; quirks = 0x0000
(probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <Sony Eri Memory Stick 0000> Removable Direct Access SCSI-0 device 
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
umass1:3:1:-1: Attached to scbus3
(probe0:umass-sim1:1:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
(probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
(probe0:umass-sim1:1:0:0): SCSI status: Check Condition
(probe0:umass-sim1:1:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
da1 at umass-sim1 bus 1 scbus3 target 0 lun 0
da1: <Sony Eri Memory Stick 0000> Removable Direct Access SCSI-0 device 
da1: 1.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
```

There is two new devides appears in /dev:
da0 (phone memory)
da1 (memory card)

But there is no partitions shown up, so I cannot manage them. Googling around I've found that partition /dev/da1s1 appears after issuing command `# mount /dev/da1 /mnt/usb`

Also I've noticed, that I can reset state of usb device, it helps either:
`# usbconfig -u 0 -a 2 reset`

```
da1 at umass-sim1 bus 1 scbus3 target 0 lun 0
da1: <Sony Eri Memory Stick 0000> Removable Direct Access SCSI-0 device 
da1: 1.000MB/s transfers
da1: 1950MB (3995273 512 byte sectors: 255H 63S/T 248C)
GEOM: da1: partition 1 does not start on a track boundary.
GEOM: da1: partition 1 does not end on a track boundary.
```

`$ ls /dev/da*`

```
da0%   da0s1% da1%   da1s1%
```
When I done that, I can mount both storages using KDE device notifier or Dolphin. How should I configure devd to execute "reset" command automaticaly? Or maybe there is some better solution exists?


----------



## hedgehog (Jul 21, 2011)

Well, manpages for devd.conf() are just perfect.
I've put this into /etc/devd.conf:

```
attach 0 {
        device-name "ugen.*";
        match "vendor"          "0x0fce";
        match "product"         "0xe039";
        action "sleep 5 ; usbconfig -d $device-name reset";

};
```
If I increase timeout to 15 seconds, usbconfig resets the bus when phone are completely initialize file transfer, but in this case the phone doesn't recharge it's battery.

Wonder if it's possible to shut down power on this usb device using KDE Device notifier :OO

PS: I'm still not sure if it's good idea to perform "reset" command when attaching a phone to USB. Any comments?


----------

