On Thu, 24 Nov 2016 15:33:41 +0300 Vasiliy Tolstov <[email protected]> wrote:
> I need to pass to qemu monitor key number to simulate keypress. > If i use utf8 package and decode characters (runes) from string i get > for example for char c code 99, but for qemu i need char number 46. > Does somebody already create package that get scancodes for chars (as > i understand ascii codes) this is very helpful, or maybe somebody > knows how to convert? I'm afraid you're confusing different matters here. Scan codes is what keyboard of a particular H/W architecture (say, "an IBM/PC-compatible personal computer") sends over the wire to its host controller, and what it passes up to the keyboard driver. The scan codes do indeed have bearing on certain textual characters in the sense a corresponding glyphs are painted on the keys generating particular scan codes. That's why when you configure your keyboard in your OS, you pick what its "model" is -- that is what scan codes it's able to generate, -- and what "layout" it uses -- that is, how the scan codes map to characters the user intends to be input when they strike various keys on their keyboard. As you can see, the scan codes only exist between keyboards and their drivers, and Unicode code points of which abstract text (as stored and transmitted) is comprised have no bearing on scan codes. That's true not only for Unicode but for any other existing charset. I think you could google for something like "IBM/PC keyboard scancodes" to get a list of them and then create a simple package mapping typical QWERTY USA layout for a PC-105 keyboard to the scan codes. Looks like that should be enough for the task. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
