Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
caps/ctrl remapping on powerbook
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
senor_fjord
n00b
n00b


Joined: 10 Oct 2003
Posts: 9

PostPosted: Fri Apr 02, 2004 12:12 am    Post subject: caps/ctrl remapping on powerbook Reply with quote

I'm trying (unsuccessfully) to swap the caps and control keys on my powerbook. I'm a dvorak user, and the xmodmap I have from an x86 box works except that rather than mapping the caps to control and control to caps, it remaps them both to nothing. I'm running 2.6.3-benh2. The following are the relevant lines from my .Xmodmap file:

remove Lock = Caps_Lock
remove Control = Control_L
add Lock = Control_L
add Control = Caps_Lock

Any help would be _greatly_ appreciated.
Back to top
View user's profile Send private message
senor_fjord
n00b
n00b


Joined: 10 Oct 2003
Posts: 9

PostPosted: Mon Jul 12, 2004 7:50 am    Post subject: solved Reply with quote

Since a lot of people have viewed this thread, I figured I'd answer my own post. It requires patching the kernel source's adb driver. The resources were scattered on old debian mailing lists, so I set up http://www.spadini.net/linux_adb_caps_hack.html explaining the whole process. Enjoy.
Back to top
View user's profile Send private message
psycho8me
n00b
n00b


Joined: 10 Oct 2004
Posts: 1

PostPosted: Mon Oct 11, 2004 10:01 pm    Post subject: Reply with quote

Has anybody tried this with the newest kernel sources? I tried to patch the sources but couldn't get it to work.
The caps lock still lit up but did nothing else. The switch statement concerned seems quite different.
-David
Back to top
View user's profile Send private message
milothurston
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 231
Location: Oxford, England.

PostPosted: Wed Mar 22, 2006 3:03 pm    Post subject: Reply with quote

There's some information and a working 2.6.15 patch here:
http://www.xmission.com/~fugalh/capslock/
I applied the patch on a 2.6.15-ck7 kernel and ended up with a locking control key where the
caps lock is normally situated. If anyone has had any better results than that I'd be interested to
know what you come up with.
Back to top
View user's profile Send private message
e-ipi
Apprentice
Apprentice


Joined: 23 Aug 2005
Posts: 192

PostPosted: Wed Mar 22, 2006 5:47 pm    Post subject: Reply with quote

milothurston wrote:
There's some information and a working 2.6.15 patch here:
http://www.xmission.com/~fugalh/capslock/
I applied the patch on a 2.6.15-ck7 kernel and ended up with a locking control key where the
caps lock is normally situated. If anyone has had any better results than that I'd be interested to
know what you come up with.


Locking control key?

Does that mean that the LED stays on after you press it? That's an unavoidable consequence of the ADB hardware (ugh! Let's hope it disappears with the new macs). The problem is that pressing and releasing the caps lock key sends the same signal.

Or do you mean that once you press your new control key you get control-everything, so that hitting letters afterwards gives you C-a, C-b, C-c, etc.? That shouldn't happen.
Back to top
View user's profile Send private message
milothurston
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 231
Location: Oxford, England.

PostPosted: Wed Mar 22, 2006 5:55 pm    Post subject: Reply with quote

I mean the latter - whilst the control key LED is lit X acts as if control is being held down. I've got this in /etc/X11/xorg.conf

Code:

Option "XkbOptions" "ctrl:nocaps"


I used the 2.6.15 patch from the site I previously linked to, and it seemed to apply without any problems.
Back to top
View user's profile Send private message
e-ipi
Apprentice
Apprentice


Joined: 23 Aug 2005
Posts: 192

PostPosted: Wed Mar 22, 2006 8:28 pm    Post subject: Reply with quote

milothurston wrote:
I mean the latter - whilst the control key LED is lit X acts as if control is being held down. I've got this in /etc/X11/xorg.conf

Code:

Option "XkbOptions" "ctrl:nocaps"


I used the 2.6.15 patch from the site I previously linked to, and it seemed to apply without any problems.



Here's the relevant section of drivers/macintosh/adbhid.c. It should look something like this.

Code:

   struct adbhid *ahid = adbhid[id];
   int up_flag;
/* begin hack */
#ifdef CONFIG_ADBHID_CAPSLOCK
   /* HACK to fix caps-lock on Powerbook and iBook keyboards */
   static int caps_lock_state = 0x0;
   switch (keycode) {
   case ADB_KEY_CAPSLOCK:
      /* this is where the led transitions to on */
      caps_lock_state = 0x3;
      break;
   case 0x80 | ADB_KEY_CAPSLOCK:
      /* this is where the led transitions to off */
      caps_lock_state = 0x0;
      break;
   case 0xff:
      switch (caps_lock_state) {
      case 0x3: /* led on, key released */
         caps_lock_state = 0x2;
         keycode = 0x80 | ADB_KEY_CAPSLOCK;
         break;
      case 0x2: /* led on, key pressed */
         caps_lock_state = 0x1;
         keycode = ADB_KEY_CAPSLOCK;
         break;
      /* these last two cases are spurious 0xff events.
       * log and ignore them.
       */
      case 0x0: /* led off, key pressed */
      case 0x1: /* led off, key released */
         printk(KERN_INFO "Spurious caps lock event (scancode 0xff).");
         break;
      }
      break;
   }
#endif /* CONFIG_ADBHID_CAPSLOCK */


   up_flag = (keycode & 0x80);
   keycode &= 0x7f;

   switch (keycode) {
#ifndef CONFIG_ADBHID_CAPSLOCK 
   case ADB_KEY_CAPSLOCK: /* Generate down/up events for CapsLock everytime. */
      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;
#endif
#ifdef CONFIG_PPC_PMAC
Back to top
View user's profile Send private message
milothurston
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 231
Location: Oxford, England.

PostPosted: Wed Mar 22, 2006 11:31 pm    Post subject: Reply with quote

I appear to have the same code. I've put the entire adbhid.c file here, should anyone wish to check it:
http://www.gvurrdon.demon.co.uk/adbhid.c
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum