Skip to content

Commit 99a3d3a

Browse files
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 e4cadd0 commit 99a3d3a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/arm/linux/chipset.c

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

905905
/**
906-
* Tries to match, case-sentitively, /Unisoc T\d{3,4}/ signature for Unisoc T
906+
* Tries to match, case-sentitively, /Unisoc T\d{3,4}/ or /UNISOC T\d{3,4}/ signature for Unisoc T
907907
* chipset. If match successful, extracts model information into \p chipset
908908
* argument.
909909
*
@@ -917,7 +917,7 @@ static bool match_sc(const char* start, const char* end, struct cpuinfo_arm_chip
917917
* @returns true if signature matched, false otherwise.
918918
*/
919919
static bool match_t(const char* start, const char* end, struct cpuinfo_arm_chipset chipset[restrict static 1]) {
920-
/* Expect 11-12 symbols: "Unisoc T" (8 symbols) + 3-4-digit model number
920+
/* Expect 11-12 symbols: "Unisoc T" / "UNISOC T" (8 symbols) + 3-4-digit model number
921921
*/
922922
const size_t length = end - start;
923923
switch (length) {
@@ -928,16 +928,16 @@ static bool match_t(const char* start, const char* end, struct cpuinfo_arm_chips
928928
return false;
929929
}
930930

931-
/* Check that string starts with "Unisoc T". The first four characters
931+
/* Check that string starts with "Unisoc T" or "UNISOC T". The first four characters
932932
* are loaded as 32-bit little endian word */
933933
const uint32_t expected_unis = load_u32le(start);
934-
if (expected_unis != UINT32_C(0x73696E55) /* "sinU" = reverse("Unis") */) {
934+
if (expected_unis != UINT32_C(0x73696E55) /* "sinU" = reverse("Unis") */ && expected_unis != UINT32_C(0x53494E55) /* "SINU" = reverse("UNIS") */) {
935935
return false;
936936
}
937937

938938
/* The next four characters are loaded as 32-bit little endian word */
939939
const uint32_t expected_oc_t = load_u32le(start + 4);
940-
if (expected_oc_t != UINT32_C(0x5420636F) /* "T co" = reverse("oc T") */) {
940+
if (expected_oc_t != UINT32_C(0x5420636F) /* "T co" = reverse("oc T") */ && expected_oc_t != UINT32_C(0x5420434F) /* "T CO" = reverse("OC T") */) {
941941
return false;
942942
}
943943

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)