为什么我不能读取的/ dev /图形/ FB0数据? [英] Why cannot I read data from /dev/graphics/fb0?
问题描述
我使用的是仿真器。所以肯定我有root权限。
我用命令:
I am using the emulator. So definitely I have the root permission. I use command:
ADB拉的/ dev /图形/ FB0 D:/ A
然后用我的程序读取这个文件,并生成一个bmp。它是成功的。但是当我使用纯Java code要做到这一点:
and then use my program to read this file and generate a bmp. It is successful. But when I use pure java code to do this:
工艺过程=调用Runtime.getRuntime()EXEC(苏-c猫的/ dev /图形/ FB0);
process.waitFor();
InputStream为= process.getInputStream();
is.read(缓冲,0,宽*高* 2);
该缓冲区不能得到正确的数据。所有数据为0,而正确的为0xFF在第几行。
The buffer can not get the correct data. All the data is 0, while the correct is 0xFF at the first several line.
然后我尝试:
亚行外壳
猫的/ dev /图形/ FB0> / SD卡/ tmp目录
的tmp文件也得到了正确的数据。
为什么纯java code失败了吗?是我用Process类的方式错了?
The tmp file also got the correct data. Why the pure java code failed? Is the way I used the Process class wrong?
推荐答案
由于FB0是缓冲文件,它是一个不断更新的文件,你应该把它复制到某个存取的目的地,然后用<$ C $阅读C>的FileInputStream ,很容易有正确的数据。
Since the fb0 is a buffer file, it is an always-changing file, you should copy it to a certain ACCESSIBLE destination then read it with FileInputStream
, easily having the correct data.
我爱:
("cat /dev/graphics/fb0 > /dev/myRawFrame.raw");
File CurrentRawFile = new File("/dev/myRawFrame.raw");
就大功告成了:)
and you're done :)
这篇关于为什么我不能读取的/ dev /图形/ FB0数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!