# Phone SD card recognized as CD-ROM instead of disk



## jalla (Dec 17, 2012)

When I plug a HTC One X into a usb port it's identified as a cdrom device.

This is what I get from dmesg

```
ugen3.4: <HTC> at usbus3
umass0: <Mass Storage> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:5:0:-1: Attached to scbus5
cd0 at umass-sim0 bus 0 scbus5 target 0 lun 0
cd0: <HTC Android Phone 0000> Removable CD-ROM SCSI-2 device
cd0: 40.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
ugen3.4: <HTC> at usbus3 (disconnected)
umass0: at uhub5, port 4, addr 4 (disconnected)
(cd0:umass-sim0:0:0:0): lost device, 1 refs
(cd0:(pass1:umass-sim0:0:umass-sim0:0:0:0:0): removing device entry
0): passdevgonecb: devfs entry is gone
ugen3.4: <HTC> at usbus3
```

OS is 9.1-RELEASE

```
FreeBSD gong 9.1-RELEASE FreeBSD 9.1-RELEASE #1 r243778: Sun Dec  2 00:20:08 CET 2012     tl@gong:/usr/obj/usr/src/sys/tom  amd64
```
 
Anyone know what magic I need to apply to have this phone recognized as a disk?


----------



## SirDice (Dec 18, 2012)

Did you recently update the phone to 4.1? I seem to have the same problem. It worked fine with 4.0.


----------



## SirDice (Dec 18, 2012)

Did some digging as I use that functionality too. It seems JellyBean removed that function in favor of MTP. Pretty much everybody hates it. I guess there's nothing else to do but downgrade to ICS.


----------



## tingo (Dec 26, 2012)

Too bad that they changed this.
I just connected my HTC HD2 (which is running CyanogenMod 10, aka JellyBean) to my FreeBSD workstation and tested. On connect, I get this in /var/log/messages:

```
Dec 26 14:30:47 kg-v2 kernel: ugen1.3: <HTC> at usbus1
Dec 26 14:30:47 kg-v2 kernel: umass1: <HTC Android Phone, class 0/0, rev 2.00/2.26, addr 3> on usbus1
Dec 26 14:30:47 kg-v2 kernel: umass1:  SCSI over Bulk-Only; quirks = 0x4100
Dec 26 14:30:47 kg-v2 kernel: umass1:1:1:-1: Attached to scbus1
Dec 26 14:30:47 kg-v2 kernel: (probe0:umass-sim1:1:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
Dec 26 14:30:47 kg-v2 kernel: (probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
Dec 26 14:30:47 kg-v2 kernel: (probe0:umass-sim1:1:0:0): SCSI status: Check Condition
Dec 26 14:30:47 kg-v2 kernel: (probe0:umass-sim1:1:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
Dec 26 14:30:47 kg-v2 kernel: da3 at umass-sim1 bus 1 scbus1 target 0 lun 0
Dec 26 14:30:47 kg-v2 kernel: da3: <HTC Android Phone 0100> Removable Direct Access SCSI-2 device 
Dec 26 14:30:47 kg-v2 kernel: da3: 40.000MB/s transfers
Dec 26 14:30:47 kg-v2 kernel: da3: Attempt to query device size failed: NOT READY, Medium not present
```
and when I turn on usb mass storage from the menu, I get this:

```
Dec 26 14:30:48 kg-v2 root: Unknown USB device: vendor 0x0bb4 product 0x0c02 bus uhub1
```
Strange about that "da3" which (nearly) shows up.


----------



## phoenix (Dec 26, 2012)

With my Optimus G, the phone is detected ad a CD-ROM first, as it tries to auto-install Windows drivers for MTP. After 20 seconds or so, that device is dropped, and a new ugenX.Y is created.

Unfortunately, the only way to access that new device is via mtpfs. Don't think that's available on FreeBSD. And have had no luck getting it to work on Linux.

