Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 49 additions & 46 deletions src/detection/gpu/gpu_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,54 +80,57 @@ void ffGPUParsePciIdsFile(const FFstrbuf* content, uint8_t subclass, uint16_t ve
ffStrbufSetNS(&gpu->vendor, (uint32_t) (vendorEnd - start), start);
}

// Search for device. Device lines are `\tXXXX name`; their ids only
// grow inside a vendor block, so one linear walk over the block is
// enough: compare in place and stop either at the line starting the
// next vendor, or -- because the ids are sorted -- right after the
// first id greater than the one we are looking for. Doing the compare
// here also removes the need to know where the block ends, so no
// length is ever derived from a pointer that may have run past it.
// pci.ids only asks contributors to keep the entries sorted, and it
// is strictly lowercase hex, so the byte comparison below matches the
// numeric order. A block that is not sorted (only reachable via
// FF_CUSTOM_PCI_IDS_PATH) makes us give up early and fall back to the
// synthesized name below.
char deviceId[8];
snprintf(deviceId, ARRAY_SIZE(deviceId), "%04x", device);
[[maybe_unused]] bool found = false;
for (const char* p = vendorEnd < fileEnd ? vendorEnd + 1 : fileEnd;
p < fileEnd && (*p == '\t' || *p == '#');) {
if (*p == '\t' && fileEnd - p >= 7) {
int order = memcmp(p + 1, deviceId, 4);
if (order > 0) {
break;
}
if (order == 0 && p[5] == ' ' && p[6] == ' ') {
FF_DEBUG("Found PCI device entry for 0x%04x:0x%04x", vendor, device);
start = p + 7;
const char* end = memchr(start, '\n', (size_t) (fileEnd - start));
if (!end) {
end = fileEnd;
}
// Search for device. Device lines are '\tXXXX name'; their ids only
// grow inside a vendor block, so one linear walk over the block is
// enough: compare in place and stop either at the line starting the
// next vendor, or -- because the ids are sorted -- right after the
// first id greater than the one we are looking for. Doing the compare
// here also removes the need to know where the block ends, so no
// length is ever derived from a pointer that may have run past it.
// pci.ids only asks contributors to keep the entries sorted, and it
// is strictly lowercase hex, so the byte comparison below matches the
// numeric order. A block that is not sorted (only reachable via
// FF_CUSTOM_PCI_IDS_PATH) makes us give up early and fall back to the
// synthesized name below.
char deviceId[8];
snprintf(deviceId, ARRAY_SIZE(deviceId), "%04x", device);
[[maybe_unused]] bool found = false;
for (const char* p = vendorEnd < fileEnd ? vendorEnd + 1 : fileEnd;
p < fileEnd && (*p != '\t' && *p != '#');) {
if (*p == '\t' && fileEnd - p >= 7) {
int order = memcmp(p + 1, deviceId, 4);
if (order > 0) {
break;
}
if (order == 0 && p[5] == ' ' && p[6] == ' ') {
FF_DEBUG("Found PCI device entry for %04x:%04x", vendor, device);
start = p + 7;
const char* end = memchr(start, '\n', (size_t)(fileEnd - start));
if (!end) {
end = fileEnd;
}

const char* closingBracket = end - 1;
if (*closingBracket == ']') {
const char* openingBracket = memrchr(start, '[', (size_t) (closingBracket - start));
if (openingBracket) {
openingBracket++;
ffStrbufSetNS(&gpu->name, (uint32_t) (closingBracket - openingBracket), openingBracket);
}
}
if (!gpu->name.length) {
ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start);
}
found = true;
break;
}
const char* closingBracket = end - 1;
if (*closingBracket == ']') {
const char* openingBracket = memchr(start, '[', (size_t)(closingBracket - start));
if (openingBracket) {
openingBracket++;
ffStrbufSetNS(&gpu->name, (uint32_t)(closingBracket - openingBracket), openingBracket);
}
p = memchr(p, '\n', (size_t) (fileEnd - p));
if (!p) {
break;
}
if (!gpu->name.length) {
ffStrbufSetNS(&gpu->name, (uint32_t)(end - start), start);
}
found = true;
break;
}
}
p = memchr(p, '\n', (size_t)(fileEnd - p));
if (!p) {
break;
}
p++;
}
}
p++;
}
Expand Down
24 changes: 24 additions & 0 deletions src/logo/ascii/k.inc
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,21 @@ static const FFlogo K[] = {
FF_COLOR_FG_BLUE,
},
.colorKeys = FF_COLOR_FG_GREEN,
.colorTitle = FF_COLOR_FG_DEFAULT,#ifdef FASTFETCH_DATATEXT_LOGO_KAIRO
// Kairo Linux
{
.names = { "kairo", "Kairo Linux" },
.lines = FASTFETCH_DATATEXT_LOGO_KAIRO,
.colors = {
FF_COLOR_FG_CYAN,
FF_COLOR_FG_WHITE,
},
.colorKeys = FF_COLOR_FG_CYAN,
.colorTitle = FF_COLOR_FG_DEFAULT,
},
#endif
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_KISS
// KISSLinux
{
Expand Down Expand Up @@ -233,6 +245,18 @@ static const FFlogo K[] = {
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_BLUE,
},
#ifdef FASTFETCH_DATATEXT_LOGO_KAIRO
// Kairo Linux
{
.names = { "kairo", "Kairo Linux" },
.lines = FASTFETCH_DATATEXT_LOGO_KAIRO,
.colors = {
FF_COLOR_FG_BLUE,
FF_COLOR_FG_WHITE,
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_DEFAULT,
},
#endif
// LAST
{},
Expand Down
21 changes: 21 additions & 0 deletions src/logo/ascii/k/kairo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
####
*==:..::::::..:==*
*=:.-+#%%%%%%%%%%#+-.:=*
#-:-*%%%%%%%%%%%%%%%%%%*-:-#
+::#%%%%%%%%%%%%%%%%%%%%%%*.:+
#-.*%%%%%%. .%%%%%%%%%%%%%%%%+.:#
=.*%%%%%%%. .%%%%%%%%%%%%%%%%%+.-
+:=%%%%%%%%. .%%%%%%%*+++*%%%%%%=.+
=:#%%%%%%%%. .%%%%%#-. .=%%%%%%#:-
*.-%%%%%%%%%. .%%%#-. .:#%%%%%%%%-.*
*.=%%%%%%%%%. .%%+. .+%%%%%%%%%%=.*
*.=%%%%%%%%%. .-%%%%%%%%%%%%=.*
#--%%%%%%%%%. ... -#%%%%%%%%%%#--#
+.+%%%%%%%%. .##*:. .=#%%%%%%%%+.=
+-:#%%%%%%%. .%%%#+. .:*%%%%%%*:-+
*-:#%%%%%%. .%%%%%%- :%%%%#.-*
*-.*%%%%%%%%%%%%%%%%%%%%%%%%*.:*
*::*%%%%%%%%%%%%%%%%%%%#*::*
+::=*%%%%%%%%%%%%%%*=::+
+==::-=+*##*+=-:.-=+
#*++++++*#
24 changes: 24 additions & 0 deletions src/logo/ascii/s.inc
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,17 @@ static const FFlogo S[] = {
},
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_SOPLOS
// Soplos
{
.names = { "Soplos", "Soplos Linux", "soplos" },
.lines = FASTFETCH_DATATEXT_LOGO_SOPLOS,
.colors = {
FF_COLOR_FG_CYAN,
FF_COLOR_FG_WHITE,
},
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_SOURCE_MAGE
// Source Mage
{
Expand Down Expand Up @@ -525,6 +536,19 @@ static const FFlogo S[] = {
},
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_SATELLAOS
// SatellaOS
{
.names = { "satellaos", "SatellaOS" },
.lines = FASTFETCH_DATATEXT_LOGO_SATELLAOS,
.colors = {
FF_COLOR_FG_BLUE,
FF_COLOR_FG_WHITE,
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_DEFAULT,
},
#endif
// LAST
{},
};
19 changes: 19 additions & 0 deletions src/logo/ascii/s/satellaos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$1 0
$1 010
$1 01010
$1 010101010101010101 0101010
$1 01010101010101010101 01010
$1 0101010101010101010101 010
$1 010101 010101 0
$1 010101 0101010101 010101
$1 010101 010101010101 010101
$1 010101 01010101010101 010101
$1 010101 0101010101010101 010101
$1 010101 0101010101010101 010101
$1 010101 01010101010101 010101
$1 010101 010101010101 010101
$1 010101 0101010101 010101
$1 010101 010101
$1 0101010101010101010101
$1 01010101010101010101
$1 010101010101010101
19 changes: 19 additions & 0 deletions src/logo/ascii/s/soplos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
:=::
:::::=::::::
:::::::===::::::::
::::::::::-====::::
:::::::::::-=====-:
::::::::----=
::::::----@@%
:::::-*@@@@%%%%%%
:::@@@@@@@@%%%%%%%%%
@@@@@@@@@@%%%%%%%%%%%-
@@@@@@%%%%%%%%----
@@@%%%%-=------
%=====------
**=======-----
+++*****========----
++++++***=========
+++++++***======
+++++**+==
+++
13 changes: 13 additions & 0 deletions src/logo/ascii/u.inc
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,19 @@ static const FFlogo U[] = {
},
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_UNRAID
// Unraid
{
.names = { "Unraid OS", "unraid-os", "unraid" },
.lines = FASTFETCH_DATATEXT_LOGO_UNRAID,
.colors = {
FF_COLOR_FG_LIGHT_RED,
FF_COLOR_FG_WHITE,
},
.colorKeys = FF_COLOR_FG_LIGHT_RED,
.colorTitle = FF_COLOR_FG_LIGHT_RED,
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_UOS
// UOS
{
Expand Down
8 changes: 8 additions & 0 deletions src/logo/ascii/u/unraid_os.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$3█ ██ █
$3██ █ ██
$2██ $3██ ██ ██ ██
$2██ $3██ ██
$2██ ██ █ ██ $3██
$2██ ██ ██ ██ $3██
$2██ █ ██
$2█
11 changes: 11 additions & 0 deletions src/logo/ascii/z.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
#include "common/color.h"

static const FFlogo Z[] = {
#ifdef FASTFETCH_DATATEXT_LOGO_ZINNIA
// Zinnia
{
.names = { "Zinnia", "zinnia" },
.lines = FASTFETCH_DATATEXT_LOGO_ZINNIA,
.colors = {
FF_COLOR_FG_MAGENTA,
FF_COLOR_FG_WHITE,
},
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_ZORIN
// Zorin
{
Expand Down
20 changes: 20 additions & 0 deletions src/logo/ascii/z/zinnia.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@@@@%%%%%%@@@@
@@%#+=$2:........:$1-+#%@@
@@#=$2........$1:-:$2.......$1-*%@
@@*$2:.....$1-==+%@@@%===$2:....:$1+%@
@%-$2.....$1-%@@@@@@@@@@@@@#$2.....:$1#@
@#$2.......$1+@@@@@@@@@@@@@@@-$2......$1*@
@#$2......:$1#@@@@@@@@@@@@@@@@@*$2......$1#@
@-$2......$1-@@@@@@@@@@@@@@@@@@%$2......:$1%@
@#$2........:$1*@@@@@@@@@@@@@@@+$2:.......$1*@
@*$2.........$1=@@@@@@@@@@@@@@%$2:........$1+@
@*$2..........$1-*#*#@@@@@##*+$2:.........$1+@
@%$2...............$1-#*+-$2..............$1#@
@=$2...............$1#$2:...............$1-@
@%$2:...:$1===--$2:....$1%$2................$1%@
@%$2:...$1*@@@@@%#+-%-+#%%@@@@%+$2...:$1#@
@%=$2...:$1*%@@@@@@@@@@@@@%#=$2....$1=%@
@#=$2....:$1--=-$2:$1%$2:$1-===-$2.....$1-#@@
@@%+-$2.......$1#$2:.......$1-+%@@
@@%#+=-$2::$1++$2::$1-=+#%@@
@@@@@@@@@@@