Raw access to keycodes/scancodes from userspace?
Is there an interface whereby a userspace program can retrieve the raw keycodes/scancodes from a keyboard? I'm trying to make something in the way of a piano keyboard, and I need to know when keys are pressed (possibly simultaneously), and when they are released.
|
Quote:
http://www.linuxquestions.org/questi...1/#post3956458 and here too: http://www.faqs.org/docs/Linux-HOWTO...-HOWTO.html#s1 |
Quote:
|
Quote:
|
Quote:
|
Quote:
http://linux.die.net/man/1/kbd_mode Check out the following links too (but after the first one): http://gunnarwrobel.de/wiki/Linux-an...oard.html#sec5 and http://gunnarwrobel.de/wiki/Linux-an...oard.html#sec5 |
you could
keyboard() { fd=open(/dev/null); read(fd) } |
Quote:
* It is an external program (I would like a library function or system call I can call from within a program), and * As far as I can tell, Its action would be global (if I suspend my program, I'd like to be able to type correctly). Is there a library function or system call that replaces this functionality? |
Quote:
|
Quote:
Note: You should try searching Google before asking questions and then tell exactly what you found and how that was not helpful ! |
Quote:
I stay in console mode, switching back and forth between virtual terminals, and I don't want ALL my keyboard input to be in keycode mode. Also, I just checked, and I don't have kbd_mode. :( If there's no library function to replace that functionality, is there somewhere I can get kbd_mode? |
Quote:
Name your distribution ! |
Quote:
I mean that to open a device file of keyboard with the system call "open" and read data from the file,when a key is pressed or released the event have been save into the struct input_event this is defined in /usr/include/linux/input.h. else some key code and input event defined in it the define is following struct input_event { struct timeval time; _u16 type; _u16 code; _u32 value; }; a simple example: struct input_event ie; memset(&ie,0,sizeof(struct input_event)); int fd=open("/dev/input/event0",O_RDONLY); read(fd,&ie,sizeof(struct input_event)) switch(ie.code) { case KEY_ESC: exit(0); break; case KEY_F1: .....//your code break; ........ default: printf("No key pressed\n"); } the above code may be take mistake too :-) |
Quote:
|
Quote:
Code:
anisha@linux-dpjj:~> which kbd_mode Check which package/RPM/DEB/tar etc is needed for Puppy Linux for keyboard programming ! |
All times are GMT -5. The time now is 08:42 AM. |