XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESystem

【Rust】XFE系统,基于Rust和汇编

公开
关注 0 Fork 0 Star 0
UTF-8
using System.Runtime.InteropServices;

namespace XFESystem.NativeRuntime.Application;

internal static class NativeUsbDiagnostics
{
    [DllImport("xfe_pal", EntryPoint = "xfe_usb_info", CallingConvention = CallingConvention.Cdecl)]
    private static extern ulong Info(uint field);
    internal static ulong KeyboardMouse => Info(5);
    internal static string ReadReport() => "XFESystem native USB diagnostics\nScope: XFESystemGuest\n" +
        "Backend: independent C# xHCI / USB HID\nState: " + Info(1) + " (1 initializing, 2 polling)\n" +
        "Controllers: " + Info(2) + "; devices: " + Info(3) + "; interrupt endpoints: " + Info(4) + "\n" +
        "Keyboard: " + ((Info(5) & 1) != 0) + "; mouse: " + ((Info(5) & 2) != 0) + "\n" +
        "Hardware reports: " + Info(6) + "; failures: " + Info(7) + "\n" +
        "USB storage is not mounted or written. RGB lighting uses device firmware defaults.\n";
}