os_detection.h (1658B)
1 /* Copyright 2022 Ruslan Sayfutdinov (@KapJI) 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 2 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16 17 #pragma once 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 #include "usb_device_state.h" 22 23 typedef enum { 24 OS_UNSURE, 25 OS_LINUX, 26 OS_WINDOWS, 27 OS_MACOS, 28 OS_IOS, 29 } os_variant_t; 30 31 void process_wlength(const uint16_t w_length); 32 os_variant_t detected_host_os(void); 33 void erase_wlength_data(void); 34 void os_detection_notify_usb_device_state_change(struct usb_device_state usb_device_state); 35 36 void os_detection_task(void); 37 38 bool process_detected_host_os_kb(os_variant_t os); 39 bool process_detected_host_os_user(os_variant_t os); 40 41 #if defined(SPLIT_KEYBOARD) && defined(SPLIT_DETECTED_OS_ENABLE) 42 void slave_update_detected_host_os(os_variant_t os); 43 #endif 44 45 #ifdef OS_DETECTION_DEBUG_ENABLE 46 # if defined(DYNAMIC_KEYMAP_ENABLE) || defined(VIA_ENABLE) 47 # error Cannot enable OS Detection debug mode simultaneously with DYNAMIC_KEYMAP or VIA 48 # endif 49 void print_stored_setups(void); 50 void store_setups_in_eeprom(void); 51 #endif