mi-360 icon indicating copy to clipboard operation
mi-360 copied to clipboard

Please add 3-axis accelerometer support

Open xmanweb opened this issue 5 years ago • 10 comments

Thank you for your program so that we can use the Xiaomi Bluetooth controller on the PC smoothly. But in some scenarios, such as in cemu, I hope to use the 3-axis accelerometer of the millet handle to achieve more control. For example, users of the PS4 controller can use ds4windows( https://github.com/rajkosto/DS4Windows ) to simulate the xbox controller and add accelerometer support, which can be used in cemu to aim at the arrow. So I hope that you can add 3-axis accelerometer support so that all the functions of the Xiaomi Bluetooth controller are available on the PC. Thanks again.

xmanweb avatar Apr 17 '19 12:04 xmanweb

Hi!

Yes, I thought about it many times (and I know how to read the sensors data already). The problem is that Xbox 360 does not support any motion axis, so there's no exact correspondence to anything and the accelerometer may be mapped to anything. That would require a configuration UI to let the user choose the mapping, but that would require some major rework, as this tool was never intended to have complex configurations and remapping capabilities.

Until I don't have a clear idea on how to do it in a usable way, I'll keep this feature on hold.

If you have any suggestion, you are welcome to share it here!

dancol90 avatar Apr 21 '20 07:04 dancol90

I think it can be merged with BetterJoy. BetterJoy maps the accelerometer to a mouse and the keys to x360. https://github.com/Davidobot/BetterJoy

zhangbo8418 avatar May 18 '20 07:05 zhangbo8418

Hi, Daniele!

and I know how to read the sensors data already

Do you have any working Windows code for reading accelerometer data? I've examined https://github.com/irungentoo/Xiaomi_gamepad/blob/master/accelerometer_print/hidraw.c but I can't reproduce it on Windows. Accelerometer values are always zero.

grayver avatar Jun 14 '20 21:06 grayver

Hi, Daniele!

and I know how to read the sensors data already

Do you have any working Windows code for reading accelerometer data? I've examined https://github.com/irungentoo/Xiaomi_gamepad/blob/master/accelerometer_print/hidraw.c but I can't reproduce it on Windows. Accelerometer values are always zero.

https://docs.microsoft.com/en-us/previous-versions/windows/hardware/design/dn613925(v=vs.85) https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/Accelerometer

zhangbo8418 avatar Jun 15 '20 07:06 zhangbo8418

@zhangbo8418 Thanks, but it's slightly not what I'm looking for. This is generic code for Windows UWP application. But I'm looking for specific low-level code for extracting accelerometer data from Xiaomi Gamepad.

grayver avatar Jun 15 '20 08:06 grayver

Hi, Daniele!

and I know how to read the sensors data already

Do you have any working Windows code for reading accelerometer data? I've examined https://github.com/irungentoo/Xiaomi_gamepad/blob/master/accelerometer_print/hidraw.c but I can't reproduce it on Windows. Accelerometer values are always zero.

Hi! I actually tried to enable accelerometer reports without success. I suspect that the feature doesn't even get turned on at all, as I continue receiving reports only when I press something on the gamepad.

dancol90 avatar Jun 17 '20 17:06 dancol90

@dancol90 do you have any idea why the same packet to enable accel works on Linux but not on window? Maybe the gamepad tried to guest the os and if it is Linux, accel can be enabled, and if its window, accel cannot be enabled. Or maybe hid.dll filter out that packet and actually does not send that packet to the gamepad, for some reason.

tu-nv avatar Jul 10 '20 14:07 tu-nv

I think standard Windows HID driver doesn't pass that packet through, because Xiaomi Gamepad doesn't advertise it in REPORTDESCRIPTOR structure.

grayver avatar Jul 10 '20 19:07 grayver

I think standard Windows HID driver doesn't pass that packet through, because Xiaomi Gamepad doesn't advertise it in REPORTDESCRIPTOR structure.

So, gyro can't be started under windows?

sokalskiy-a avatar Oct 16 '20 09:10 sokalskiy-a

So, gyro can't be started under windows?

Unless someone writes a kernel-mode native Windows HID driver for Xiaomi Gamepad. I've put my efforts to start writing it, but I don't have experience in writing kernel-mode drivers. So, I've stopped my work on it for now.

grayver avatar Oct 16 '20 09:10 grayver