0

I am in search of a tutorial or guidance on how to access the framebuffer (fb0) from an Android device and modify specific pixel columns. From my research, it seems this can be achieved by creating a kernel module. However, attempting to use "cat /dev/fb0" results in an error message stating "cat: /dev/fb0: No such file or directory," even when the device is rooted.

3
  • Possibly related: Why is the FrameBuffer missing on some Android devices? Commented Apr 16 at 20:59
  • The link is possibly related but not discussing about a solution. Plus not talking about kernel module
    – dhan
    Commented Apr 17 at 0:37
  • More that Android does its own thing not the same as standard Linux. Without knowing which version of Android you are working with, just making sure you are aware of: source.android.com/docs/core/graphics as I'm unclear what modifications you are trying to make and as a heads-up may require deeper modifications than just 'root', i.e. custom ROM/HAL beyond just a Kernel module. And if you already knew all of this then details about what was explored and rejected may help. Commented Apr 17 at 1:19

1 Answer 1

1

You're confusing a couple of things here:

"cat: /dev/fb0: No such file or directory" - that's because /dev/fb0 is the old (by now, gone) device node for the frame buffer. Newer devices use either /dev/kgsl-3d0 (for Qualcomm Adreno) or /dev/mali0 (for non Qualcomm, ARM GPUs)

Second, even if you could cat it - you would get the frame buffer snapshot , from user mode - though most drivers won't allow that before doing so ioctl() and/or mmap(2) to map the frame buffer. And it wouldn't allow you to just "echo foo > /...framebuffer" since the drivers do not support that. Lastly, that's accessing the FB from user mode, not from a kernel module. A kernel module wouldn't "see" any of the above /dev nodes , but would be able to access GPU memory directly.

If you WERE to create a kernel module, it would be dependent on which driver you would be interfacing with. Alternatively, depending on WHAT you want to modify, a better approach is to remain in user mode, and interface with Android's SurfaceFlinger process. this enables you to create your own surfaces. SurfaceFlinger then composite these on top of the Lower level frame buffer, using a HAL to abstract the exact /dev node and the ioctl codes required.

4
  • Hi, Here i what I wanted to do. 1) Wanted to modify the display regardless of the app someone using on the device.
    – dhan
    Commented Apr 23 at 6:49
  • Just like flashlight application. Is should be on until turning off. That is why i need to do this in kernel level. 2) Needed to pass values from app level like brightness slider in the quick menu bar.
    – dhan
    Commented Apr 23 at 15:05
  • I still did not get an answer: " how to modify framebuffer in a kernel module"
    – dhan
    Commented Apr 23 at 15:12
  • so A) again this doesn't need to be a kernel module. B) best way is to go directly to display manager over AIDL. C) Display manager can still be contacted by others to dim display: According to Android's power policy, the systemui may submit a request to the display driver at any time to dim. Commented Jun 5 at 12:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.