Skip to content

Commit 4cc1937

Browse files
committed
Fix Unisoc T618 Chipset Detection
Add support for uppercase "UNISOC T" prefix in `match_t` function to handle devices like Samsung Galaxy Tab A8 (SM-X205N) that report "UNISOC T618" instead of the expected mixed-case "Unisoc T618". The function now explicitly matches both variants: - "Unisoc T" (mixed case, existing) - "UNISOC T" (uppercase, new) This ensures proper chipset vendor detection on affected Samsung devices where the uppercase variant caused match failures. Includes test case for "UNISOC T618" detection.
1 parent 0d5985d commit 4cc1937

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/arm/linux/chipset.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ static bool match_sc(const char* start, const char* end, struct cpuinfo_arm_chip
953953
}
954954

955955
/**
956-
* Tries to match, case-sentitively, /Unisoc T\d{3,4}/ signature for Unisoc T
956+
* Tries to match, case-sentitively, /Unisoc T\d{3,4}/ or /UNISOC T\d{3,4}/ signature for Unisoc T
957957
* chipset. If match successful, extracts model information into \p chipset
958958
* argument.
959959
*
@@ -967,7 +967,7 @@ static bool match_sc(const char* start, const char* end, struct cpuinfo_arm_chip
967967
* @returns true if signature matched, false otherwise.
968968
*/
969969
static bool match_t(const char* start, const char* end, struct cpuinfo_arm_chipset chipset[restrict static 1]) {
970-
/* Expect 11-12 symbols: "Unisoc T" (8 symbols) + 3-4-digit model number
970+
/* Expect 11-12 symbols: "Unisoc T" / "UNISOC T" (8 symbols) + 3-4-digit model number
971971
*/
972972
const size_t length = end - start;
973973
switch (length) {
@@ -978,16 +978,18 @@ static bool match_t(const char* start, const char* end, struct cpuinfo_arm_chips
978978
return false;
979979
}
980980

981-
/* Check that string starts with "Unisoc T". The first four characters
981+
/* Check that string starts with "Unisoc T" or "UNISOC T". The first four characters
982982
* are loaded as 32-bit little endian word */
983983
const uint32_t expected_unis = load_u32le(start);
984-
if (expected_unis != UINT32_C(0x73696E55) /* "sinU" = reverse("Unis") */) {
984+
if (expected_unis != UINT32_C(0x73696E55) /* "sinU" = reverse("Unis") */ &&
985+
expected_unis != UINT32_C(0x53494E55) /* "SINU" = reverse("UNIS") */) {
985986
return false;
986987
}
987988

988989
/* The next four characters are loaded as 32-bit little endian word */
989990
const uint32_t expected_oc_t = load_u32le(start + 4);
990-
if (expected_oc_t != UINT32_C(0x5420636F) /* "T co" = reverse("oc T") */) {
991+
if (expected_oc_t != UINT32_C(0x5420636F) /* "T co" = reverse("oc T") */ &&
992+
expected_oc_t != UINT32_C(0x5420434F) /* "T CO" = reverse("OC T") */) {
991993
return false;
992994
}
993995

test/name/proc-cpuinfo-hardware.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ TEST(PROC_CPUINFO_HARDWARE, telechips) {
460460

461461
TEST(PROC_CPUINFO_HARDWARE, unisoc) {
462462
EXPECT_EQ("Unisoc T301", parse_proc_cpuinfo_hardware("Unisoc T301", 4, 1800000));
463+
EXPECT_EQ("Unisoc T618", parse_proc_cpuinfo_hardware("UNISOC T618", 4, 1800000));
463464
EXPECT_EQ("Unisoc UMS312", parse_proc_cpuinfo_hardware("Unisoc UMS312", 4, 1800000));
464465
}
465466

0 commit comments

Comments
 (0)