Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newbie, How to rewire keys on second BT keyboard (numpad)? (AHI related) #115

Open
PeterP1975 opened this issue Aug 30, 2024 · 6 comments
Open

Comments

@PeterP1975
Copy link

Hi,
Sorry for asking on this forum, I know its AutoHotInterception related, but maybe its possible to make it in Capsicain only???

Setup: 2 BT devices: K380 logitech keyboard, 2nd is numpad from China that sends wrong keycodes (Keycodes 0-9 = the same in logitech keyboard number row). Lack of proper keycodes on numpad made me to remap numpad keys to proper ones: Numpad1, Numpad2 instead of 1, 2 etc. No changes to K380 logitech keyboard.

So far i have:

#SingleInstance force
Persistent
#include Lib\AutoHotInterception.ahk

AHI := AutoHotInterception()

keyboardId := AHI.GetKeyboardIdFromHandle("HID{00001124-0000-1000-8000-00805f9b34fb}_VID&000204e8_PID&7021&Col01")
AHI.SubscribeKeyboard(keyboardId, true, KeyEvent)

return

WHAT NEXT?
How to remap, i only have isolated keyboard (numpad) number.. OR How to rewire numpad keyboard using Capsicain??
Cheers
Peter

@cajhin
Copy link
Owner

cajhin commented Aug 30, 2024 via email

@PeterP1975
Copy link
Author

Hi, apologies for my delay

Unfortunately there are my device ids (connected via BT):
dev id numpad hid{00001124-0000-1000-8000-00805f9b34fb}_vid&000204e8_pid&7021&col01 - this one must be rewired
dev id K380 hid{00001124-0000-1000-8000-00805f9b34fb}_vid&0002046d_pid&b342&col01
and they both have the same substring: 00001124, vid and pid are different

I'd like to add that i have LWin::F24 on K380 but in AutoHotkey.ahk config file (is run by capsicain).

Any thoughts on:

  1. How to rewire keys on numpad with the same substring as K380 (vid & pid different)
  2. Next question: Maybe all should be rewired by capsicain.ini (I mean Lwin to F24 - on K380, not only certain keys on numpad). Lwin remapped to F24 behaves strangely when rewired on upper level than driver level (I mean rewired via AutoHotkey.ahk). In Blender i cannot use rewired to F24 key (used similarly as Ctrl, Shift - as a modifier key) with certain letter keys. I ASSUME that Windows shortcuts interfering with Blender shortcuts.

So i think all should be rewired by capsicain.ini. Lwin to F24 on K380 keyboard AND certain keys on numpad.

How to do it?

CONFIG capsicain.ini
GLOBAL StartInTraybar
GLOBAL startAHK
[CONFIG_1]

CONFIG AutoHotkey.ahk
#Requires AutoHotkey v2.0
LWin::F24

Cheers
Peter

@cajhin
Copy link
Owner

cajhin commented Sep 2, 2024

  1. you can use any unique substring from the device id, like "000204e8_pid" or "7021"
  2. sorry capsicain can't do what you want. You cannot put the definitions for both devices into one config, because keyboard and numpad send the same key events (plain numbers), so you can't define different results for these keys.
    When you use two configs, one per device, then you'd have to switch them manually. There is no "autoswitch config on device change". A feature I might implement one day...
    The OPTION includeDeviceID limits the config to one specific device, and will ignore the other one.

For your keyboard, you would want an ini like

GLOBAL StartInTraybar
GLOBAL startAHK

[CONFIG_1]
OPTION ConfigName myKeyboard
OPTION includeDeviceID b342
REWIRE LWIN F24

...but that of course ignores your numpad. Not sure what F24 is supposed to do for you.
I guess that Blender gets its key events from a lower level, which might not work with AHK. That's one of the reasons I made capsicain. I've used Blender and it generally worked with capsicain. Might be that 3D navigation with keys is choppy, if you use anything other than REWIRE for the navigation keys (I don't know, I gifted myself a 3dConnextion Space Mouse, which is very cool :)

@PeterP1975
Copy link
Author

F24 in my case should work as another modifier key (like ctr, shift, alt). Blender compared to eg 3ds Max has a lot of keybindings (I mean A LOT - with new Blender 4.2 extension platform for example letter "t" has 26 bindings and this is not an exception "r"is about 27..)
Another thing: 2 BT HID devices: I needed Numpad to be on the left side of the keyboard. Right side Numpad's location is totally useles as my right hand uses mouse, my left hand uses left located numpad and BT keyboard.

Anyway:
cajhin = God Like Person

My config now:
GLOBAL StartInTraybar
GLOBAL startAHK

[CONFIG_1]
OPTION ConfigName K35
OPTION includeDeviceID pid&7021&
REWIRE 1 NP1
REWIRE 2 NP2
REWIRE 3 NP3
REWIRE 4 NP4
REWIRE 5 NP5
REWIRE 6 NP6
REWIRE 7 NP7
REWIRE 8 NP8
REWIRE 9 NP9
REWIRE 0 NP0
REWIRE , NP,
REWIRE . NP.
REWIRE = F13
REWIRE TAB NUMLOCK
REWIRE RET NPRET

Numpad keys works flawleslly (Blender reads it properly).
Issues:

  1. As You see I used key labels from Numpad rather than it's keycodes to rewire (trial & error). I assume that capsicain reads keycodes not quite right. (the same with Monitor.ahk, but different keycodes)
  2. There are some strange keys on this China piece of ... (Numpad I meant): for example HOW to rewire double 0 key ("00" - there is separate "00" key: pressing it once causes double "0" action) to for example ctrl (Yes: new Blender extension adds new custom orientation and its binded to Numpad 0-9 keys WITH a modifier key). I read manual and I understood nothing, too technical for me, especially combos and MOD keys.

??

@cajhin
Copy link
Owner

cajhin commented Sep 4, 2024 via email

@PeterP1975
Copy link
Author

I'll rewire something elsethan "00" eg "," (as a modifier key: shift, alt, ctrl) which it's not present in normal numpad.
This thing i mean numpad is called K35 from 198i brand. Has 2xBT + 2,4G connector, quite good scissor keys. But software part, o my... It's like that scene from M.A.S.H series. One of main characters ordered a pinstripe suit (suit with stripe pattern) from korean tailor. And suit is done, good material, nice fashion but stripes are not from top to bottom but horizontal:)

Anyway
Now numpad is doing what is supposed to, mostly. Keystrokes are fast as hell. Next time I'll try autohotkey, but syntax, i do not understand it, i am not a programmer.

About layers concept. As far as I understand, I suppose to switch to another set of keys called a "layer" by pressing special key, then use for example "q" instead of "w". From an ergonomic point of view it's a complication. I'd rather want to have all my commands in one layer, that is why i needed "Win" key remapped to "F24" (now it is done by AHK) to use it as a modifier key (like eg another "ctrl") to fit all commands in one set of keys. Look at Blender s
Obsidian_wGQAz4flDT
hortcuts in Obsidian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants