0

I am debugging the suspend/resume process of an android phone. I am using adb shell into the phone and doing cat /proc/kmsg to view the debug message. The problem is whenever the phone suspends, it will put the usb to sleep, which will disconnects adb and therefore kmsg will terminate. I can unplug and replug in usb and do another cat /proc/kmsg. But the important debug message will be lost.

So my question is how do I capture the kmsg while the phone is going through suspend and resume cycle?

Thank you.

jiawen
  • 1,198
  • 2
  • 17
  • 29

1 Answers1

0

I'm currently trying to debug device suspend in Android, and work around this by:

1) create a shell script that cats /proc/kmsg in background:

/sdcard/log.sh

#!/bin/sh
cat /proc/kmsg > /sdcard/kmsg.log &

2) run the script over adb:

$ adb shell
$ su
# sh /sdcard/log.sh

You can then exit out of adb, unplug the device, and it'll keep logging to /sdcard/kmsg.log. When you're ready to view the log, you can connect it to usb and pull the log. Note that I put my log in /sdcard so that it persists between reboots.