Keyboard input...How do I get keys?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
damn! this is veryveryvery weird ... maybe you should check it has no problem with compiling/linking/loading (for instance, print your array on the screen in the kernel or something alike ...
another trick would be to enter it as a string (" 1234567890-qwertyuiop ...")
another trick would be to enter it as a string (" 1234567890-qwertyuiop ...")
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
does this have chances to work ?? the [ESC] key has scancode #1, so i don't see where this will lead ...abless wrote: try
char *keymap[] = {NULL, '1', ...};
Now something you should take care of is to map only key presses (not key releases ), thus something like
if (scancode & 0x80) {
// the key is released
} else {
putch(keymap[scancode]);
}
I also suggest you search in previous post, there was some explaination of how to handle extended scancodes (grey keys) like print screen, pause, num lock, etc. which have a 0xe0 prefix (if i remember well
Re:Keyboard input...How do I get keys?
Code: Select all
char *keymap[] = {NULL, '1', ...};
This here should work:
Code: Select all
char keymap[][2]={
{NULL, NULL},
{ESC, NULL},
{'1', '!'},
.
.
};
Re:Keyboard input...How do I get keys?
;D Ok, Got my scancode to work, ( all the stuff you posted didn't help )
Now, all I have to do is work on the shifted keys, and release the code.
To all the people who want the code, it should be in
./include/keys.h
Now, all I have to do is work on the shifted keys, and release the code.
To all the people who want the code, it should be in
./include/keys.h
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
now, how do I do shift?
I have all the keys for non-shifted and shifted defined, now just need to know how to detect a shift key is pressed when a letter or num is pressed.
How?
I have all the keys for non-shifted and shifted defined, now just need to know how to detect a shift key is pressed when a letter or num is pressed.
How?
Re:Keyboard input...How do I get keys?
I cannot find your include/keys.h. Where is it?
Answer to your question:
Check if the key press is the SHIFT key:
Answer to your question:
Check if the key press is the SHIFT key:
Code: Select all
void kbd_handler(void)
{
int scan = scan_keyboard();
int key;
static int shift = 0;
if (scan == LSHIFT || scan == RSHIFT)
{
shift = 1;
return;
}
if (shift)
key = keymap[scan][1];
else
key = keymap[scan][0];
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
oooh ... right . sorry, i didn't see you had a char* [] ... i thought it was a char []
Re:Keyboard input...How do I get keys?
I didn't release pk0.7 yet, that's why you can't fine the keys file
I'll try the code, if it works i'lll release pk0.7
Thank you,
I'll try the code, if it works i'lll release pk0.7
Thank you,
Re:Keyboard input...How do I get keys?
DUH forgot to use inportb :-[
trying abless's code now
trying abless's code now