jonascj Posted March 13, 2016 Report Posted March 13, 2016 tl;dr USB HID codes from here http://www.freebsddiary.org/APC/usb_hid_usages.php should be given to flirc_util record_api as decimal Hi allJust had to deal with flirc_util record_api on account of the GUI not recognizing the Flirc board as connected (http://forum.flirc.tv/index.php?/topic/2208-linux-x64-flirc_util-works-without-root-but-flirc-gui-always-say-disconnected/#comment-12182 ), and I thought I'd save the information I found in a topic with a descriptive title for future reference:This is also a good resource: http://forum.flirc.tv/index.php?/topic/128-modifier-keys-in-command-line-recording/flirc_util record_api x y where x is the modifier key and y is the HID key. # Modifier keysAccording to the documentation presented when running "flirc_util record_api" the modifier keys are specified by logically OR'ing these values together as binary (the de facto standard for specifying flags as a single parameter):Key modifiers are defined in the IEEE HID Spec as follows: LEFT CONTROL 1 # 00000001 as binary LEFT SHIFT 2 # 00000010 LEFT ALT 4 # 00000100 LEFT CMD|WIN 8 # 00001000 RIGHT CONTROL 16 # 00010000 RIGHT SHIFT 32 # 00100000 RIGHT ALT 64 # 01000000 RIGHT CMD|WIN 128 # 10000000OR'ing binary numbers is done by going through the two numbers bit by bit and comparing corresponding bits. If one of the two bits is 1 set the corresponding result bit to 1, otherwise set it to 0, e.g. 0101 OR 0010 = 0111.For these specific binary numbers (1,2,4...128 as decimal) OR'ing is the same as ADDing, and since "flirc_util record_api" expects a decimal input we might as add them in decimal:LEFT CTRL + LEFT SHFIT = 1 + 2 = 3LEFT CTRL + LEFT ALT + LEFT SHIFT = 1 + 2 + 4 = 7# HID keysThe HID key codes can be found here: http://www.freebsddiary.org/APC/usb_hid_usages.php"flirc_util record_api" expects the code as decimal, but the freebsddiary.org page gives them in HEX, so get your hex-to-dec converter out.For example, 'g and G' is specified as 0x0A which is 10 in decimal. So if you want to program the g/G keyboard key with "flirc_util record_api x y" you have to specify y as 10, not 0x0A or similar. Another example is DownArrow which is specified as 0x52 in hex which needs to be specified as 82 in decimal. # Putting it togetherIf you want to program LEFT CTRL + LEFT SHIFT + UP ARROW you need 1+2=3 as modifier key and 0x52=82 as HID key:flirc_util record_api 3 82Another example is LEFT CTRL + LEFT SHIFT + LEFT ALT + S which would be 1+2+4=7 as modifier key and 0x16=22 as HID key:flirc_util record_api 7 22 # Documentation from flirc_util$ flirc_util record_api Help for `record_api' command: Send the raw HID value down to flirc to be linked with button recorded usage: record_api 'arg1 arg2' arg1 is key-modifier arg2 is HID key example: 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.