diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2014-12-03 09:21:45 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2014-12-12 23:39:20 -0800 |
commit | a0652a78e2ee00e4230f49a8759069992d2ae63a (patch) | |
tree | 61f5f327cf5c2dbc9cbe6ad62b3876c3578e4edd | |
parent | c9988ec59bd085908c05b55a19e1205df7aff3f2 (diff) | |
download | android_hardware_libhardware-stable/cm-12.0-YNG1I.tar.gz android_hardware_libhardware-stable/cm-12.0-YNG1I.tar.bz2 android_hardware_libhardware-stable/cm-12.0-YNG1I.zip |
usbaudio: reset profile on device disconnectstable/cm-12.0-YNG1I
Reset ALSA device profile on disconnect event. Entries like
supported sample rates, channel counts, formats will be repopulated
on next connect.
Change-Id: I27d3b7fd7ff22646996f58c53de08547b1a1fb6a
CRs-Fixed: 765434
-rw-r--r-- | modules/usbaudio/alsa_device_profile.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/usbaudio/alsa_device_profile.c b/modules/usbaudio/alsa_device_profile.c index 137d2405..8b62d994 100644 --- a/modules/usbaudio/alsa_device_profile.c +++ b/modules/usbaudio/alsa_device_profile.c @@ -58,10 +58,9 @@ extern int8_t const pcm_format_value_map[50]; static const unsigned std_sample_rates[] = {192000, 96000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000}; -void profile_init(alsa_device_profile* profile, int direction) +static void profile_reset(alsa_device_profile* profile) { profile->card = profile->device = -1; - profile->direction = direction; /* Fill the attribute arrays with invalid values */ size_t index; @@ -83,6 +82,12 @@ void profile_init(alsa_device_profile* profile, int direction) profile->is_valid = false; } +void profile_init(alsa_device_profile* profile, int direction) +{ + profile->direction = direction; + profile_reset(profile); +} + bool profile_is_initialized(alsa_device_profile* profile) { return profile->card >= 0 && profile->device >= 0; @@ -97,7 +102,7 @@ bool profile_is_cached_for(alsa_device_profile* profile, int card, int device) { } void profile_decache(alsa_device_profile* profile) { - profile->card = profile->device = -1; + profile_reset(profile); } /* |