diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-08 17:50:59 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-08 17:50:59 +0200 |
commit | f5ab22bbfa00862e60d232648f1674fc9181ceb8 (patch) | |
tree | 2cfe83ff4b7704767f760032bf1c62f85fc3c70d /audio/headset.c | |
parent | be81c7873a8241c68b5d03883492dfe069918145 (diff) |
Check for headset connected state when unregistering
In theory a headset could be in a connected state when the driver for it gets
unregistered. Do proper cleanup in this case (call headset_set_state(hs,
DISCONNECTED)). Currently this happens even in practice due to a bug where we
incorrectly assume that a device has removed a profile when in fact it's just
hiding it while it's connected.
Diffstat (limited to 'audio/headset.c')
-rw-r--r-- | audio/headset.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c index a4fe84fe..a0b7af54 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -1899,6 +1899,12 @@ static void headset_free(struct audio_device *dev) static void path_unregister(void *data) { struct audio_device *dev = data; + struct headset *hs = dev->headset; + + if (hs->state > HEADSET_STATE_DISCONNECTED) { + debug("Headset unregistered while device was connected!"); + headset_set_state(hs, HEADSET_STATE_DISCONNECTED); + } info("Unregistered interface %s on path %s", AUDIO_HEADSET_INTERFACE, dev->path); |