Open titibandit opened 3 years ago
Ok so I found out about the enable
command, which enables my devices and allows me to then query for keys and add actions etc...
Then, the devices will be automatically enabled next time we start imodd, since it's retained in the configuration. I'm not sure why I need to enable devices on my laptop but anyway.
Now, when I add an action, it successfully disables the original functionality of the key, but it doesn't trigger the new ones :( It basically completely disables the key.
I'm trying the remap the 3 "trackpoint keys" that you have on thinkpads (the ones between the keyboard and the touchpad). These are the keys that acts as mouse buttons and are supposed to be used when you use the trackpoint.
So it's progress, but I'm not there yet!
Time to fix this. Thank you for reporting!
I'm not sure why I need to enable devices on my laptop but anyway.
The reason for this is because we don't want to grab every device right off the first launch (it would break things and add overhead to e.g. cameras and mistaken devices).
Now, when I add an action, it successfully disables the original functionality of the key, but it doesn't trigger the new ones :( It basically completely disables the key.
Hmmm... May you please do listbinds <device>
? (replace <device>
with the device number)
I've actually just noticed that the enabling of devices is covered in your docs. So the issue name is now kinda misleading... thanks for the explanation anyway!
I get this:
> listdevices
0: Integrated Camera: Integrated C
1: TPPS/2 IBM TrackPoint
2: Synaptics TM3053-004
3: ThinkPad Extra Buttons
4: AT Translated Set 2 keyboard
Ready.
> listbinds 1
bound keys:
- BTN_LEFT
Ready.
> listactions 1 BTN_LEFT
0: key: KEY_A
Ready.
The action seems to have been correctly set?
I'm observing the same thing when trying to bind a button of my Logitech G400 mouse (BTN_SIDE) to a button (KEY_LEFTALT). So this seems to happen with BTN keys?
Hey @tildearrow, I went ahead and tried to debug the problem. And I'm pretty sure I know what the issue is. It's that part in device.cpp:
// copy evbits
for (int i=0; i<EV_CNT; i++) if (evcaps[i]) ioctl(uinputfd,UI_SET_EVBIT,i);
if (evcaps[EV_KEY]) for (int i=0; i<KEY_CNT; i++) if (keycaps[i]) ioctl(uinputfd,UI_SET_KEYBIT,i);
if (evcaps[EV_REL]) for (int i=0; i<REL_CNT; i++) if (relcaps[i]) ioctl(uinputfd,UI_SET_RELBIT,i);
if (evcaps[EV_ABS]) for (int i=0; i<ABS_CNT; i++) if (abscaps[i]) ioctl(uinputfd,UI_SET_ABSBIT,i);
if (evcaps[EV_MSC]) for (int i=0; i<MSC_CNT; i++) if (msccaps[i]) ioctl(uinputfd,UI_SET_MSCBIT,i);
if (evcaps[EV_SW]) for (int i=0; i<SW_CNT; i++) if (swcaps[i]) ioctl(uinputfd,UI_SET_SWBIT,i);
if (evcaps[EV_LED]) for (int i=0; i<LED_CNT; i++) if (ledcaps[i]) ioctl(uinputfd,UI_SET_LEDBIT,i);
if (evcaps[EV_SND]) for (int i=0; i<SND_CNT; i++) if (sndcaps[i]) ioctl(uinputfd,UI_SET_SNDBIT,i);
From my limited understanding, this copies the "capabilities" of the original device, to the mapped device. Since my mouse is never supposed to output the event KEY_A, it's not one of them, and mapping a button to that event using imod
won't work.
However, if I (dirtily) add this line:
ioctl(uinputfd,UI_SET_KEYBIT, KEY_A);
Then my mouse (and all the other mapped devices for that matter) will be able to output the KEY_A event, and that indeed works.
I have absolutely no idea where to begin with, if I were to implement a clean solution to that issue, but hey, at least we know where it comes from :)
Hey :) Good job for the program. it's suuuuper useful! It works perfectly on my desktop, however, on my Thinkpad, I have a problem when I try to use
whichkey
to find out about the keys.I get for every single device
error: that device isn't enabled
These are my devicesOther than that, all the output from
imodd
is exactly the same compared to my working copy on my desktop.Do you know what it could be? What can I do to debug this further? Cheers!