3 // Win32::{self, Storage::FileSystem},
5 // use netcorehost::{nethost, pdcstr};
7 // pub fn set_rgb(r: u8, g: u8, b: u8) {
9 // let lib = libloading::Library::new("IntelOCWrapper.dll").unwrap();
11 // let fun: libloading::Symbol<unsafe extern fn(u8, u8, u8, u8) -> bool> = lib.get(b"SetLEDColor").unwrap();
12 // let ctlInit: libloading::Symbol<unsafe extern fn(u32) -> std::ffi::c_void> = lib.get(b"ctlInit").unwrap();
13 // let ctlInit: libloading::Symbol<unsafe extern "C++" fn(u32) -> std::ffi::c_void> = lib.get(b"SetLEDColor").unwrap();
17 // let hostfxr = nethost::load_hostfxr().unwrap();
18 // let context = hostfxr.initialize_for_dotnet_command_line(pdcstr!("IntelOCWrapper.dll")).unwrap();
19 // let result = context.run_app().value();
22 // let handle = FileSystem::CreateFileW(
23 // // w!("\\\\.\\Intel_NF_I2C"),
24 // w!("\\\\.\\VIDEO\\INTC_I2C"),
25 // // w!("\\\\.\\WinRing0_1_2_0"),
27 // FileSystem::FILE_SHARE_MODE(0),
29 // FileSystem::FILE_CREATION_DISPOSITION(3),
30 // FileSystem::FILE_FLAGS_AND_ATTRIBUTES(1073741824),
31 // Win32::Foundation::HANDLE::default(),
34 // println!("handle: {:?}", handle);
37 //"\\\\.\\Intel_NF_I2C"
40 // internal static \u0024ArrayType\u0024\u0024\u0024BY08E \u003FA0x171ed149\u002E\u003FprevData\u0040\u003F1\u003F\u003FSetLEDBehavior\u0040CVGAAdaptor\u0040\u0040UEAA_NEEEEEEEEE\u0040Z\u00404PAEA;
41 // public static __FnPtr<_ctl_result_t (_ctl_init_args_t*, _ctl_api_handle_t**)> __m2mep\u0040\u003FctlInit\u0040\u0040\u0024\u0024J0YA\u003FAW4_ctl_result_t\u0040\u0040PEAU_ctl_init_args_t\u0040\u0040PEAPEAU_ctl_api_handle_t\u0040\u0040\u0040Z;
48 process
::{Child
, Command
},
57 pub fn new() -> anyhow
::Result
<Self> {
59 process
: Command
::new(r
"IntelOC.exe").spawn()?
,
60 stream
: TcpStream
::connect("127.0.0.1:6577")?
,
64 pub fn set_color(&mut self, r
: u8, g
: u8, b
: u8) -> anyhow
::Result
<()> {
65 let buffer
: [u8; 3] = [r
, g
, b
];
66 self.stream
.write(&buffer
).map(|_
| ())?
;
73 if let Err(error
) = self.process
.kill().and(self.process
.try_wait()) {
74 error!("Unable to kill the child process: {:?}", error
);