FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
fastfetch/scripts/gen-amdgpuids.py at dev · fastfetch-cli/fastfetch · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
fastfetch-cli
/
fastfetch
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
882
Star
24.6k
Code
Issues
62
Pull requests
27
Discussions
Actions
Wiki
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
fastfetch
/
scripts
/
gen-amdgpuids.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
46 lines (33 loc) · 1.13 KB
Breadcrumbs
fastfetch
/
scripts
/
gen-amdgpuids.py
Copy path
File metadata and controls
executable file
·
46 lines (33 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
import
sys
def
main
(
amdgpu_ids_path
:
str
):
with
open
(
amdgpu_ids_path
,
'r'
)
as
f
:
full_text
=
f
.
read
()
if
full_text
==
''
:
sys
.
exit
(
f'Error:
{
amdgpu_ids_path
}
file is empty'
)
products
=
[]
for
line
in
full_text
.
split
(
'
\n
'
):
if
not
line
or
line
[
0
]
==
'#'
or
not
',
\t
'
in
line
:
continue
device
,
revision
,
name
=
line
.
split
(
',
\t
'
,
maxsplit
=
2
)
products
.
append
((
device
,
revision
,
name
))
code
=
"""
\
// SPDX-License-Identifier: MIT
// https://opensource.org/license/mit
// Generated from https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids
#include <stdint.h>
#include <stddef.h>
typedef struct FFArmGpuProduct
{
const uint32_t id; // device << 8 | revision
const char* name;
} FFArmGpuProduct;
const FFArmGpuProduct ffAmdGpuProducts[] = {
"""
for
device
,
revision
,
name
in
products
:
code
+=
f" {{ 0x
{
device
}
<< 8 | 0x
{
revision
}
,
\"
{
name
}
\"
}},
\n
"
code
+=
"};
\n
"
print
(
code
)
if
__name__
==
'__main__'
:
len
(
sys
.
argv
)
==
2
or
sys
.
exit
(
'Usage: gen-amdgpuids.py </path/to/amdgpu.ids>'
)
main
(
sys
.
argv
[
1
])
Back
|
FazBrowse Home
|
New Git URL