适用于 Linux 帧缓冲区的 Windows 镜像驱动程序
对于我正在编写的软件,我需要知道 Linux 帧缓冲区何时更新。 我需要类似 Windows 镜像驱动程序(有关更多信息,请参阅维基百科上的 Mirror_driver)。
环顾四周,我没有发现任何东西,所以我正在寻找一种方法来实现这一目标。
据我所知,我需要编写一个模块,该模块在帧缓冲区特定模块之后加载,并挂钩 fb ops 结构以注入自己的内容并捕获更新。
有人可以给我提示吗?我对内核模块编写没有太多经验。
谢谢你!
for a software i'm writing i need to know when the linux framebuffer gets updated.
I need something like Windows Mirror Drivers (for more infos look Mirror_driver on wikipedia).
Looking around i haven't finded anything, so i'm looking a way to accomplish this.
From what i've seen, i need to write a module that gets loaded after framebuffer specific module and that hooks fb ops structure to inject own stuff and catch updates.
Can someone give me an hint? I don't have much experience with kernel module writing.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于一般的内核模块编写技巧,您可以阅读书籍:Linux Kernel Development 、 Linux 内核简介 和 Linux 设备驱动程序。
了解如何构建和构建的基础知识后,安装您自己的内核模块,您可以阅读内核的源代码来找出帧缓冲区内容的位置(从 Documentation/fb/framebuffer.txt 开始)。我不确定您是否可以像这样连接帧缓冲区驱动程序,如果不能,您可能需要自己添加钩子支持或“劫持”主驱动程序的事件来模拟钩子。例如,假设有一个函数,只要有更新就会被调用。您找到声明该函数的指针的位置,保存该值,然后使用指向您的函数的指针对其进行修改。在函数内部,您调用原始函数,然后调用您自己的代码来操作您想要的内容并正确返回。
我对帧缓冲区的东西不太了解,所以我只是猜测你的选择是什么。可能有一个特定于 linux-fb 主题的讨论列表。 这可能是一个好的开始。
For general kernel module writing tips, you can read the books:Linux Kernel Development, Linux Kernel in a Nutshell and Linux Device Drivers.
After you understand the basics on how to build & install your own kernel modules, you can read the source code of the kernel to figure out where the framebuffer stuff is (start at Documentation/fb/framebuffer.txt). I'm not sure whether you can just hook up on the framebuffer driver like that, if not, you might need to add the hook support yourself or 'hijack' the main driver's events to simulate hooking. For example, suppose that there's a function that is called whenever there's an update. You find where the pointer to this function is declared, save the value, then modify it with a pointer to your function. Inside your function you call the original function, then your own code to manipulate what you want and return properly.
I don't know much about the framebuffer stuff, so I'm just guessing what your options are. It's possible that there might be a discussion list somewhere specific to the subject of linux-fb. This might me a good start.