[quoted lines by Samuel Thibault on 2018/11/02 at 23:46 +0100] >> Can you give or refer to a short example? > >I don't have anything immediately available. Perhaps Dave has something.
The only example code I have is what's in brltty's Linux screen driver. I'll be glad to explain it, though. You want to be using at least a 4.19 kernel because it has the new vcsu devices. Using 4.18 or earlier maens that you'd need to use some rather complex code to back translate font positions to Unicode characters. You need to open two devices - the vcsu device you need, and its corresponding vcsa device. You only need to be concerned with the first four characters returned by the vcsa device, which are a ehader that contain: 0: the number of rows on the screen 1: the number of columns on the screen 2: the zero-origin column number where the cursor is 3: the zero-origin row number where the cursor is The vcsu device contains four-byte Unicode characters, one for each character on the screen. They're rendered in whole rows, so first all the characters on the first row, then all the characters on the second row, etc. Here's an example that illustrates all of this. To read the character where the cursor is, you'd do this: uint8_t header[4]; read(vcsa, header, sizeof(header)); off_t offset = ((header[3] * header[1]) + header[2]) * sizeof(character); wchar_t character; read(vcsu, offset, sizeof(character)); You should use poll() to wait for changes to the screen content. -- I believe the Bible to be the very Word of God: http://Mielke.cc/bible/ Dave Mielke | 2213 Fox Crescent | WebHome: http://Mielke.cc/ EMail: [email protected] | Ottawa, Ontario | Twitter: @Dave_Mielke Phone: +1 613 726 0014 | Canada K2A 1H7 | _______________________________________________ This message was sent via the BRLTTY mailing list. To post a message, send an e-mail to: [email protected] For general information, go to: http://brltty.app/mailman/listinfo/brltty
