2 days ago, I would have said it wasn't possible. I use a gamepad (Logitech Rumblepad2) that can have 22 buttons (the software lets you designate one to act as a Shift key), still not nearly enough. Then I followed spud42's link:
some PS3 controller links and joystick adjusting threads
and discovered Xpadder. The help topic on "Advanced assignments: Combinations, sequences, timing and distance" starts:
Each button has an infinite number of slots. ..
It rated a closer look and, in a word, wow!
There's a bit of a learning curve but it's worth it. It supports upto 8 'sets', which are groups of button assignments. I only need 3 for oolite. One for flight, the 2nd is a 'shift' set like I had before and the third for use when docked. (It could possible be done in just 2 sets)
The real magic, though, is in those "infinite number of slots". You can program buttons to do almost anything you want. I've only just started but
- a single button for cargo: I tap it to cycle thru my manifest, hold it down to dump that cargo
- another I tap for ECM, hold to cycle weapons on/off
- my pause button pulls up the comms log before pausing
- my Shift button also has a sequence to execute when it's just tapped (the button had no other function in Logitech's profiler)
So, in just a single set, each button can have 2 uses: high priority ( tap it ) & low priority ( hold it ).
The joysticks/D-pad can be configured 6 different ways. Eg. on a secondary set, you could give a stick a 90% dead zone and gain 8 buttons (arrow keys, PgUp, PgDn, Space & Enter for use when docked).
I'm still learning what all it can do but why not check out:
Spoiler: there is no demo/trial. It'll cost you $10 for a lifetime licence.