Added a deactivate device function.