I'm currently trying to make a communication between my Raspberry Pi 2 and my smartphone (Samsung Galaxy S7). I'd like to do it using a USB cable, does anyone know if it's possible and how to do it?
2 Answers
I think in effect you're asking if the Pi can support USB host mode (a.k.a. On-The-Go or OTG). From reading assorted posts, I gather that you can't do this with any of the Pis that have built-in Ethernet (which is provided with a chip that sits on the internal USB and somehow this prevents host mode from being used).
The Pi A and the Pi Zero (but probably not Zero W) apparently can be used this way, but apparently not any of the others.
I'd provide links but I didn't find any that were clear enough to include here. Googling for "raspberry pi host mode" will find most of the same stuff I read. Another question has relevant answers though.
MTP
If you want to copy files to and from your smartphone's storage, you need to install an MTP program (either a commandline tool or a graphical file browser) on your Raspberry Pi.
Easy Way
One graphical program that's easy to use is nautilus
. It's a file browser with a lot of dependencies, so it might take awhile to install, but it's intuitive.
Hard(er) Way
If you're running Raspbian Linux, these instructions for Debian Linux should work. Basically:
- Install
mtp-tools
- Run
mtp-detect
(it should see your phone) - Run
fusermount -u /path/to/emptyfolder
- Run
jmtpfs -l
(it should see your phone) - Run
jmtpfs /path/to/emptyfolder
Now you should be able to see all of your phone's files in emptyfolder
!