# -*- python-mode -*- ## Copyright (C) 2012-2013 Daniel Pavel ## ## 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 ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License along ## with this program; if not, write to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Reprogrammable keys information # Mostly from Logitech documentation, but with some edits for better Lunix compatability from .common import NamedInts as _NamedInts # tasks.py Switch_Presentation__Switch_Screen=0x0093, # on K400 Plus Minimize_Window=0x0094, Maximize_Window=0x0095, # on K400 Plus MultiPlatform_App_Switch=0x0096, MultiPlatform_Home=0x0097, MultiPlatform_Menu=0x0098, MultiPlatform_Back=0x0099, Switch_Language=0x009A, # Mac_switch_language Screen_Capture=0x009B, # Mac_screen_Capture, on Craft Keyboard Gesture_Button=0x009C, Smart_Shift=0x009D, AppExpose=0x009E, Smart_Zoom=0x009F, Lookup=0x00A0, Microphone_on__off=0x00A1, Wifi_on__off=0x00A2, Brightness_Down=0x00A3, Brightness_Up=0x00A4, Display_Out=0x00A5, View_Open_Apps=0x00A6, View_All_Open_Apps=0x00A7, AppSwitch=0x00A8, Gesture_Button_Navigation=0x00A9, # Mouse_Thumb_Button on MX Master Fn_inversion=0x00AA, Multiplatform_Back=0x00AB, Multiplatform_Forward=0x00AC, Multiplatform_Gesture_Button=0x00AD, HostSwitch_Channel_1=0x00AE, HostSwitch_Channel_2=0x00AF, HostSwitch_Channel_3=0x00B0, Multiplatform_Search=0x00B1, Multiplatform_Home__Mission_Control=0x00B2, Multiplatform_Menu__Launchpad=0x00B3, Virtual_Gesture_Button=0x00B4, Cursor=0x00B5, Keyboard_Right_Arrow=0x00B6, SW_Custom_Highlight=0x00B7, Keyboard_Left_Arrow=0x00B8, TBD=0x00B9, Multiplatform_Language_Switch=0x00BA, SW_Custom_Highlight_2=0x00BB, Fast_Forward=0x00BC, Fast_Backward=0x00BD, Switch_Highlighting=0x00BE, Mission_Control__Task_View=0x00BF, # Switch_Workspace on Craft Keyboard Dashboard_Launchpad__Action_Center=0x00C0, # Application_Launcher on Craft Keyboard Backlight_Down=0x00C1, # Backlight_Down_FW_internal_function Backlight_Up=0x00C2, # Backlight_Up_FW_internal_function Right_Click__App_Contextual_Menu=0x00C3, # Context_Menu on Craft Keyboard DPI_Change=0x00C4, New_Tab=0x00C5, F2=0x00C6, F3=0x00C7, F4=0x00C8, F5=0x00C9, F6=0x00CA, F7=0x00CB, F8=0x00CC, F1=0x00CD, Laser_Button=0x00CE, Laser_Button_Long_Press=0x00CF, Start_Presentation=0x00D0, Blank_Screen=0x00D1, DPI_Switch=0x00D2, # AdjustDPI on MX Vertical Home__Show_Desktop=0x00D3, App_Switch__Dashboard=0x00D4, App_Switch=0x00D5, Fn_Inversion=0x00D6, LeftAndRightClick=0x00D7, LedToggle=0x00DD, # ) TASK._fallback = lambda x: 'unknown:%04X' % x # Capabilities and desired software handling for a control # Ref: https://drive.google.com/file/d/10imcbmoxTJ1N510poGdsviEhoFfB_Ua4/view # We treat bytes 4 and 8 of `getCidInfo` as a single bitfield KEY_FLAG = _NamedInts( analytics_key_events=0x400, force_raw_XY=0x200, raw_XY=0x100, virtual=0x80, persistently_divertable=0x40, divertable=0x20, reprogrammable=0x10, FN_sensitive=0x08, nonstandard=0x04, is_FN=0x02, mse=0x01 ) # Flags describing the reporting method of a control # We treat bytes 2 and 5 of `get/setCidReporting` as a single bitfield MAPPING_FLAG = _NamedInts( analytics_key_events_reporting=0x100, force_raw_XY_diverted=0x40, raw_XY_diverted=0x10, persistently_diverted=0x04, diverted=0x01 ) CID_GROUP_BIT = _NamedInts(g8=0x80, g7=0x40, g6=0x20, g5=0x10, g4=0x08, g3=0x04, g2=0x02, g1=0x01) CID_GROUP = _NamedInts(g8=8, g7=7, g6=6, g5=5, g4=4, g3=3, g2=2, g1=1) DISABLE = _NamedInts( Caps_Lock=0x01, Num_Lock=0x02, Scroll_Lock=0x04, Insert=0x08, Win=0x10, # aka Super ) DISABLE._fallback = lambda x: 'unknown:%02X' % x