D1 UNO USB (serial) as HID game controller based on mi-360
mi-360 fork - practice for hacking ViGEm.NET into VJoySerialFeeder
Background
Wanted: D1 UNO as HID game controller.
Unlike FTDI USB chips, CH340G on D1 UNO can only be serial.
- Traditional serial<>HID workaround was vJoy - no longer supported
workaround for workaround
- Arduino IBUS sketch running on ESP8266
- mi-360 uses ViGEm.NET, which is supported.
- C# interface code for Xiaomi Gamepad
- Ultimately, derive a dedicated serial<>ViGEm filter from mi-360,
simpler than VJoySerialFeeder.- mi-360 runs in the system tray AKA taskbar and “Notification Area”.
- less daunting code than VJoySerialFeeder,
which uses obsolete and undocumented SharpDevelop 4.4 - extract serial port and IBUS code from VJoySerialFeeder
- SerialPort-attached ESP8266 will not need HidGuardian
- replace _monitor in mi-360/Mi360Application.cs with SerialPort equivalent
- replace MiGamepad in XInputManager.cs with ESP8266 equivalent
- replace Xiaomi Gamepad actions in [MiGamepad.cs] with IBUS equivalent
C# code
`DeviceWorker()` runs in a `Thread()`
* ViGEmClient becomes `_Target`
* Xiaomi Gamepad becomes `_Device`
* `_Report` structure is eventually sent to `_Target` * in `DeviceWorker()`, get `hidReport` from `_Device`, then `data` from `hidReport`, hack `data` contents into `_Report`, __finally__ `_Target.SendReport(_Report)`; * ViGEm referenced in README.md, MiGamepad.cs, mi-360-setup.iss, XInputManager.cs * HidGuardian referenced in README.md, HidGuardian.cs, mi360.csproj,
Mi360Application.cs, mi-360-setup.iss, Drivers/
* presumably need to understand [HIDLibrary](https://www.nuget.org/packages/HidLibrary/) [GitHub](https://github.com/mikeobrien/HidLibrary)
* HID (, USB, Serial Port) [references](http://janaxelson.com/hidpage.htm)
* .NET [SerialPort Class](https://docs.microsoft.com/en-us/dotnet/api/system.io.ports.serialport)
* stackoverflow [SerialPort HowTo](https://stackoverflow.com/questions/1243070/how-to-read-and-write-from-the-serial-port)
* [Coad's SerialPort article](https://blogs.msmvps.com/coad/2005/03/23/serialport-rs-232-serial-com-port-in-c-net/)
- Visual Studio 2017 Community.
- Fody “Extensible tool for weaving .net assemblies”
- Merging .NET Assemblies with MSBuild
- ILMerge merges multiple .NET assemblies into a single target
- NuGet is the package manager for .NET
- HowTo
- NuGet.Core is the framework assembly on which the rest of NuGet is built.
- Notificaton Popup video
- NativeUsbLib to enumerate Usb hubs and devices on Windows,
presumably based on USBView
Includes EnumerageUsb app.
Automapper maps members among objects. vide0
According to Jan Axelson Microsoft supports HID devices via DirectX … but HID support is NOT found in .NET APIs
Microsoft’s MonoGame GamePad Reference strongly implies that Input for games support may be only for Xbox One and PS/4 Game Controllers and mainly via UWP.