Jump to content
Flirc Forums

Flirc HID codes and Android keycode counterparts


TMWNN

Recommended Posts

Flirc has a hidden method for sending HID Consumer (page 12) codes:

flirc_util record_api x 102 where x is in decimal

flirc_util record_api 2 x where x is in hexadecimal

The first method is only documented in @yawor's forum post; the second is not documented anywhere except sort of in one comment by @jseymour. I tried every value for x from 0 to 0x29c (668 decimal), the highest listed in the HID documentation, to to see which ones cause Nvidia Shield TV to do things. Each is listed with the Android KEYCODE the resulting Flirc binding produced in Button Mapper. (The Flirc codes do not match Android keycodes' numbers.)

Flirc code | Android keycode
-----------|----------------
        48 | POWER1
        50 | SLEEP1
        52 | SLEEP1
        54 | BUTTON_1
        64 | MENU
        65 | DPAD_CENTER
        66 | DPAD_UP
        67 | DPAD_DOWN
        68 | DPAD_LEFT
        69 | DPAD_RIGHT
        70 | ESCAPE
        71 | NUMPAD_ADD
        72 | NUMPAD_SUBTRACT
       101 | CAMERA
       111 | BRIGHTNESS_UP
       112 | BRIGHTNESS_DOWN
       132 | ENTER
       137 | TV
(Live Channels app)
       138 | EXPLORER
       140 | CALL
       154 | DVR
(DVR functionality in Live Channels app)
       156 | CHANNEL_UP
       157 | CHANNEL_DOWN
       176 | MEDIA_PLAY
       177 | BREAK
       178 | MEDIA_RECORD
       179 | MEDIA_FAST_FORWARD
       180 | MEDIA_REWIND
       181 | MEDIA_NEXT
       182 | MEDIA_PREVIOUS
       183 | MEDIA_STOP
       184 | MEDIA_EJECT
       205 | MEDIA_PLAY_PAUSE
       207 | VOICE_ASSIST1
(general Google Assistant voice search)
       226 | VOLUME_MUTE
       233 | VOLUME_UP
       234 | VOLUME_DOWN
       386 | BOOKMARK
       387 | MUSIC
       394 | ENVELOPE
       397 | CONTACTS
       398 | CALENDAR
       402 | CALCULATOR
       406 | EXPLORER
       414 | POWER1
       418 | APP_SWITCH1
(Recents in Button Mapper)
       539 | COPY
       540 | CUT
       541 | PASTE
       545 | VOICE_ASSIST1
       547 | HOME
       548 | BACK
       549 | FORWARD
       550 | MEDIA_STOP
       554 | BOOKMARK
       563 | PAGE_UP
       564 | PAGE_DOWN

1 Did not produce Android keycodes in Button Mapper. I identified the corresponding keycodes based on what they caused Shield to do. Other Flirc codes may not generate Android keycodes but still do things that I did not notice.

I hope @jason will implement the ability to use flirc_util record_api in long press and/or macro, and perhaps other HID tables and/or true Android keycodes. The latter would obviate the need for apps like Button Mapper to convert HID codes to Android counterparts.

Until then, what is this list useful for today? Many of the Flirc codes produce bindings already available for use via the GUI or command line utilities. My remote has separate Play and Pause buttons, and I do prefer to bind the former to MEDIA_PLAY (not in GUI or command line utilities) and the latter to MEDIA_PLAY_PAUSE (which is). Otherwise, unused keybindings can be used in Button Mapper, or Keyboard/Button Mapper, to open specified apps or other duties              .

Edited by TMWNN
Ping
Link to comment
Share on other sites

  • 3 months later...
  • 4 years later...

Ooh this is awesome!! I've wanted updated Android TV OS control code sets for the FLIRC USB configuration GUI, but am still working on my post detailing my findings for getting it to program codes normally sent by the Google TV reference remotes (specifically the G20 which is a superset of the G10 for devices that have TV tuners), and from there, add the media transport controls that some manufacturers like Hisense, TCL, Skyworth, and Sony add to the remotes for their TV models (including those who sell rebranded Hisense, TCL, and/or Skyworth TVs).

The only Android TV OS codes I found in the current 3.15.x release are specifically for the NVIDIA Shield TV older and newer remotes, those may work on my Xiaomi TV Box, but I want more for my Logitech Harmony 300 (which I'm using because FLIRC are still working on their Skip software and can't yet make a Skip 1m or 2m (medium) instead) to use with Sparkle TV that I have installed (and set up to access a Tvheadend system on my home network) as it does support using channel keys.

Other than that, the GUI has codes for the original Fire TV, so those just have the basic controls for navigation and playback, but that may not be a problem for some as the only buttons that were added were for volume control, assistance, TV guide, and specific video streaming services, however I don't have any Fire TV devices, so I can't check. I know, however, that Amazon's documentation included some pages that guided developers on porting their Google TV apps (Android TV OS apps) to Fire TV, including how context menus are triggered (press and hold the Enter/Select/OK button to trigger the context menu on Google TV, but Fire TV instead has a dedicated Menu button).

I likely won't be posting that post anytime soon as I still have things to test, and I have an older Xiaomi TV Box that was left on Android 9. I plan to get the newer TV Box S 2nd gen, but am not ready as I have an older Full HD TV and don't need some of the new features at this time, but thanks to what you mentioned, I can test the commands using Button Mapper.

EDIT: I'm cross-referencing the AOSP documentation page about keyboard input that @tmm1 posted a link to. As I suspected, the AOSP page shows the key codes as hexadecimal numbers, while the FLIRC USB CLI instead uses regular decimal numbers. As I suspected, 30 in hexadecimal is 48 in decimal, and 182 in hexadecimal is 386 in decimal.

Edited by kbhasi
Added some additional info
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.

Guest
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...