On Tue, May 24, 2011 at 07:39:22PM +0200, David Christen wrote: > >> > >> Dear Dmitry, > >> > >> I'm starting to feel stupid. I tried a simple code doing some ioctl > >> calls using EVIOCSKEYCODE and EVIOCGKEYCODE. But it does not appear > >> to work. If I run it using ./ioctl-test /dev/input/event0 I get lots > >> of complains about wrong arguments: > >> > >> ==== > >> evdev ioctl: Invalid argument > >> [0]= 125, [1] = 0 > >> evdev ioctl: Invalid argument > >> [0]= 126, [1] = 0 > >> evdev ioctl: Invalid argument > >> [0]= 127, [1] = 0 > >> evdev ioctl: Invalid argument > >> [0]= 128, [1] = 0 > >> evdev ioctl: Invalid argument > >> [0]= 129, [1] = 0 > >> evdev ioctl: Invalid argument > >> Testing changes > >> evdev ioctl: Invalid argument > >> [0]= 49, [1] = 49 > >> evdev ioctl: Invalid argument > >> [0]= 50, [1] = 49 > > > > The "scancode" for USB HID devices is full usage code (32 bit), so to > > remap 'M' to 'N' I think you need to issue EVIOCSKEYCODE for > > usage 0x00070010 (I think) and keycode 49 (KEY_N). > > > > BTW, this requires somewhat recent kernel. What kernel are you using? > > > Dear Dmitry, > > So you mean it should say: > > codes[0] = 0x00070010 ; /* M keycap */ > codes[1] = 49; /* assign to N */ Yes. > > if(ioctl(fd, EVIOCSKEYCODE, codes)) { > perror("evdev ioctl"); > } > > > > P.S. In your program you call EVIOCSKEYCODE twice. I believe the 2nd > > time, when you test, you want to call EVIOCGKEYCODE. > > > > > > Yes, you were right. Please find the corrected file attached. > > But it seems that the behavior is exactly the same. > > The kernel I use is 2.6.33 . It's a debian distro running on a risc processor. I am afraid you need 2.6.38. Or you'll have to backport the following commits: 8613e4c Input: add support for large scancodes ab4e019 Input: define separate EVIOCGKEYCODE_V2/EVIOCSKEYCODE_V2 de391d1 Input: fix typo in keycode validation supporting large scancodes a0bf0ea Input: hid-input - switch to using new keycode interface f5854fa Input: hid-input - allow mapping unknown usages -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html