[Q] Newbie: USB programming - Android Q&A, Help & Troubleshooting

I'm completely new to mobile phone development but am a very experienced programmer in C++.
I want to write an android app that can copy the contents of one external USB memory card to another external memory card.
From what I can understand from my reading so far I'll need a phone that can host USB devices (OTG) which seems to limit the number of phones I could use.
From the software side of things, would such an application require any special permissions to write to an external USB device? If so how are these permissions gained, I've read about rooting but this seems a pretty brutal method.
There seem to be quite a few initial hurdles to creating this app. I don't own an android phone yet and don't want to end up with a phone I can't write this app on.
Any advise / tips would be much appreciated.

Please use the Q&A Forum for questions Thanks
Moving to Q&A

Related

[Q] noob wondering how to mount sd card. please help have searched for hours

hey guys, I just got the hd2 yesterday, and it alread was loaded android miui onto it. I was just wondering, how do I mount a sd card from windows mobile so i can see the contents of the card on a computer? What I'm trying to do is, use a sd card that doesn't have android on it in windows mobile, but i don't have a card reader. I know thres a way to put my micro sd into my hd2 and connect it to my macbook ( i dont have any virtual machines for windows so the sync software won't work ) so I can view all the files and put the necessary files for android on it. I have the clarity rom 6.5 and in the settings in connections/usb it just says allow usb connection or something like that. everytime I connect to my mac it doesn't recognize an external device, but my hd2 charges. When i boot it into android i can mount my sd card, but the problem is i dont have android on the other sd card that i want to modify, so I can't go into android and mount my sd card to modify files. So to make a long question short, HOW DO I VIEW/MODIFY THE CONTENTS OF MY SD CARD ON MY MAC WITH ONLY MY HD2 AND USB CABLE? This is my first post, so please go easy on me.
if you set the hd2 to disk drive mode the mac should see it as a usb hard disk. shouldnt it? (in windows mobile, not android, dunno nuffink about android)
how do i do this? I have never used windows mobile. ever. thanks for the help!
well when you plug in the usb cable, normally you get a popup (on the hd2) asking what you want, actyive sync, disk drive or (sometimes) internet sharing.
if it doesnt, you can go
settings tab menu all settings connections usb to PC
or settings tab other usb to PC
select disk drive, connect (or reconnect) USB cable.
you sometimes have better luck with switching usb mode if you havent already connected the device that session. try it from a fresh phone and pc reboot, put the phone in disk mode then connect usb.
(just as an added point of interest, you can use the hd2 in usb disk mode to boot a PC from a suitably formatted bootlable sd card, so it is using real usb hard disk mode. I use it to boot to ubuntu when im testing faulty machines.)
I only have one usb to pc, and it says when i tap it,
enable advanced network functionality.
no other settings. is something wrong? I am on clarity rom.
oh and im on clarity rom, but for some reason its not doing anything when i plug it into the mac
dunno what to say then, you are looking for the screen as my image.
G'nite, good luck.
you might claim to be a noob, but you certainly know what you're doing and you're on the right track!
here are the facts:
1. the HD2 is TOTALLY capable of what you require, i.e. usb disk mode
2. point 1 is true in both WM6.5(.x) and android (and you have already used the feature first-hand in android!)
3. point 2 is true only for WM ROMs and android builds in which the chef has chosen to provide the ability to toggle the usb disk mode option (this feature is present and fully usable in 90+% of the available ROMs/builds and in 100% of the ROMs/builds i've tried personally!)
4. given point 3, i find it hard to believe or understand why the chef of this "clarity" ROM you speak about left out the option! maybe it is there but moved to a different section of settings as samsamuel has suggested. maybe it WAS there but somehow something got corrupted/screwed and now the option has been wiped out? maybe try hard resetting your WM.
my honest and humble suggestion to you is to post in the thread of the "clarity" ROM and ask the chef/users of the ROM.
you seem very comfortable with the tweaking and ROM scene, so why not try a different WM ROM (i suggest NRGZ's "energy" ROM series)? you are already using android, and changing the WM ROM is a whole lot easier and straight forward if your primary OS is android (like yours truly!); nothing to backup/restore, no apps to install/configure, no contacts/messages backup/restore, etc.
i am happily using an old NRGZ ROM from june 2010, i keep WM in flight mode and simply use WM as a "bootstrap" into android. my WM is properly tweaked and configured to my liking just in case android ever screws up and i end up having to rely on WM until i get android sorted. hasn't happened yet, but fingers crossed!

/SDCARD2 Need to Know

Folks,
I don't claim to be an expert on the microiSD card, but there are some things
that need to be said -- and if I don't get it all or get it right then other folks
need to jump in.
1. Care always need to be taken putting your microSD card in and out. Not
only is it small and fragile, but the slot is small as well. You sometimes may
have to use your fingernail or something else thin to ease it far enough in
against the spring to get it to "click" into place. Same thing in reverse for
removal.
2. YOU CANNOT JUST PLUG AND UNPLUG THE FULL SIZE USB STUFF IN ANDROID.
They are not "Plug and Play" like Windows. I don't know the final word, but on
the full size USB port -- when I put in a USB key -- I always shut down, plug it in,
then reboot.
The miniUSB you use to your PC is a little more flexible, but that's another
post for another time.
3. You can use the microSD for recovery, but you have to edit the recovery
command file to point to /SDCARD2. When you boot standard recovery, Android
checks the internal memory for a recovery/command and update.zip presence.
If it does not find them, the it looks for a microSD external card and if it finds it
then it checks for recovery/command and update.zip file there.
4. Different ROMS have different capabilities with regard to finding and using the
USB ports. You'll have to research that -- or maybe someone will fill in that
blank here.
I hope this helps. I know this is not all the info on /SDCARD2 -- but I hope it
get the discussion going to help those having problems.
Rev
Good Topic! May want to add mention that /SDCARD2 does not normally mount to your PC when the tablet is connected for file transfers (I've seen that question 3 or 4 times in the past few days). There are some apps that allow it but I've run into some serious issues with a couple of them up to and including corruption of the internal memory.
#2 - the large USB port... I'm not an expert on this either but I do have two flash drives that will not mount if they're inserted with the tablet off. They do work fine when inserted with it on. So there is at least some level of auto-detect and mount going on I'm just not sure to what degree. It is on the list for further study. I would definitely err on the side of caution on this one with regards to anything containing important data.
#3 could be expanded to include or link to a how to on making your own recovery/utility MicroSD (another thread?). This could really save some folks some time and anguish.
+1 placeholder
+2 placeholder.
I won't bump it again. Just want those who need this to have the opportunity to
read it.
Rev
If SDCARD2 does not mount to your PC, how do you get the PC to recognize it so that you can store media files from your PC? Thanks!
mebrat said:
If SDCARD2 does not mount to your PC, how do you get the PC to recognize it so that you can store media files from your PC? Thanks!
Click to expand...
Click to collapse
If I understand your question correctly, you must get a standard sd holder for your micro sd (usually comes with the micro, but not always), and then you need a card reader with a usb plug to go into your computer.
snarful,
Yes. In my case an adapter came with the microSD card and I have a card reader
on my PC -- so I'm good to go.
But if you are going to do much with the cards, it really helps and speeds things up.
Rev

[Q] internal memory

apologies in advanced but i have searched high and low for the answer to this .
i am trying to get the internal memory of the HTC Legend to show up as a standard hard drive in my computer.
is this possible? I thought it might happen when i rooted the device however it did not so now im not sure i actually even rooted it.
Any answers would be helpful but really im just looking for a yes or no as to if its possible... if it is possible i will get to the bottom of it but i dont want to waste my time if far more intelligent people have not been able to do it
Try Swiftp from the market,it takes some setting up and needs to run via wifi.It's read only though
Or get handy with ADB and push and pull via the command line
Another solution would be to modify the vold.fstab to mount the internal memory as USB storage... Either way, I can't see a need for it and I think it will create more FC's than it's worth (it would involve unmounting /data). the safest way to access internal memory is when booted into recovery mode and using ADB

[HELP] USB OTG Questions

Hey XDA, I was looking to purchase a USB OTG setup for my HTC One S and had a few questions for those who have it and use OTG in general (please, only respond if you use OTG and can help). I know support is different on different devices, I would just like general answers is all [Also seen on the One S General section]
1) Is OTG reliable / stable? As in: can I store music on it and easily play it through a media player with no lag / media scan delay?
2) Is it possible to store game data on the storage? In example, Vice City or Modern Combat require you download ~1gb of files (game data) to the SD, can this be placed / read from OTG instead of /storage/sdcard? Keeping in mind my device has internal storage and no external SD support.
3) For those of you who use TWRP recovery, does it play nice with OTG? My device's TWRP version says it supports OTG, I just want to know opinions if it works well. My main use for OTG would be to backup / restore TWRP backups.
If anyone can answer these any of these questions I would greatly appreciate it. I am really interested in OTG since the One S has a limited storage space. Please note: I posted this in the One S general section as well, just putting this here to get more traffic / more answers, plus this may help other users considering OTG on a device with limited storage. Thanks again!

What's the device expected by make_f2fs.exe on Windows

Hi guys.
I'm trying to format an USB flash disk for using it as additional internal storage on an Android TV.
Doing this using the TVs interface seems to take forever and the TV needs to stay on continuously. Last time I turned the TV off after around 3 days of waiting for nothing...
In the same folder with the platform tools (adb.exe), there are these 2 other utilities who seem to be related to what I want, make_f2fs.exe and mke2fs.exe.
Their help suggests that they expect a device parameter, which on Linux is the /dev/... file.
Anybody knows what's the equivalent in Windows?
Thank you!
PS: if you think I asked the question in the wrong forum, please be so kind and redirect me to the better one..
In the end, I solved my initial problem (adding more internal storage to my TV) by installing a Linux VM and formatting my flash disk with F2FS.
The operation on the TV was pretty straight forward, the flash disk appeared as a new drive on the TVs interface, I just needed to select it and format it as internal storage which took only a few minutes for a 32 GB device.
However, if at some point someone has an idea about how make_f2fs.exe can be used on Windows, please share
Thank you.

Categories

Resources