An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @magrega ,
Thanks for reaching out.
The issue looks to be the packet format you are sending to \\.\XboxGIP.
According to the GIP USB Set Device State documentation, the command format is:
05 20 <sequence> 01 04
The 04 value for Off is correct, but the buffer you posted does not match this command format. It is padded to 23 bytes, and it uses 00 as the sequence id, which is reserved. That is the most likely reason for ERROR_INVALID_PARAMETER (87).
So the direct answer is:
- Yes,
04is the correct device state value for Off. - No, the 23-byte buffer you posted does not match the documented command.
- If you want to test the raw command, use a non-zero sequence value, for example
05 20 01 01 04.
There is also an important limitation here: there is no documented public API that guarantees powering off the controller through \\.\XboxGIP.
The closest official API reference is IGameInputDevice::PowerOff(), which states that the method was never implemented, was removed in GameInput v1, and has no equivalent in the current API surface.
So even if the controller supports the Off command at the protocol level, there is no supported Windows API that guarantees user-mode writes to \\.\XboxGIP will work for this scenario.
Hope this helps! If my answer was useful to you, I would greatly appreciate it if you could follow the instructions here so others with the same problem can benefit as well.