From: Brad H. <bh...@bi...> - 2002-10-08 03:13:53
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm trying to finish off my documentation, and it's down to EVIOC[G,S]KEYCODE. The problem is that I don't think I understand what the arguments are. EVIOCGKEYCODE takes a int[2], and the first int looks like it should be passed in (ie I set int[0] to some value, then call ioctl(fd, EVIOCGKEYCODE, int), and then read back the other value in int[1]). I guess that the first argument is a scancode, and the second is a keycode. However when I pass in what I think is a reasonable value (as given by showkeys -s), I'm getting -EINVAL. Example: showkey -s gives me 0x39 for a space bar held down. I assumed if I codes[0] = 0x39; if(ioctl(fd, EVIOCGKEYCODE, codes)) perror("evdev ioctl"); printf("[0]= %d, [1] = %d\n", codes[0], codes[1]); Then I would get back codes[1] == KEY_SPACE. However I get evdev ioctl: Invalid argument [0]= 57, [1] = 1073784704 Anyone familiar with this? Or can provide a hint? I guess EVIOCSKEYCODE just assignes the int[1] keycode to the int[0] scancode. I can't make that work until I understand the scancodes business more, I think. Brad - -- http://linux.conf.au. 22-25Jan2003. Perth, Aust. I'm registered. Are you? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9oktrW6pHgIdAuOMRAlfVAKCQvVThsCrOlkxIutLH/osW8hOEJgCdFiTJ 5sdLuX+KSl5K9G6P4cq/t4w= =LfXd -----END PGP SIGNATURE----- |