[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using caps_lock as control in iBook G4



On Thu, Nov 11, 2004 at 12:05:39AM +0100, Jose A. Ortega Ruiz wrote:
> 
> hi. i've just installed sid on a new ibook G4 12''. i wanted to use
> ctrl:nocaps in my XFree86 config, but the caps_lock key reports a
> 'release key' event immediately after pressing it (without actually
> releasing it) and, well, it doesn't work... is there any workaround?

You can use the following patch:

--- adbhid.c    2004-08-24 10:03:49.000000000 +0300
+++ ../../../patches-2.6.7/adbhid.c     2004-09-01 13:52:10.431807503 +0300
@@ -166,16 +166,43 @@
        struct adbhid *ahid = adbhid[id];
        int up_flag;
 
+#if 1
+       static int caps_lock_down = 0;
+#endif
+
+#if 1
+       if (1) {
+               switch (keycode) {
+               case 0x39:
+                       caps_lock_down = 1;
+                       break;
+               case 0xff:
+                       if (caps_lock_down) {
+                               caps_lock_down = 0;
+                               keycode = 0xb9;
+                       } else {
+                               keycode = 0x39;
+                       }
+                       break;
+               }
+       }
+#endif
+
        up_flag = (keycode & 0x80);
        keycode &= 0x7f;
 
        switch (keycode) {
        case ADB_KEY_CAPSLOCK: /* Generate down/up events for CapsLock everytime. */
+if (0) {
                input_regs(&ahid->input, regs);
                input_report_key(&ahid->input, KEY_CAPSLOCK, 1);
                input_report_key(&ahid->input, KEY_CAPSLOCK, 0);
                input_sync(&ahid->input);
                return;
+} else {
+               break;
+}
+
 #ifdef CONFIG_PPC_PMAC
        case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */
                switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO,

-----------------------------------------------------------------------------------

Recompile your kernel and reboot

-- 
Jesus Climent                                      info:www.pumuki.org
Unix SysAdm|Linux User #66350|Debian Developer|2.4.27|Helsinki Finland
GPG: 1024D/86946D69 BB64 2339 1CAA 7064 E429  7E18 66FC 1D7F 8694 6D69

I'll see my lawyer about this as soon as he graduates from law school!
		--Rufus T. Firefly (Duck Soup)



Reply to: