Accessing SD Cards on Dumbphones
Recently I was giving somebody a dumbphone. It was some Samsung that looked like an old Blackberry, but I do not remember the exact model number and I do not think it is important.
I tried to connect the dumbphone to an Xubuntu 18.04 computer so that
I could access its SD card as a drive. It looked as if the phone
recognised that it was being connected to the computer, and it looked
as if the SD card was being detected by the computer as a drive, but
then I could not access the SD card. The output of dmesg
looked
something like this:
usb 7-1: new full-speed USB device number 2 using uhci_hcd
usb 7-1: New USB device found, idVendor=04e8, idProduct=6640
usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 7-1: Product: SAMSUNG CDMA Technologies
usb 7-1: Manufacturer: SAMSUNG Electronics Co.,Ltd.
cdc_acm 7-1:1.0: ttyACM0: USB ACM device
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver qcaux
usbserial: USB Serial support registered for qcaux
qcaux 7-1:1.2: qcaux converter detected
usb 7-1: qcaux converter now attached to ttyUSB0
usb 7-1: USB disconnect, device number 2
cdc_acm 7-1:1.0: failed to set dtr/rts
qcaux ttyUSB0: qcaux converter now disconnected from ttyUSB0
qcaux 7-1:1.2: device disconnected
usb 7-1: new full-speed USB device number 3 using uhci_hcd
usb 7-1: New USB device found, idVendor=05c6, idProduct=1000
usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 7-1: Product: USB MMC Storage
usb 7-1: Manufacturer: Qualcomm, Incorporated
usb 7-1: SerialNumber: 000000000002
usb-storage 7-1:1.0: USB Mass Storage device detected
scsi host7: usb-storage 7-1:1.0
scsi 7:0:0:0: Direct-Access Samsung Mass Storage 2.31 PQ: 0 ANSI: 2
sd 7:0:0:0: Attached scsi generic sg3 type 0
sd 7:0:0:0: [sdc] 30228480 512-byte logical blocks: (15.5 GB/14.4 GiB)
sd 7:0:0:0: [sdc] Write Protect is off
sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
sd 7:0:0:0: [sdc] No Caching mode page found
sd 7:0:0:0: [sdc] Assuming drive cache: write through
sdc: sdc1
sd 7:0:0:0: [sdc] Attached SCSI removable disk
usbcore: registered new interface driver option
usbserial: USB Serial support registered for GSM modem (1-port)
Once the USB Serial support is registered then the drive (sdc
in
this case) goes away.
The culprit is something called usb_modeswitch
. The idea is that
some modem hardware contains separate partitions for drivers in addition to
the modem, and they share USB identifiers. usb_modeswitch
changes
the functionality of the device to privilege the modems.
In my case, the dumbphone is not going to be a modem for the Xubuntu box (and it is a CDMA phone anyways, so...) and this functionality is preventing me from accessing the drive. There are two solutions to this:
First, you could disable usb_modeswitch
completely by setting the
value of DisableSwitching
in /etc/usb_modeswitch.conf
to 1.
Alternatively, you could disable mode switching for the particular
device, as documented here:
http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=4&t=2458
. The trick is to make a file with the USB identifier (PC identifier?)
of the device in /etc/usb_modeswitch.d
. In my case, here is the line
from dmesg
that identifies the dumbphone:
usb 7-1: New USB device found, idVendor=04e8, idProduct=6640
The ID is 04e8:6640
. I can then make a file
/etc/usb_modeswitch.d/04e8:6640
that has the following contents:
ATTR{idVendor}=="04e8", ATTR{idProduct}=="6640", GOTO="modeswitch_rules_end"
This should be enough to prevent the modem from appearing, so you can access the SD card.