]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
core: Add HID usage for Display Brightness Control
authortmk <hasu@tmk-kbd.com>
Mon, 11 May 2020 12:51:41 +0000 (21:51 +0900)
committertmk <hasu@tmk-kbd.com>
Mon, 11 May 2020 12:58:50 +0000 (21:58 +0900)
tmk_core/common/action.c
tmk_core/common/actionmap.h
tmk_core/common/keycode.h
tmk_core/common/keymap.c
tmk_core/common/report.h

index 5a6f3df3116a1f0afa84028fa95c1cbed5bfd8ac..85a0631ffe3960a14220d0a2a41c4165110e7675 100644 (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
index ca643e825123224e95adbca3980cbdf9de7dd5a6..c8f9c38df4723a20210e9373a174c770a04c9e65 100644 (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)
 
index acbe5c320fb1acbbe24cc640eb25275a37e1165d..534f52d54f8f92528463bcaabfb8c74c95101713 100644 (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,
index 80ad388edb8673cabb8b02428a4d9e8a88a26157..617a1f70d81e0e305884d869f836118719156fde 100644 (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:
index 2a2ff2ded50199dc23e2af7acd5aa1c4a568486a..fde57776e0d17098c7788848bf2e88125f840437 100644 (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
 }