hidraw: add Consumer Control Table

Most should be fine, though I did not tested each key.

HID++ 1.0 and 2.0 use it now, though HID++ 2.0 needs refinments (only a u8
is used though we need a u16)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
This commit is contained in:
Benjamin Tissoires
2015-11-27 16:55:06 +01:00
parent 4ebba2df74
commit e063d7d5e1
5 changed files with 828 additions and 6 deletions

View File

@@ -77,8 +77,7 @@ hidpp10drv_map_button(struct ratbag_device *device,
break;
case PROFILE_BUTTON_TYPE_CONSUMER_CONTROL:
button->action.type = RATBAG_BUTTON_ACTION_TYPE_KEY;
/* FIXME: we need the consumer control table */
button->action.action.key.key = ratbag_hidraw_get_keycode_from_keyboard_usage(device,
button->action.action.key.key = ratbag_hidraw_get_keycode_from_consumer_usage(device,
profile.buttons[button->index].consumer_control.consumer_control);
break;
case PROFILE_BUTTON_TYPE_SPECIAL:

View File

@@ -119,6 +119,11 @@ hidpp20drv_read_button_8100(struct ratbag_button *button)
button->action.action.key.key = ratbag_hidraw_get_keycode_from_keyboard_usage(device,
profile->buttons[button->index].code);
break;
case HIDPP20_BUTTON_HID_CONSUMER_CONTROL:
button->action.type = RATBAG_BUTTON_ACTION_TYPE_KEY;
button->action.action.key.key = ratbag_hidraw_get_keycode_from_consumer_usage(device,
profile->buttons[button->index].code);
break;
case HIDPP20_BUTTON_SPECIAL:
button->action.type = RATBAG_BUTTON_ACTION_TYPE_SPECIAL;
button->action.action.special = hidpp20_onboard_profiles_get_special(profile->buttons[button->index].code);
@@ -182,7 +187,7 @@ hidpp20drv_write_button_8100(struct ratbag_button *button,
struct ratbag_device *device = button->profile->device;
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
struct hidpp20_profile *profile;
uint8_t code;
uint8_t code, type;
if (!(drv_data->capabilities & HIDPP_CAP_ONBOARD_PROFILES_8100))
return -ENOTSUP;
@@ -195,10 +200,15 @@ hidpp20drv_write_button_8100(struct ratbag_button *button,
profile->buttons[button->index].code = action->action.button;
break;
case RATBAG_BUTTON_ACTION_TYPE_KEY:
type = HIDPP20_BUTTON_HID_KEYBOARD;
code = ratbag_hidraw_get_keyboard_usage_from_keycode(device, action->action.key.key);
if (code == 0)
return -EINVAL;
profile->buttons[button->index].type = HIDPP20_BUTTON_HID_KEYBOARD;
if (code == 0) {
type = HIDPP20_BUTTON_HID_CONSUMER_CONTROL;
code = ratbag_hidraw_get_consumer_usage_from_keycode(device, action->action.key.key);
if (code == 0)
return -EINVAL;
}
profile->buttons[button->index].type = type;
profile->buttons[button->index].code = code;
break;
case RATBAG_BUTTON_ACTION_TYPE_SPECIAL:

View File

@@ -1330,6 +1330,9 @@ int hidpp20_onboard_profiles_read(struct hidpp20_device *device,
if (profile->buttons[i].type == HIDPP20_BUTTON_HID_KEYBOARD) {
profile->buttons[i].modifiers = button->value.hid.key.modifier;
profile->buttons[i].code = button->value.hid.key.code;
} else if (profile->buttons[i].type == HIDPP20_BUTTON_HID_CONSUMER_CONTROL) {
profile->buttons[i].modifiers = button->value.hid.key.modifier;
profile->buttons[i].code = button->value.hid.key.code;
} else {
profile->buttons[i].code = ffs(hidpp_be_u16_to_cpu(button->value.hid.button));
}

View File

@@ -398,6 +398,778 @@ static const unsigned int hid_keyboard_mapping[] = {
[0xe8 ... 0xff] = 0,
};
#define HID_CC_CONSUMER_CONTROL 0x01
#define HID_CC_NUMERIC_KEY_PAD 0x02
#define HID_CC_PROGRAMMABLE_BUTTONS 0x03
#define HID_CC_MICROPHONE 0x04
#define HID_CC_HEADPHONE 0x05
#define HID_CC_GRAPHIC_EQUALIZER 0x06
#define HID_CC_PLUS_10 0x20
#define HID_CC_PLUS_100 0x21
#define HID_CC_AM_PM 0x22
#define HID_CC_POWER 0x30
#define HID_CC_RESET 0x31
#define HID_CC_SLEEP 0x32
#define HID_CC_SLEEP_AFTER 0x33
#define HID_CC_SLEEP_MODE 0x34
#define HID_CC_ILLUMINATION 0x35
#define HID_CC_FUNCTION_BUTTONS 0x36
#define HID_CC_MENU 0x40
#define HID_CC_MENU_PICK 0x41
#define HID_CC_MENU_UP 0x42
#define HID_CC_MENU_DOWN 0x43
#define HID_CC_MENU_LEFT 0x44
#define HID_CC_MENU_RIGHT 0x45
#define HID_CC_MENU_ESCAPE 0x46
#define HID_CC_MENU_VALUE_INCREASE 0x47
#define HID_CC_MENU_VALUE_DECREASE 0x48
#define HID_CC_DATA_ON_SCREEN 0x60
#define HID_CC_CLOSED_CAPTION 0x61
#define HID_CC_CLOSED_CAPTION_SELECT 0x62
#define HID_CC_VCR_TV 0x63
#define HID_CC_BROADCAST_MODE 0x64
#define HID_CC_SNAPSHOT 0x65
#define HID_CC_STILL 0x66
#define HID_CC_ASPECT 0x6D
#define HID_CC_3D_MODE_SELECT 0x6E
#define HID_CC_DISPLAY_BRIGHTNESS_INCREMENT 0x6F
#define HID_CC_DISPLAY_BRIGHTNESS_DECREMENT 0x70
#define HID_CC_DISPLAY_BRIGHTNESS 0x71
#define HID_CC_DISPLAY_BACKLIGHT_TOGGLE 0x72
#define HID_CC_DISPLAY_SET_BRIGHTNESS_TO_MINIMUM 0x73
#define HID_CC_DISPLAY_SET_BRIGHTNESS_TO_MAXIMUM 0x74
#define HID_CC_DISPLAY_SET_AUTO_BRIGHTNESS 0x75
#define HID_CC_SELECTION 0x80
#define HID_CC_ASSIGN_SELECTION 0x81
#define HID_CC_MODE_STEP 0x82
#define HID_CC_RECALL_LAST 0x83
#define HID_CC_ENTER_CHANNEL 0x84
#define HID_CC_ORDER_MOVIE 0x85
#define HID_CC_CHANNEL 0x86
#define HID_CC_MEDIA_SELECTION 0x87
#define HID_CC_MEDIA_SELECT_COMPUTER 0x88
#define HID_CC_MEDIA_SELECT_TV 0x89
#define HID_CC_MEDIA_SELECT_WWW 0x8A
#define HID_CC_MEDIA_SELECT_DVD 0x8B
#define HID_CC_MEDIA_SELECT_TELEPHONE 0x8C
#define HID_CC_MEDIA_SELECT_PROGRAM_GUIDE 0x8D
#define HID_CC_MEDIA_SELECT_VIDEO_PHONE 0x8E
#define HID_CC_MEDIA_SELECT_GAMES 0x8F
#define HID_CC_MEDIA_SELECT_MESSAGES 0x90
#define HID_CC_MEDIA_SELECT_CD 0x91
#define HID_CC_MEDIA_SELECT_VCR 0x92
#define HID_CC_MEDIA_SELECT_TUNER 0x93
#define HID_CC_QUIT 0x94
#define HID_CC_HELP 0x95
#define HID_CC_MEDIA_SELECT_TAPE 0x96
#define HID_CC_MEDIA_SELECT_CABLE 0x97
#define HID_CC_MEDIA_SELECT_SATELLITE 0x98
#define HID_CC_MEDIA_SELECT_SECURITY 0x99
#define HID_CC_MEDIA_SELECT_HOME 0x9A
#define HID_CC_MEDIA_SELECT_CALL 0x9B
#define HID_CC_CHANNEL_INCREMENT 0x9C
#define HID_CC_CHANNEL_DECREMENT 0x9D
#define HID_CC_MEDIA_SELECT_SAP 0x9E
#define HID_CC_VCR_PLUS 0xA0
#define HID_CC_ONCE 0xA1
#define HID_CC_DAILY 0xA2
#define HID_CC_WEEKLY 0xA3
#define HID_CC_MONTHLY 0xA4
#define HID_CC_PLAY 0xB0
#define HID_CC_PAUSE 0xB1
#define HID_CC_RECORD 0xB2
#define HID_CC_FAST_FORWARD 0xB3
#define HID_CC_REWIND 0xB4
#define HID_CC_SCAN_NEXT_TRACK 0xB5
#define HID_CC_SCAN_PREVIOUS_TRACK 0xB6
#define HID_CC_STOP 0xB7
#define HID_CC_EJECT 0xB8
#define HID_CC_RANDOM_PLAY 0xB9
#define HID_CC_SELECT_DISC 0xBA
#define HID_CC_ENTER_DISC 0xBB
#define HID_CC_REPEAT 0xBC
#define HID_CC_TRACKING 0xBD
#define HID_CC_TRACK_NORMAL 0xBE
#define HID_CC_SLOW_TRACKING 0xBF
#define HID_CC_FRAME_FORWARD 0xC0
#define HID_CC_FRAME_BACK 0xC1
#define HID_CC_MARK 0xC2
#define HID_CC_CLEAR_MARK 0xC3
#define HID_CC_REPEAT_FROM_MARK 0xC4
#define HID_CC_RETURN_TO_MARK 0xC5
#define HID_CC_SEARCH_MARK_FORWARD 0xC6
#define HID_CC_SEARCH_MARK_BACKWARDS 0xC7
#define HID_CC_COUNTER_RESET 0xC8
#define HID_CC_SHOW_COUNTER 0xC9
#define HID_CC_TRACKING_INCREMENT 0xCA
#define HID_CC_TRACKING_DECREMENT 0xCB
#define HID_CC_STOP_EJECT 0xCC
#define HID_CC_PLAY_PAUSE 0xCD
#define HID_CC_PLAY_SKIP 0xCE
#define HID_CC_VOICE_COMMAND 0xCF
#define HID_CC_VOLUME 0xE0
#define HID_CC_BALANCE 0xE1
#define HID_CC_MUTE 0xE2
#define HID_CC_BASS 0xE3
#define HID_CC_TREBLE 0xE4
#define HID_CC_BASS_BOOST 0xE5
#define HID_CC_SURROUND_MODE 0xE6
#define HID_CC_LOUDNESS 0xE7
#define HID_CC_MPX 0xE8
#define HID_CC_VOLUME_UP 0xE9
#define HID_CC_VOLUME_DOWN 0xEA
#define HID_CC_SPEED_SELECT 0xF0
#define HID_CC_PLAYBACK_SPEED 0xF1
#define HID_CC_STANDARD_PLAY 0xF2
#define HID_CC_LONG_PLAY 0xF3
#define HID_CC_EXTENDED_PLAY 0xF4
#define HID_CC_SLOW 0xF5
#define HID_CC_FAN_ENABLE 0x100
#define HID_CC_FAN_SPEED 0x101
#define HID_CC_LIGHT_ENABLE 0x102
#define HID_CC_LIGHT_ILLUMINATION_LEVEL 0x103
#define HID_CC_CLIMATE_CONTROL_ENABLE 0x104
#define HID_CC_ROOM_TEMPERATURE 0x105
#define HID_CC_SECURITY_ENABLE 0x106
#define HID_CC_FIRE_ALARM 0x107
#define HID_CC_POLICE_ALARM 0x108
#define HID_CC_PROXIMITY 0x109
#define HID_CC_MOTION 0x10A
#define HID_CC_DURESS_ALARM 0x10B
#define HID_CC_HOLDUP_ALARM 0x10C
#define HID_CC_MEDICAL_ALARM 0x10D
#define HID_CC_BALANCE_RIGHT 0x150
#define HID_CC_BALANCE_LEFT 0x151
#define HID_CC_BASS_INCREMENT 0x152
#define HID_CC_BASS_DECREMENT 0x153
#define HID_CC_TREBLE_INCREMENT 0x154
#define HID_CC_TREBLE_DECREMENT 0x155
#define HID_CC_SPEAKER_SYSTEM 0x160
#define HID_CC_CHANNEL_LEFT 0x161
#define HID_CC_CHANNEL_RIGHT 0x162
#define HID_CC_CHANNEL_CENTER 0x163
#define HID_CC_CHANNEL_FRONT 0x164
#define HID_CC_CHANNEL_CENTER_FRONT 0x165
#define HID_CC_CHANNEL_SIDE 0x166
#define HID_CC_CHANNEL_SURROUND 0x167
#define HID_CC_CHANNEL_LOW_FREQ_ENHANCEMENT 0x168
#define HID_CC_CHANNEL_TOP 0x169
#define HID_CC_CHANNEL_UNKNOWN 0x16A
#define HID_CC_SUB_CHANNEL 0x170
#define HID_CC_SUB_CHANNEL_INCREMENT 0x171
#define HID_CC_SUB_CHANNEL_DECREMENT 0x172
#define HID_CC_ALTERNATE_AUDIO_INCREMENT 0x173
#define HID_CC_ALTERNATE_AUDIO_DECREMENT 0x174
#define HID_CC_APPLICATION_LAUNCH_BUTTONS 0x180
#define HID_CC_AL_LAUNCH_BUTTON_CONFIG_TOOL 0x181
#define HID_CC_AL_PROGRAMMABLE_BUTTON_CONFIG 0x182
#define HID_CC_AL_CONSUMER_CONTROL_CONFIG 0x183
#define HID_CC_AL_WORD_PROCESSOR 0x184
#define HID_CC_AL_TEXT_EDITOR 0x185
#define HID_CC_AL_SPREADSHEET 0x186
#define HID_CC_AL_GRAPHICS_EDITOR 0x187
#define HID_CC_AL_PRESENTATION_APP 0x188
#define HID_CC_AL_DATABASE_APP 0x189
#define HID_CC_AL_EMAIL_READER 0x18A
#define HID_CC_AL_NEWSREADER 0x18B
#define HID_CC_AL_VOICEMAIL 0x18C
#define HID_CC_AL_CONTACTS_ADDRESS_BOOK 0x18D
#define HID_CC_AL_CALENDAR_SCHEDULE 0x18E
#define HID_CC_AL_TASK_PROJECT_MANAGER 0x18F
#define HID_CC_AL_LOG_JOURNAL_TIMECARD 0x190
#define HID_CC_AL_CHECKBOOK_FINANCE 0x191
#define HID_CC_AL_CALCULATOR 0x192
#define HID_CC_AL_A_VCAPTURE_PLAYBACK 0x193
#define HID_CC_AL_LOCAL_MACHINE_BROWSER 0x194
#define HID_CC_AL_LAN_WANBROWSER 0x195
#define HID_CC_AL_INTERNET_BROWSER 0x196
#define HID_CC_AL_REMOTE_NETWORKING_ISPCONNECT 0x197
#define HID_CC_AL_NETWORK_CONFERENCE 0x198
#define HID_CC_AL_NETWORK_CHAT 0x199
#define HID_CC_AL_TELEPHONY_DIALER 0x19A
#define HID_CC_AL_LOGON 0x19B
#define HID_CC_AL_LOGOFF 0x19C
#define HID_CC_AL_LOGON_LOGOFF 0x19D
#define HID_CC_AL_TERMINAL_LOCK_SCREENSAVER 0x19E
#define HID_CC_AL_CONTROL_PANEL 0x19F
#define HID_CC_AL_COMMAND_LINE_PROCESSOR_RUN 0x1A0
#define HID_CC_AL_PROCESS_TASK_MANAGER 0x1A1
#define HID_CC_AL_SELECT_TASK_APPLICATION 0x1A2
#define HID_CC_AL_NEXT_TASK_APPLICATION 0x1A3
#define HID_CC_AL_PREVIOUS_TASK_APPLICATION 0x1A4
#define HID_CC_AL_PREEMPT_HALT_TASK_APPLICATION 0x1A5
#define HID_CC_AL_INTEGRATED_HELP_CENTER 0x1A6
#define HID_CC_AL_DOCUMENTS 0x1A7
#define HID_CC_AL_THESAURUS 0x1A8
#define HID_CC_AL_DICTIONARY 0x1A9
#define HID_CC_AL_DESKTOP 0x1AA
#define HID_CC_AL_SPELL_CHECK 0x1AB
#define HID_CC_AL_GRAMMAR_CHECK 0x1AC
#define HID_CC_AL_WIRELESS_STATUS 0x1AD
#define HID_CC_AL_KEYBOARD_LAYOUT 0x1AE
#define HID_CC_AL_VIRUS_PROTECTION 0x1AF
#define HID_CC_AL_ENCRYPTION 0x1B0
#define HID_CC_AL_SCREEN_SAVER 0x1B1
#define HID_CC_AL_ALARMS 0x1B2
#define HID_CC_AL_CLOCK 0x1B3
#define HID_CC_AL_FILE_BROWSER 0x1B4
#define HID_CC_AL_POWER_STATUS 0x1B5
#define HID_CC_AL_IMAGE_BROWSER 0x1B6
#define HID_CC_AL_AUDIO_BROWSER 0x1B7
#define HID_CC_AL_MOVIE_BROWSER 0x1B8
#define HID_CC_AL_DIGITAL_RIGHTS_MANAGER 0x1B9
#define HID_CC_AL_DIGITAL_WALLET 0x1BA
#define HID_CC_AL_INSTANT_MESSAGING 0x1BC
#define HID_CC_AL_OEMFEATURES_TIPS_TUTO_BROWSER 0x1BD
#define HID_CC_AL_OEMHELP 0x1BE
#define HID_CC_AL_ONLINE_COMMUNITY 0x1BF
#define HID_CC_AL_ENTERTAINMENT_CONTENT_BROWSER 0x1C0
#define HID_CC_AL_ONLINE_SHOPPING_BROWSER 0x1C1
#define HID_CC_AL_SMART_CARD_INFORMATION_HELP 0x1C2
#define HID_CC_AL_MARKET_MONITOR_FINANCE_BROWSER 0x1C3
#define HID_CC_AL_CUSTOMIZED_CORP_NEWS_BROWSER 0x1C4
#define HID_CC_AL_ONLINE_ACTIVITY_BROWSER 0x1C5
#define HID_CC_AL_RESEARCH_SEARCH_BROWSER 0x1C6
#define HID_CC_AL_AUDIO_PLAYER 0x1C7
#define HID_CC_GENERIC_GUIAPPLICATION_CONTROLS 0x200
#define HID_CC_AC_NEW 0x201
#define HID_CC_AC_OPEN 0x202
#define HID_CC_AC_CLOSE 0x203
#define HID_CC_AC_EXIT 0x204
#define HID_CC_AC_MAXIMIZE 0x205
#define HID_CC_AC_MINIMIZE 0x206
#define HID_CC_AC_SAVE 0x207
#define HID_CC_AC_PRINT 0x208
#define HID_CC_AC_PROPERTIES 0x209
#define HID_CC_AC_UNDO 0x21A
#define HID_CC_AC_COPY 0x21B
#define HID_CC_AC_CUT 0x21C
#define HID_CC_AC_PASTE 0x21D
#define HID_CC_AC_SELECT_ALL 0x21E
#define HID_CC_AC_FIND 0x21F
#define HID_CC_AC_FINDAND_REPLACE 0x220
#define HID_CC_AC_SEARCH 0x221
#define HID_CC_AC_GO_TO 0x222
#define HID_CC_AC_HOME 0x223
#define HID_CC_AC_BACK 0x224
#define HID_CC_AC_FORWARD 0x225
#define HID_CC_AC_STOP 0x226
#define HID_CC_AC_REFRESH 0x227
#define HID_CC_AC_PREVIOUS_LINK 0x228
#define HID_CC_AC_NEXT_LINK 0x229
#define HID_CC_AC_BOOKMARKS 0x22A
#define HID_CC_AC_HISTORY 0x22B
#define HID_CC_AC_SUBSCRIPTIONS 0x22C
#define HID_CC_AC_ZOOM_IN 0x22D
#define HID_CC_AC_ZOOM_OUT 0x22E
#define HID_CC_AC_ZOOM 0x22F
#define HID_CC_AC_FULL_SCREEN_VIEW 0x230
#define HID_CC_AC_NORMAL_VIEW 0x231
#define HID_CC_AC_VIEW_TOGGLE 0x232
#define HID_CC_AC_SCROLL_UP 0x233
#define HID_CC_AC_SCROLL_DOWN 0x234
#define HID_CC_AC_SCROLL 0x235
#define HID_CC_AC_PAN_LEFT 0x236
#define HID_CC_AC_PAN_RIGHT 0x237
#define HID_CC_AC_PAN 0x238
#define HID_CC_AC_NEW_WINDOW 0x239
#define HID_CC_AC_TILE_HORIZONTALLY 0x23A
#define HID_CC_AC_TILE_VERTICALLY 0x23B
#define HID_CC_AC_FORMAT 0x23C
#define HID_CC_AC_EDIT 0x23D
#define HID_CC_AC_BOLD 0x23E
#define HID_CC_AC_ITALICS 0x23F
#define HID_CC_AC_UNDERLINE 0x240
#define HID_CC_AC_STRIKETHROUGH 0x241
#define HID_CC_AC_SUBSCRIPT 0x242
#define HID_CC_AC_SUPERSCRIPT 0x243
#define HID_CC_AC_ALL_CAPS 0x244
#define HID_CC_AC_ROTATE 0x245
#define HID_CC_AC_RESIZE 0x246
#define HID_CC_AC_FLIPHORIZONTAL 0x247
#define HID_CC_AC_FLIP_VERTICAL 0x248
#define HID_CC_AC_MIRROR_HORIZONTAL 0x249
#define HID_CC_AC_MIRROR_VERTICAL 0x24A
#define HID_CC_AC_FONT_SELECT 0x24B
#define HID_CC_AC_FONT_COLOR 0x24C
#define HID_CC_AC_FONT_SIZE 0x24D
#define HID_CC_AC_JUSTIFY_LEFT 0x24E
#define HID_CC_AC_JUSTIFY_CENTER_H 0x24F
#define HID_CC_AC_JUSTIFY_RIGHT 0x250
#define HID_CC_AC_JUSTIFY_BLOCK_H 0x251
#define HID_CC_AC_JUSTIFY_TOP 0x252
#define HID_CC_AC_JUSTIFY_CENTER_V 0x253
#define HID_CC_AC_JUSTIFY_BOTTOM 0x254
#define HID_CC_AC_JUSTIFY_BLOCK_V 0x255
#define HID_CC_AC_INDENT_DECREASE 0x256
#define HID_CC_AC_INDENT_INCREASE 0x257
#define HID_CC_AC_NUMBERED_LIST 0x258
#define HID_CC_AC_RESTART_NUMBERING 0x259
#define HID_CC_AC_BULLETED_LIST 0x25A
#define HID_CC_AC_PROMOTE 0x25B
#define HID_CC_AC_DEMOTE 0x25C
#define HID_CC_AC_YES 0x25D
#define HID_CC_AC_NO 0x25E
#define HID_CC_AC_CANCEL 0x25F
#define HID_CC_AC_CATALOG 0x260
#define HID_CC_AC_BUY_CHECKOUT 0x261
#define HID_CC_AC_ADDTO_CART 0x262
#define HID_CC_AC_EXPAND 0x263
#define HID_CC_AC_EXPAND_ALL 0x264
#define HID_CC_AC_COLLAPSE 0x265
#define HID_CC_AC_COLLAPSE_ALL 0x266
#define HID_CC_AC_PRINT_PREVIEW 0x267
#define HID_CC_AC_PASTE_SPECIAL 0x268
#define HID_CC_AC_INSERT_MODE 0x269
#define HID_CC_AC_DELETE 0x26A
#define HID_CC_AC_LOCK 0x26B
#define HID_CC_AC_UNLOCK 0x26C
#define HID_CC_AC_PROTECT 0x26D
#define HID_CC_AC_UNPROTECT 0x26E
#define HID_CC_AC_ATTACH_COMMENT 0x26F
#define HID_CC_AC_DELETE_COMMENT 0x270
#define HID_CC_AC_VIEW_COMMENT 0x271
#define HID_CC_AC_SELECT_WORD 0x272
#define HID_CC_AC_SELECT_SENTENCE 0x273
#define HID_CC_AC_SELECT_PARAGRAPH 0x274
#define HID_CC_AC_SELECT_COLUMN 0x275
#define HID_CC_AC_SELECT_ROW 0x276
#define HID_CC_AC_SELECT_TABLE 0x277
#define HID_CC_AC_SELECT_OBJECT 0x278
#define HID_CC_AC_REDO_REPEAT 0x279
#define HID_CC_AC_SORT 0x27A
#define HID_CC_AC_SORT_ASCENDING 0x27B
#define HID_CC_AC_SORT_DESCENDING 0x27C
#define HID_CC_AC_FILTER 0x27D
#define HID_CC_AC_SET_CLOCK 0x27E
#define HID_CC_AC_VIEW_CLOCK 0x27F
#define HID_CC_AC_SELECT_TIME_ZONE 0x280
#define HID_CC_AC_EDIT_TIME_ZONES 0x281
#define HID_CC_AC_SET_ALARM 0x282
#define HID_CC_AC_CLEAR_ALARM 0x283
#define HID_CC_AC_SNOOZE_ALARM 0x284
#define HID_CC_AC_RESET_ALARM 0x285
#define HID_CC_AC_SYNCHRONIZE 0x286
#define HID_CC_AC_SEND_RECEIVE 0x287
#define HID_CC_AC_SEND_TO 0x288
#define HID_CC_AC_REPLY 0x289
#define HID_CC_AC_REPLY_ALL 0x28A
#define HID_CC_AC_FORWARD_MSG 0x28B
#define HID_CC_AC_SEND 0x28C
#define HID_CC_AC_ATTACH_FILE 0x28D
#define HID_CC_AC_UPLOAD 0x28E
#define HID_CC_AC_DOWNLOAD(SAVE_TARGET_AS) 0x28F
#define HID_CC_AC_SET_BORDERS 0x290
#define HID_CC_AC_INSERT_ROW 0x291
#define HID_CC_AC_INSERT_COLUMN 0x292
#define HID_CC_AC_INSERT_FILE 0x293
#define HID_CC_AC_INSERT_PICTURE 0x294
#define HID_CC_AC_INSERT_OBJECT 0x295
#define HID_CC_AC_INSERT_SYMBOL 0x296
#define HID_CC_AC_SAVEAND_CLOSE 0x297
#define HID_CC_AC_RENAME 0x298
#define HID_CC_AC_MERGE 0x299
#define HID_CC_AC_SPLIT 0x29A
#define HID_CC_AC_DISRIBUTE_HORIZONTALLY 0x29B
#define HID_CC_AC_DISTRIBUTE_VERTICALLY 0x29C
static const unsigned int hid_consumer_mapping[] = {
[0x00] = 0,
[0x07 ... 0x1F] = 0,
[0x23 ... 0x2F] = 0,
[0x37 ... 0x3F] = 0,
[0x49 ... 0x5F] = 0,
[0x67 ... 0x6C] = 0,
[0x76 ... 0x7F] = 0,
[0x9F ... 0x9F] = 0,
[0xA5 ... 0xAF] = 0,
[0xD0 ... 0xDF] = 0,
[0xEB ... 0xEF] = 0,
[0xF6 ... 0xFF] = 0,
[0x10E ... 0x14F] = 0,
[0x156 ... 0x15F] = 0,
[0x16B ... 0x16F] = 0,
[0x175 ... 0x17F] = 0,
[0x1BB ... 0x1BB] = 0,
[0x1C8 ... 0x1FF] = 0,
[0x20A ... 0x219] = 0,
[0x29D ... 0xFFF] = 0,
[HID_CC_CONSUMER_CONTROL ] = 0,
[HID_CC_NUMERIC_KEY_PAD ] = 0,
[HID_CC_PROGRAMMABLE_BUTTONS ] = 0,
[HID_CC_MICROPHONE ] = 0,
[HID_CC_HEADPHONE ] = 0,
[HID_CC_GRAPHIC_EQUALIZER ] = 0,
[HID_CC_PLUS_10 ] = 0,
[HID_CC_PLUS_100 ] = 0,
[HID_CC_AM_PM ] = 0,
[HID_CC_POWER ] = KEY_POWER,
[HID_CC_RESET ] = 0,
[HID_CC_SLEEP ] = KEY_SLEEP,
[HID_CC_SLEEP_AFTER ] = 0,
[HID_CC_SLEEP_MODE ] = 0,
[HID_CC_ILLUMINATION ] = 0,
[HID_CC_FUNCTION_BUTTONS ] = 0,
[HID_CC_MENU ] = KEY_MENU,
[HID_CC_MENU_PICK ] = 0,
[HID_CC_MENU_UP ] = 0,
[HID_CC_MENU_DOWN ] = 0,
[HID_CC_MENU_LEFT ] = 0,
[HID_CC_MENU_RIGHT ] = 0,
[HID_CC_MENU_ESCAPE ] = 0,
[HID_CC_MENU_VALUE_INCREASE ] = 0,
[HID_CC_MENU_VALUE_DECREASE ] = 0,
[HID_CC_DATA_ON_SCREEN ] = 0,
[HID_CC_CLOSED_CAPTION ] = 0,
[HID_CC_CLOSED_CAPTION_SELECT ] = 0,
[HID_CC_VCR_TV ] = 0,
[HID_CC_BROADCAST_MODE ] = 0,
[HID_CC_SNAPSHOT ] = 0,
[HID_CC_STILL ] = 0,
[HID_CC_ASPECT ] = 0,
[HID_CC_3D_MODE_SELECT ] = 0,
[HID_CC_DISPLAY_BRIGHTNESS_INCREMENT ] = 0,
[HID_CC_DISPLAY_BRIGHTNESS_DECREMENT ] = 0,
[HID_CC_DISPLAY_BRIGHTNESS ] = 0,
[HID_CC_DISPLAY_BACKLIGHT_TOGGLE ] = 0,
[HID_CC_DISPLAY_SET_BRIGHTNESS_TO_MINIMUM ] = 0,
[HID_CC_DISPLAY_SET_BRIGHTNESS_TO_MAXIMUM ] = 0,
[HID_CC_DISPLAY_SET_AUTO_BRIGHTNESS ] = 0,
[HID_CC_SELECTION ] = 0,
[HID_CC_ASSIGN_SELECTION ] = 0,
[HID_CC_MODE_STEP ] = 0,
[HID_CC_RECALL_LAST ] = 0,
[HID_CC_ENTER_CHANNEL ] = 0,
[HID_CC_ORDER_MOVIE ] = 0,
[HID_CC_CHANNEL ] = 0,
[HID_CC_MEDIA_SELECTION ] = 0,
[HID_CC_MEDIA_SELECT_COMPUTER ] = 0,
[HID_CC_MEDIA_SELECT_TV ] = 0,
[HID_CC_MEDIA_SELECT_WWW ] = 0,
[HID_CC_MEDIA_SELECT_DVD ] = 0,
[HID_CC_MEDIA_SELECT_TELEPHONE ] = 0,
[HID_CC_MEDIA_SELECT_PROGRAM_GUIDE ] = 0,
[HID_CC_MEDIA_SELECT_VIDEO_PHONE ] = 0,
[HID_CC_MEDIA_SELECT_GAMES ] = 0,
[HID_CC_MEDIA_SELECT_MESSAGES ] = 0,
[HID_CC_MEDIA_SELECT_CD ] = 0,
[HID_CC_MEDIA_SELECT_VCR ] = 0,
[HID_CC_MEDIA_SELECT_TUNER ] = 0,
[HID_CC_QUIT ] = 0,
[HID_CC_HELP ] = KEY_HELP,
[HID_CC_MEDIA_SELECT_TAPE ] = 0,
[HID_CC_MEDIA_SELECT_CABLE ] = 0,
[HID_CC_MEDIA_SELECT_SATELLITE ] = 0,
[HID_CC_MEDIA_SELECT_SECURITY ] = 0,
[HID_CC_MEDIA_SELECT_HOME ] = 0,
[HID_CC_MEDIA_SELECT_CALL ] = 0,
[HID_CC_CHANNEL_INCREMENT ] = 0,
[HID_CC_CHANNEL_DECREMENT ] = 0,
[HID_CC_MEDIA_SELECT_SAP ] = 0,
[HID_CC_VCR_PLUS ] = 0,
[HID_CC_ONCE ] = 0,
[HID_CC_DAILY ] = 0,
[HID_CC_WEEKLY ] = 0,
[HID_CC_MONTHLY ] = 0,
[HID_CC_PLAY ] = KEY_PLAY,
[HID_CC_PAUSE ] = KEY_PAUSE,
[HID_CC_RECORD ] = KEY_RECORD,
[HID_CC_FAST_FORWARD ] = KEY_FASTFORWARD,
[HID_CC_REWIND ] = KEY_REWIND,
[HID_CC_SCAN_NEXT_TRACK ] = KEY_NEXTSONG,
[HID_CC_SCAN_PREVIOUS_TRACK ] = KEY_PREVIOUSSONG,
[HID_CC_STOP ] = KEY_STOP,
[HID_CC_EJECT ] = KEY_EJECTCD,
[HID_CC_RANDOM_PLAY ] = 0,
[HID_CC_SELECT_DISC ] = 0,
[HID_CC_ENTER_DISC ] = 0,
[HID_CC_REPEAT ] = 0,
[HID_CC_TRACKING ] = 0,
[HID_CC_TRACK_NORMAL ] = 0,
[HID_CC_SLOW_TRACKING ] = 0,
[HID_CC_FRAME_FORWARD ] = 0,
[HID_CC_FRAME_BACK ] = 0,
[HID_CC_MARK ] = 0,
[HID_CC_CLEAR_MARK ] = 0,
[HID_CC_REPEAT_FROM_MARK ] = 0,
[HID_CC_RETURN_TO_MARK ] = 0,
[HID_CC_SEARCH_MARK_FORWARD ] = 0,
[HID_CC_SEARCH_MARK_BACKWARDS ] = 0,
[HID_CC_COUNTER_RESET ] = 0,
[HID_CC_SHOW_COUNTER ] = 0,
[HID_CC_TRACKING_INCREMENT ] = 0,
[HID_CC_TRACKING_DECREMENT ] = 0,
[HID_CC_STOP_EJECT ] = 0,
[HID_CC_PLAY_PAUSE ] = KEY_PLAYPAUSE,
[HID_CC_PLAY_SKIP ] = 0,
[HID_CC_VOICE_COMMAND ] = KEY_VOICECOMMAND,
[HID_CC_VOLUME ] = 0,
[HID_CC_BALANCE ] = 0,
[HID_CC_MUTE ] = KEY_MUTE,
[HID_CC_BASS ] = 0,
[HID_CC_TREBLE ] = 0,
[HID_CC_BASS_BOOST ] = KEY_BASSBOOST,
[HID_CC_SURROUND_MODE ] = 0,
[HID_CC_LOUDNESS ] = 0,
[HID_CC_MPX ] = 0,
[HID_CC_VOLUME_UP ] = KEY_VOLUMEUP,
[HID_CC_VOLUME_DOWN ] = KEY_VOLUMEDOWN,
[HID_CC_SPEED_SELECT ] = 0,
[HID_CC_PLAYBACK_SPEED ] = 0,
[HID_CC_STANDARD_PLAY ] = 0,
[HID_CC_LONG_PLAY ] = 0,
[HID_CC_EXTENDED_PLAY ] = 0,
[HID_CC_SLOW ] = KEY_SLOW,
[HID_CC_FAN_ENABLE ] = 0,
[HID_CC_FAN_SPEED ] = 0,
[HID_CC_LIGHT_ENABLE ] = 0,
[HID_CC_LIGHT_ILLUMINATION_LEVEL ] = 0,
[HID_CC_CLIMATE_CONTROL_ENABLE ] = 0,
[HID_CC_ROOM_TEMPERATURE ] = 0,
[HID_CC_SECURITY_ENABLE ] = 0,
[HID_CC_FIRE_ALARM ] = 0,
[HID_CC_POLICE_ALARM ] = 0,
[HID_CC_PROXIMITY ] = 0,
[HID_CC_MOTION ] = 0,
[HID_CC_DURESS_ALARM ] = 0,
[HID_CC_HOLDUP_ALARM ] = 0,
[HID_CC_MEDICAL_ALARM ] = 0,
[HID_CC_BALANCE_RIGHT ] = 0,
[HID_CC_BALANCE_LEFT ] = 0,
[HID_CC_BASS_INCREMENT ] = 0,
[HID_CC_BASS_DECREMENT ] = 0,
[HID_CC_TREBLE_INCREMENT ] = 0,
[HID_CC_TREBLE_DECREMENT ] = 0,
[HID_CC_SPEAKER_SYSTEM ] = 0,
[HID_CC_CHANNEL_LEFT ] = 0,
[HID_CC_CHANNEL_RIGHT ] = 0,
[HID_CC_CHANNEL_CENTER ] = 0,
[HID_CC_CHANNEL_FRONT ] = 0,
[HID_CC_CHANNEL_CENTER_FRONT ] = 0,
[HID_CC_CHANNEL_SIDE ] = 0,
[HID_CC_CHANNEL_SURROUND ] = 0,
[HID_CC_CHANNEL_LOW_FREQ_ENHANCEMENT ] = 0,
[HID_CC_CHANNEL_TOP ] = 0,
[HID_CC_CHANNEL_UNKNOWN ] = 0,
[HID_CC_SUB_CHANNEL ] = 0,
[HID_CC_SUB_CHANNEL_INCREMENT ] = 0,
[HID_CC_SUB_CHANNEL_DECREMENT ] = 0,
[HID_CC_ALTERNATE_AUDIO_INCREMENT ] = 0,
[HID_CC_ALTERNATE_AUDIO_DECREMENT ] = 0,
[HID_CC_APPLICATION_LAUNCH_BUTTONS ] = 0,
[HID_CC_AL_LAUNCH_BUTTON_CONFIG_TOOL ] = 0,
[HID_CC_AL_PROGRAMMABLE_BUTTON_CONFIG ] = 0,
[HID_CC_AL_CONSUMER_CONTROL_CONFIG ] = KEY_CONFIG,
[HID_CC_AL_WORD_PROCESSOR ] = KEY_WORDPROCESSOR,
[HID_CC_AL_TEXT_EDITOR ] = KEY_EDITOR,
[HID_CC_AL_SPREADSHEET ] = KEY_SPREADSHEET,
[HID_CC_AL_GRAPHICS_EDITOR ] = KEY_GRAPHICSEDITOR,
[HID_CC_AL_PRESENTATION_APP ] = KEY_PRESENTATION,
[HID_CC_AL_DATABASE_APP ] = KEY_DATABASE,
[HID_CC_AL_EMAIL_READER ] = KEY_EMAIL,
[HID_CC_AL_NEWSREADER ] = KEY_NEWS,
[HID_CC_AL_VOICEMAIL ] = KEY_VOICEMAIL,
[HID_CC_AL_CONTACTS_ADDRESS_BOOK ] = KEY_ADDRESSBOOK,
[HID_CC_AL_CALENDAR_SCHEDULE ] = 0,
[HID_CC_AL_TASK_PROJECT_MANAGER ] = 0,
[HID_CC_AL_LOG_JOURNAL_TIMECARD ] = 0,
[HID_CC_AL_CHECKBOOK_FINANCE ] = KEY_FINANCE,
[HID_CC_AL_CALCULATOR ] = KEY_CALC,
[HID_CC_AL_A_VCAPTURE_PLAYBACK ] = 0,
[HID_CC_AL_LOCAL_MACHINE_BROWSER ] = KEY_FILE,
[HID_CC_AL_LAN_WANBROWSER ] = 0,
[HID_CC_AL_INTERNET_BROWSER ] = KEY_WWW,
[HID_CC_AL_REMOTE_NETWORKING_ISPCONNECT ] = 0,
[HID_CC_AL_NETWORK_CONFERENCE ] = 0,
[HID_CC_AL_NETWORK_CHAT ] = 0,
[HID_CC_AL_TELEPHONY_DIALER ] = KEY_PHONE,
[HID_CC_AL_LOGON ] = 0,
[HID_CC_AL_LOGOFF ] = 0,
[HID_CC_AL_LOGON_LOGOFF ] = 0,
[HID_CC_AL_TERMINAL_LOCK_SCREENSAVER ] = KEY_COFFEE,
[HID_CC_AL_CONTROL_PANEL ] = 0,
[HID_CC_AL_COMMAND_LINE_PROCESSOR_RUN ] = 0,
[HID_CC_AL_PROCESS_TASK_MANAGER ] = 0,
[HID_CC_AL_SELECT_TASK_APPLICATION ] = 0,
[HID_CC_AL_NEXT_TASK_APPLICATION ] = 0,
[HID_CC_AL_PREVIOUS_TASK_APPLICATION ] = 0,
[HID_CC_AL_PREEMPT_HALT_TASK_APPLICATION ] = 0,
[HID_CC_AL_INTEGRATED_HELP_CENTER ] = KEY_HELP,
[HID_CC_AL_DOCUMENTS ] = 0,
[HID_CC_AL_THESAURUS ] = 0,
[HID_CC_AL_DICTIONARY ] = 0,
[HID_CC_AL_DESKTOP ] = 0,
[HID_CC_AL_SPELL_CHECK ] = 0,
[HID_CC_AL_GRAMMAR_CHECK ] = 0,
[HID_CC_AL_WIRELESS_STATUS ] = 0,
[HID_CC_AL_KEYBOARD_LAYOUT ] = 0,
[HID_CC_AL_VIRUS_PROTECTION ] = 0,
[HID_CC_AL_ENCRYPTION ] = 0,
[HID_CC_AL_SCREEN_SAVER ] = KEY_SCREENSAVER,
[HID_CC_AL_ALARMS ] = 0,
[HID_CC_AL_CLOCK ] = 0,
[HID_CC_AL_FILE_BROWSER ] = KEY_FILE,
[HID_CC_AL_POWER_STATUS ] = 0,
[HID_CC_AL_IMAGE_BROWSER ] = KEY_IMAGES,
[HID_CC_AL_AUDIO_BROWSER ] = KEY_AUDIO,
[HID_CC_AL_MOVIE_BROWSER ] = KEY_VIDEO,
[HID_CC_AL_DIGITAL_RIGHTS_MANAGER ] = 0,
[HID_CC_AL_DIGITAL_WALLET ] = 0,
[HID_CC_AL_INSTANT_MESSAGING ] = KEY_MESSENGER,
[HID_CC_AL_OEMFEATURES_TIPS_TUTO_BROWSER ] = KEY_INFO,
[HID_CC_AL_OEMHELP ] = 0,
[HID_CC_AL_ONLINE_COMMUNITY ] = 0,
[HID_CC_AL_ENTERTAINMENT_CONTENT_BROWSER ] = 0,
[HID_CC_AL_ONLINE_SHOPPING_BROWSER ] = 0,
[HID_CC_AL_SMART_CARD_INFORMATION_HELP ] = 0,
[HID_CC_AL_MARKET_MONITOR_FINANCE_BROWSER ] = 0,
[HID_CC_AL_CUSTOMIZED_CORP_NEWS_BROWSER ] = 0,
[HID_CC_AL_ONLINE_ACTIVITY_BROWSER ] = 0,
[HID_CC_AL_RESEARCH_SEARCH_BROWSER ] = 0,
[HID_CC_AL_AUDIO_PLAYER ] = 0,
[HID_CC_GENERIC_GUIAPPLICATION_CONTROLS ] = 0,
[HID_CC_AC_NEW ] = KEY_NEW,
[HID_CC_AC_OPEN ] = KEY_OPEN,
[HID_CC_AC_CLOSE ] = KEY_CLOSE,
[HID_CC_AC_EXIT ] = KEY_EXIT,
[HID_CC_AC_MAXIMIZE ] = 0,
[HID_CC_AC_MINIMIZE ] = 0,
[HID_CC_AC_SAVE ] = KEY_SAVE,
[HID_CC_AC_PRINT ] = KEY_PRINT,
[HID_CC_AC_PROPERTIES ] = KEY_PROPS,
[HID_CC_AC_UNDO ] = KEY_UNDO,
[HID_CC_AC_COPY ] = KEY_COPY,
[HID_CC_AC_CUT ] = KEY_CUT,
[HID_CC_AC_PASTE ] = KEY_PASTE,
[HID_CC_AC_SELECT_ALL ] = KEY_SELECT,
[HID_CC_AC_FIND ] = KEY_FIND,
[HID_CC_AC_FINDAND_REPLACE ] = 0,
[HID_CC_AC_SEARCH ] = KEY_SEARCH,
[HID_CC_AC_GO_TO ] = KEY_GOTO,
[HID_CC_AC_HOME ] = KEY_HOMEPAGE,
[HID_CC_AC_BACK ] = KEY_BACK,
[HID_CC_AC_FORWARD ] = KEY_FORWARD,
[HID_CC_AC_STOP ] = KEY_STOP,
[HID_CC_AC_REFRESH ] = KEY_REFRESH,
[HID_CC_AC_PREVIOUS_LINK ] = KEY_PREVIOUS,
[HID_CC_AC_NEXT_LINK ] = KEY_NEXT,
[HID_CC_AC_BOOKMARKS ] = KEY_BOOKMARKS,
[HID_CC_AC_HISTORY ] = 0,
[HID_CC_AC_SUBSCRIPTIONS ] = 0,
[HID_CC_AC_ZOOM_IN ] = KEY_ZOOMIN,
[HID_CC_AC_ZOOM_OUT ] = KEY_ZOOMOUT,
[HID_CC_AC_ZOOM ] = KEY_ZOOMRESET,
[HID_CC_AC_FULL_SCREEN_VIEW ] = 0,
[HID_CC_AC_NORMAL_VIEW ] = 0,
[HID_CC_AC_VIEW_TOGGLE ] = 0,
[HID_CC_AC_SCROLL_UP ] = KEY_SCROLLUP,
[HID_CC_AC_SCROLL_DOWN ] = KEY_SCROLLDOWN,
[HID_CC_AC_SCROLL ] = 0,
[HID_CC_AC_PAN_LEFT ] = 0,
[HID_CC_AC_PAN_RIGHT ] = 0,
[HID_CC_AC_PAN ] = 0,
[HID_CC_AC_NEW_WINDOW ] = 0,
[HID_CC_AC_TILE_HORIZONTALLY ] = 0,
[HID_CC_AC_TILE_VERTICALLY ] = 0,
[HID_CC_AC_FORMAT ] = 0,
[HID_CC_AC_EDIT ] = KEY_EDIT,
[HID_CC_AC_BOLD ] = 0,
[HID_CC_AC_ITALICS ] = 0,
[HID_CC_AC_UNDERLINE ] = 0,
[HID_CC_AC_STRIKETHROUGH ] = 0,
[HID_CC_AC_SUBSCRIPT ] = 0,
[HID_CC_AC_SUPERSCRIPT ] = 0,
[HID_CC_AC_ALL_CAPS ] = 0,
[HID_CC_AC_ROTATE ] = 0,
[HID_CC_AC_RESIZE ] = 0,
[HID_CC_AC_FLIPHORIZONTAL ] = 0,
[HID_CC_AC_FLIP_VERTICAL ] = 0,
[HID_CC_AC_MIRROR_HORIZONTAL ] = 0,
[HID_CC_AC_MIRROR_VERTICAL ] = 0,
[HID_CC_AC_FONT_SELECT ] = 0,
[HID_CC_AC_FONT_COLOR ] = 0,
[HID_CC_AC_FONT_SIZE ] = 0,
[HID_CC_AC_JUSTIFY_LEFT ] = 0,
[HID_CC_AC_JUSTIFY_CENTER_H ] = 0,
[HID_CC_AC_JUSTIFY_RIGHT ] = 0,
[HID_CC_AC_JUSTIFY_BLOCK_H ] = 0,
[HID_CC_AC_JUSTIFY_TOP ] = 0,
[HID_CC_AC_JUSTIFY_CENTER_V ] = 0,
[HID_CC_AC_JUSTIFY_BOTTOM ] = 0,
[HID_CC_AC_JUSTIFY_BLOCK_V ] = 0,
[HID_CC_AC_INDENT_DECREASE ] = 0,
[HID_CC_AC_INDENT_INCREASE ] = 0,
[HID_CC_AC_NUMBERED_LIST ] = 0,
[HID_CC_AC_RESTART_NUMBERING ] = 0,
[HID_CC_AC_BULLETED_LIST ] = 0,
[HID_CC_AC_PROMOTE ] = 0,
[HID_CC_AC_DEMOTE ] = 0,
[HID_CC_AC_YES ] = 0,
[HID_CC_AC_NO ] = 0,
[HID_CC_AC_CANCEL ] = KEY_CANCEL,
[HID_CC_AC_CATALOG ] = 0,
[HID_CC_AC_BUY_CHECKOUT ] = 0,
[HID_CC_AC_ADDTO_CART ] = 0,
[HID_CC_AC_EXPAND ] = 0,
[HID_CC_AC_EXPAND_ALL ] = 0,
[HID_CC_AC_COLLAPSE ] = 0,
[HID_CC_AC_COLLAPSE_ALL ] = 0,
[HID_CC_AC_PRINT_PREVIEW ] = 0,
[HID_CC_AC_PASTE_SPECIAL ] = 0,
[HID_CC_AC_INSERT_MODE ] = 0,
[HID_CC_AC_DELETE ] = KEY_DELETE,
[HID_CC_AC_LOCK ] = 0,
[HID_CC_AC_UNLOCK ] = 0,
[HID_CC_AC_PROTECT ] = 0,
[HID_CC_AC_UNPROTECT ] = 0,
[HID_CC_AC_ATTACH_COMMENT ] = 0,
[HID_CC_AC_DELETE_COMMENT ] = 0,
[HID_CC_AC_VIEW_COMMENT ] = 0,
[HID_CC_AC_SELECT_WORD ] = 0,
[HID_CC_AC_SELECT_SENTENCE ] = 0,
[HID_CC_AC_SELECT_PARAGRAPH ] = 0,
[HID_CC_AC_SELECT_COLUMN ] = 0,
[HID_CC_AC_SELECT_ROW ] = 0,
[HID_CC_AC_SELECT_TABLE ] = 0,
[HID_CC_AC_SELECT_OBJECT ] = 0,
[HID_CC_AC_REDO_REPEAT ] = KEY_REDO,
[HID_CC_AC_SORT ] = 0,
[HID_CC_AC_SORT_ASCENDING ] = 0,
[HID_CC_AC_SORT_DESCENDING ] = 0,
[HID_CC_AC_FILTER ] = 0,
[HID_CC_AC_SET_CLOCK ] = 0,
[HID_CC_AC_VIEW_CLOCK ] = 0,
[HID_CC_AC_SELECT_TIME_ZONE ] = 0,
[HID_CC_AC_EDIT_TIME_ZONES ] = 0,
[HID_CC_AC_SET_ALARM ] = 0,
[HID_CC_AC_CLEAR_ALARM ] = 0,
[HID_CC_AC_SNOOZE_ALARM ] = 0,
[HID_CC_AC_RESET_ALARM ] = 0,
[HID_CC_AC_SYNCHRONIZE ] = 0,
[HID_CC_AC_SEND_RECEIVE ] = 0,
[HID_CC_AC_SEND_TO ] = 0,
[HID_CC_AC_REPLY ] = KEY_REPLY,
[HID_CC_AC_REPLY_ALL ] = 0,
[HID_CC_AC_FORWARD_MSG ] = KEY_FORWARDMAIL,
[HID_CC_AC_SEND ] = KEY_SEND,
[HID_CC_AC_ATTACH_FILE ] = 0,
[HID_CC_AC_UPLOAD ] = 0,
[HID_CC_AC_DOWNLOAD(SAVE_TARGET_AS) ] = 0,
[HID_CC_AC_SET_BORDERS ] = 0,
[HID_CC_AC_INSERT_ROW ] = 0,
[HID_CC_AC_INSERT_COLUMN ] = 0,
[HID_CC_AC_INSERT_FILE ] = 0,
[HID_CC_AC_INSERT_PICTURE ] = 0,
[HID_CC_AC_INSERT_OBJECT ] = 0,
[HID_CC_AC_INSERT_SYMBOL ] = 0,
[HID_CC_AC_SAVEAND_CLOSE ] = 0,
[HID_CC_AC_RENAME ] = 0,
[HID_CC_AC_MERGE ] = 0,
[HID_CC_AC_SPLIT ] = 0,
[HID_CC_AC_DISRIBUTE_HORIZONTALLY ] = 0,
[HID_CC_AC_DISTRIBUTE_VERTICALLY ] = 0,
};
unsigned int
ratbag_hidraw_get_keycode_from_keyboard_usage(struct ratbag_device *device,
uint8_t hid_code)
@@ -418,6 +1190,26 @@ ratbag_hidraw_get_keyboard_usage_from_keycode(struct ratbag_device *device, unsi
return 0;
}
unsigned int
ratbag_hidraw_get_keycode_from_consumer_usage(struct ratbag_device *device,
uint16_t hid_code)
{
return hid_consumer_mapping[hid_code];
}
uint16_t
ratbag_hidraw_get_consumer_usage_from_keycode(struct ratbag_device *device, unsigned keycode)
{
unsigned int j;
for (j = 0; j < ARRAY_LENGTH(hid_consumer_mapping); j++) {
if (hid_consumer_mapping[j] == keycode)
return j;
}
return 0;
}
static int
ratbag_hidraw_parse_report_descriptor(struct ratbag_device *device)
{

View File

@@ -168,4 +168,22 @@ ratbag_hidraw_get_keycode_from_keyboard_usage(struct ratbag_device *device,
uint8_t
ratbag_hidraw_get_keyboard_usage_from_keycode(struct ratbag_device *device,
unsigned keycode);
/**
* Gives the input key code associated to the Consumer Control HID usage.
*
* @return the key code of the HID usage or 0.
*/
unsigned int
ratbag_hidraw_get_keycode_from_consumer_usage(struct ratbag_device *device,
uint16_t hid_code);
/**
* Gives the HID Consumer Control usage associated to the input keycode.
*
* @return the HID Consumer Control usage or 0.
*/
uint16_t
ratbag_hidraw_get_consumer_usage_from_keycode(struct ratbag_device *device,
unsigned keycode);
#endif /* LIBRATBAG_HIDRAW_H */