reset controller to zero when unplugged in XboxdrvDaemon

This commit is contained in:
Ingo Ruhnke 2011-01-26 17:37:22 +01:00
parent 04c24bd710
commit 9bd6b68d71
2 changed files with 9 additions and 5 deletions

5
TODO
View file

@ -78,13 +78,8 @@ Daemon Related Stuff
* cleanup device_id, don't manually do (slot<<16) | devid
* need to properly tear down the rumble callback to avoid calling it
before XboxGenericController gets destructed
* get rid of all std::cout stuff, redirect it somewhere else
* unplugging a controller should reset it to neutral position
* improve output on which uinput devices are created
* need magic to assign controller to a slot:

View file

@ -164,6 +164,15 @@ XboxdrvThread::controller_loop(const Options& opts)
// catch read errors from USB and other stuff that can go wrong
log_error << err.what() << std::endl;
}
{
// send a event with everything set to zero, so that the input
// device doesn't end up with a non-centered state
XboxGenericMsg msg;
msg.type = XBOX_MSG_XBOX360;
memset(&msg.xbox360, 0, sizeof(msg.xbox360));
m_processor->send(msg, 0);
}
}
void