Skip to content

Instantly share code, notes, and snippets.

@jrgm
Last active December 10, 2015 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jrgm/4490638 to your computer and use it in GitHub Desktop.
Save jrgm/4490638 to your computer and use it in GitHub Desktop.
enable NSPR HTTP logging for b2g phones...
#!/bin/sh
# You may of course prefer not to trust this script and do the below
# manually, step by step, with an editor, etc., ;-).
#
# make /system/bin writable
#
DISK_DEVICE=`adb shell mount | grep '/system' | awk '{ print $1 }'`
adb shell "mount -o remount,rw $DISK_DEVICE /system"
#
# Put busybox in place
#
# downloaded from http://busybox.net/downloads/binaries/1.20.0/busybox-armv6l
adb push /home/jrgm/busybox-armv6l /system/bin
adb shell chmod 755 /system/bin/busybox-armv6l
# /system/xbin is the last dir in the default $PATH atm, but unused. So we'll
# put busybox links in there. Someday, I'll regret this ;-).
adb shell mkdir -p /system/xbin
adb shell /system/bin/busybox-armv6l --install -s /system/xbin
#
# pull a copy of b2g.sh, add our lines and push it back
#
adb pull /system/bin/b2g.sh .
LINES=`wc -l b2g.sh | awk '{ print $1 }'`
head -n 1 b2g.sh > b2g.sh.new
# Make `adb logcat` show timestamped lines about HTTP and cookies. Yay!
echo 'export NSPR_LOG_MODULES=timestamp,cookie:5,nsSocketTransport:5,nsHttp:5' >> b2g.sh.new
tail -n `expr $LINES - 1` b2g.sh >> b2g.sh.new
adb push b2g.sh.new /system/bin/b2g.sh
adb shell chmod 755 /system/bin/b2g.sh
adb shell chown root.shell /system/bin/b2g.sh
adb shell ls -l /system/bin/b2g.sh
echo @@@
adb shell cat /system/bin/b2g.sh
echo @@@
# reboot the phone to pick up the change
# adb reboot
@dclarke
Copy link

dclarke commented Sep 10, 2013

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment