dinput: Move internal function calculate_ids to where it's really used.