Android sdcard communication through spi - android

I need to communicate with an modified sdcard in an android phone on very basic level just few commands and responses back. Originally the communication was handled through file system, but when android 4.4 denied access to most of the sdcard this has to be done through SPI, which I hope will work. I have a experience with Android, but not so much in SPI. Could anyone provide a brief tutorial on how to tackle this, or point me to some resources, I couldn't find anything that would deal with how to communicate with sdcard in Android.
Thanks

Direct access to the physical storage device is not permitted on a secured device, as it would be an obvious end-run around the restrictions that are now part of the security model.
On an unsecured (engineering, root hacked, etc) device, if you get a helper executable running as root, you can probably interact with the file system or raw block device just as you were before android 4.4, possibly after shutting down any official-Android components that were talking to it.
Even on an unsecured device, you would need hard-to-obtain SOC-specific peripheral-register programming information to talk to the card in SPI mode (or perhaps by bit-banging the pins in GPIO mode) rather than by the faster 4-bit protocol it is almost certainly using.
If you want a workaround supported by a secured device, then if that device supports USB host mode, you can get an adapter cable and a USB SD reader and talk raw mass storage commands using the Android USB Host APIs. Or if USB mass storage does not give you sufficiently fine-grained control, you can use the SPI mode of an FTDI USB-serial chip, or make something custom with a USB-enabled microconctroller.

Related

Is there any alternative ways to create communication between Android and Computer via USB but not using Android Debug Bridge?

I want to send and recevice data between .NET application and Android Device by using USB. However, due to the security concerns, I do not desire to use Android Debug Bridge (USB debugging).
Is there any possible way to send and receive data from Android Device to my .NET application on computer by using USB ?
Thanks in advance.
There are many ways to skin this particular cat, let me name two:
Simple message files via MTP. Pro: Easiest to implement and widest possible client support. Con: High latency. Good, if you have few requests with a bigish payload each.
USB networking via CDC-ECM. Pro: Allows easy extension to full networking. Con: Not so broad client suppoort. Good, if you have full control over the hardware.
The prevalent problem is, that the fragmentation of Android allows you to assume only a very low baseline.
I do recommend, that you revisit the encrypted network connection option: It should be quite trivial to create a minimal network consisting only of the Android device and a single partner - e.g. by pluging a WLAN access point directly into a secondary network interface of the workstation - and by being associated to a special WLAN you make sure, that the device at this point is not connected to a different WLAN or mobile network.
This will not only be easiest, but also give you the best starting point if you want to upgrade to a broader network later on.

Android USB Host read/write a file in USB device OTG [duplicate]

I am trying to use the android host api for USB storage. I have many doubts regarding same.
What all things are possible using host api. I want to see the content of USB and if possible so the normal file operation. I didnt find any documentation help regarding this.
I am able to claimInterface using UsbDeviceConnection class API but I'm unable to understand how the bulkTransfer works so if anyone can guide me or give some reference I will try myself.
I tried reading the USB specification also, I understood how bulkTransfer works at USB level but unable to relate how android/java file operations are possible using bulkTransfer which using UsbEndpoint not the File Descriptor.
Thanks in Advance !!
The Android USB Host APIs do not include USB Mass Storage filesystem code, nor as of this writing in 2014 will "stock" Android mount a USB Mass Storage volume at operating system level.
To access a USB Mass Storage device using the stock Android USB Host APIs, you must therefore implement in your Application code both the necessary raw-USB operations to achieve block-level device access, and the appropriate filesystem logic itself. Needless to say, the details of such are of a complexity beyond the scope of an answer here, but you could start by studying documentation or existing implementations of USB Mass Storage drivers and filesystem drivers for other platforms.
It appears the situation in Android 6 may be different, and access via the USB host apis to something that version recognizes as a storage device might even no longer be permitted. Those targeting Android 6+ may need to look elsewhere, but older devices will remain in use for some time.

USB code for Android 2.3.4

I want to use usb in my application to retrieve data from my computer (present in text files) to android mobile and read it... what are the neccessities in terms of hardware and helpful links for the usb code...
Recently google launched USB accessory for android 2.3 ... it have classes UsbManager, UsbAccessory etc... i want to use that ... how can it be used.??
Usually the opposite of this is observed, where the android mobile projects itself as a usb device (client) , The USB host controller driver on the computer recognizes the device and handles future USB requests from your client. This is just the hardware layer, mind you. Since the USB protocol has become so ubiquitous, the computer actually stores multiple families of drivers both at the kernel layer and user space to be able to handle the variety of requests and their user space interpretations.
Since android mobiles are primarily linux-based devices, to achieve your end you will need to integrate these USB host-based driver families to your device's kernel / ROM. You will need to create a custom ROM (someone else asked this question here). This link provides you a list of drivers corresponding to specific hardware families.
Additionally, you will need to set up necessary programs on your computer that allows it to project itself as a USB client.
If you use linux on the computer too, this article might help you to start.

How to access file system of another phone using bluetooth in Android?

After pairing with a phone via bluetooth, is it possible to access the sd card contents (like music or images)?
Are there any tutorials or sample code for this?
i see an application named "Bluetooth File Transfer" and want to make another like that i read about bluetooth, bluetooth socket but not found any thing useful how to perform that operation i am researching more if i found i will post here the solution if anyone found soon then please post here.... Thanks
Sure it is possible. But you need to know:
Which Bluetooth protocol you want to use? Some of them are here:
Bluetooth protocols
How big data you are willing to share between, because if you have big
data then you need to use some other connection.
You need to know
how to secure data, Bluetooth is very vulnerable.
And you can tell us what you want to do? You are programmer or just asking? If so use link as suggested in your comments.
EDIT:
Here is for example some examples in QT programming language, which I use for developing apps for Android: http://www.developer.nokia.com/Community/Wiki/QBluetooth_-_A_Qt_bluetooth_library
There was a way in early 2000s with Ericsson and Siemens phones with OBEX protocol, and a user file system.
In windows XP with Toshiba stack you had to assign a virtual COM port to a bluetooth device, and install the original phone software, with its RS232 interface IO drivers.
After that you could browse your phone using OBEX tools, or as a disk device, it there was a driver.
If you want to open sd-card and phone storage of any phone using android, then you can follow the following method:
Open your android settings.
Now open bluetooth settings.
Activate your bluetooth.
Search for devices.
Pair the bluetooth device.
Now you will be able to see a setting sign on right side of name of bluetooth device.
Touch that sign. You will now see a file transfer box then ftp client will open and you can open the other phone's storage.

Live data transfer over USB

I'm trying to figure out how to transfer frames rendered on a computer to an android phone. Wifi and Bluetooth aren't fast enough for a smooth framerate, but the data transfer speed across the USB connector is more than enough (up to 480 megabytes/ second). Thing is, I can't figure out how to do it- there's nothing in the Android docs and I haven't found anything online. How can I access the USB connection?
You can't access the USB connection in any documented and supported fashion.
It's not possible at all? Are there any hacks that allow it?
It's not an app for publication, and I don't mind messing with my own phone.
Try turning debug mode on and using adb to connect to the device. You can manually push files to the phone (e.g. to the sdcard) which you can in turn periodically check in your app. You can also write files the other way around (from your app) and have your PC app check that file, again over ADB. That way you can establish simple protocols for communication.
I also need this right now, but a bit more difficult since I try to access the phone from an programmable integrated device with USB host chip inside. Which probably means reverse engineering ADB...
Either way, it's a pretty hacky solution but it should work over all phones as long as debug mode is turned on, which makes it feasible.

Categories

Resources