Skip to content

Commit

Permalink
sysinfo updates
Browse files Browse the repository at this point in the history
  • Loading branch information
uliss committed May 7, 2024
1 parent 7a7126e commit c21b3a8
Show file tree
Hide file tree
Showing 11 changed files with 204 additions and 169 deletions.
1 change: 0 additions & 1 deletion ceammc/ext/ceammc_objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ http.send
hw.apple_smc
hw.apple_sms
hw.arduino
hw.cpu_temp
hw.display
hw.gamepad
hw.kbd_light
Expand Down
1 change: 1 addition & 0 deletions ceammc/extra/rust/hw/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"gamepads",
"gilrs",
"listdev",
"pdfium",
"powerinfo",
"powerstate",
"repr",
Expand Down
1 change: 0 additions & 1 deletion ceammc/extra/rust/hw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ c_str_macro = "1.0.3"
env_logger = "0.11.3"
gilrs = "0.10.5"
log = "0.4.21"
sysinfo = "0.30.12"
tokio = { version = "1.36", features = ["rt", "rt-multi-thread", "signal", "sync", "macros", "time"] }

[target.'cfg(windows)'.dependencies]
Expand Down
26 changes: 7 additions & 19 deletions ceammc/extra/rust/hw/hw_rust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,9 @@ enum class ceammc_hw_printer_state {
UNKNOWN,
};

struct ceammc_hw_cputemp;

/// gamepad opaque type
struct ceammc_hw_gamepad;

struct ceammc_hw_notify_cb {
/// dispatcher ID
size_t id;
/// dispatcher callback (not NULL!)
void (*f)(size_t id);
};

struct ceammc_gamepad_err_cb {
/// pointer to user data
void *user;
Expand Down Expand Up @@ -132,6 +123,13 @@ struct ceammc_gamepad_listdev_cb {
void (*cb)(void *user, const ceammc_gamepad_dev_info *info);
};

struct ceammc_hw_notify_cb {
/// dispatcher ID
size_t id;
/// dispatcher callback (not NULL!)
void (*f)(size_t id);
};

struct ceammc_hw_printer_info {
const char *name;
const char *system_name;
Expand Down Expand Up @@ -163,16 +161,6 @@ struct ceammc_hw_error_cb {

extern "C" {

ceammc_hw_cputemp *ceammc_hw_cputemp_create(void *user,
void (*cb_temp)(void *user, const char *label, float cpu_temp),
ceammc_hw_notify_cb cb_notify);

void ceammc_hw_cputemp_free(ceammc_hw_cputemp *cpu_temp);

bool ceammc_hw_cputemp_get(ceammc_hw_cputemp *cpu_temp);

bool ceammc_hw_cputemp_process(ceammc_hw_cputemp *cpu_temp);

/// free gamepad
/// @param gp - pointer to gp
void ceammc_hw_gamepad_free(ceammc_hw_gamepad *gp);
Expand Down
1 change: 0 additions & 1 deletion ceammc/extra/rust/hw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ impl hw_notify_cb {
}

pub mod gamepad;
pub mod sysinfo;
pub mod printers;

#[repr(C)]
Expand Down
146 changes: 0 additions & 146 deletions ceammc/extra/rust/hw/src/sysinfo.rs

This file was deleted.

3 changes: 2 additions & 1 deletion ceammc/extra/rust/system/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"FUDI"
"FUDI",
"sysinfo"
]
}
1 change: 1 addition & 0 deletions ceammc/extra/rust/system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ lazy_static = "1.4.0"
log = "0.4.21"
logging = "0.1.0"
regex = "1.10.4"
sysinfo = "0.30.12"
# c_str_macro = "1.0.3"
# gilrs = "0.10.5"

Expand Down
14 changes: 14 additions & 0 deletions ceammc/extra/rust/system/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
pub mod command;
pub mod sysinfo;

#[allow(non_camel_case_types)]
#[repr(C)]
pub struct system_notify_cb {
client_id: usize,
cb: Option<extern "C" fn(client_id: usize)>,
}

impl system_notify_cb {
fn notify(&self) {
self.cb.map(|f| f(self.client_id));
}
}
Loading

0 comments on commit c21b3a8

Please sign in to comment.