Jump to content
Flirc Forums

How to emulate a numpad key ?


Recommended Posts


I would like to record on my remote the keys from a numpad (1,2,3,4,5,6,7,8,9).

This is easy, thanks to Flirc .. but ...


This is to emulate a mouse on my PC and the key emulated must be regarded not as a number, but as a key from the numpad.

More : i dont know the difference between the two, a number as "4" does not work. The key "4" of the numpad works fine. 


If someone knows how to do ...


Link to comment
Share on other sites


below is the solution for your problem:

You will need to use the command line. You should know how to navigate through your file system and call programs using the command line.



For the OS, the numpad keys are different keys than the main field number-keys. The operating system maps the same symbol (the number) to both keys.

To get your mouse emulation, you need to map the low level keypad values, instead of the main key field keys. The Flirc GUI can map the main field keys only, but not the numpad keys.



---Obtaining the needed values:---

To program the numpad keys, you need the raw USB-HID values as decimal numbers, and program them with the command line tool and the tool’s record_api function.

You can get the raw values from here: http://www.freebsddiary.org/APC/usb_hid_usages

I’ve quoted the relevant part below:

For reference, this is the main keyboard that the GUI programs into Flirc:

	0x1E	Keyboard 1 and !
	0x1F	Keyboard 2 and @
	0x20	Keyboard 3 and #
	0x21	Keyboard 4 and $
	0x22	Keyboard 5 and %
	0x23	Keyboard 6 and ^
	0x24	Keyboard 7 and &
	0x25	Keyboard 8 and *
	0x26	Keyboard 9 and (
	0x27	Keyboard 0 and )

using a Hex to decimal number converter (like this online one: http://www.statman.info/conversions/hexadecimal.html), you can convert those to decimal numbers. This is range 30-39 decimal.


But you will need those:

	0x53	Keypad Num Lock and Clear
	0x54	Keypad /
	0x55	Keypad *
	0x56	Keypad -
	0x57	Keypad +
	0x58	Keypad ENTER
	0x59	Keypad 1 and End
	0x5A	Keypad 2 and Down Arrow
	0x5B	Keypad 3 and PageDn
	0x5C	Keypad 4 and Left Arrow
	0x5D	Keypad 5
	0x5E	Keypad 6 and Right Arrow
	0x5F	Keypad 7 and Home
	0x60	Keypad 8 and Up Arrow
	0x61	Keypad 9 and PageUp
	0x62	Keypad 0 and Insert
	0x63	Keypad . and Delete

the Keypad numbers 1-0 have decimal values of 89 to 98. You can calculate the other values (+, -, / keys, etc), if needed, by simply counting down from 89.


--- Programming Flirc:---

First, unlearn all the keys you want to use for the mouse emulation (with the GUI or command line tool).

(For linux, the command line tool we will use is called flirc_util. For windows it *might* be called flirc_util.exe. I don’t know, as I don’t use windows, look in the program’s install folder)

Now you use the command line tool to program the Keypad keys, by using the program’s record_api function:

Quote from the program’s internal help:


Send the raw HID value down to flirc to be linked with button recorded
  record_api 'arg1 arg2'   arg1 is key-modifier
                           arg2 is HID key
  flirc record_api 136 4   '136' represents right cmd + left cmd
                           '4' represents 'a' in HID

Key modifiers are defined in the IEEE HID Spec as follows:
LEFT  CONTROL          1
LEFT  SHIFT            2
LEFT  ALT              4
LEFT  CMD|WIN          8
RIGHT CONTROL          16
RIGHT SHIFT            32
RIGHT ALT              64
RIGHT CMD|WIN          128

To record Control + Shift, logically or 1 & 2 to make 3

You don’t want any modifiers, so the first argument is 0 and the command is: flirc_util record_api 0 <arg> or flirc_util.exe record_api 0 <arg>, where <arg> is a number between 89 and 98.

eg.: flirc_util record_api 0 89 to program the keypad 1, flirc_util record_api 0 90 to program the keypad 2, etc…


so you start the program with the proper arguments for the key you want to program, then the program waits until you press a key on your remote, programs it and exits.

you redo that for every key you want to map, entering the correct value as a start parameter.


BTW: note for windows users: you cannot simply click a command-line program, that won’t work. You have to start the command line from the menu, navigate to the exe’s folder (use cd command) and then type the program name and its parameters.

<Tab> can be used for auto-completion, <Arrow up> and <Arrow down> to recall the last entered commands (so you don’t need to retype the command 10 times, but can use <Arrow up> and edit the last command.)


I hope that helps

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 years later...

Thanks for this - this is what I needed as well.

But surely, a profile named 'Full Keyboard' ought to actually have the numpad keys presented for easier programming, right?

Alternatively, this works for GNOME: 


Move the current window one monitor to the left.


Move the current window one monitor to the right.

Edited by Enigma
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...