ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have an embedded application. I want to compare the frame/screen being shown on the display for validation purposes i.e. i want to check whether the frame currently being shown on the display is same as the frame shown earlier.
For this i am saving the checksum of frame buffer contents and comparing for validation.
Now, the problem is that when the checksum is computed, it takes into account the mouse pointer position. So, the next time when i compute the checksum if the mouse pointer is at a different position then the checksum will be different and the validation will fail.
Now, how can i compare two frames of a frame buffer? Currently i am using checksum for comparison but it takes mouse pointer position into account.
lol, i am simply using a checksum command for computing the checksum and it takes the mouse position into account automatically. So, i am not deliberately doing it.
So, there is no way to not include the mouse position? Not even if you create a new input that does not use the mouse? Cant reset the mouse data just for the checksum-computing phase?
OK then, ummm, perhaps you should write your own checksum command? Or use a already existing checksum system (MD5) and make it compute based on your framebuffer data? Or.... is the mouse data somehow, for some impossible to know reason, part of the framebuffer data?
Hey thanks for replying! i think the mouse data is infact part of the framebuffer data as it includes the mouse cursor. I don't have the exact code of the checksum computation algo as my friend is doing it but i think it's only based on the existing linux checksum command (maybe md5sum).
I'll know the details only when i get the code from my friend. The code is for an embedded device and in addition to mouse, it accepts keyboard and touchscreen events.
According to ur reply, i guess i have to disable any inputs (mouse, touchscreen) while taking the checksum. I have to investigate on this a bit. I think the problem might be due to the mouse cursor being displayed as it is part of the frame buffer data while the checksum is being computed. As soon as the cursor position is changed, the checksum changes.
Basically, this is what i want to achieve:
My embedded application has several screens. When u press a button it opens another screen. I want to validate the screens after opening i.e. whether the correct screen is getting opened or not. So, i take a checksum of the frame buffer as soon as a screen opens and save it somewhere. Next time the same window is opened, i validate the screen by taking its checksum and comparing the checksums. Is there any other way to compare the screens in an embedded application?
Disclaimer: My experience with embedded programming is close to null, so ignore me if I'm stating the obvious or making wrong assumptions
A common practice to compare large objects is not doing the very expensive job of comparing each byte (or even doing checksums) but rather add additional state informations to this object (if diskspace/memory allows), and keeping these up to date.
Like said - I wouldn't know if this is feasible at all - but my approach would be to add such a state flag to the framebuffer and let the instance which usually does the checksums rather set/reset this flag according to the different ways how the framebuffer could have been changed (content, size, mouse, etc.) and then it would be an extremely cheap operation to just check this flag once in a while.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.