geekhack
geekhack Community => Keyboards => Topic started by: alipstadt on Mon, 14 December 2009, 01:07:29
-
So as discussed in a thread in ebay finds, I am the proud new owner of a TG3 BL82 USB keyboard. I like it much more than my Deck 82 Toxic, but I'm still keeping both. The one thing that bothers me - other than the Cherry Blacks - is the lack of a Windows Key, which I do use - a lot. Now, I'm all ready to remap Pause/Break to function as a Windows Key - which is what the Toxic, a more consumer board, does.
However, I do not need nor want this change to apply to all input devices - just this external, USB, device ID. I doubt I'm ever going to use the Pause/Break on the laptop keyboard under Windows, but I'd like to leave the inbuilt keyboard alone. (The laptop is a Fujitsu U820; google it. Really, I don't use the keyboard much.)
So my question is thus: can I remap Windows (7, 32-bit) selectively by device?
I am now thinking that in the alternative, I might be able to dump the firmware from the Toxic on to the BL82, but I have not looked at the controller boards yet...
-
I don't think that this is possible unless you would be using something like AHK (http://www.autohotkey.com/) and make a macro without actually remapping the keys and getting the hardware ID somehow...
The way most software remaps the Windows key is by writing a registry entry for the specific key. This will not work selective.
-
wait, so in linux then, you can have different maps for different keyboards?
-
AndrewZorn wrote on 5948 September 1993:
> wait, so in linux then, you can have different maps for different
> keyboards?
I don't know if there is some convenient GUI for it, but in theory, it
is possible. Each keyboard gets its own input device:
,----
| $ ls -1 /dev/input/by-id/*kbd*
| /dev/input/by-id/usb-046a_0001-event-kbd
| /dev/input/by-id/usb-04d9_1400-event-kbd
| /dev/input/by-id/usb-10d5_PS2_to_USB_Adapter_96540001-event-kbd
`----
Normally, X is configured to listen to all devices, but you can
configure it to listen to custom devices. Now a sloution would be to
write a program that slurps events from the devices above, do
device-specific translation and output the events into a fifo file the X
server is configured to read from.
Should be doable in two screenfuls of perl.
-
I don't think Autohotkey has the ability to sniff out different devices.
This does seem cumbersome, but somewhat possible:
http://www.autohotkey.com/forum/viewtopic.php?t=48238
EDIT:
; Stolen from http://www.autohotkey.com/forum/viewtopic.php?t=48238
; mutilated from joel/gwarble's code
#NoEnv
#SingleInstance, Force
#MaxHotkeysPerInterval, 999999
;#NoTrayIcon
SetBatchLines, -1
DetectHiddenWindows, On
Process, Exist
hwnd := WinExist("ahk_class AutoHotkey ahk_pid " ErrorLevel)
DetectHiddenWindows, Off
Usage = 6 ; Usage=6:kbd 2:mouse
UsagePage = 1
VarSetCapacity(dev, 12, 0)
NumPut(UsagePage, dev, 0, "UShort")
NumPut(Usage, dev, 2, "UShort")
NumPut(0x100, dev, 4)
NumPut(hwnd, dev, 8)
RawReturn := DllCall("RegisterRawInputDevices"
, "uint", &dev ; pRawInputDevices (pointer to an array of RAWINPUTDEVICE)
, "uint", 1 ; uiNumDevices
, "uint", 12) ; cbSize (size of a RAWINPUTDEVICE structure)
If (ErrorLevel or !RawReturn)
{
MsgBox, , Registering keyboard`ndevices failed.`n`nExiting..., 5
ExitApp
}
SetTimer, OnInput, -500 ; small delay in case you start app with non-default Kbd
Send, Pause
Return
OnInput:
Hotkey, Pause, Key_Pause, Off
OnMessage(0xFF, "WM_INPUT")
Return
WM_INPUT(wParam, lParam) ;=== detects raw device handle input change
{
Critical
SetBatchLines, -1
global jhDevice
VarSetCapacity(raw, 40, 0)
RawReturn := DllCall("GetRawInputData", "uint", lParam, "uint", 0x10000003
, "uint", &raw, "uint*", 40, "uint", 16, "int")
If (ErrorLevel or RawReturn = -1 or !jhDevice := NumGet(raw, 8))
Return 0
GoSub, SetInput
Return 0
}
SetInput:
If (LastDevice = "")
{
FirstKbd := jhDevice
LastDevice := jhDevice
Return
}
If (LastDevice = jhDevice or jhDevice = 0)
Return
If (SecondKbd = "")
{
SecondKbd := jhDevice
}
LastDevice := jhDevice
SetMode:
If (jhDevice = FirstKbd)
{
Hotkey, Pause, Off
}
Else
{
Hotkey, Pause, On
}
Return
Key_Pause:
SendInput, A
;SendInput, {LWin}
Return
The code is funny, though. It will treat the Pause key of the first keyboard as Pause, and not for the second keyboard.
This is to say, you must hit Pause on one keyboard first to decide that subsequently hitting pause on the second one will not send Pause.
-
You could always remap win to capslock then remap capslock to Rctrl or menu or some other somewhat useless key(depends on the user).
I do this with my 'boards even when they have windows keys because I like having it closer to the home row
-
It can be awkward if you use lots of keyboards. I standardised on mapping ScrlLock as a Windows key. That enabled me to map the Windows keys (on boards that have them) to act as special modifiers for AutoHotkey. This worked well. Until I realised my RealForce 87U doesn't have a dedicated ScrlLock key. D'oh! :doh:
-
the caps lock to control thing is what gets me...
-
Does someone try this?
http://codeninja.de/fretsmapper/