Xboxdrv "windows/super" key EV_KEY name - linux

I want to map windows/super keyboard key in my xboxdrv config but KEY_SUPER or KEY_WINDOWS doesn't work. what is the EV_KEY name of the "super" key? (I mean key with windows logo on many keyboards)

Either KEY_LEFTMETA or KEY_RIGHTMETA.
You can find it out using evtest, for example:
$ evtest /dev/input/event1
Once you press the button you are looking for, you should see something like this:
Event: time 1477389229.423141, type 1 (EV_KEY), code 126 (KEY_RIGHTMETA), value 1

Related

Mapping device input event codes to new event codes

I am currently trying to restore an old arcade machine, and I'm running into issues with interpreting the events from the usb controller. In particular, the controller is sending the event code 1:300 (EV_KEY:300), but unfortunately 300 is not a valid event code. Because of this, I am unable to get it to work with the arcade software that I am using.
What I'm looking to do is run a process that intercepts the 1:300 events and turns them into some other type of event. For example, every time I press the joystick, I may want it to be interpreted as 1:194 (EV_KEY:KEY_F24).
Any idea how to do this?
Output from evtest:
Event: time 1669313468.400824, type 4 (EV_MSC), code 4 (MSC_SCAN), value 9000d
Event: time 1669313468.400824, type 1 (EV_KEY), code 300 (?), value 0
I've tried various input mapping softwares such as evsieve, but to no avail.
Output from evsieve:
While parsing the arguments "--map key:300 key:up":
While parsing the key "key:300":
Invalid argument: unknown event code "300".
Well I think I at least found a temporary workaround:
CONTROLLER1_LOCATION=/dev/input/by-id/usb-GGG_GPWiz49-event-joystick
CONTROLLER1_EVENT_PORT=event6
BTN=BTN_TRIGGER_HAPPY4
sudo /bin/evtest $CONTROLLER1_LOCATION EV_KEY 300 \
| grep "300.*value" --line-buffered \
| grep --line-buffered -o "[01]$" \
| while read x ; do sudo evemu-event /dev/input/$CONTROLLER1_EVENT_PORT --type EV_KEY --code $BTN --value $x ; done
Basically this:
Monitors the device for matching erroneous events
Takes the output that corresponds to actual button presses
And sends a virtual event from the controller
This could definitely be cleaned up, but it'll do for now

How to change java card default key with my own keys?

I am trying to change a java card default keys (40 41... 4F) to my own key set. I tried to use JCManager but the process of Modify Key returns 6A 88 meaning that reference data not found.
Next I tried GPShell put_sc_key to change but same error returned.
What are proper P1 and P2 bytes for changing default keys?
How can I fix this?
APPENDIX 1:
This is the result of GET DATA command executed in GPShell as below:
mode_211
enable_trace
establish_context
card_connect
select -AID A000000151000000
Command --> 00A4040008A000000151000000
Wrapped command --> 00A4040008A000000151000000
Response <-- 6F108408A000000151000000A5049F6501FF9000
get_data -identifier E0
Command --> 80CA00E000
Wrapped command --> 80CA00E000
Response <-- E012C00401208080C00402208080C004032080809000
E012C00401208080C00402208080C00403208080
card_disconnect
release_context
APPNDIX 2:
This is the script by which I have tried to change key using GP pro with ACR83 reader:
gp -lock 010B0371D78377B801F2D62AFC671D95
Warning: no keys given, using default test key 404142434445464748494A4B4C4D4E4F
Failed to communicate with card in JnaCardTerminal{scardHandle=SCardContext{cd00000100000001}, name=ACS ACR83U 0}: SCardTransmit got response 0x57 (null: null)
I found pyResMan useful in my case. It is a python application which helps you easily list your key sets on your cards and add/modify keys.

Trouble with Global Send Keys Event/ VB SendKeys

