Remapping The Mouse Buttons, Etc?


Mr Loon said:
tsh said:
OK, when you find out anything useful, make a note here:
http://pandorawiki.org/Keyboard_remapping

(This contains nothing new yet, but it's a common question and i hate trawling the forum to find something I think I saw in the past)

Nice one tsh, really like the idea of having this as a wiki page.

Just wondering where you heard that 'currently only the nubs (or an external mouse) will generate mouse button events, and this is not trivial to change (for a user).'

Not disputing the fact but if there is a reason attached to that statement it might help with the quest for the remappable mouse button.
By reading the source code, and making some guesses. Also guessing that others might have googled for anything simple (i.e. in the user domain of linux). My assumption is that if the keyboard is to generate mouse events, the gpio_keys driver needs to be extended to advertise to the kernel that it includes a mouse device. It's probably not difficult, but requires more than just merging the code from these drivers:
http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blob;f=drivers/input/misc/vsense.c (nubs)
http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blob;f=drivers/input/keyboard/gpio_keys.c (keyboard)

I've not spent any time reading these, or looking into the underlying kernal stuff they hook into, I'm more interested today in playing with the charging stuff - but I can try and help with some pointers.
 
Last edited by a moderator:
Well that sounds like it's well out of my league, I'm only a 1st level geek after all. :rolleyes:

It would be really nice if ED or one of the guys who worked on the firmware / OS could confirm or deny that it would take some serious technical knowledge to remap the mouse buttons to the shoulder / ABXY buttons.

Here's hoping we'll be able to do it one day.
 
Okay, this is workaroundable without any kernel changes, but it's not 100% pretty (I'm only reporting in a "this is how it works for me"). Somebody dropped some info on the mousekeys feature on this or the another remapping thread, so this is the feature we're going to abuse. I wanted shoulders (L&R) as mouse buttons, so adjust accordingly. .pndXmodmap needs these lines (for mapping L = left mouse click, R = right mouse click, adjust keycodes if you want to use other keys, look up the keycode with eg. xev):
Code:
keycode 62 = Pointer_Button1 NoSymbol Pointer_Button1
keycode 105 = Pointer_Button3 NoSymbol Pointer_Button3
It'd be nice if you insert these to the appropriate numerical positions (or modify already existing lines with those keycode numbers, if you already have them mapped to something).
And note that these wont work out of the box, they're used only if the mousekeys feature is enabled (normally used for normal keyboard numpad = mouse). After "applying" the changes to the .pndXmodmap (reboot or logout+login might work...), you can fast test your mapping by opening the XFCE Accessibility settings and enabling mouse keys. There is still a little problem as in by default there is a timeout after which the feature (if unused) will be disabled, and the default enable trigger is something related to NumLock (i dont recall exactly). Since the pandora has no numlock key, and we dont want to waste a key, we need a way to disable the timeout. If it timeouts you can "workaround" by going to the Accessibility settings and flipping the checkbox on->off->on, but there exists a little utility called xkbset that can disable the timeout, but it isnt in Ångström repos (quite forgotten tool...). With all the stuff I had installed on my SD card system compiling it was a single call to make, so the compiled binary is http://urjaman.dyndns.info/xkbset <- there, it doesnt seem to need any special libraries, so I would guess it works on a standard OS.
Drop that to /usr/bin and make it executable. Then write a script like this (name and location is upto you):
Code:
#!/bin/sh
xkbset m
xkbset exp =m
Then add that script to the XFCE autostarted stuff (Session and Startup->Application Autostart), and you should have always enabled mousekeys feature.

EDIT:
Alternative instructions (for gaming buttons instead of shoulders) and xkbset download URI by zx-81 http://www.gp32x.de/board/index.php?/topic/54073-the-one-nub-club/page__view__findpost__p__905644 <- in that post.
 
Last edited by a moderator:
Thank you urjaman.
I did what you posted, and now I'm left clicking and right clicking the mouse with the L and R buttons!!!

I'll let you all know if this times out or anything.

I am psyched!
Using the right nub for moving the mouse pointer.
I was getting really tired of trying to use the oversensitive analog nub for discrete click commands.

Woo Hoo!

Edit:
Well, it does time out, and I run sudo xkbset m in terminal, and it resets for awhile.
I didn't make the script up, as shown, just ran the commands in terminal.
Is there something about the script which makes the mousekeys persistant?
 
Urjaman, you da man.

Many thanks for this, it'll be the first thing I try out when I get my Pandora back from being repaired.
 
j.pickens said:
Well, it does time out, and I run sudo xkbset m in terminal, and it resets for awhile.
I didn't make the script up, as shown, just ran the commands in terminal.
Is there something about the script which makes the mousekeys persistant?
You dont need to sudo it, it might not even work if sudo'd. xkbset exp =m is the line that disables the timeout (xkbset m enables the mousekeys feature). And you get persistant timeout disabling by putting the script to be autostarted when you log in.
 
Last edited by a moderator:
urjaman said:
You dont need to sudo it, it might not even work if sudo'd. xkbset exp =m is the line that disables the timeout (xkbset m enables the mousekeys feature). And you get persistant timeout disabling by putting the script to be autostarted when you log in.
You are correct, leaving out the sudo works.
However, what is different about putting it in the autostart script which will prevent it from timing out?
Thanks,
j.
 
Last edited by a moderator:
j.pickens said:
However, what is different about putting it in the autostart script which will prevent it from timing out?
(I feel like bending stuff out of iron wire here, but here goes nothing...) By default (upon X start, that is) the default is a timeout of some minutes* (actually mousekeys are disabled by default, but if enabled), so the driver doesnt remember a thing, XFCE Accessibility settings will enable the feature upon login (if you crossed the box), but it will not touch the timeout (I think the GUI is lacking a feature here, meh); If you _dont_ run the script after X start it _will_ timeout, how simple logic is that? Of course you can run the script manually each time you login, but why when you can autostart?

*(I could check the sources but I'm too lazy to go out googling now)
 
Last edited by a moderator:
Back
Top