Related
hi,
two days ago i rooted my Nexus One FRF91-Vodafone with these two methods ( forum.xda-developers.com/showthread.php?p=7548842 and forum.xda-developers.com/showthread.php?t=736271). Still some commands of adb don't work and i can't find a solution.
Code:
C:\>cd android/tools
C:\android\tools>adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
HT05EP800252 device
C:\android\tools>adb shell
$ su
su
# id
id
uid=0(root) gid=0(root)
# exit
exit
$ exit
exit
C:\android\tools>adb remount
remount failed: Operation not permitted
C:\android\tools>adb root
adbd cannot run as root in production builds
C:\android\tools>
as you can see the device is connected in debug mode and i am rooted but the commands "adb remount" and "adb root" don't work (and maybe some other commands? i don't know). does it happen because the bootloader is still locked? if so, is there a way to have those commands working without unlocking it? if not, what could it be?
sorry for my english
thanks a lot
I'd have to guess because "remount" and "root" are not the way to do it.. Where are you seeing this is the way to do what you need to do?
how shoul it be used? i found a lot place where is written just like that. besides i read that the default.prop should be like this:
Code:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=0
ro.debuggable=1
persist.service.adb.enable=1
for adb to work properly
but mine is like this
Code:
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=0
and i don't understand why, i cant change it because it's a read-only file
What about:
Code:
mount -o remount,rw /system
?
i have this same problem, im guessing you went the way without unlocking your bootloader?
if so i dont think you can do adb remount
but what you can do is this method
adb shell
su
#mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
this will remount your phone system to read-write and you should be good to push/pull/cp/rm/clear/ and what your trying to do
Thanks for the info. I was having the same issue with my N1. The full mount path worked
Kage_
If you're really slick, I imagine you could add an alias "remount" to your shell profile script (.csh or something similar) to execute that full command for you when you needed it
Here is an easy way to run commands after each boot.
In the init.rc file, the file /system/bin/clrbootcount.sh always gets run after a successful boot. Since it isn't trivial to change the init.rc file, we will use clrbootcount.sh to run commands after a boot. Since people are having issues with modifying clrbootcount.sh, we will choose a safer method.
clrbootcount.sh will always attempt to call /data/boot_complete_hook.sh, which doesn't exit. We are going to create this file and use that to run commands.
Create a file named boot_complete_hook.sh with the following contents (On Windows, use Notepad++):
Code:
#!/system/bin/sh
##################################################################################
#
# File boot_complete_hook.sh
# Description Run any commands that you want to be run after boot
#
##
setprop persist.service.mount.umsauto 0
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
Save and close.
Now, execute the following commands to put the file on your nook:
Code:
adb push boot_complete_hook.sh /data/boot_complete_hook.sh
adb shell chmod 755 /data/boot_complete_hook.sh
Note:
Before you reboot verify that the file will run properly. Open up a shell via adb shell. Inside that run the following:
Code:
setprop persist.service.mount.umsauto 1
getprop persist.service.mount.umsauto
You should see 1 as the output. Now run:
Code:
sh /system/bin/clrbootcount.sh
You should see an output similar to:
Code:
4+0 records in
4+0 records out
4 bytes transferred in 0.010 secs (400 bytes/sec)
Now run:
Code:
getprop persist.service.mount.umsauto
If 0 is printed out, exit the shell.
If 0 is not printed out, something went wrong and the file will not be run properly on the next boot. If you do reboot in this state 8 times, the boot count won't be reset and you will hit the factory reset. While you are trying to get the script working, you could always manually reset the boot count by executing (from a shell):
Code:
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
Now reboot:
Code:
adb shell reboot
As you are rebooting, run:
Code:
adb shell getprop persist.service.mount.umsauto
It will return 1 since the init.rc file sets it to 1 explicitly. However, once you are fully booted it will return 0.
Didn't work for me.
JoshMiers said:
Here is an easy way to run commands after each boot.
In the init.rc file, the file /system/bin/clrbootcount.sh will always gets run after a successful boot. Since it isn't trivial to change the init.rc file, we will use clrbootcount.sh to run commands after a boot.
Do:
Code:
adb pull /system/bin/clrbootcount.sh .
Open the file (on Windows, don't use Notepad) and you should see:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
Add the following to the end of the file:
Code:
#run other commands
setprop persist.service.mount.umsauto 0
Save and close.
Now, execute the following commands to put the file back on your nook:
Code:
adb shell mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
adb push clrbootcount.sh /system/bin/clrbootcount.sh
adb shell chmod 755 /system/bin/clrbootcount.sh
adb shell mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
adb shell reboot
As you are rebooting, run:
Code:
adb shell getprop persist.service.mount.umsauto
It will return 1 since the init.rc file sets it to 1 explicitly. However, once you are fully booted it will return 0.
Click to expand...
Click to collapse
Wouldn't this screw up the 8X "back to stock firmware" sequence since that depends on having the boot counter increment up to 8?
docfreed said:
Wouldn't this screw up the 8X "back to stock firmware" sequence since that depends on having the boot counter increment up to 8?
Click to expand...
Click to collapse
The script file is already there and already being called after each successful boot. The 8x boot counter logic happens with 8 failed boots. Regardless, the instructions just show you how to append a custom command to be run after the stock commands run, no other booting logic is affected.
>DARKMAN< said:
Didn't work for me.
Click to expand...
Click to collapse
What didn't work? Run the following and paste your output:
Code:
adb shell cat /system/bin/clrbootcount.sh
Code:
adb shell ls -l /system/bin/clrbootcount.sh
Awesome, thanks for the tip! Been wondering how to put in my own stuff into the init, I'd love to modify the path but I suspect this won't be the way, but regardless it's good info.
BTW, I have found that disabling this USM property seems to disable the SD card automounting but the Nook itself might still automount... But that's for another thread I suppose
Worked perfectly
This is exactly what I was looking for.
Thanks
Sent from my LogicPD Zoom2
There seems to be a little confusion over at the refresh rate thread http://forum.xda-developers.com/showthread.php?t=901294.
To be explicit, if you want to disable auto-mounting as well as change the refresh rate, you would edit clrbootcount.sh to have the following contents:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#run other commands
setprop persist.service.mount.umsauto 0
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
If you don't want to disable auto-mounting, just remove the line with
Code:
setprop persist.service.mount.umsauto 0
I ran what was posted and it still returns 1.
Sent from my HAXSUNG Moment
JoshMiers said:
What didn't work? Run the following and paste your output:
Code:
adb shell cat /system/bin/clrbootcount.sh
Code:
adb shell ls -l /system/bin/clrbootcount.sh
Click to expand...
Click to collapse
Screen shot attached (1.0.1 Auto-Nooter 2.12.25).
# cat /system/bin/clrbootcount.sh
cat /system/bin/clrbootcount.sh
#!/system/bin/sh
################################################################################
##
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#
# ls -l /system/bin/clrbootcount.sh
ls -l /system/bin/clrbootcount.sh
-rwxr-xr-x root root 338 2011-01-06 19:50 clrbootcount.sh
#
edit double post oops
I lost my backup of clrbootcount.sh
and now it won't reset the boot count.
any help would be greatly appreciated.
adb shell getprop persist.service.mount.umsauto
Click to expand...
Click to collapse
always returns 1 during and after complete reboot. The echo command for screen does not persist. Have followed your instructions super letter by letter multiple times and leading up to the reboot everything is exactly as you say.
Right now, I am most concerned that whatever I have done will not reset the boot count since it stays at 1 and does not go to 0. I've already lost my entire setup twice and had to start from scratch trying to make this work. At least I know how to reset to 0 with the line command script but how do I ensure i don't need to worry about it?
I think this process may be a bust.
I am on 1.0.0 and have been using this since I posted it and both the refresh rate and automount values are sticking between reboots.
>DARKMAN< said:
# cat /system/bin/clrbootcount.sh
cat /system/bin/clrbootcount.sh
#!/system/bin/sh
################################################################################
##
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#
# ls -l /system/bin/clrbootcount.sh
ls -l /system/bin/clrbootcount.sh
-rwxr-xr-x root root 338 2011-01-06 19:50 clrbootcount.sh
#
Click to expand...
Click to collapse
I am assuming you are using the new method, which would mean you need to post your /data/boot_complete_hook.sh
>DARKMAN< said:
I lost my backup of clrbootcount.sh
and now it won't reset the boot count.
any help would be greatly appreciated.
Click to expand...
Click to collapse
The clrbootcount.sh file that you posted is the default file. I will post it again:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
Also, the original post explains how to manually reset the boot count. Here it is:
If 0 is not printed out, something went wrong and the file will not be run properly on the next boot. If you do reboot in this state 8 times, the boot count won't be reset and you will hit the factory reset. While you are trying to get the script working, you could always manually reset the boot count by executing (from a shell):
Code:
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
jleecong said:
Screen shot attached (1.0.1 Auto-Nooter 2.12.25).
Click to expand...
Click to collapse
It appears you are running Windows, so I am hoping that you did not use Notepad to edit this file.
Since you are running 1.0.1, post your /init.rc file.
Thought I may have been doing something wrong since I used notepad but downloaded Notepad++ and created the new .sh file. Still no go. Screen still flickers and USB still automounts. Maybe 1.0.1 just is not commpatible with this process. Only difference I can see.
The getprop persist.service.mount.umsauto also indicates 1 after full boot and not 0. Pretty sure this will wipe everything out after 8 boots, going to wipe it all out now and proactively prevent it.
So, I'm currently investigating UMS on Galaxy Tab 2 and I got it somewhat working (for extSdCard).
If you feel brave enough, here's how I did it (ONLY tested on GNU/Linux!):
Q: What prerequisites do I need?
A: You need:
human brain
CWM
root access (aka 'su')
some knowledge about Linux in general won't hurt
After you sucessfully booted into your newly rooted, init.d ready P3110, do this:
Code:
adb root
adb shell
su
mount -o rw,remount /
mount -o rw,remount /system
chmod 0777 /¹
¹ = only if you're on stock rom. on cyanogen this is not needed.
locally, create a file called 'ums', with the following content:
STOCK ROM
Code:
#!/system/bin/busybox sh
if [ "$1" = "enable" ]; then
/system/bin/setprop sys.usb.config mass_storage,adb
/system/bin/setprop persist.sys.usb.config mass_storage,adb
/system/bin/setprop sys.usb.state mass_storage,adb
echo 0 > /sys/devices/virtual/android_usb/android0/enable
umount /mnt/extSdCard
echo "mass_storage,adb" > /sys/class/android_usb/android0/functions
echo "/dev/block/vold/179:25" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun1/file
echo 1 > /sys/devices/virtual/android_usb/android0/enable
fi
if [ "$1" = "disable" ]; then
/system/bin/setprop sys.usb.config mtp,adb
/system/bin/setprop persist.sys.usb.config mtp,adb
/system/bin/setprop sys.usb.state mtp,adb
echo "" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun1/file
echo 0 > /sys/devices/virtual/android_usb/android0/enable
echo "mtp,adb" > /sys/class/android_usb/android0/functions
echo 1 > /sys/devices/virtual/android_usb/android0/enable
vold
fi
Code:
adb push ums /ums
adb shell
su
busybox mv /ums /system/bin/ums
chmod 0777 /system/bin/ums
CYANOGEN MOD 10
May work with CM9 aswell, but I didn't test it.
Code:
#!/system/xbin/busybox sh
if [ "$1" = "enable" ]; then
/system/bin/setprop sys.usb.config mass_storage,adb
/system/bin/setprop persist.sys.usb.config mass_storage,adb
/system/bin/setprop sys.usb.state mass_storage,adb
umount /storage/sdcard1
echo 0 > /sys/devices/virtual/android_usb/android0/enable
echo "mass_storage,adb" > /sys/class/android_usb/android0/functions
echo "/dev/block/vold/179:25" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file
echo 1 > /sys/devices/virtual/android_usb/android0/enable
fi
if [ "$1" = "disable" ]; then
/system/bin/setprop sys.usb.config mtp,adb
/system/bin/setprop persist.sys.usb.config mtp,adb
/system/bin/setprop sys.usb.state mtp,adb
echo 0 > /sys/devices/virtual/android_usb/android0/enable
echo "mtp,adb" > /sys/class/android_usb/android0/functions
echo "" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file
echo 1 > /sys/devices/virtual/android_usb/android0/enable
vold
fi
Code:
adb push ums /system/bin/ums
adb shell
su
chmod 0777 /system/bin/ums
STEP B
Install some terminal emulator from Market. Open that app and issue
su (when SuperUser asks, give it permission).
next, to enable UMS:
Code:
ums enable
to disable UMS
Code:
ums disable
NOTE: there are two different options: calling 'ums enable' prior to connecting with USB or while connected. Different ROMs behave differently, try what works best for you.
If everyhing is fine (and you're running Linux), dmesg should show something like:
Code:
[ 1680.264023] usb 1-6: new high-speed USB device number 29 using ehci_hcd
[ 1680.356086] hub 1-0:1.0: unable to enumerate USB device on port 6
[ 1680.636060] usb 1-6: new high-speed USB device number 30 using ehci_hcd
[ 1680.769829] usb 1-6: New USB device found, idVendor=04e8, idProduct=685e
[ 1680.769832] usb 1-6: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[ 1680.769835] usb 1-6: Product: GT-P3110
[ 1680.769837] usb 1-6: Manufacturer: samsung
[ 1680.769838] usb 1-6: SerialNumber: c1607c00051963f
[ 1680.771433] scsi26 : usb-storage 1-6:1.0
[ 1681.769047] scsi 26:0:0:0: Direct-Access SAMSUNG File-Stor Gadget 0001 PQ: 0 ANSI: 2
[ 1681.770784] scsi 26:0:0:1: Direct-Access SAMSUNG File-Stor Gadget 0001 PQ: 0 ANSI: 2
[ 1681.779155] sd 26:0:0:0: [sdc] 8052736 512-byte logical blocks: (4.12 GB/3.83 GiB)
[ 1681.782898] sd 26:0:0:0: [sdc] Write Protect is off
[ 1681.782901] sd 26:0:0:0: [sdc] Mode Sense: 0f 00 00 00
[ 1681.787146] sd 26:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 1681.794399] sd 26:0:0:1: [sdd] Attached SCSI removable disk
[ 1681.804415] sdc:
[ 1681.809590] sd 26:0:0:0: [sdc] Attached SCSI removable disk
And now you can access extSdCard as ordinary UMS.
TODO:
some button/widget to easily en/disable UMS
make it work with internal storage, too
Suggestions welcome :]
Credits:
Commands for ums derived from: http://forum.xda-developers.com/showthread.php?t=1785243
Tried this on my P3113 running today's build of CM10. Changed /mnt/extSdCard/ to /storage/sdcard1/ in accordance with the ROM's setup. Got the following error:
Code:
can't create /sys/devices/virtual/android_usb/android0/f_mass_storage/lun1/file: No such file or directory
I don't use CM, only stock rom. I guess it's simply a different virtual device, you should investigate in /sys/devices/virtual/
Meanwhile I'm currently trying to improve the script, it does not always work for me, I need to check why.
Edit:
improved 'ums' script:
- better handling of returning to MTP
- better handling of entering UMS
I noticed, that it does not always work, when running 'ums enable' from within 'adb shell'.
But when doing from a terminal emulator on the tablet - disconnected from PC - it always works.
Setialpha said:
I don't use CM, only stock rom. I guess it's simply a different virtual device, you should investigate in /sys/devices/virtual/
Meanwhile I'm currently trying to improve the script, it does not always work for me, I need to check why. Next version atleast properly does returning to MTP.
Click to expand...
Click to collapse
I think it needs to run a little later during boot.
Sent from my ADR6425LVW using xda premium
See my edited post above.
Ah and it's not running from init.d (that's not called late enough, as vold is one of the last in the boot process) - it's run manually, right before you want to acces your stuff.
Setialpha said:
See my edited post above.
Ah and it's not running from init.d (that's not called late enough, as vold is one of the last in the boot process) - it's run manually, right before you want to acces your stuff.
Click to expand...
Click to collapse
Gotcha
Sent from my ADR6425LVW using xda premium
Yeah, when I was screwing around with remapping the mount points of sdcard and extSdCard, I found that vold runs really late in the boot-up process. The only easy way I found to get shell scripts to run that late is an app (like Script Manager), since apps can register an event handler and then they do stuff "at boot time", which runs after init.d, userinit.sh, and vold.
So wait, does this access for the external micro SD card from MTP over to UMS? And by 'UMS' do you mean regular-style USB mass storage device? As in "hey you can just read/write files instead of having to wait for the slow ass MTP server!"?
Because that's AWESOME!
DivinityCycle said:
Yeah, when I was screwing around with remapping the mount points of sdcard and extSdCard, I found that vold runs really late in the boot-up process. The only easy way I found to get shell scripts to run that late is an app (like Script Manager), since apps can register an event handler and then they do stuff "at boot time", which runs after init.d, userinit.sh, and vold.
So wait, does this access for the external micro SD card from MTP over to UMS? And by 'UMS' do you mean regular-style USB mass storage device? As in "hey you can just read/write files instead of having to wait for the slow ass MTP server!"?
Because that's AWESOME!
Click to expand...
Click to collapse
Yes, regular USB as in 'plug in an USB-Stick'. It's a hack so it may not always work (especially not when plugged in with ADB active) but hey - better than nothing. I will try to improve that thingy, though.
does stock rom have ums?
despine said:
does stock rom have ums?
Click to expand...
Click to collapse
No
Sent from my ADR6425LVW using xda premium
Update: additional script/steps for CM10 added - have fun
This works flawlessly on Linux, but not Windows. Any idea what the difference is (besides the obvious)?
Macadamia Daze said:
This works flawlessly on Linux, but not Windows. Any idea what the difference is (besides the obvious)?
Click to expand...
Click to collapse
I don't know. I may use my old XP installation (it's totally dusty - not used for long time) to test this week.
Hello guys,
I am trying to send AT commands on Galaxy S (I9000). The problem is that I am not sure which device is the modem. Searching into file /system/build.prop, i get that the device used by rild is /dev/ttyS0 (rild.libargs=-d /dev/ttyS0). But there is no ttyS0 file into /dev directory, and as a result I get an error when trying to send commands to it.
Executing the command cat /proc/tty/drivers I get the following results:
/dev/tty /dev/tty 5 0 system:/dev/tty
/dev/console /dev/console 5 1 system:console
/dev/ptmx /dev/ptmx 5 2 system
/dev/vc/0 /dev/vc/0 4 0 system:vtmaster
rfcomm /dev/rfcomm 216 0-255 serial
g_serial /dev/ttyGS 250 0 serial
ttySAC /dev/s3c2410_serial 204 64-67 serial
pty_slave /dev/pts 136 0-1048575 pty:slave
pty_master /dev/ptm 128 0-1048575 pty:master
unknown /dev/tty 4 1-63 console
From these I guess that the modem is /dev/ttyGS0. So i go on and execute via adb or terminal IDE application:
stop ril-daemon
cat /dev/ttyGS0 &
echo -e 'AT+CGSN\r' > /dev/ttyGS0.
But I get no response. I have also installed busybox and execute
echo "AT+CGSN\r" | busybox microcom -t 500 /dev/ttyGS0
but i get no response either.
Reading this thread http://forum.xda-developers.com/showthread.php?t=1471241 I didn't get much help.
Does anyone know what is going on or what can I do to get response from modem?
Thank you in advance
Closed Per OP Request
I want to make a tasker shortcut so that if I run a shortcut, the usb will be unmounted.
I have confirmed that the usbotg is in the storage and mnt/media_rw directory.
So I used the run shell to write down umount /storage/usbotg, and I wrote down umount /mnt/media_rw/usbotg, but I couldn't unmount it.
I rooted my tablet and I checked the use root next to the run shell command, but I couldn't unmount it.
The tasker printed the following error message:
17.08.33/E Run Shell: ->
17.08.33/E Run Shell: ->
17.08.33/E Run Shell: ->
17.08.33/Shell runBackground umount /storage/usbotg root: true timeout: -1
17.08.33/Shell start process-thread ID 154
17.08.33/E add wait type Shell1 time 2147483647
17.08.33/E add wait type Shell1 done
17.08.33/E add wait task
17.08.34/E Error: 1
Is there any way to solve this problem?