os_detection.h
1490 bytes
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
23typedef enum {
24 OS_UNSURE,
25 OS_LINUX,
26 OS_WINDOWS,
27 OS_MACOS,
28 OS_IOS,
29} os_variant_t;
30
31void process_wlength(const uint16_t w_length);
32os_variant_t detected_host_os(void);
33void erase_wlength_data(void);
34void os_detection_notify_usb_device_state_change(struct usb_device_state usb_device_state);
35
36void os_detection_task(void);
37
38bool process_detected_host_os_kb(os_variant_t os);
39bool process_detected_host_os_user(os_variant_t os);
40
41#if defined(SPLIT_KEYBOARD) && defined(SPLIT_DETECTED_OS_ENABLE)
42void slave_update_detected_host_os(os_variant_t os);
43#endif
44
45#ifdef OS_DETECTION_DEBUG_ENABLE
46void print_stored_setups(void);
47void store_setups_in_eeprom(void);
48#endif