NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » how to update keymap.h for ps/2 keyboard project?
November 15, 2010 by kle8309 |
How do I go about to add more scancode to the keymap.h. I have found all the scancode for all the keys but just don't know how to mod the python code so that it can generate a new keymap.h by the way, what do these two lines means, is the sys.argv[1] supposed to be the font.txt import sys f = open(sys.argv[1]) |
---|---|
November 15, 2010 by hevans (NerdKits Staff) |
Hi kle8309, The keymapper.py script uses font.txt to generate the keymap.h file. You can update the keymap.h file by adding new scancode/character pairs to font.txt, then running
keymapper.py takes the font file in as an argument, which is the reason for the use of the sys module. sys.argv in a python script is the list of arguments that were passed into the script. sys.argv[0] is the name of the script and sys.argv[1] etc. are arguments used in order. Check out the python sys module documentation for more. In the case of keymapper.py it expects the argument to be a file in the same directory that it just opens and reads line by line. You can make a new font.txt file with a different name and then just pass in that name if you desire. Humberto |
March 28, 2011 by kle8309 |
What if the scan code is E075 (up arrow) would that change everything? |
March 28, 2011 by hevans (NerdKits Staff) |
Hi kle8309, The arrow keys throw out extended scan codes, so basically two bytes get sent by the keyboard 0xE0 first then 0x75. For the break it first sends 0xE0, then 0xFO (the break code), then 0x75. The current code is not written to handle this, but adding the functionality would be a great exercise. Humberto |
Please log in to post a reply.
Did you know that interrupts can cause problems if you're not careful about timing and memory access? Learn more...
|