static void Main(string[] args) { Console.WriteLine("cs-hid-keyboard"); bool waitLocalHost = true; if (args.Length >= 1) { if (args[0] == "-w") { waitLocalHost = false; } } byte[] reportBuffer = KeyboardDescriptors.Report; using (Usbip device = new Usbip(UsbDescriptors.Device, KeyboardDescriptors.Hid, reportBuffer)) { KeyboardDevice keyboard = new KeyboardDevice(device, reportBuffer); device.Run(); if (waitLocalHost == true) { Thread usbipServer = new Thread(usbipServer_Run); usbipServer.IsBackground = true; usbipServer.Start(); } KeyboardTest(keyboard); } }
static void Main(string[] args) { Console.WriteLine("cs-hid-mouse"); bool waitLocalHost = true; if (args.Length >= 1) { if (args[0] == "-w") { waitLocalHost = false; } } int cxScreen = SafeMethods.GetSystemMetrics(SystemMetric.SM_CXVIRTUALSCREEN); int cyScreen = SafeMethods.GetSystemMetrics(SystemMetric.SM_CYVIRTUALSCREEN); Console.WriteLine($"CX: {cxScreen}"); Console.WriteLine($"CY: {cyScreen}"); // byte[] reportBuffer = MouseDescriptors.RelativeReport; // Usbip device = new Usbip(MouseDescriptors.Device, MouseDescriptors.RelativeHid, reportBuffer); // byte[] reportBuffer = MouseDescriptors.AbsoluteReport; // Usbip device = new Usbip(MouseDescriptors.Device, MouseDescriptors.AbsoluteHid, reportBuffer); byte[] reportBuffer = MouseDescriptors.AbsoluteAndRelativeReport; using (Usbip device = new Usbip(UsbDescriptors.Device, MouseDescriptors.AbsoluteAndRelativeHid, reportBuffer)) { MouseDevice mouse = new MouseDevice(device, reportBuffer, cxScreen, cyScreen); device.Run(); if (waitLocalHost == true) { Thread usbipServer = new Thread(usbipServer_Run); usbipServer.IsBackground = true; usbipServer.Start(); } MouseTest(mouse); } }