Thread (46 messages) 46 messages, 7 authors, 2006-01-14

Re: [PATCH/RFC?] usb/input: Add support for fn key on Apple PowerBooks

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2006-01-13 22:05:11
Also in: lkml

On 1/13/06, Benjamin Herrenschmidt [off-list ref] wrote:
quoted
That should be "MODULE_PARM_DESC(pb_fn_mode, ...)". Also, since this is
for compatibility with ADB, why do we have 3 options? Doesn't ADB have
only 2?
No, the ADB keyboard can operate in 2 modes that can be set with a PMU
command, I forgot about that in my earlier comments. In one mode, you get
the "special" behaviour by default on the Fx keys and you get Fx when
pressing Fn-Fx, and in the other mode, you get the Fx by default and the
special behaviour when pressing Fn-Fx.
Right, so do we need "no translation, fnkeyfirst and fnkeylast" option
or just "fnkeyfirst and fnkeyast"?
quoted
quoted
+static inline struct hidinput_key_translation *find_translation(
I thought is was agreed that we'd avoid "inlines" in .c files?
Ah ? I have certainly missed that discussion ...
Newer GCCs, unit-at-a-time, etc. etc. - teher was pretty long
discussion about letting GCC decide on inlining.
quoted
quoted
+   struct hidinput_key_translation *table, u16 from)
+{
+   struct hidinput_key_translation *trans;
+
+   /* Look for the translation */
+   for(trans =3D table; trans->from && (trans->from !=3D from); tran=
s++);
quoted
quoted
+
+   return (trans->from?trans:NULL);
+}
I'd prefer liberal amount of spaces applied here </extreme nitpick mode=

Me too :)
quoted
quoted
+           try_translate =3D test_bit(usage->code, usbhid_pb_numlock=
)?1:
quoted
quoted
+                           test_bit(LED_NUML, input->led);
+           if (try_translate) {
Isn't this the same as

              if (test_bit(usage->code, usbhid_pb_numlock) || test_bit(=
LED_NUML, input->led))
quoted
but harder to read?
No. If the first one is 0, the second one will not matter in the first
version, while it will in yours.
Huh? You mean 1, right?

    try_translate =3D 0;
    if (test_bit(usage->code, usbhid_pb_numlock))
         try_translate =3D 1;
    else if (test_bit(LED_NUML, input->led))
         try_translate =3D 1;
    else






Ben.


--
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help