My application needs to access files on a usb stick from a rooted Nexus7 tablet over an OTG cable. I have been looking into this extensively and found a few related posts but no real answer.
I know this is possible, because I can mount it with stickmount though I can't use third party software, so I need to somehow re-implement this myself.
When I plug in the USB stick it appears as 001 in /dev/bus/usb/001, so I was hoping it would be as simple as:
Runtime.getRuntime().exec("su -c \"mount /dev/bus/usb/001/001 /sdcard/test\"");
but that doesn't work. A little toast pops up with
myApp has been given superuser permissions:
mount /dev/bus/usb/001/001 /sdcard/test
But it isn't mounted.
Am I formatting the command wrong, or is this the completely wrong way to go with it? Any ideas on how I could get this thing to mount?
Thanks
Related
The question is: how to determine (programmatically) which USB port was used when the USB flash drive was plugged in?
Context:
I am developing an app for an Android TV Box that lets you view files from a Pendrive. My device has 3 USB ports. I would like to know which of the port was used (some kind of ID, port name, whatever that could help me identify it in the code).
What have I done:
I read the android docs regarding USB as a host. None of the classes contains such information. The API is listing only devices which are plugged in but there is no information about the USB sockets. The deviceName is a string containing the path to a device file created in the android system but it is changing every time I plug in a USB flash drive (it looks like this /dev/bus/usb/007/008 the numbers, in the end, are different each time).
Looked into android sys files by adb shell command but couldn't find anything that describes the USB ports and says which one is currently in use.
Maybe someone encountered a similar problem? I'd really appreciate any help. Thanks in advance!
The Android operating system does not expose the information you are looking for.
Only with root access to the underlying Linux system below, can that information be obtained.
Use lsusb to enumerate the usb devices, and dmesg and mount to correlate the drive's mount point.
I'm interested in using "ADB over Wi-Fi" for debugging and troubleshooting my Android Studio application developments?
I already have two tablets that I will like to use for developing instead of using the slow emulator. The problem is that the manufacturer ACER does not provide suitable (Windows 8) ADB compatible driver for them.
I believe the "ADB over WiFi" will make these tablets useful for programming and testing on real devices. I have been searching around but have only found apps requiring a functional USB port on the tablet for the initial configuration.
+Most apps in Google Play require Rooting and a USB in order to work. I do not want to root AND sadly my USB ports are useless, so the question is:
Does anyone of you know any other way to do this? Achieving ADB over Wi-Fi without Rooting and without a USB port?
Thanks all
This one works perfect for me:
https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es
Yesterday I decided to fix the internal front speakers of my "HTC Desire Z" (aka. G2). While I was able to fix them, I broke the connector for the microSD slot (the left one). After trying to fix it for several hours, I gave up. It isn't in the scope of my hardwareskills :-(
Well, since I have like 600mb left on /data and my device is rooted, I tried to find a software solution i.e. "emulate" a SDcard device (because many applications require one to work properly, e.g. the camera app). I found here http://www.android-x86.org/documents/sdcardhowto a description how to create a vfat image and mount it as loopback.
While this is exactly what I want, I don't get it to work:
I don't know how to modifiy /proc/cmdline, or
how the entry in /etc/vold.fstab should look like.
dev_mount sdcard /mnt/sdcard auto /data/sdcard.img
didn't work for me. according to logcat, I have this version: I/Vold ( 2368): Vold 2.1 (the revenge) firing up
btw, just mounting the loopback device to /mnt/sdcard didn't work too. For example, the camera app still claims there isn't a SD card inserted.
edit: I also asked this on xda -> http://forum.xda-developers.com/showthread.php?t=1393395
There's no way for an Android application (constrained within the application sandbox) to create a loopback device.
Anything outside of this is not a developer question, and should be posted to another forum (e.g. https://superuser.com/).
I don't agree. Hanitaro Tide and PlasmaSoundHD both have created loop devices on my phone, all by themselves. On an x86 device it's even easier to fake an sdcard.img.p
I managed to conect my phone to the computer and I am able to debug with eclipse but I need internet conection but the phone I got has no sim card and wifi at work doesn't work well (not possible to use wifi) so I woul like to create a bridge like instructed here but it doesn't work.
The problem is I think is that the phone is not rooted. I am not allowed to do any modification to the device like the rooting instructions you can find on the net. Is there something else I can do? just a temporary "su" or sudo on the device? I have the terminal installed on the device and I tried typing su and it says "permission denied". Is there an apk to just activate the su temporary to make the conection and that's it?
The phone is a nexus one with Android 2.3.4.
EDIT: I know I need a linux pc. And at the top of the page it was written that you need a rooted phone but I decided to try it anyway but it doesn't work it seams the phone doesn't "allow it" I also tried what was written on the link suggested but it doesn't work for me either.
You don't need root for reverse usb tethering. You can follow the steps normally without having to type "su" on your device?
If you read the page, you need a linux computer if you want to use reverse tethering AND adb and the same time.
The trick is that you need to execute this I guess:
./adb shell netcfg usb0 dhcp
to get the usb-connection on your phone.
so I'm trying to get root access on my Android in order to use Barnacle. But I keep getting the same error, over and over:
$ adb shell
$ rootshell
rootshell: permission denied
What is the deal with this? I mean, seems logical that I need some permissions to access rootshell, but I can't seem to find any way around it.
Anybody knows how?
Is there any other way to get root access to your phone? (An easy way, hopefully)
EDIT 1:
I will clarify the question.
Unix and Linux systems let you retrieve / change lost passwords for root user. Considering this:
Is there an easy way to root an Android device using the terminal on my Mac OS X? My device is an Xperia X10 mini pro.
Or, does anybody know why I get that permission denied error using adb and rootshell in the first place? It's supposed to work, as stated here?
Thnx!
A.
I'm not sure how much of a question this is or not or whether it is appropriate for StackExchange, but I'm gonna answer it anyway. I don't have enough rep to do anything else about the anyway :D
When you are trying to root any android phone in general, you need to run a program that gives you root access. You can't just simply say "adb give-me-root-permissions-please". :) But yeah, Google is your friend in this case. Apparently your phone the Sony Xperia needs a very specific rooting process that is enumerated here: http://forum.xda-developers.com/showthread.php?t=711907
I would recommend asking this kind of question THERE on XDA because that site is dedicated to questions like this. This site is for programming questions and the like :)
TO BE ROOT AT SONY XPERIA
you can use
king root software
or
rootkitXperia L
how to get temproot by 'getroot'
usage
push 'getroot' in device, set permission, and execute 'getroot'
adb push getroot /data/local/tmp
adb shell
$ cd /data/local/tmp
$ chmod 0755 getroot
$ ./getroot
use CVE-2013-6282 vulnerability
kernel start address 0xc0008000
In some cases, modify KERNEL_START_ADDRESS or KERNEL_SIZE in 'getroot.c'