The Samsung Galaxy series certainly should be
compatible with Linux.
After all, they run the Android operating system,
which is based on Linux.
The About phone screen even shows the base Linux
kernel version.
This page shows how I've connected my SGH-T989,
the T-Mobile version, running CyanogenMod,
based on Android and the Linux kernel.
However, if you download
the manual (11.0 MB),
you see nothing about using it with computers running
Linux, BSD, OS X, or any other Unix-based operating system.
Be aware that Android and therefore CyanogenMod
dropped support for USB mass storage
starting with Android v3.0.
It used to be as easy to use as a USB thumb drive,
now it takes a little work to set things up to work
with the PTP/MTP protocols.
The alternative is to unmount the MicroSD card,
remove it from the phone and place it in a reader.
How to use the Samsung Galaxy S2 with Linux
You will need the mtpfs program,
which will probably be in a package with the same name.
See my page on
software package management
for details on how to figure out which package you need
to add and how to go about that.
You may want to look at the
mtpfs web page
for further details.
Start by selecting the MTP protocol for connecting your phone:
<Settings button> | Storage | <Settings menu>
| Media device (MTP)
You see me making that change below.
Connect the phone.
Something like the following will appear in the
Linux machine's kernel ring buffer:
$ dmesg | tail
... some lines deleted ...
[271527.319166] usb 2-8: new high-speed USB device number 11 using ehci-pci
[271527.436410] usb 2-8: New USB device found, idVendor=04e8, idProduct=6860
[271527.436415] usb 2-8: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[271527.436417] usb 2-8: Product: Android
[271527.436418] usb 2-8: Manufacturer: Android
[271527.436419] usb 2-8: SerialNumber: 88df75ea
[271527.437807] cdc_acm 2-8:1.1: This device cannot do calls on its own. It is not a modem.
[271527.437910] cdc_acm 2-8:1.1: ttyACM0: USB ACM device
Mount it.
Be patient, the mtpfs command
may take about 40 seconds:
Meanwhile you have access to the file systems
on the phone, the internal storage and that on the SD card.
Timestamps are also strange on the FUSE file system,
everything's time stamp is -1, or one second before
the UNIX epoch began in 1970.
$ cd ~/android
$ ls -laF
drwxrwxrwx 2 cromwell cromwell 0 Dec 31 1969 ./
drwxr-xr-x 196 cromwell cromwell 57344 Mar 11 14:15 ../
drwxrwxrwx 2 cromwell cromwell 0 Dec 31 1969 Internal storage/
drwxrwxrwx 2 cromwell cromwell 0 Dec 31 1969 Playlists/
drwxrwxrwx 2 cromwell cromwell 0 Dec 31 1969 SD card/
% du -sh *
467M Internal storage
0 Playlists
1.8G SD card
When you're done, unmount it:
$ cd
$ fusermount -u ~/android
Another thing to consider:
enable SSH service
on your phone and connect to your phone over SSH
over 802.11 wireless.
$ cd /tmp
$ gtar xf ~/gmtp-latestversion.tar.gz
$ cd ~/gmtp-latestversion
$ ./configure
$ gmake
$ su root -c 'gmake install'
Password:
Connect the phone.
Something like the following will appear in the
kernel ring buffer:
$ dmesg | tail
... some lines deleted ...
umodem0 at uhub1 port 1 configuration 1 interface 1 "Android Android" rev 2.00/4.00 addr 2
umodem0: data interface 2, has no CM over data, has no break
umodem0: status change notification available
ucom0 at umodem0
ugen0 at uhub1 port 1 configuration 1 "Android Android" rev 2.00/4.00 addr
Run gmtp and click the Connect button.
Again, expect this to take 40 seconds or so.
You will get a pop-up window asking if you want to
connect to the SD card or internal storage.
Select one, click OK, and browse away.
CyanogenMod File Permission Mystery
My camera app stores images in
/storage/sdcard1/DCIM/Camera/,
which is the removeable Micro SD card.
I have connected in over SSH using
SSHDroid.
Look at this strange result, I have never encountered
files of mode 0075 before:
root@SGH-T989:/storage/sdcard1/DCIM/Camera # ls -la
d---rwxr-x 2 system sdcard_r 32768 Mar 11 20:00 .
d---rwxr-x 4 system sdcard_r 32768 Mar 11 15:51 .
----rwxr-x 1 system sdcard_r 3786464 Mar 11 19:59 IMG_20140311_195956.jpg
----rwxr-x 1 system sdcard_r 3734592 Mar 11 20:00 IMG_20140311_200000.jpg
----rwxr-x 1 system sdcard_r 3765426 Mar 11 20:00 IMG_20140311_200004.jpg
The odd mode comes from how it's mounted,
notice the fmask= and dmask=
options setting the umask for this VFAT file system:
The mode is persistent, chmod 644 * runs with
no error and a return value of 0, but it has no effect.
So, the dmask and fmask options
are why directories and files get these strange permission
masks.
My real question is why those strange permissions
are needed.
Update: a later version of Cyanogenmod
fixed this.
WARNING:
Content below this point is now of
historical interest only.
Android and therefore CyanogenMod
dropped support for USB mass storage
starting with Android v3.0.
Use the PTP/MTP protocols as described above,
or simply unmount the MicroSD card and place it in a reader.