Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add 3-axis accelerometer support #12

Open
xmanweb opened this issue Apr 17, 2019 · 10 comments
Open

Please add 3-axis accelerometer support #12

xmanweb opened this issue Apr 17, 2019 · 10 comments

Comments

@xmanweb
Copy link

xmanweb commented Apr 17, 2019

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.

@dancol90
Copy link
Owner

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 dancol90 reopened this Apr 22, 2020
@zhangbo8418
Copy link

zhangbo8418 commented May 18, 2020

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

@grayver
Copy link

grayver commented Jun 14, 2020

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.

@zhangbo8418
Copy link

zhangbo8418 commented Jun 15, 2020

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

@grayver
Copy link

grayver commented Jun 15, 2020

@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.

@dancol90
Copy link
Owner

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.

@tu-nv
Copy link

tu-nv commented Jul 10, 2020

@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.

@grayver
Copy link

grayver commented Jul 10, 2020

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

@sokalskiy-a
Copy link

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?

@grayver
Copy link

grayver commented Oct 16, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants