summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2025-01-29 19:28:06 +0000
committerQMK Bot <hello@qmk.fm>2025-01-29 19:28:06 +0000
commitae01f1b63e6c48af462311ae75dc7201e552e34e (patch)
tree146951c9ed02dac36068bd4fc9cbcdb771476bed /quantum
parent0c14fc3a211fc6ba55cf58c1b8224700102a33b3 (diff)
parent8bf01dd7966c9d556a7931be47f97bafe9a32ff9 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'quantum')
-rw-r--r--quantum/os_detection.c2
-rw-r--r--quantum/os_detection/tests/os_detection.cpp61
2 files changed, 55 insertions, 8 deletions
diff --git a/quantum/os_detection.c b/quantum/os_detection.c
index 0dd048a8c4..84bbeeed54 100644
--- a/quantum/os_detection.c
+++ b/quantum/os_detection.c
@@ -133,7 +133,7 @@ void process_wlength(const uint16_t w_length) {
133 } else if (setups_data.count == setups_data.cnt_ff) { 133 } else if (setups_data.count == setups_data.cnt_ff) {
134 // Linux has 3 packets with 0xFF. 134 // Linux has 3 packets with 0xFF.
135 guessed = OS_LINUX; 135 guessed = OS_LINUX;
136 } else if (setups_data.count == 5 && setups_data.last_wlength == 0xFF && setups_data.cnt_ff == 1 && setups_data.cnt_02 == 2) { 136 } else if (setups_data.count >= 5 && setups_data.last_wlength == 0xFF && setups_data.cnt_ff >= 1 && setups_data.cnt_02 >= 2) {
137 guessed = OS_MACOS; 137 guessed = OS_MACOS;
138 } else if (setups_data.count == 4 && setups_data.cnt_ff == 0 && setups_data.cnt_02 == 2) { 138 } else if (setups_data.count == 4 && setups_data.cnt_ff == 0 && setups_data.cnt_02 == 2) {
139 // iOS and iPadOS don't have the last 0xFF packet. 139 // iOS and iPadOS don't have the last 0xFF packet.
diff --git a/quantum/os_detection/tests/os_detection.cpp b/quantum/os_detection/tests/os_detection.cpp
index ea43de144c..21c4536243 100644
--- a/quantum/os_detection/tests/os_detection.cpp
+++ b/quantum/os_detection/tests/os_detection.cpp
@@ -68,8 +68,12 @@ ChibiOS:
68Windows 10: [FF, FF, 4, 24, 4, 24, 4, FF, 24, FF, 4, FF, 24, 4, 24, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A] 68Windows 10: [FF, FF, 4, 24, 4, 24, 4, FF, 24, FF, 4, FF, 24, 4, 24, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A]
69Windows 10 (another host): [FF, FF, 4, 24, 4, 24, 4, 24, 4, 24, 4, 24] 69Windows 10 (another host): [FF, FF, 4, 24, 4, 24, 4, 24, 4, 24, 4, 24]
70macOS 12.5: [2, 24, 2, 28, FF] 70macOS 12.5: [2, 24, 2, 28, FF]
71macOS 15.1.x: [ 2, 4E, 2, 1C, 2, 1A, FF, FF]
72macOS 15.x (another host): [ 2, 0E, 2, 1E, 2, 42, FF]
73macOS 15.x (periodic weirdness): [ 2, 42, 2, 1C, 2, 1A, FF, 2, 42, 2, 1C, 2, 1A, FF ]
71iOS/iPadOS 15.6: [2, 24, 2, 28] 74iOS/iPadOS 15.6: [2, 24, 2, 28]
72Linux (including Android, Raspberry Pi and WebOS TV): [FF, FF, FF] 75Linux (including Android, Raspberry Pi and WebOS TV): [FF, FF, FF]
76Linux (another host): [FF, FF, FF, FF, FF, FF]
73PS5: [2, 4, 2, 28, 2, 24] 77PS5: [2, 4, 2, 28, 2, 24]
74Nintendo Switch: [82, FF, 40, 40, FF, 40, 40, FF, 40, 40, FF, 40, 40, FF, 40, 40] 78Nintendo Switch: [82, FF, 40, 40, FF, 40, 40, FF, 40, 40, FF, 40, 40, FF, 40, 40]
75Quest 2: [FF, FF, FF, FE, FF, FE, FF, FE, FF, FE, FF] 79Quest 2: [FF, FF, FF, FE, FF, FE, FF, FE, FF, FE, FF]
@@ -79,6 +83,7 @@ Windows 10 (first connect): [12, FF, FF, 4, 10, FF, FF, FF, 4, 10, 20A, 20A, 20A
79Windows 10 (subsequent connect): [FF, FF, 4, 10, FF, 4, FF, 10, FF, 20A, 20A, 20A, 20A, 20A, 20A] 83Windows 10 (subsequent connect): [FF, FF, 4, 10, FF, 4, FF, 10, FF, 20A, 20A, 20A, 20A, 20A, 20A]
80Windows 10 (another host): [FF, FF, 4, 10, 4, 10] 84Windows 10 (another host): [FF, FF, 4, 10, 4, 10]
81macOS: [2, 10, 2, E, FF] 85macOS: [2, 10, 2, E, FF]
86macOS 15.x: [ 2, 64, 2, 28, FF, FF]
82iOS/iPadOS: [2, 10, 2, E] 87iOS/iPadOS: [2, 10, 2, E]
83Linux: [FF, FF, FF] 88Linux: [FF, FF, FF]
84PS5: [2, 4, 2, E, 2, 10] 89PS5: [2, 4, 2, E, 2, 10]
@@ -109,18 +114,67 @@ TEST_F(OsDetectionTest, TestLinux) {
109 assert_not_reported(); 114 assert_not_reported();
110} 115}
111 116
117TEST_F(OsDetectionTest, TestChibiosLinux) {
118 EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}), OS_LINUX);
119 os_detection_task();
120 assert_not_reported();
121}
122
112TEST_F(OsDetectionTest, TestChibiosMacos) { 123TEST_F(OsDetectionTest, TestChibiosMacos) {
113 EXPECT_EQ(check_sequence({0x2, 0x24, 0x2, 0x28, 0xFF}), OS_MACOS); 124 EXPECT_EQ(check_sequence({0x2, 0x24, 0x2, 0x28, 0xFF}), OS_MACOS);
114 os_detection_task(); 125 os_detection_task();
115 assert_not_reported(); 126 assert_not_reported();
116} 127}
117 128
129TEST_F(OsDetectionTest, TestChibiosMacos2) {
130 EXPECT_EQ(check_sequence({0x2, 0x42, 0x2, 0x1C, 0x2, 0x1A, 0xFF}), OS_MACOS);
131 os_detection_task();
132 assert_not_reported();
133}
134
135TEST_F(OsDetectionTest, TestChibiosMacos3) {
136 EXPECT_EQ(check_sequence({0x2, 0x42, 0x2, 0x1C, 0x2, 0x1A, 0xFF, 0x2, 0x42, 0x2, 0x1C, 0x2, 0x1A, 0xFF}), OS_MACOS);
137 os_detection_task();
138 assert_not_reported();
139}
140
141// Regression reported in https://github.com/qmk/qmk_firmware/pull/21777#issuecomment-1922815841
142TEST_F(OsDetectionTest, TestChibiosMacM1) {
143 EXPECT_EQ(check_sequence({0x02, 0x32, 0x02, 0x24, 0x101, 0xFF}), OS_MACOS);
144 os_detection_task();
145 assert_not_reported();
146}
147
148TEST_F(OsDetectionTest, TestChibiosMacSequoia) {
149 EXPECT_EQ(check_sequence({0x02, 0x4E, 0x02, 0x1C, 0x02, 0x1A, 0xFF, 0xFF}), OS_MACOS);
150 os_detection_task();
151 assert_not_reported();
152}
153
154TEST_F(OsDetectionTest, TestChibiosMacSequoia2) {
155 EXPECT_EQ(check_sequence({0x02, 0x4E, 0x02, 0x1C, 0x02, 0x1A, 0xFF, 0x02, 0x42, 0x02, 0x1C, 0x02, 0x1A, 0xFF}), OS_MACOS);
156 os_detection_task();
157 assert_not_reported();
158}
159
160TEST_F(OsDetectionTest, TestChibiosMacSequoia3) {
161 EXPECT_EQ(check_sequence({0x02, 0x0E, 0x02, 0x1E, 0x02, 0x42, 0xFF}), OS_MACOS);
162 os_detection_task();
163 assert_not_reported();
164}
165
118TEST_F(OsDetectionTest, TestLufaMacos) { 166TEST_F(OsDetectionTest, TestLufaMacos) {
119 EXPECT_EQ(check_sequence({0x2, 0x10, 0x2, 0xE, 0xFF}), OS_MACOS); 167 EXPECT_EQ(check_sequence({0x2, 0x10, 0x2, 0xE, 0xFF}), OS_MACOS);
120 os_detection_task(); 168 os_detection_task();
121 assert_not_reported(); 169 assert_not_reported();
122} 170}
123 171
172TEST_F(OsDetectionTest, TestDetectLufaMacSequoia2) {
173 EXPECT_EQ(check_sequence({0x02, 0x64, 0x02, 0x28, 0xFF, 0xFF}), OS_MACOS);
174 os_detection_task();
175 assert_not_reported();
176}
177
124TEST_F(OsDetectionTest, TestVusbMacos) { 178TEST_F(OsDetectionTest, TestVusbMacos) {
125 EXPECT_EQ(check_sequence({0x2, 0xE, 0x2, 0xE, 0xFF}), OS_MACOS); 179 EXPECT_EQ(check_sequence({0x2, 0xE, 0x2, 0xE, 0xFF}), OS_MACOS);
126 os_detection_task(); 180 os_detection_task();
@@ -235,13 +289,6 @@ TEST_F(OsDetectionTest, TestVusbQuest2) {
235 assert_not_reported(); 289 assert_not_reported();
236} 290}
237 291
238// Regression reported in https://github.com/qmk/qmk_firmware/pull/21777#issuecomment-1922815841
239TEST_F(OsDetectionTest, TestDetectMacM1AsIOS) {
240 EXPECT_EQ(check_sequence({0x02, 0x32, 0x02, 0x24, 0x101, 0xFF}), OS_IOS);
241 os_detection_task();
242 assert_not_reported();
243}
244
245TEST_F(OsDetectionTest, TestDoNotReportIfUsbUnstable) { 292TEST_F(OsDetectionTest, TestDoNotReportIfUsbUnstable) {
246 EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFE}), OS_LINUX); 293 EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFE}), OS_LINUX);
247 os_detection_task(); 294 os_detection_task();