I am currently working with one application that requires to press Numpad Enter (Keycode 13 Location: 3) in specific situations. Regular Enter (Keycode 13 Location 0) does not work.
I have tried to use:
Global Send Keys: with {ENTER}
Global Send Keys Event: with {ENTER}, ~, {RETURN}
VB code stage with
My.Computer.Keyboard.SendKeys("{ENTER}", True)
They all seems to Press KeyCode 13 Location 0. And I need to press Keycode 13 Location 3 specifically.
Does anyone have an idea how to create in BluePrism functionality to press KeyCode 13 location 3 button?
Allright I managed to solve it!
Thanks to: https://www.ibm.com/support/knowledgecenter/en/SSEQ5Y_5.9.0/com.ibm.pcomm.doc/books/html/host_access08.htm
Dim autECLPSObj As Object
autECLPSObj = CreateObject("PCOMM.autECLPS")
autECLPSObj.SetConnectionByName ("A")
autECLPSObj.SendKeys ("[enter]")
Basically for PCOMM there is a list of mnemonic keys, you can send with this method.
Fun part is, there no need for any PCOMM dll. The only thing you need is a namespace: Microsoft.VisualBasic.Interaction
It works without any issue and you can use all of the other autECLPS type of object!

What is the VK_KEY / scancode for this key?

I am using GetASyncKeyState (C++) to check for keys.
I don't know what the name of this key is:
How is this key named? What is the VK_ or Scancode?
VK_LMENU : Left menu key (0xA4)
VK_RMENU : Right menu key (0xA5)
Source has many more interesting keys I didn't even know that exist, such as "right windows key" o.O
Apparently, this key is reported by VK_APPS
VK_APPS is an extended key and its scan code is D5E0 (D5E1 on some systems). More on Windows key maps here.

How to send "Ctrl + c" in Sikuli?

This feels like it should be pretty easy but I can't find documentation on how to do this:
I just want Sikuli to type Ctrl+C to copy text to the clipboard.
type(KEY_CTRL+'c') doesn't work and neither does type(KEY_CTRL,'c').
Any suggestions?
Try using type("c",KEY_CTRL) instead.
I wrote a simple script which types a line in notepad, double clicks it to mark it and then ctrl+x ctrl+v it into the document again. Works great.
openApp("notepad.exe")
find("textfield.png" )
type("Some text")
doubleClick("theText.png")
type("x", KEY_CTRL)
click("theTextField.png" )
type("v",KEY_CTRL)
The following works in 0.9 and newer versions of sikuli
type('x', KeyModifier.CTRL)
Key objects are defined for pretty much all the modifier keys and num pad keys. Anyways, it should look something like this
keyDown(Key.CTRL)
type('c')
keyUp(Key.CTRL)
The usage of type() and the possible key names are documented here:
http://doc.sikuli.org/region.html#Region.type
http://doc.sikuli.org/keys.html#key-constants
As others have mentioned, use the following:
type('c', Key.CTRL) # Copy command
One point worth mentioning - do not use upper-case characters, i.e.:
type('C', Key.CTRL) # Does not copy, avoid this
I haven't looked into the Sikuli source code, but my best guess is that it implicitly sends this as Shift+C, which results in a different command entirely.
type('x', Key.CTRL) also works.
Also, make sure that NUM_LOCK is off. If NUM_LOCK is on, it can make anything with KeyModifier.CTRL or KeyModifier.SHIFT misbehave.
You can try next code:
keyDown(Key.CTRL)
type("c")
keyUp(Key.CTRL)
I had a requirement to automate a flash content. The following code worked for me.
These were the following steps I ahd to perform as a part of the automation:
Enter Username and Password
Click on Login Button
Click on the button which will navigate to the application
The challenge I faced was to focus on the Username and password which had no placeholders . Hence the focusing was difficult. So I used the CTRL keys to do this .
Pattern appLogo = new Pattern("C:\\images\\appLogo.png");
StringSelection userNameText = new StringSelection("username");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(userNameText, null);//Copy the text into the memory
Screen s = new Screen();
s.find(appLogo);
s.click(appLogo);
s.type(Key.TAB);//I had to enter tab twice to focus on user name textbox
s.type(Key.TAB);
s.type("V",KeyModifier.CTRL);
StringSelection password = new StringSelection("password");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(password, null);
s.type(Key.TAB);//I had to enter tab twice to focus on user name textbox
s.type("V",KeyModifier.CTRL);
Pattern loginButton = new Pattern("C:\\images\\Login.png");
s.find(loginButton);
s.doubleClick(loginButton);
The scenario is like i need to press say key E in my keyboard after finishing the test how to add this in the script in Sikuli IDE.

Resources