📜 ⬆️ ⬇️

SATA controller, blurred photography and competition

A few days ago, an English-speaking user registered with the nickname mdickie registered on the KolibriOS forum and complained that the mouse does not work on his Dell Latitude C640 laptop: board.kolibrios.org/viewtopic.php?f=4&t=2389 . Since we recently had USB support (in particular, USB mice), our founder Mario_Z logically suggested that mdickie is using some old version, and advised him to download the latest nightly build and check on it .

The assumption of Mario_Z turned out to be true - the mouse worked in the nightly build, but something else broke :
It works with the latest build,
Thanks
EDIT: It freezes slower.
Unfortunately, the user was laconic ( or English is not his native language ), so for some time we found out exactly what was wrong by asking leading questions until the picture cleared:
Needs to freeze the mouse.
Oh yes, the whole system freezes. The Keyboard and the clock are not working.
Here, I already guessed that the cause of the hangup is most likely the SATA IDE driver, which is currently developing Mario_Z . At the moment, KolibriOS has a native driver only for the PATA controller, and support for the SATA controller in IDE mode is only through the BIOS, which introduces 2 limitations:
  1. Access to disks through the “crutch” BIOS is very slow, so the movie from such a disk in KolibriOS does not look - it will go jerky. The speed of copying files is also unacceptable - you can have lunch while a large file is being copied.
  2. Some disks without a driver are not visible at all in the system.

In view of this, at the moment we are writing 2 SATA drivers (in parallel):

Both drivers have one unpleasant feature - hang the system tightly in case of any abnormal situation - and then you need logs to see the configuration of the disks and try to find out the cause of the hang. This is exactly what happened in mdickie , and therefore I asked him to attach logs. Naturally, if the entire system hangs, copying the logs directly from KolibriOS to a text file will not work, and in such cases we ask to take a picture of the log from the monitor screen to a smartphone or camera, and upload the photo on our forum. And here we go to the second part of the article.

To write a log to a text file (like dmesg in Linux ) we have the utility BOARD , which also displays the last few lines of the log in its window. When the system hangs, the visible part of the log is usually not enough, and copying the entire file is not possible, as I said above. It remains only to duplicate the entire log to the screen, and then photograph it, and for such purposes we have an option on the start screen:
')


CleverMouse wrote the functionality for duplicating the log to the screen, but I can be proud that my assembly language knowledge was enough to arrange this functionality as an option for the start screen * (before that, manual recompilation of the KolibriOS kernel was required to enable or disable this functionality often too difficult for new project users.

* We often informally call this screen " blue screen " by analogy with Windows , but, naturally, our starting screen does not have any connection with the BSOD ( " Blue Screen of Death " / " Blue Screen of Death " ) (except for color). Even more likely, it is the exact opposite of the blue screen of Windows - there the blue screen heralds the “end of life”, and in our case the contrary is about the beginning :-)

So, I asked mdickie to enable option C on the “blue screen” and attach the resulting log . What he did, only instead of a photo, he rewrote the text manually :
========= tmpdisk 0.45 ========
trying to add disk
10% of free RAM will be used, new Disksize: 50MB
operation completed successfully
K: Attach Interrupt 11 Handler 80BA2F04
Unfortunately, his answer could not help us, although the result was quite expected. The fact is that the log is displayed on the screen, but simultaneously with the drawing of other programs (for example, “icons”), and if the draw event occurs after the log output event (as it was in our case), then part of the log is simply erased in video memory, since other images are drawn on top of it (in the file, of course, the entire log is saved, but the file cannot be pulled out, as mentioned above).

Since I myself have already encountered a similar problem repeatedly, I found a solution - disabling the launch of all programs except the kernel is not guaranteed to erase the log on the screen. KolibriOS has its own Windows autoloader equivalent, or /etc/init.d Linux : after booting the kernel, it launches the LAUNCHER program, which reads one line from the AUTORUN.DAT file and runs the programs registered there (with optional parameters). Moreover, in KolibriOS, both the desktop itself, and the icons, and the background image are run from AUTORUN.DAT , and are not part of the kernel. Thus, all that was needed was to add the ability to turn off the LAUNCHER call after the kernel was loaded on the start screen. Inspired by the fact that I was able to add the option of duplicating the log to the screen, I added the option to disable LAUNCHER (under the letter D in the photo of the blue screen above).

Therefore, I asked the user to simultaneously enable log duplication on the screen and disable the LAUNCHER boot :
Unfortunately it will not help us.

Please turn on option C on blue screen . This will boot KolibriOS without displaying the debug log. Please try to make a photo this time. I don’t worry about it. It wouldn’t get them to be stuck.
This request was finally crowned with success - we were presented with a photo of the full log (below I give it in a reduced size):



The user warned me that the photo looks bad, but I wrote to him arrogantly (translated from English above): " Do not be afraid about the small print - we can disassemble it ." Looking at the photo, I realized that I underestimated the user's ability to make bad photos (or overestimated his ability to disassemble them) - the photo was specifically “blurred”, so it was almost impossible to disassemble something. I advised the user how to try to solve the hang problem (and get a text log, instead of a blurred photo), but he seemed to be tired of it, and he decided to wait until KolibriOS becomes more stable .

So, it was not necessary to expect to receive any more information from this user, and the hang problem is very desirable to solve (but for this you need to get a clear photo of the log). And then I remembered the program for recovering blurred images (the author even advertised one of them, SmartDeblur , several times on Habré).

I downloaded for trial 2 versions of SmartDeblur (the last free and last paid trial version), as well as the Blurity program found on the Internet that openly considers itself better than SmartDeblur in the comparison section :

Having played with the manual settings and using the automatic improvement method where it was, I could not get a normal result. The best photo that I had was obtained using manual adjustment in SmartDeblur v.2.2 with the following parameters:



The result is shown in the photo below (you can open the photo in a new window using PCM, and then it will open in its original size). I don’t know whether my hands are completely crooked, or all these programs in their advertisements / on the site use specially made test photos that are well restored, or this photo is from the discharge of those that no existing program can restore It cannot, but the fact remains: I could not get a good result.

UPDATE: YUVladimir (author of the SmartDeblur program) explains in the comments why all programs give poor quality: habrahabr.ru/company/kolibrios/blog/192558/#comment_6710828



Therefore, I decided to announce a contest - any Habr reader can try to improve the original blurred photo with the help of any blurred image recovery program (it’s not necessary to use one of the ones I brought - I am sure there are many more). You can post an improved photo either in the comments to this post, or on our forum in the original thread , until September 17, 2013 at 24:00 GMT. To the photo you need to attach the instruction (better screenshot), which program, which version and which settings to use in order to achieve such a result.

The top 10 photos, according to the KolibriOS developers, will be put up for voting at Habré. The author of the photo that received the most votes will be awarded with a branded USB flash drive and a KolibriOS t-shirt (including shipment to the address specified by the winner). Good luck!

Bonus - a prize of 1000 rubles to the one who first correctly tells Mario_Z how to solve the hangup problem: board.kolibrios.org/viewtopic.php?f=1&t=2343&start=120#p51072 (the decision itself is optional; only a hint is sufficient). Tips can be written both here in the comments and on our forum .

Source: https://habr.com/ru/post/192558/


All Articles