Update json with mesa
This commit is contained in:
parent
509746951c
commit
9c77a027d6
@ -15,4 +15,4 @@ rust-i18n = "3.0.1"
|
|||||||
users = "0.11.0"
|
users = "0.11.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
reqwest = { version = "0.11", features = ["blocking", "json"] }
|
reqwest = { version = "0.11", features = ["blocking"] }
|
||||||
|
@ -10,42 +10,7 @@ then
|
|||||||
fi
|
fi
|
||||||
elif [[ $1 == "description" ]]
|
elif [[ $1 == "description" ]]
|
||||||
then
|
then
|
||||||
if echo "$2" | grep mesa-git &> /dev/null
|
|
||||||
then
|
|
||||||
apt-cache show mesa-git | grep 'Description*' | cut -d":" -f2 | head -n1
|
|
||||||
else
|
|
||||||
apt-cache show $2 | grep 'Description*' | cut -d":" -f2 | head -n1
|
apt-cache show $2 | grep 'Description*' | cut -d":" -f2 | head -n1
|
||||||
fi
|
|
||||||
elif [[ $1 == "icon" ]]
|
|
||||||
then
|
|
||||||
if echo "$2" | grep "pika-rocm-meta"&> /dev/null; then
|
|
||||||
echo "amd"
|
|
||||||
elif echo "$2" | grep "vulkan-amdgpu-pro"&> /dev/null; then
|
|
||||||
echo "amd"
|
|
||||||
elif echo "$2" | grep "amf-amdgpu-pro"&> /dev/null; then
|
|
||||||
echo "amd"
|
|
||||||
elif echo "$2" | grep "amdvlk"&> /dev/null; then
|
|
||||||
echo "amd"
|
|
||||||
elif echo "$2" | grep "opencl-legacy-amdgpu-pro-icd"&> /dev/null; then
|
|
||||||
echo "amd"
|
|
||||||
elif echo "$2" | grep "amdgpu-pro-oglp"&> /dev/null; then
|
|
||||||
echo "amd"
|
|
||||||
elif echo "$2" | grep "xone-dkms"&> /dev/null; then
|
|
||||||
echo "input-gaming"
|
|
||||||
elif echo "$2" | grep "nvidia"&> /dev/null; then
|
|
||||||
echo "nvidia"
|
|
||||||
elif echo "$2" | grep "intel"&> /dev/null; then
|
|
||||||
echo "intel"
|
|
||||||
else
|
|
||||||
echo "pika-drivers"
|
|
||||||
fi
|
|
||||||
elif [[ $1 == "safe" ]]
|
|
||||||
then
|
|
||||||
if [[ "$2" == "mesa-git" ]]; then
|
|
||||||
echo "true"
|
|
||||||
else
|
|
||||||
echo "false"
|
|
||||||
fi
|
|
||||||
elif [[ $1 == "device" ]]
|
elif [[ $1 == "device" ]]
|
||||||
then
|
then
|
||||||
if echo "$2" | grep -i -E 'pika-rocm-meta|vulkan-amdgpu-pro|amf-amdgpu-pro|amdvlk|opencl-legacy-amdgpu-pro-icd|amdgpu-pro-oglp' &> /dev/null
|
if echo "$2" | grep -i -E 'pika-rocm-meta|vulkan-amdgpu-pro|amf-amdgpu-pro|amdvlk|opencl-legacy-amdgpu-pro-icd|amdgpu-pro-oglp' &> /dev/null
|
||||||
|
@ -1,40 +1,58 @@
|
|||||||
{
|
{
|
||||||
"drivers": [
|
"drivers": [
|
||||||
|
{
|
||||||
|
"driver": "mesa-stable",
|
||||||
|
"icon": "video-display",
|
||||||
|
"experimental": false,
|
||||||
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -vi nvidia"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"driver": "mesa-hybrid",
|
||||||
|
"icon": "video-display",
|
||||||
|
"experimental": false,
|
||||||
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -vi nvidia"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"driver": "mesa-git",
|
||||||
|
"icon": "video-display",
|
||||||
|
"experimental": true,
|
||||||
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -vi nvidia"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"driver": "pika-rocm-meta",
|
"driver": "pika-rocm-meta",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i amd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"driver": "vulkan-amdgpu-pro",
|
"driver": "vulkan-amdgpu-pro",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i amd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"driver": "amf-amdgpu-pro",
|
"driver": "amf-amdgpu-pro",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i amd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"driver": "amdvlk",
|
"driver": "amdvlk",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i amd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"driver": "opencl-legacy-amdgpu-pro-icd",
|
"driver": "opencl-legacy-amdgpu-pro-icd",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i amd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"driver": "amdgpu-pro-oglp",
|
"driver": "amdgpu-pro-oglp",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i amd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"driver": "nvidia-driver-525",
|
"driver": "nvidia-driver-525",
|
||||||
@ -94,7 +112,7 @@
|
|||||||
"driver": "intel-gpu-compute",
|
"driver": "intel-gpu-compute",
|
||||||
"icon": "intel",
|
"icon": "intel",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i intel"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i intel"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -120,12 +120,14 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
|
|
||||||
credits_button.connect_clicked(clone!(@weak credits_button => move |_| credits_window.present()));
|
credits_button.connect_clicked(clone!(@weak credits_button => move |_| credits_window.present()));
|
||||||
|
|
||||||
|
println!("Downloading driver DB...");
|
||||||
|
let data = reqwest::blocking::get("https://raw.githubusercontent.com/PikaOS-Linux/pkg-pika-drivers/main/driver-db.json").unwrap().text().unwrap();
|
||||||
|
|
||||||
let (drive_hws_sender, drive_hws_receiver) = async_channel::unbounded();
|
let (drive_hws_sender, drive_hws_receiver) = async_channel::unbounded();
|
||||||
let drive_hws_sender = drive_hws_sender.clone();
|
let drive_hws_sender = drive_hws_sender.clone();
|
||||||
// The long running operation runs now in a separate thread
|
// The long running operation runs now in a separate thread
|
||||||
gio::spawn_blocking(move || {
|
gio::spawn_blocking(clone!(@strong data => move || {
|
||||||
println!("Downloading driver DB...");
|
let mut drivers_found_array: Vec<String> = Vec::new();
|
||||||
let data = reqwest::blocking::get("https://raw.githubusercontent.com/PikaOS-Linux/pkg-pika-drivers/main/driver-db.json").unwrap().text().unwrap();
|
|
||||||
println!("Parsing Downloaded driver DB...");
|
println!("Parsing Downloaded driver DB...");
|
||||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||||
if let serde_json::Value::Array(drivers) = &res["drivers"] {
|
if let serde_json::Value::Array(drivers) = &res["drivers"] {
|
||||||
@ -137,14 +139,14 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
let _ = cmd!("chmod", "+x", "/tmp/run-pkdm-detect.sh").run();
|
let _ = cmd!("chmod", "+x", "/tmp/run-pkdm-detect.sh").run();
|
||||||
let result = cmd!("/tmp/run-pkdm-detect.sh").run();
|
let result = cmd!("/tmp/run-pkdm-detect.sh").run();
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
println!("{}", driver["driver"])
|
drivers_found_array.push((driver["driver"].as_str().to_owned().unwrap()).to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// drive_hws_sender
|
drive_hws_sender
|
||||||
// .send_blocking(ubuntu_drivers_list_utf8)
|
.send_blocking(drivers_found_array)
|
||||||
// .expect("channel needs to be open.")
|
.expect("channel needs to be open.")
|
||||||
});
|
}));
|
||||||
|
|
||||||
window.present();
|
window.present();
|
||||||
|
|
||||||
@ -152,7 +154,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
// The main loop executes the asynchronous block
|
// The main loop executes the asynchronous block
|
||||||
drive_hws_main_context.spawn_local(clone!(@weak content_box, @weak loading_box => async move {
|
drive_hws_main_context.spawn_local(clone!(@weak content_box, @weak loading_box => async move {
|
||||||
while let Ok(drive_hws_state) = drive_hws_receiver.recv().await {
|
while let Ok(drive_hws_state) = drive_hws_receiver.recv().await {
|
||||||
get_drivers(&content_box, &loading_box, drive_hws_state, &window);
|
get_drivers(&content_box, &loading_box, &drive_hws_state, &window);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -184,7 +186,7 @@ fn driver_modify(
|
|||||||
fn get_drivers(
|
fn get_drivers(
|
||||||
main_window: >k::Box,
|
main_window: >k::Box,
|
||||||
loading_box: >k::Box,
|
loading_box: >k::Box,
|
||||||
ubuntu_drivers_list_utf8: String,
|
driver_found_array: &Vec<String>,
|
||||||
window: &adw::ApplicationWindow,
|
window: &adw::ApplicationWindow,
|
||||||
) {
|
) {
|
||||||
let main_box = gtk::Box::builder()
|
let main_box = gtk::Box::builder()
|
||||||
@ -210,31 +212,31 @@ fn get_drivers(
|
|||||||
let mut driver_array: Vec<DriverPackage> = Vec::new();
|
let mut driver_array: Vec<DriverPackage> = Vec::new();
|
||||||
let mut device_groups: HashMap<String, Vec<DriverPackage>> = HashMap::new();
|
let mut device_groups: HashMap<String, Vec<DriverPackage>> = HashMap::new();
|
||||||
|
|
||||||
for ubuntu_driver in ubuntu_drivers_list_utf8.lines() {
|
for found_driver in driver_found_array.iter() {
|
||||||
let ubuntu_driver_string = ubuntu_driver.to_string();
|
let found_driver_string = found_driver.to_string();
|
||||||
let command_version_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
let command_version_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
||||||
.args(["version", ubuntu_driver])
|
.args(["version", found_driver])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let command_description_label =
|
let command_description_label =
|
||||||
Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
||||||
.args(["description", ubuntu_driver])
|
.args(["description", found_driver])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let command_device_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
let command_device_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
||||||
.args(["device", ubuntu_driver])
|
.args(["device", found_driver])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let command_icon_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
let command_icon_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
||||||
.args(["icon", ubuntu_driver])
|
.args(["icon", found_driver])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let command_safe_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
let command_safe_label = Command::new("/usr/lib/pika/drivers/generate_package_info.sh")
|
||||||
.args(["safe", ubuntu_driver])
|
.args(["safe", found_driver])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let ubuntu_driver_package = DriverPackage {
|
let found_driver_package = DriverPackage {
|
||||||
driver: ubuntu_driver_string,
|
driver: found_driver_string,
|
||||||
version: String::from_utf8(command_version_label.stdout)
|
version: String::from_utf8(command_version_label.stdout)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.trim()
|
.trim()
|
||||||
@ -257,7 +259,7 @@ fn get_drivers(
|
|||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
};
|
};
|
||||||
driver_array.push(ubuntu_driver_package);
|
driver_array.push(found_driver_package);
|
||||||
driver_array.sort_by(|a, b| b.cmp(a))
|
driver_array.sort_by(|a, b| b.cmp(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user