read android dmesg with code
来源:互联网 发布:算法模型电商 编辑:程序博客网 时间:2024/05/25 05:37
You can write some Android NDK code which calls the klogctl functions. Something like:
#include <sys/klog.h>#define KLOG_READ_ALL 3#define KLOG_LEN (1 << 17)char buf[KLOG_LEN];if (klogctl(KLOG_READ_ALL, buf, KLOG_LEN) < 0){ printf("Error %s reading dmesg\n", strerror(errno));}else{ /* do something with contents of buf */}
However, in Android 4.1 Jelly Bean they have implemented a security feature which disallows access to the dmesg messages. The code above will fail with an "Operation not permitted" error. If you have root access to the device, you can turn off dmesg_restrict:
echo 0 > /proc/sys/kernel/dmesg_restrict
Also, some recent devices have SELinux enabled, in which case you will need to do
setenforce 0
If you don't have root access, you're pretty much out of luck.
阅读全文
0 0
- read android dmesg with code
- Pstore dmesg read篇
- read-python-code-with-cscope-on-emacs
- Read & Comment Android Source Code
- Using Eclipse to read Android Framework code.
- Read Code
- Read Code
- android 中的dmesg
- dmesg
- dmesg
- dmesg
- dmesg
- dmesg
- dmesg
- dmesg
- dmesg
- android下的dmesg方法
- android N dmesg源码分析
- [PAT-乙级]1036.跟奥巴马一起编程
- 对于“javac不是内部或外部命令也不是可运行的程序”的解决方法
- httpd正向代理与反向代理技术
- Kali 安装 Nessus 详细过程
- jsp中session 失效设置
- read android dmesg with code
- 嵌入式视频方案学习第五篇——系统初始化的一般流程
- “勒索病毒”的应对方案
- JVM底层又是如何实现synchronized的
- Android TabLayout 设置Tab 字体大小
- 动态库中使用openmp 发生异常报错
- JFreeChart使用示范
- 链表面试题(三)---当前结点前插入一个数据x
- android NFC开发