Update json
This commit is contained in:
parent
067cf28bef
commit
509746951c
@ -13,3 +13,6 @@ duct = "0.13.7"
|
|||||||
os_pipe = "1.1.5"
|
os_pipe = "1.1.5"
|
||||||
rust-i18n = "3.0.1"
|
rust-i18n = "3.0.1"
|
||||||
users = "0.11.0"
|
users = "0.11.0"
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
reqwest = { version = "0.11", features = ["blocking", "json"] }
|
||||||
|
@ -1,100 +1,100 @@
|
|||||||
{
|
{
|
||||||
"drivers": {
|
"drivers": [
|
||||||
"pika-rocm-meta": {
|
{
|
||||||
"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": "inxi -G | grep driver | grep -i amdgpu"
|
||||||
},
|
},
|
||||||
"vulkan-amdgpu-pro": {
|
{
|
||||||
"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": "inxi -G | grep driver | grep -i amdgpu"
|
||||||
},
|
},
|
||||||
"amf-amdgpu-pro": {
|
{
|
||||||
"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": "inxi -G | grep driver | grep -i amdgpu"
|
||||||
},
|
},
|
||||||
"amdvlk": {
|
{
|
||||||
"driver": "amdvlk",
|
"driver": "amdvlk",
|
||||||
"icon": "amd",
|
"icon": "amd",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
"detection": "inxi -G | grep driver | grep -i amdgpu"
|
||||||
},
|
},
|
||||||
"opencl-legacy-amdgpu-pro-icd": {
|
{
|
||||||
"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": "inxi -G | grep driver | grep -i amdgpu"
|
||||||
},
|
},
|
||||||
"amdgpu-pro-oglp": {
|
{
|
||||||
"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": "inxi -G | grep driver | grep -i amdgpu"
|
||||||
},
|
},
|
||||||
"nvidia-driver-525": {
|
{
|
||||||
"driver": "nvidia-driver-525",
|
"driver": "nvidia-driver-525",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-525-open": {
|
{
|
||||||
"driver": "nvidia-driver-525-open",
|
"driver": "nvidia-driver-525-open",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": true,
|
"experimental": true,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-535": {
|
{
|
||||||
"driver": "nvidia-driver-535",
|
"driver": "nvidia-driver-535",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-535-open": {
|
{
|
||||||
"driver": "nvidia-driver-535-open",
|
"driver": "nvidia-driver-535-open",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": true,
|
"experimental": true,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-545": {
|
{
|
||||||
"driver": "nvidia-driver-545",
|
"driver": "nvidia-driver-545",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-545-open": {
|
{
|
||||||
"driver": "nvidia-driver-545-open",
|
"driver": "nvidia-driver-545-open",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": true,
|
"experimental": true,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-550": {
|
{
|
||||||
"driver": "nvidia-driver-550",
|
"driver": "nvidia-driver-550",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": true,
|
"experimental": true,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"nvidia-driver-550-open": {
|
{
|
||||||
"driver": "nvidia-driver-550-open",
|
"driver": "nvidia-driver-550-open",
|
||||||
"icon": "nvidia",
|
"icon": "nvidia",
|
||||||
"experimental": true,
|
"experimental": true,
|
||||||
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
"detection": "lspci -D | grep -iE 'VGA|3D' | grep -i nvidia | cut -d: -f 4"
|
||||||
},
|
},
|
||||||
"xone-dkms": {
|
{
|
||||||
"driver": "xone-dkms",
|
"driver": "xone-dkms",
|
||||||
"icon": "input-gaming",
|
"icon": "input-gaming",
|
||||||
"experimental": false,
|
"experimental": false,
|
||||||
"detection": "lsusb | grep -i xbox"
|
"detection": "lsusb | grep -i xbox"
|
||||||
},
|
},
|
||||||
"intel-gpu-compute": {
|
{
|
||||||
"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": "inxi -G | grep driver | grep -i intel"
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
use std::path::Path;
|
||||||
|
use std::fs;
|
||||||
use crate::config::*;
|
use crate::config::*;
|
||||||
use crate::save_window_size::save_window_size;
|
use crate::save_window_size::save_window_size;
|
||||||
use crate::DriverPackage;
|
use crate::DriverPackage;
|
||||||
@ -12,8 +14,12 @@ use std::error::Error;
|
|||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use users::*;
|
use users::*;
|
||||||
|
|
||||||
|
use serde_json::json;
|
||||||
|
use serde_json::Value;
|
||||||
|
|
||||||
pub fn build_ui(app: &adw::Application) {
|
pub fn build_ui(app: &adw::Application) {
|
||||||
gtk::glib::set_prgname(Some(APP_NAME));
|
gtk::glib::set_prgname(Some(APP_NAME));
|
||||||
glib::set_application_name(APP_NAME);
|
glib::set_application_name(APP_NAME);
|
||||||
@ -118,16 +124,26 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
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(move || {
|
||||||
println!("Checking HW paramter script for available drivers:\n");
|
println!("Downloading driver DB...");
|
||||||
let ubuntu_drivers_list_cli =
|
let data = reqwest::blocking::get("https://raw.githubusercontent.com/PikaOS-Linux/pkg-pika-drivers/main/driver-db.json").unwrap().text().unwrap();
|
||||||
Command::new("/usr/lib/pika/drivers/generate_driver_definitions.sh")
|
println!("Parsing Downloaded driver DB...");
|
||||||
.output()
|
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||||
.expect("failed to execute process");
|
if let serde_json::Value::Array(drivers) = &res["drivers"] {
|
||||||
|
for driver in drivers {
|
||||||
let ubuntu_drivers_list_utf8 = String::from_utf8(ubuntu_drivers_list_cli.stdout).unwrap_or_default();
|
if Path::new("/tmp/run-pkdm-detect.sh").exists() {
|
||||||
drive_hws_sender
|
fs::remove_file("/tmp/run-pkdm-detect.sh").expect("Bad permissions on /tmp/pika-installer-gtk4-target-manual.txt");
|
||||||
.send_blocking(ubuntu_drivers_list_utf8)
|
}
|
||||||
.expect("channel needs to be open.")
|
fs::write("/tmp/run-pkdm-detect.sh", "#! /bin/bash\nset -e\n".to_owned() + driver["detection"].as_str().to_owned().unwrap()).expect("Unable to write file");
|
||||||
|
let _ = cmd!("chmod", "+x", "/tmp/run-pkdm-detect.sh").run();
|
||||||
|
let result = cmd!("/tmp/run-pkdm-detect.sh").run();
|
||||||
|
if result.is_ok() {
|
||||||
|
println!("{}", driver["driver"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// drive_hws_sender
|
||||||
|
// .send_blocking(ubuntu_drivers_list_utf8)
|
||||||
|
// .expect("channel needs to be open.")
|
||||||
});
|
});
|
||||||
|
|
||||||
window.present();
|
window.present();
|
||||||
|
Loading…
Reference in New Issue
Block a user