On the bright side, it does fallback to PTP-mode, and KDE's camera:/ kioslabe allows me to access it.


----------



## SirDice (Dec 27, 2012)

phoenix said:
			
		

> Unfortunately, the only way to access that new device is via mtpfs. Don't think that's available on FreeBSD. And have had no luck getting it to work on Linux.


There's sysutils/mtpfs which is a FUSE module. I haven't tried it yet as I don't like FUSE.


----------



## Lowell (Jan 3, 2013)

On my (updated to "Jelly Bean") phone, MTP only works if the USB debugging option is enabled. If it is, usbconfig(8) sees a ugen(4) interface of MTP type; but not otherwise. I also have a tablet, running Android 4.0.4, and it reports as MTP rather than umass. libmtp (and thus, probably, tools like gmtp) talks to it somewhat. 

Recognizing the phone as a CD isn't in itself a bug, at least on my phone. It's a real CD device (more or less; it's at least mountable), and it contains Windows drivers for using the device as MTP. The problem is that the CD (a umass interface) is the *only* one that shows up. As far as I can gather, the device is expected to revert to MTP mode in a short period of time if the CD isn't mounted, and I can't seem to get it to do that.

I wouldn't mind using MTP if it worked, but I can't get my phone (Motorola Atria HD, a.k.a. MB886) to offer it to me.


----------



## Lowell (Jan 3, 2013)

I asked the experts, and Hans Petter Selasky suggested I just eject (via cdcontrol(1)) the CD that the phone was presenting to me. This works, in that the MTP interface is available on my USB bus afterwards. 

I'm trying to figure out how to automate this, but neither devfs(8) nor devd(8) has quite enough information to figure out both (a) the fact that it needs to be done, and (b) which device it attached to. It may have to be a device quirk, but that isn't very maintainable if more and more Android phones are going to work this way.


----------



## Lowell (Jan 9, 2013)

@SirDice and others: if you can show me the `usbconfig` output for these CD devices, I can add them to my patch for disabling this behaviour.


----------



## tankist02 (Jan 9, 2013)

The following works great on Fedora 17 and 18 for Nexus 7 tablet and Galaxy Note phablet:


```
## Using mtp for files transfer

# Install package
sudo yum install simple-mtpfs

# Prepare mount directory
mkdir -p ~/mnt/nexus7

# To mount
simple-mtpfs ~/mnt/nexus7

# Trasfer files...

# To unmount:
fusermount -u ~/mnt/nexus7
```

Maybe there is something similar on FreeBSD.


----------



## Lowell (Jan 10, 2013)

Yes, as already mentioned on this thread, the FUSE mtpfs is already in the FreeBSD ports system.


----------



## Lowell (Jan 23, 2013)

PRs submitted, with patches:
PR 175302
PR 175296


----------



## tzoi516 (Jan 15, 2014)

Anything new on the MTP front? I have Android 4.3 on my phone, FreeBSD 10.0-RC5 on my computer, and sysutils/mtpfs installed and it still won't mount.


```
ugen2.3: <HTC> at usbus2
ugen2.3: <HTC> at usbus2 (disconnected)
ugen2.3: <HTC> at usbus2
umass0: <Mass Storage> on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:3:0:-1: Attached to scbus3
cd1 at umass-sim0 bus 0 scbus3 target 0 lun 0
cd1: <HTC Android Phone 0000> Removable CD-ROM SCSI-2 device 
cd1: 40.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present
cd1: quirks=0x10<10_BYTE_ONLY>
ugen2.3: <HTC> at usbus2 (disconnected)
umass0: at uhub3, port 1, addr 3 (disconnected)
cd1 at umass-sim0 bus 0 scbus3 target 0 lun 0
cd1: <HTC Android Phone 0000> detached
(cd1:umass-sim0:0:0:0): Periph destroyed
ugen2.3: <HTC> at usbus2
```


----------

