core: Add HID usage for Display Brightness Control

This commit is contained in:
tmk 2020-05-11 21:51:41 +09:00
parent 42b7bf8942
commit dd316b990f
5 changed files with 34 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
Copyright 2012,2013,2020 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/*
Copyright 2015 Jun Wako <wakojun@gmail.com>
Copyright 2015,2020 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -283,6 +283,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define AC_WWW_STOP ACTION_USAGE_CONSUMER(APPCONTROL_STOP)
#define AC_WWW_REFRESH ACTION_USAGE_CONSUMER(APPCONTROL_REFRESH)
#define AC_WWW_FAVORITES ACTION_USAGE_CONSUMER(APPCONTROL_BOOKMARKS)
#define AC_BRIGHTNESS_INC ACTION_USAGE_CONSUMER(BRIGHTNESS_INCREMENT)
#define AC_BRIGHTNESS_DEC ACTION_USAGE_CONSUMER(BRIGHTNESS_DECREMENT)
/* Mousekey */
#define AC_MS_UP ACTION_MOUSEKEY(KC_MS_UP)
@ -417,6 +419,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define AC_WSTP ACTION_USAGE_CONSUMER(APPCONTROL_STOP)
#define AC_WREF ACTION_USAGE_CONSUMER(APPCONTROL_REFRESH)
#define AC_WFAV ACTION_USAGE_CONSUMER(APPCONTROL_BOOKMARKS)
#define AC_BRTI ACTION_USAGE_CONSUMER(BRIGHTNESS_INCREMENT)
#define AC_BRTD ACTION_USAGE_CONSUMER(BRIGHTNESS_DECREMENT)
/* Transparent */
#define AC_TRNS ACTION_KEY(KC_TRANSPARENT)

View file

@ -1,5 +1,5 @@
/*
Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
Copyright 2011,2012,2020 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
#define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE)
#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_WFAV)
#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_BRIGHTNESS_DEC)
#define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31)
#define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_ACCEL2)
#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT)
@ -174,6 +174,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KC_WSTP KC_WWW_STOP
#define KC_WREF KC_WWW_REFRESH
#define KC_WFAV KC_WWW_FAVORITES
#define KC_BRTI KC_BRIGHTNESS_INC
#define KC_BRTD KC_BRIGHTNESS_DEC
/* Jump to bootloader */
#define KC_BTLD KC_BOOTLOADER
/* Transparent */
@ -438,7 +440,9 @@ enum internal_special_keycodes {
KC_WWW_FORWARD,
KC_WWW_STOP,
KC_WWW_REFRESH,
KC_WWW_FAVORITES, /* 0xBC */
KC_WWW_FAVORITES,
KC_BRIGHTNESS_INC,
KC_BRIGHTNESS_DEC, /* 0xBE */
/* Jump to bootloader */
KC_BOOTLOADER = 0xBF,

View file

@ -1,5 +1,5 @@
/*
Copyright 2013,2016 Jun Wako <wakojun@gmail.com>
Copyright 2013,2016,2020 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -145,7 +145,7 @@ static action_t keycode_to_action(uint8_t keycode)
case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
return (action_t)ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
break;
case KC_AUDIO_MUTE ... KC_WWW_FAVORITES:
case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DEC:
return (action_t)ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
break;
case KC_MS_UP ... KC_MS_ACCEL2:

View file

@ -1,5 +1,5 @@
/*
Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
Copyright 2011,2012,2020 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -37,8 +37,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MOUSE_BTN7 (1<<6)
#define MOUSE_BTN8 (1<<7)
/* Consumer Page(0x0C)
* following are supported by Windows: http://msdn.microsoft.com/en-us/windows/hardware/gg463372.aspx
/*
* USB HID Specifications
* https://www.usb.org/hid#approved-usage-table-review-requests
*/
/*
* Consumer Page(0x0C)
* https://github.com/tmk/tmk_keyboard/issues/370
*/
#define AUDIO_MUTE 0x00E2
#define AUDIO_VOL_UP 0x00E9
@ -68,8 +75,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TRANSPORT_REWIND 0x00B4
#define TRANSPORT_EJECT 0x00B8
#define APPCONTROL_MINIMIZE 0x0206
/* Display Brightness Controls https://www.usb.org/sites/default/files/hutrr41_0.pdf */
#define BRIGHTNESS_INCREMENT 0x006F
#define BRIGHTNESS_DECREMENT 0x0070
/* Generic Desktop Page(0x01) - system power control */
/*
* Generic Desktop Page(0x01) - system power control
*/
#define SYSTEM_POWER_DOWN 0x0081
#define SYSTEM_SLEEP 0x0082
#define SYSTEM_WAKE_UP 0x0083
@ -182,7 +194,9 @@ typedef struct {
(key == KC_WWW_FORWARD ? APPCONTROL_FORWARD : \
(key == KC_WWW_STOP ? APPCONTROL_STOP : \
(key == KC_WWW_REFRESH ? APPCONTROL_REFRESH : \
(key == KC_WWW_FAVORITES ? APPCONTROL_BOOKMARKS : 0)))))))))))))))))))))
(key == KC_WWW_FAVORITES ? APPCONTROL_BOOKMARKS : \
(key == KC_BRIGHTNESS_INC ? BRIGHTNESS_INCREMENT : \
(key == KC_BRIGHTNESS_DEC ? BRIGHTNESS_DECREMENT : 0)))))))))))))))))))))))
#ifdef __cplusplus
}